Tanner Postert wrote:
I don't think it's built in, so I was wondering ya'll would recommend as the
best way to convert int to string, not basic type casting, but converting to
the english word the int represents.
Something like this:
5 = "Five" or 20 = "Twenty"
You're right - its not built in.
You could use something like this
function numerictotext($numeric) {
for ($i;$i < strlen($numeric);$i++) {
$character = substr($numeric,$i,1);
switch ($character) {
case 0:
$return .= 'Zero ';
break;
case 1:
$return .= 'One ';
break;
}
}
return $return;
}
Regards,
Peter Hoskin
Do I get a cookie?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php