note 13351 deleted from function.str-replace by philip

From: Date: Mon, 04 Feb 2002 13:33:46 +0000
Subject: note 13351 deleted from function.str-replace by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-26227@lists.php.net to get a copy of this message
I noticed that every time i do a replace on a string pattern with a function that returns a string, the functions gets executed whether the pattern is found or not! this significantly impacts runtime if you are a doing a looping replace (like i was) and if the function is large so be careful. example of what i'm talking about: $line = str_replace("PATTERN", replacement(), $line); my solution-> make a variable = replacement() before the loop.

« previous php.notes (#26227) next »