Created
October 23, 2010 16:04
-
-
Save scribu/642361 to your computer and use it in GitHub Desktop.
get_ascii_array()
This file contains hidden or 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 | |
/** | |
* Returns an array containing the ASCII codes of a string (useful for decomposition) | |
* Example: print_r(get_ascii_array('ș')) | |
* | |
* @param string $str | |
* @return array | |
*/ | |
function get_ascii_array($str) { | |
$r = array(); | |
$length = strlen($str); | |
for ($i=0; $i < $length; $i++) { | |
$r[] = ord($str[$i]); | |
} | |
return $r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment