3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo{ public static $alphabet = 'ABCDEFGHIKLMNOPQRSTVXYZabcdefghiklmnopqrstvxyz'; public static function shorten($number) { $alphabet = self::$alphabet; $base = strlen($alphabet); $number = intval($number, 10); $shortened = ""; while ($number > 0) { $remainder = $number % $base; $shortened = $alphabet[$remainder] . $shortened; $number = (int) ($number / $base); } return $shortened; } public static function unshorten($string) { $alphabet = self::$alphabet; $base = strlen($alphabet); $length = strlen($string); $returnVal = 0; for ($i=$length-1; $i >= 0; --$i) { $ind = strpos($string[$i], $alphabet); if ($ind === false) { return false; } $returnVal += (int)($alphabet[$ind] * pow($base, $i)); } } } $shortened = Foo::shorten(12343336363636636); echo $shortened . "\n"; echo Foo::unshorten($shortened);
Output for git.master, git.master_jit, rfc.property-hooks
OSkMYgpOmE

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
45.92 ms | 401 KiB | 8 Q