Find Jobs
Hire Freelancers

About a function strlen(Banned words(

$2-8 USD / hour

En curso
Publicado hace más de 9 años

$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.
ID del proyecto: 6396268

Información sobre el proyecto

1 propuesta
Proyecto remoto
Activo hace 10 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
1 freelancer está ofertando un promedio de $10 USD /hora por este trabajo
Avatar del usuario
A proposal has not yet been provided
$10 USD en 1 día
4,9 (208 comentarios)
6,4
6,4

Sobre este cliente

Bandera de TURKEY
sanki, Turkey
5,0
91
Forma de pago verificada
Miembro desde oct 31, 2013

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.