note 116986 deleted from function.preg-replace by crell
| From: | crell@php.net | Date: | Fri, 01 Jul 2022 19:55:04 +0000 |
| Subject: | note 116986 deleted from function.preg-replace by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218871@lists.php.net to get a copy of this message | ||
Note Submitter: Garrett Albright
----
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'].
?>