Php str_replace not working with special chars

前端 未结 3 1683
终归单人心
终归单人心 2021-01-12 23:29

why isn\'t this working as expected:

 echo str_replace(\"é\",\"é\",\"Fédération Camerounaise de Football\");

result:

\"F         


        
3条回答
  •  失恋的感觉
    2021-01-13 00:11

    Check The following Code:

    $chain="Fédération Camerounaise de Football";
    $pattern = array("'é'");
    $replace = array('é'); 
    $chain = preg_replace($pattern, $replace, $chain);
    echo $chain;
    

提交回复
热议问题