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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: peter dot lerner at bayreuth dot baynet dot de
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sat Sep 20 15:00:02 2025 UTC