Sunday, 8 September 2013

Remove slash str_replace PHP

Remove slash str_replace PHP

im trying to remove the unwanted characters from a string, but i cannot
figure out with the slash / one.
$array_remove = array(
'/',
' ',
'-',
'.'
);
$string = "This i Will convert to-Picture/sting";
$convert = $file.'images/'.strtolower(str_replace($array_remove,
'_',$string).'.gif');
in this case the slash will remain there and the result will be:
this_i_will_convert_to_picture/string.gif
But need to be this_i_will_convert_to_picture_string.gif
Any help or hint here is very well appreciated.

No comments:

Post a Comment