how to find special punctuations and special character in a string and replace it with..

  • Thread starter Thread starter jum
  • Start date Start date
J

jum

Guest
...a space using php code? given: sample.string,,.this is,,
output: sample string this is

how would i implement this..using php code..please help me..god bless...
 
This can be done by using str_replace() ... here is a snippet

$original_string = "sample.string,,.this is,,";

$special = array(".",","); //you can add to the array as neccessary

$newstring = str_replace($special, " ", $original_string);

echo $newstring;
 
This can be done by using str_replace() ... here is a snippet

$original_string = "sample.string,,.this is,,";

$special = array(".",","); //you can add to the array as neccessary

$newstring = str_replace($special, " ", $original_string);

echo $newstring;
 
Back
Top