note 16772 rejected from function.str-replace by zak

From: Date: Tue, 13 Nov 2001 14:17:12 +0000
Subject: note 16772 rejected from function.str-replace by zak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-20795@lists.php.net to get a copy of this message
I didn't see this documented anywhere, but I'm trying to use str_replace to delete users in a peice of code i'm working on, but an error message, saying "Warning: The length of the needle must not be 0" shows up. This is the code, any ideas? ($todelete is inherited from the previous page, its the number of the user to delete.) $open = fopen("userlist.txt", "r"); $saved = fread($open, filesize("userlist.txt")); fclose($open); str_replace("$username[$todelete]", "", $saved); $open = fopen("userlist.txt", "w"); fwrite($open, $saved); fclose($open);

« previous php.notes (#20795) next »