3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gdr_encode($val) { return base_convert(strval($val), 10, 64); } function gdr_decode($val) { return base_convert(strval($val), 64, 10); } $vals = array(0, 1, 99, 100, 255, 256, 999, 1000, 9999, 10000, 65535, 65536, 99999, 100000, 999999, 1000000, 4294967295, 4294967296); foreach ($vals as $val) { $enc = json_encode(gdr_encode($val)); $dec = json_encode(gdr_decode($enc)); $val = json_encode($val); if (strlen($enc) > strlen($val)) { echo "$enc $val WORSE\n"; } else if (strlen($enc) == strlen($val)) { echo "$enc $val EQUAL\n"; } else { echo "$enc $val\n"; } }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ValueError: base_convert(): Argument #3 ($to_base) must be between 2 and 36 (inclusive) in /in/1QF10:4 Stack trace: #0 /in/1QF10(4): base_convert('0', 10, 64) #1 /in/1QF10(13): gdr_encode(0) #2 {main} thrown in /in/1QF10 on line 4
Process exited with code 255.

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:
40.96 ms | 401 KiB | 8 Q