note 89471 deleted from function.preg-replace by cmb
| From: | cmb@php.net | Date: | Sun, 29 Sep 2019 07:18:53 +0000 |
| Subject: | note 89471 deleted from function.preg-replace by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212392@lists.php.net to get a copy of this message | ||
Note Submitter: arie dot benichou at gmail dot com
----
<?php
//Be carefull with utf-8, even with unicode and utf-8 support enabled, a pretty odd bug occurs
depending on your operating system
$str = "Hi, my name is Arié!<br />";
echo preg_replace('#\bArié\b#u', 'Gontran', $str);
//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 />"