Search code examples
phpstr-replacesingle-quotes

String replace(single quotes) function in php


I wan't to replace both quotes in unique format using php

$f1= "Alva’s Institute of Engineering & Technology (AIET)";
$f1= "Alva's Institute Of Engineering & Technology";

I tried str_replace function, but it not applicable for both quotes: str_replace("’","'",$f1), how can i replace both quotes???

Thanks in advance....


Solution

  • It is possible to lookup for more than one string with str_replace like:

    print str_replace(array("’","'"),"'",$f1);
    

    http://php.net/manual/en/function.str-replace.php