-5

I want to replace special character single quotes(') with space . In Java it is easy but i dont know how to do this in php.

Arsalan Mithani
  • 490
  • 3
  • 11
007_android
  • 57
  • 1
  • 5

3 Answers3

1

You can use str_replace() string function in php.

Example : echo str_replace(" ' "," ","India' ");

Explanation : Here, in str_replace() function first argument you need to pass string which you want to replace. For second argument you need to pass string you want to replace with existing. And for third and last argument you need to pass your original string in which you need replace.

0
<?php $data = str_replace("'", " ", string);
      echo $data;
?>
0

to remove just single quote :

$FileName = str_replace("'", " ", string);

to remove other characters as well, use array :

$remove[] = "'";
$remove[] = '"';
$remove[] = "-"; // just as another example

$FileName = str_replace( $remove, " ", string);
Arsalan Mithani
  • 490
  • 3
  • 11