OK, I created the following code, that searches a string for occurrences of different numbers stored inside an array. Upon a digit being found, the number in words is stored in the $stringreplaced variable.
Can this code be edited to achieve the end result without using arrays, also can the code just search the string for 2 characters, instead of nine?
I think I'm on the right track, aren't I?
Code:
<?php
$find = array("1","2","3","4","5","6","7","8","9");
$replace = array("one","two","three","four","five","six","seven","eight","nine");
$string = "12166784";
$stringreplaced = str_replace($find, $replace, $string);
echo 'Orig string'.$string.'<br>';
echo $stringreplaced;
?>