note 51841 deleted from function.str-replace by bjori

From: Date: Sun, 26 Mar 2006 22:24:05 +0000
Subject: note 51841 deleted from function.str-replace by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-106672@lists.php.net to get a copy of this message
Note Submitter: james dot robert dot lee at gmail dot com ---- "Note: As of PHP 5.0.0 the number of matched and replaced needles (search) will be returned in count which is passed by reference. Prior to PHP 5.0.0 this parameter is not available." In version 4.3.10 and I assume others before 5.0.0, str_replace returns null if you pass it a $count. <?php $count = 0; $str = "This is a string"; $str = str_replace("a", "a null", $str, $count); if (is_null($str)) { // TRUE before php 5.0.0 echo "NULL"; } ?> Fortunately, this does produce a warning: "Wrong parameter count for str_replace()"

« previous php.notes (#106672) next »