If all zeros in str_replace will be replaced, how can you just let him replace them in the first number 0?

str_replace(substr($_SESSION["phone"], 0, 1), "+64", $_SESSION["phone"]);

assuming that I am 0111012123
, he will be replaced by
+ 641111612123

.

gets the first zero, but str_replace will change all 0 to + 64
.
what a pain in the neck

Apr.11,2021

does http://php.net/manual/zh/func.
study without looking at the documents


preg_replace

Menu