3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('ALNUM_MAP', str_split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')); define('DIGIT_MAP', array_flip(ALNUM_MAP)); function numToAlnum($num) { return strtr($num, ALNUM_MAP); } function alnumToNum($alphaNum) { return strtr($alphaNum, DIGIT_MAP); } $ids = ['4440', '464426', '43304441302845', '262018191701180', '273381111186152545352']; foreach ($ids as $id) { $idLength = strlen($id); $alphaNum = numToAlnum($id); $alNumLength = strlen($alphaNum); $backToId = alnumToNum($alphaNum); var_export(['original' => $id, 'encoded' => $alphaNum, 'decoded' => $backToId, 'reduction' => $idLength - $alNumLength]); echo "\n---\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'original' => '4440', 'encoded' => 'SO', 'decoded' => '4440', 'reduction' => 2, ) --- array ( 'original' => '464426', 'encoded' => 'USA', 'decoded' => '464426', 'reduction' => 3, ) --- array ( 'original' => '43304441302845', 'encoded' => 'RESPECT', 'decoded' => '43304441302845', 'reduction' => 7, ) --- array ( 'original' => '262018191701180', 'encoded' => 'Australia', 'decoded' => '262018191701180', 'reduction' => 6, ) --- array ( 'original' => '273381111186152545352', 'encoded' => 'BHills90210', 'decoded' => '273381111186152545352', 'reduction' => 10, ) ---

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:
90.56 ms | 402 KiB | 8 Q