note 23541 deleted from function.ereg-replace by tularis
| From: | tularis@php.net | Date: | Sun, 29 Aug 2004 12:19:57 +0000 |
| Subject: | note 23541 deleted from function.ereg-replace by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75570@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
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:
-> echo ereg_replace("two", (string) $rep, "one two three");
-> /** output: "one 2 three" **/