php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #876 ereg_replace() and eregi_replace() don't do anything
Submitted: 1998-10-26 12:12 UTC Modified: 1998-10-26 12:15 UTC
From: peter dot lerner at bayreuth dot baynet dot de Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0 Latest CVS (26/10/1998) OS: Linux 2.0.35
Private report: No CVE-ID: None
 [1998-10-26 12:12 UTC] peter dot lerner at bayreuth dot baynet dot de
the following code snippet ...

 echo "string = \"" . $string . "\"<br>\n";
 eregi_replace("!", " ", $string);
 echo "string = \"" . $string . "\"<br>\n";

... yields this result:

string = "con ! air"
string = "con ! air"

did i miss something, or is this bad behaviour?
the "!" should have been replaced by <space>.

same with ereg_replace().


ups ... should read doku more thoroughly. must assign ereg_replace() 
result. ;-) sorry.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-10-26 12:15 UTC] rasmus
These functions do not modify the argument string.  They return the new string.  To make the above work, use:
$string = eregi_replace("!"," ",$string);
Note though that if you just want to change a single character you are better off using strtr().
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 04:01:34 2024 UTC