- str_split: documentation ( source)
- ord: documentation ( source)
- printf: documentation ( source)
<?php
$str = <<<'HERE'
$State ='Kentucky'; echo $State; switch($State) { case 'Kentucky': $StateAbbreviation = 'KY'; break;}echo $StateAbbreviation ;
HERE;
foreach (str_split($str) as $char) {
printf("%02X => %s\n", ord($char), $char);
}