note 116986 added to function.preg-replace
| From: | GarrettAlbright | Date: | Mon, 30 Mar 2015 20:14:25 +0000 |
| Subject: | note 116986 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202086@lists.php.net to get a copy of this message | ||
It may be useful to note that if you pass an associative array as the $replacement parameter, the
keys are preserved.
<?php
$replaced = preg_replace('/foo/', 'bar', ['first' =>
'foobar', 'second' => 'barfoo']);
// $replaced is now ['first' => 'barbar', 'second' =>
'barbar'].
?>
----
Server IP: 72.52.91.14
Probable Submitter: 174.126.18.86
----
Manual Page -- http://php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/116986
Del: integrated -- https://master.php.net/note/delete/116986/integrated
Del: useless -- https://master.php.net/note/delete/116986/useless
Del: bad code -- https://master.php.net/note/delete/116986/bad+code
Del: spam -- https://master.php.net/note/delete/116986/spam
Del: non-english -- https://master.php.net/note/delete/116986/non-english
Del: in docs -- https://master.php.net/note/delete/116986/in+docs
Del: other reasons-- https://master.php.net/note/delete/116986
Reject -- https://master.php.net/note/reject/116986
Search -- https://master.php.net/manage/user-notes.php