function toAlphaNumber( $num ) { $anum = ''; while( $num >= 1 ) { $num = $num - 1; $anum = chr(($num % 26)+65).$anum; $num = $num / 26; } return $anum; }
echo toAlphaNumber(1) // output: A echo toAlphaNumber(27) // output: AA