3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gdr_encode($val) { $str = ''; while ($val > 0) { $str .= chr($val & 0xFF); $val = $val >> 8; } return str_replace(array('/', '='), array('_', ''), base64_encode($str)); } function gdr_decode($bin) { $str = base64_decode(str_replace('_', '/', $bin)); $val = 0; for ($i=0; $i<strlen($str); $i++) { $val |= ord($str[$i]) << $i*8; } return $val; } for ($i=0; $i<32; $i++) { $val = 1<<$i; $enc = gdr_encode($val); $dec = gdr_decode($enc); echo "$val => $enc => $dec\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
1 => AQ => 1 2 => Ag => 2 4 => BA => 4 8 => CA => 8 16 => EA => 16 32 => IA => 32 64 => QA => 64 128 => gA => 128 256 => AAE => 256 512 => AAI => 512 1024 => AAQ => 1024 2048 => AAg => 2048 4096 => ABA => 4096 8192 => ACA => 8192 16384 => AEA => 16384 32768 => AIA => 32768 65536 => AAAB => 65536 131072 => AAAC => 131072 262144 => AAAE => 262144 524288 => AAAI => 524288 1048576 => AAAQ => 1048576 2097152 => AAAg => 2097152 4194304 => AABA => 4194304 8388608 => AACA => 8388608 16777216 => AAAAAQ => 16777216 33554432 => AAAAAg => 33554432 67108864 => AAAABA => 67108864 134217728 => AAAACA => 134217728 268435456 => AAAAEA => 268435456 536870912 => AAAAIA => 536870912 1073741824 => AAAAQA => 1073741824 2147483648 => AAAAgA => 2147483648

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