Try substr along with strpos instead of str_replace as
$string = "PAAUSTRALIA" ; $string = substr($string,(strpos($string, 'P') > -1)); $string = substr($string,(strpos($string, 'A') > -1)); echo $string; //AUSTRALIA
Edited by
Executing a function will also do the same thing as
echo removeOne($string,'p'); function removeOne($str,$value){ return substr($str,(stripos($str,$value) > -1)); }
str_replace will find the letter "A" inside the string and replace it with ''
source share