In Arabic numbers, I found a mistake in the code I sent you 8|
in the line where Arabic numbers are ظ...
Zero had a space that made a problem so I have put the $arNums array in a file that is saved as utf8, to be:
$Nums = array (0,1,2,3,4,5,6,7,8,9);
$output = str_replace($Nums, $arNums, $output);