note 23541 added to function.ereg-replace
| From: | Anonymous@php.net | Date: | Sun, 21 Jul 2002 17:30:55 +0000 |
| Subject: | note 23541 added to function.ereg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33365@lists.php.net to get a copy of this message | ||
Be careful with replacing a substring with an int:
$rep = 2;
echo ereg_replace("two", $rep, "one two three");
/** output: "one three" **/
echo ereg_replace("two", "".$rep."", "one two three");
/** output: "one 2 three" **/
-> You have to convert an int to a string before replacing.
--
http://www.php.net/manual/en/function.ereg-replace.php
http://master.php.net/manage/user-notes.php?action=edit+23541
http://master.php.net/manage/user-notes.php?action=delete+23541
http://master.php.net/manage/user-notes.php?action=reject+23541