3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function gdr_encode($val) { $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!='; $base = strlen($chars); $str = ''; while ($val > 0) { $str .= $chars[$val % $base]; $val = int($val / $chars); } return $str; } function gdr_decode($val) { return base_convert(strval($val), 16, 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"; } }
based on I2SK5

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
5.4.310.0060.04212.52
5.4.300.0040.03812.52
5.4.290.0070.03712.51
5.4.280.0070.03512.41
5.4.270.0060.03712.41
5.4.260.0060.03712.41
5.4.250.0060.04112.41
5.4.240.0090.03712.41
5.4.230.0070.04312.40
5.4.220.0070.04812.40
5.4.210.0060.03512.40
5.4.200.0070.03612.40
5.4.190.0080.03412.40
5.4.180.0070.03512.40
5.4.170.0060.05012.40
5.4.160.0060.03612.40
5.4.150.0090.03312.40
5.4.140.0070.03612.09
5.4.130.0050.03712.07
5.4.120.0070.03512.04
5.4.110.0080.03512.03
5.4.100.0070.03312.03
5.4.90.0050.03912.03
5.4.80.0070.03612.03
5.4.70.0050.04212.03
5.4.60.0040.03812.03
5.4.50.0070.03512.03
5.4.40.0050.03512.02
5.4.30.0070.03512.01
5.4.20.0120.04512.01
5.4.10.0080.03412.01
5.4.00.0060.03711.50
5.3.290.0030.04412.80
5.3.280.0110.03412.71
5.3.270.0050.04212.73
5.3.260.0070.03812.72
5.3.250.0060.03712.72
5.3.240.0070.03612.72
5.3.230.0060.03812.70
5.3.220.0090.03412.68
5.3.210.0080.03712.68
5.3.200.0040.03712.68
5.3.190.0050.03812.68
5.3.180.0060.03712.68
5.3.170.0090.03512.67
5.3.160.0070.03612.67
5.3.150.0040.04412.67
5.3.140.0060.03712.66
5.3.130.0060.04012.66
5.3.120.0110.03412.65
5.3.110.0050.04012.66
5.3.100.0060.03712.13
5.3.90.0030.04012.11
5.3.80.0060.03812.09
5.3.70.0060.03712.09
5.3.60.0050.03812.08
5.3.50.0090.03312.02
5.3.40.0080.03512.02
5.3.30.0050.03611.98
5.3.20.0060.03811.76
5.3.10.0060.03511.73
5.3.00.0060.03611.71
5.2.170.0030.0329.22
5.2.160.0040.0309.21
5.2.150.0020.0339.22
5.2.140.0060.0329.21
5.2.130.0040.0309.17
5.2.120.0040.0349.18
5.2.110.0020.0339.18
5.2.100.0030.0309.18
5.2.90.0080.0299.18
5.2.80.0050.0319.18
5.2.70.0080.0289.18
5.2.60.0090.0289.13
5.2.50.0090.0279.09
5.2.40.0080.0299.07
5.2.30.0050.0309.04
5.2.20.0090.0259.04
5.2.10.0070.0308.95
5.2.00.0040.0308.81
5.1.60.0050.0258.09
5.1.50.0050.0348.08
5.1.40.0050.0248.06
5.1.30.0050.0278.43
5.1.20.0040.0288.44
5.1.10.0060.0248.16
5.1.00.0040.0268.16
5.0.50.0040.0206.64
5.0.40.0030.0206.50
5.0.30.0040.0326.31
5.0.20.0030.0226.29
5.0.10.0050.0196.26
5.0.00.0070.0376.25
4.4.90.0050.0204.78
4.4.80.0020.0244.75
4.4.70.0030.0204.76
4.4.60.0020.0174.75
4.4.50.0030.0164.77
4.4.40.0030.0254.71
4.4.30.0050.0164.76
4.4.20.0050.0204.85
4.4.10.0030.0234.85
4.4.00.0020.0304.76
4.3.110.0030.0154.67
4.3.100.0000.0184.67
4.3.90.0030.0194.64
4.3.80.0050.0234.58
4.3.70.0030.0144.63
4.3.60.0010.0164.63
4.3.50.0020.0174.63
4.3.40.0010.0264.54
4.3.30.0010.0173.30
4.3.20.0040.0143.28
4.3.10.0040.0143.24
4.3.00.0000.01715.90