views:

32

answers:

1

Hello there. okay so i got a script that removes "_" and replaces it with a space " " and it does not work i even used ereg_replace and eregi_replace none worked yet it works backwards( " ","_")

thanks a lot here is the script:

$namefixed = preg_replace("/_/", " ", $name);

and even

$namefixed = preg_replace("_", " ", $name);
+2  A: 

No need for regex, just use str_replace().

$namefixed = str_replace("_", " ", $name);

If it only works backwards, then you're replacing spaces with underscores, which can only mean that there aren't any underscores in $name to replace in the first place, or you're searching in the wrong variable...

BoltClock