PDA

View Full Version : Stripping characters



Moglizorz
09-28-2008, 07:31 PM
I have a PhP variable called $edited which value is, for example; /62fg5/
I wish to strip all the "/" from it, so I would be left with 62fg5
I have tried this;

$edited = str_replace($edited,"/","");
echo $edited;
But with that echo, nothing is outputted. It's like it makes the WHOLE variable equal to nothing, rather than just the slash. Can anyone help?

techietim
09-28-2008, 07:35 PM
Your parameters are in the wrong places. It should be:


$edited = str_replace("/","", $edited);
echo $edited;

Moglizorz
09-28-2008, 07:36 PM
My bad. Thanks lol :P +thanks.