ID: 28119 Updated by: [EMAIL PROTECTED] Reported By: vb_user at yahoo dot com -Status: Open +Status: Bogus Bug Type: Strings related Operating System: Windows 2003 PHP Version: 4.3.5 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php When you pass a non-string value as the 'replace' to ereg_replace() function it converts the argument to a number and then to the character represented by that number. Number 13 gets converted to the \r, with which the word test is replaced in your test. Previous Comments: ------------------------------------------------------------------------ [2004-04-23 09:33:11] vb_user at yahoo dot com Description: ------------ When i pass in ereg_replace a variable like this: ereg_replace($pattern, $variable, $string); and $variable is holding an integer value, then $string will be replace with blank, not the value hold in $variable. This only happen in Windows installation not Linux as i have used this many times. Doing the following will fix the problem: ereg_replace($pattern, (string)$variable, $string); But does that mean PHP is now no long type tolerant? Reproduce code: --------------- $variable = 13; $pattern = 'test'; $string = 'this is a test'; ereg_replace($pattern, $variable, $string); Expected result: ---------------- this is 13 Actual result: -------------- this is ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28119&edit=1
