note 124934 deleted from function.preg-replace by crell
| From: | crell@php.net | Date: | Fri, 01 Jul 2022 19:55:08 +0000 |
| Subject: | note 124934 deleted from function.preg-replace by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218872@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Warning: craiga's function escape_backreference() is incomplete (doesn't escape
'\0' nor '${0}').
To escape any potential backreferences in a replacement variable, use addcslashes() for backslash
and dollar characters:
<?php
// $replacement may contain sequences like \0, $0 or ${0}
echo preg_replace($pattern, addcslashes($replacement, '\\$'), $subject);
?>