note 13348 deleted from function.str-replace by philip
| From: | philip@php.net | Date: | Mon, 04 Feb 2002 12:49:33 +0000 |
| Subject: | note 13348 deleted from function.str-replace by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-26217@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;
}