3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $KEY_BASE = str_split("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); $BASE = 62; $num = 11112887; $num = intval($num); $num = array_map('intval',str_split($num)); $result = ''; $remainder = 0; foreach ($num as $digit) { $remainder = $digit/$BASE; echo 'remainder '.$remainder; echo 'key remainder '.$KEY_BASE[$remainder]; $result.=$KEY_BASE[$remainder]; //echo $digit; } echo $result;
Output for 5.3.7 - 7.1.0
remainder 0.016129032258065key remainder 0remainder 0.016129032258065key remainder 0remainder 0.016129032258065key remainder 0remainder 0.016129032258065key remainder 0remainder 0.032258064516129key remainder 0remainder 0.12903225806452key remainder 0remainder 0.12903225806452key remainder 0remainder 0.11290322580645key remainder 000000000