[PHP-DEV] Bug #13319 Updated: ereg_replace() with numeric 2nd argument From: joseph_a <email protected>
Date: 09/15/01

ID: 13319
User updated by: joseph_a <email protected>
Reported By: joseph_a <email protected>
Status: Closed
Bug Type: Regexps related
Operating System: Linux
PHP Version: 4.0.6
New Comment:

But this also happends with double, not only with integer.
In this case it should be possible to autoconvert it to
string.

Previous Comments:
------------------------------------------------------------------------

[2001-09-15 13:42:29] sterling <email protected>

This is impossible due to the fact that ereg_replace() supports the specifying of ascii values as a replacement argument.

------------------------------------------------------------------------

[2001-09-15 13:26:03] joseph_a <email protected>

But preg_replace('/4/', 3, '124') will produce '123' as
expected. Even if it's not a bug, it still would be nice
if that number would be autoconverted to string.

------------------------------------------------------------------------

[2001-09-15 13:11:31] swm <email protected>

closed.

------------------------------------------------------------------------

[2001-09-15 13:11:01] swm <email protected>

You are correct in saying that the second argument is a
'replacement string', not a number. The documentation
is very clear about this.

------------------------------------------------------------------------

[2001-09-15 12:13:10] joseph_a <email protected>

When using ereg_replace() with a numeric 2nd argument (replacement string), this argument is treated as an empty string.
ereg_replace('4', 3, '124') produces '12' instead of '123'.

------------------------------------------------------------------------

Edit this bug report at http://bugs.php.net/?id=13319&edit=1

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>