Hi I was wondering how can I print out numbers in their word form ? When I did a Google search it showed other peoples script on how to print 234 as two hundred thirty four .
I need 234 as two three four.
Thank you guys!
Hi I was wondering how can I print out numbers in their word form ? When I did a Google search it showed other peoples script on how to print 234 as two hundred thirty four .
I need 234 as two three four.
Thank you guys!
I need 234 as two three four.
It would be as simple as creating an array of your number to word map, then taking your number and printing out the corresponding value:
<?php
$num_word = array();
$num_word[0] = 'zero';
$num_word[1] = 'one';
$num_word[2] = 'two'
...
$num_word[9] = 'nine';
$num = 234;
foreach(str_split($num) as $w) {
echo $num_word[$w];
}
?>