3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getCharacter($index) { $chars = "0123456789ABCDEFGHIJKLMOPQRSTUVWabcdefghijklmnopqrstuvw"; $c = ord(substr($chars, $index % strlen($chars))); //return ord(substr($chars, ($index << $c) % strlen($chars))); return ($index << $c) & 0xffff; } function main() { $array = array(176, 52, 608, 855); foreach ($array as $value) { echo "$value: " . getCharacter($value) . "\n"; } } main();

preferences:
55.7 ms | 402 KiB | 5 Q