note 92933 deleted from function.str-replace by philip

From: Date: Wed, 07 Oct 2009 07:53:36 +0000
Subject: note 92933 deleted from function.str-replace by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-161438@lists.php.net to get a copy of this message
Note Submitter: steve at slhawkins dot com ---- Something that might seem obvious, that had me searching the documentation for a different function... if the text you're replacing looks like a variable i.e. $name. Make sure to use single quotes.. str_replace("{$name}", 'Steve', $string); will search the string for whatever the variable is set to, in my case it wasn't set at all... str_replace('{$name}', 'Steve', $string); Worked correctly as I was aiming for....

« previous php.notes (#161438) next »