note 69441 added to function.preg-replace
| From: | php-general at lists dot php dot net | Date: | Wed, 06 Sep 2006 10:21:10 +0000 |
| Subject: | note 69441 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116753@lists.php.net to get a copy of this message | ||
Note that it is important for the $count parameter to be initialized with "some" value (it
does'nt matter what value or data type you choose).
Otherwise preg_replace() will leave $count untouched.
See this example:
preg_replace('/a/', 't', 'x', -1, $test);
var_dump($test);
Will output NULL.
While this:
$test = 'foo';
preg_replace('/a/', 't', 'x', -1, $test);
var_dump($test);
Will output int(0) as you may have expected.
----
Server IP: 66.163.161.117
Probable Submitter: 213.238.41.61 (proxied: 192.168.168.42)
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/69441
Del: integrated -- https://master.php.net/note/delete/69441/integrated
Del: useless -- https://master.php.net/note/delete/69441/useless
Del: bad code -- https://master.php.net/note/delete/69441/bad+code
Del: spam -- https://master.php.net/note/delete/69441/spam
Del: non-english -- https://master.php.net/note/delete/69441/non-english
Del: in docs -- https://master.php.net/note/delete/69441/in+docs
Del: other reasons-- https://master.php.net/note/delete/69441
Reject -- https://master.php.net/note/reject/69441
Search -- https://master.php.net/manage/user-notes.php