[thelist] [php] ereg_replace

MarsHall evolt at MARSorange.com
Mon Nov 18 21:50:01 CST 2002


On Monday, Nov 18, 2002, at 21:39 US/Central, Paul Bennett wrote:
> $var = "<p class=\"header\">hello</p>";
> echo $var."<br/>"; // shows: <p class="header">hello</p>
> [...SNIP...]
> $replaceChar = "<";
> $var4 = ereg_replace("&gt;", $replaceChar , $var);
> echo $var4."<br/>"; // shows: <p class="header">hello</p>

In this last section, you execute an ereg_replace() with $var as the
subject string.

But $var is still the original, un-encoded characters... so, the
ereg_replace() does nothing.

$var == $var4

Where is the magic? I see none!

Mars :)




More information about the thelist mailing list