- substr: documentation ( source)
- ord: documentation ( source)
<?php
$chars = "0123456789ABCDEFGHIJKLMOPQRSTUVWabcdefghijklmnopqrstuvw";
$length = strlen($chars);
$per = $index % $length;
$subst = substr($chars, $per);
$disp = ord($subst);
echo ($index << $disp);