I\'m trying to use str_replace in a weblog updater that i\'m writing to delete users from userlist.txt. It tells me that the length of the needle must not be zero. here\'s the code, please help.
$open = fopen(\"userlist.txt\", \"r\");
$saved = fread($open, filesize(\"userlist.txt\"));
fclose($open);
$towrite = str_replace(\"$username[$todelete]\", \"\", $saved);
$open = fopen(\"userlist.txt\", \"w\");
fwrite($open, $towrite);
fclose($open);