I've the following function and using str_replace gives an unexpected result
function repo($text) {
$search = array("0","1","2","3","4","5","6","7","8","9");
$replace = array("z30","z31","z32","z33","z34","z35","z36","z37","z38","z99");
$text = str_replace($search,$replace,$text);
return $text;
}
echo repo('0');
The expected answer is
z30
and instead I get
zz330
What am I doing wrong?