3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getShortUrl(int $id) { $chars = "123456789bcdfghjkmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ"; $length = strlen($chars); $id = intval($id); if ($id < 1) { return 0; } $code = ""; while ($id > $length - 1) { $fmod =intval(fmod($id, $length)); $code =$chars[$fmod].$code; $id = floor($id / $length); } $code = $chars[intval($id)] . $code; return $code; } $short_url=getShortUrl(1499213934773); echo "sinadme.com/".$short_url;

preferences:
44.2 ms | 402 KiB | 5 Q