note 9638 deleted from function.ereg-replace by jimw
| From: | jimw@php.net | Date: | Fri, 02 Nov 2001 01:50:40 +0000 |
| Subject: | note 9638 deleted from function.ereg-replace by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20195@lists.php.net to get a copy of this message | ||
I'm using PHP 4.0.3 and I've found it impossible to use ereg_replace to escape the NUL
character in a string. It looks like the strings are cast as C-style strings internally, so a NUL
byte becomes the end-of-string marker.
echo ereg_replace("a", "A", "ab\x00cd");
result: Ab
If you're using ereg_replace with binary data, you have to handle NUL bytes yourself somehow:
echo stripslashes(ereg_replace(addslashes("a"), addslashes("A"),
addslashes("ab\x00cd")));
result: Abcd