Created
January 8, 2014 20:36
-
-
Save niczak/8324162 to your computer and use it in GitHub Desktop.
Convert numbers to words.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function numToStr($val) { | |
$aLookup = array( | |
0 => "zero", | |
1 => "one", | |
2 => "two", | |
3 => "three", | |
4 => "four", | |
5 => "five", | |
6 => "six", | |
7 => "seven", | |
8 => "eight", | |
9 => "nine"); | |
$aVal = str_split($val); | |
$return = ''; | |
foreach($aVal as $tmp) { | |
if(array_key_exists($tmp, $aLookup)) | |
$return .= $aLookup[$tmp]." "; | |
else | |
$return .= $tmp." "; | |
} | |
echo $return; | |
} | |
numToStr("3735711A2387480E95AC924588038B49"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment