note 54539 added to function.ereg-replace
| From: | php dot net at lenix dot de | Date: | Thu, 07 Jul 2005 10:26:43 +0000 |
| Subject: | note 54539 added to function.ereg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91590@lists.php.net to get a copy of this message | ||
One thing to take note of is that if you use an integer value as the replacement parameter, you may
not get the results you expect. This is because ereg_replace() will interpret the number as the
ordinal value of a character, and apply that.
If you're ever having trouble with this one there's an easy workarround:
instead of
<?php
$foo = 23;
echo ereg_replace ( "bar", $foo , "foobar" );
?>
just do
<?php
$foo = 23;
echo ereg_replace ( "bar", "" . $foo , "foobar" );
?>
to replace "bar" inside "foobar" with the string "23".
----
Manual Page -- http://www.php.net/manual/en/function.ereg-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54539
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54539&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54539&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54539&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54539&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54539&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54539&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54539&report=yes
Search -- http://master.php.net/manage/user-notes.php