Bug #11448 Updated: str_replace

From: Date: Wed, 13 Jun 2001 14:57:59 +0000
Subject: Bug #11448 Updated: str_replace
Groups: php.dev 
Request: Send a blank email to php-dev+get-56767@lists.php.net to get a copy of this message
ID: 11448 Updated by: sniper Reported By: a2zofciv2@hotmail.com Old-Status: Open Status: Bogus Bug Type: Unknown/Other Function Operating system: PHP Version: 4.0.5 Assigned To: Comments: Where does it say you can use function as the replacement? You have to set it to variable first. Previous Comments: --------------------------------------------------------------------------- [2001-06-12 19:07:10] a2zofciv2@hotmail.com the following line: $line = str_replace("pattern", Pattern(),$line); where Pattern() is a function that returns a string. Pattern executes everytime this code line is encountered, even if "pattern" is not a match on $line. so if i loop through a file running that line, the function Pattern() will execute every single time, match or no match. (my) common sense says this function should only execute when a match is found. Is this a bug? I didn't know about it and something like this could seriously affect performance of a program. Also I don't think the modules or any other of your requirements are relevant for this issue. --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=11448&edit=2

« previous php.dev (#56767) next »