note 13348 added to function.str-replace.php
| From: | stephen at opido dot com | Date: | Tue, 12 Jun 2001 20:25:38 +0000 |
| Subject: | note 13348 added to function.str-replace.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14422@lists.php.net to get a copy of this message | ||
heh, sometimes I'm an idiot, here's a working function. Less caffeine, more sleep :)
function str_swap($swp1,$swp2,$str)
{
srand ((double) microtime() * 1000000);
for($i=0;$i<32;$i++) $tmp .= rand(0,9);
$str = str_replace($swp1,$tmp.$swp1.$tmp,$str);
$str = str_replace($swp2,$swp1,$str);
$str = str_replace($tmp.$swp1.$tmp,$swp2,$str);
return $str;
}
http://www.php.net/manual/en/function.str-replace.php