3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gdr_encode($val) { return base_convert(strval($val), 10, 16); } 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 #2 ($from_base) must be between 2 and 36 (inclusive) in /in/KPLqq:8 Stack trace: #0 /in/KPLqq(8): base_convert('"0"', 64, 10) #1 /in/KPLqq(14): gdr_decode('"0"') #2 {main} thrown in /in/KPLqq on line 8
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:
28.75 ms | 401 KiB | 8 Q