Bug with str_replace
| From: | Eugene Sidelnyk | Date: | Tue, 25 May 2021 10:12:50 +0000 |
| Subject: | Bug with str_replace | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-114575@lists.php.net to get a copy of this message | ||
When use str_replace with arrays there's strange behavior
https://3v4l.org/maNqa
```php
var_dump(str_replace(
[
',',
'.',
],[
'.',
',',
],
'1.2,3'
));
```
This code is expected to replace all commas with dots and all dots with
commas, however in result we get all commas.