note 89473 deleted from function.preg-replace by danbrown
| From: | danbrown@php.net | Date: | Mon, 09 Mar 2009 21:24:14 +0000 |
| Subject: | note 89473 deleted from function.preg-replace by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151671@lists.php.net to get a copy of this message | ||
Note Submitter: arie dot benichou at gmail dot com
Reason: in docs
----
<?php
//Be carefull with utf-8 string and preg_replace, even with PCRE utf-8 support enabled,
//a pretty odd bug occurs depending on the operating system you use :
$str = "Hi, my name is Arié!<br />";
//on windows system, output is "Hi, my name is Gontran!<br />"
//on unix system, output is "Hi, my name is Arié!<br />"
echo preg_replace('#\bArié\b#u', 'Gontran', $str);
//on windows and unix system, output is "Hi, my name is Gontran!<br />"
echo preg_replace('#\bArié(|\b)#u', 'Gontran', $str);