Find Jobs
Hire Freelancers

About a function strlen(Banned words(

$2-8 USD / hour

In Progress
Posted over 9 years ago

$2-8 USD / hour

I have a function, function is that. <?php function sanitize_core($text) { global $bannedWords; $text = htmlspecialchars($text, ENT_NOQUOTES); $text = str_replace("\n\r","\n",$text); $text = str_replace("\r\n","\n",$text); $text = str_replace("\n"," <br> ",$text); $number_word = explode(" ",$text); for($x=0;$x<count($number_word);$x++) { for ($i=0;$i < count($bannedWords);$i++) { if (stripos($text, $bannedWords[$i]) !== false) { /*$pos = stripos($text, $bannedWords[$i]); $word = substr($text,$pos,strlen($bannedWords[$i])); $first = substr($text,0,$pos); $final = substr($text,$pos+strlen($bannedWords[$i]),strlen($text)-($pos+$bannedWords[$i])); $text = $first.str_repeat("*",strlen($bannedWords[$i])).$final;*/ $text = str_ireplace($bannedWords[$i], str_repeat("*",strlen($bannedWords[$i])), $text); } //$text = str_ireplace(' '.$bannedWords[$i].' ',' '.str_repeat("*",strlen($bannedWords[$i])).' ',' '.$text.' '); } } $search = array('Ç','ç','Ğ','ğ','ı','İ','Ö','ö','Ş','ş','Ü','ü'); $replace = array('c','c','g','g','i','i','o','o','s','s','u','u'); $text = str_replace($search,$replace,$text); $text = trim($text); return $text; } $bannedWords = array( 'fuck','0','sakaci' ); $test_word = "a 1 2 5 s p o c X"; echo sanitize_core($test_word); ?> The functions is works perfect, so dont remove anything, ı wanna only add something. if I write only one letter, it should replace with * so you need to add minumum strlen. Examples, if I echo H e l l o or H all will * because if one letter after space , it will * (because minumum word should 2 ) if I echo only "H" it will also * So edit this function and send me.
Project ID: 6396268

About the project

1 proposal
Remote project
Active 10 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
1 freelancer is bidding on average $10 USD/hour for this job
User Avatar
A proposal has not yet been provided
$10 USD in 1 day
4.9 (208 reviews)
6.4
6.4

About the client

Flag of TURKEY
sanki, Turkey
5.0
91
Payment method verified
Member since Oct 31, 2013

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.