Re: int to string
| From: | Peter Hoskin | Date: | Wed, 05 Apr 2006 23:47:04 +0000 |
| Subject: | Re: int to string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-233308@lists.php.net to get a copy of this message | ||
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?