note 34135 deleted from function.ereg-replace by didou
| From: | didou@php.net | Date: | Wed, 24 Sep 2003 17:16:57 +0000 |
| Subject: | note 34135 deleted from function.ereg-replace by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57061@lists.php.net to get a copy of this message | ||
Note Submitter: chatty@wp.pl
----
Hi, I'm a php begginer, and i writed for myself a simmilar function to ereg_replace but, my
function don't replace but dell from the text input words. I don't know why I write it, if
is ready simmilar function in php, meaby becouse i was bored.
Check this, meaby its faster that erg replace! ;-)
// text cleaner by chatty
function text_clean ($typpracy,$txt, $searched)
{
$veryf=0;
$ttx=$txt;
for ($index=0;$index < strlen ($txt);$index++)
{
$veryf=0;
for ( $index2=0;$index2 < strlen ($searched);$index2++ )
{
$comando=$index+$index2;
if ( $searched[$index2]==$txt[$comando] )
{$veryf++;}
}
if ($veryf == strlen($searched) )
{
for ( $index3=0;$index3 < strlen ($searched);$index3++ )
{
$ttx[$index3+$index]=",";
}
// if typpracy ==0 then clean first met word and stop
// if typpracy ==1 then clean text from all met that word
if ( $typpracy == 0 )break;
$veryf=0;
}
}
return $ttx;
}
$duperella = "kadabrakadabrakadabrakadabraM";
echo ($duperella."<BR>");
$duperella = text_clean(1,$duperella,"dabra");
echo ($duperella."<BR>");
// POLAND IS COOL :-)