3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!function_exists('json_encode')) { function json_encode($it) { if (!($assoc = is_object($it)) && !is_array($it)) { return _js_enc_value($it); } $i = 0; $it = (array)$it; if (!$assoc) { foreach ($it as $k => $v) { if ($k !== $i) { $assoc = true; break; } $i++; } } $data = array(); foreach ($it as $k => $v) { $v = _js_enc_value($v); if ($assoc) { $k = _js_enc_value($k); $data[] = $k . ':' . $v; } else { $data[] = $v; } } if ($assoc) { $bl = '{'; $br = '}'; } else { $bl = '['; $br = ']'; } return $bl . implode(',', $data) . $br; } function _js_enc_value($value) { switch (true) { case is_array($value): case is_object($value): return json_encode($value); case is_bool($value): return $value ? 'true' : 'false'; case $value === null: case is_resource($value) && _js_error(): return 'null'; case is_string($value): return '"' . _js_uc_esc($value) . '"'; default: return $value; } } function _js_error() { return trigger_error( 'json_encode(): type is unsupported, encoded as null', E_USER_WARNING ); } function _js_uc_esc($value) { $pattern = "@[\a\b\f\n\r\t\v\"'/]|([^\x09\x0A\x0D\x20-\x7E|]{3}|\\0{2})+@"; return preg_replace_callback($pattern, '_js_uc_esc_cb', $value); } function _js_uc_esc_cb($matches) { switch (true) { case isset($matches[1]): $char = mb_convert_encoding($matches[0], 'UTF-16', 'UTF-8'); $str = ''; $len = strlen($char); for ($i = 0; $i < $len; $i += 2) { $str .= sprintf('\\u%02x%02x', ord($char[$i]), ord($char[$i + 1]) ); } return $str; default: return addcslashes($matches[0], "\a\b\f\n\r\t\v\"'/"); } } } echo json_encode(array('&/"\''=>"\0\a\b\f\n\r\t\v"));

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).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0090.00616.63
8.3.50.0100.01022.05
8.3.40.0120.00318.76
8.3.30.0090.00619.09
8.3.20.0000.00820.16
8.3.10.0080.00023.48
8.3.00.0040.00419.38
8.2.180.0070.01018.05
8.2.170.0120.00322.96
8.2.160.0090.00620.27
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0100.00726.16
8.2.120.0070.00021.98
8.2.110.0030.00722.23
8.2.100.0130.00017.78
8.2.90.0080.00019.22
8.2.80.0000.00817.97
8.2.70.0060.00317.38
8.2.60.0080.00017.91
8.2.50.0080.00018.07
8.2.40.0080.00018.09
8.2.30.0000.00718.01
8.2.20.0050.00317.75
8.2.10.0000.00718.03
8.2.00.0080.00017.55
8.1.280.0100.01025.92
8.1.270.0030.00523.81
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00624.02
8.1.230.0000.01120.93
8.1.220.0050.00317.74
8.1.210.0080.00018.77
8.1.200.0000.00817.35
8.1.190.0080.00017.39
8.1.180.0080.00018.10
8.1.170.0040.00418.55
8.1.160.0050.00221.98
8.1.150.0080.00018.73
8.1.140.0030.00617.45
8.1.130.0030.00317.82
8.1.120.0080.00017.50
8.1.110.0020.00517.45
8.1.100.0040.00417.38
8.1.90.0000.00717.47
8.1.80.0000.00717.45
8.1.70.0000.00717.44
8.1.60.0060.00317.54
8.1.50.0050.00317.49
8.1.40.0040.00417.46
8.1.30.0050.00317.59
8.1.20.0000.00717.65
8.1.10.0030.00517.36
8.1.00.0060.00317.45
8.0.300.0070.00018.77
8.0.290.0050.00217.17
8.0.280.0000.00718.32
8.0.270.0030.00317.17
8.0.260.0030.00316.82
8.0.250.0050.00317.02
8.0.240.0060.00317.00
8.0.230.0000.00717.00
8.0.220.0030.00316.90
8.0.210.0000.00716.87
8.0.200.0050.00316.83
8.0.190.0000.00716.92
8.0.180.0040.00416.90
8.0.170.0040.00416.91
8.0.160.0040.00416.85
8.0.150.0000.00816.92
8.0.140.0040.00416.88
8.0.130.0040.00413.36
8.0.120.0040.00416.89
8.0.110.0000.00716.90
8.0.100.0040.00416.70
8.0.90.0040.00416.96
8.0.80.0070.01016.88
8.0.70.0030.00516.79
8.0.60.0040.00416.94
8.0.50.0040.00416.90
8.0.30.0120.01217.23
8.0.20.0110.00817.40
8.0.10.0000.00816.96
8.0.00.0080.01016.69
7.4.330.0030.00315.09
7.4.320.0040.00416.49
7.4.300.0000.00616.52
7.4.290.0000.00716.57
7.4.280.0000.00716.58
7.4.270.0040.00416.53
7.4.260.0030.00316.58
7.4.250.0040.00416.43
7.4.240.0000.00716.53
7.4.230.0080.00016.31
7.4.220.0160.00316.34
7.4.210.0040.01116.49
7.4.200.0070.00016.48
7.4.190.0040.00416.39
7.4.160.0170.00316.27
7.4.150.0220.00317.40
7.4.140.0060.01317.86
7.4.130.0130.00316.49
7.4.120.0090.00716.58
7.4.110.0070.01016.42
7.4.100.0120.01216.50
7.4.90.0180.00416.49
7.4.80.0070.01119.39
7.4.70.0070.01016.40
7.4.60.0030.01316.55
7.4.50.0000.00416.30
7.4.40.0090.00422.77
7.4.30.0060.00916.50
7.4.00.0000.01514.84
7.3.330.0030.00313.24
7.3.320.0000.00713.27
7.3.310.0070.00016.14
7.3.300.0070.00016.12
7.3.290.0000.01516.34
7.3.280.0070.01116.24
7.3.270.0130.00317.40
7.3.260.0130.00416.38
7.3.250.0120.00616.44
7.3.240.0090.00916.49
7.3.230.0060.01016.39
7.3.210.0000.01716.44
7.3.200.0070.01019.39
7.3.190.0070.01416.32
7.3.180.0150.00716.53
7.3.170.0060.00916.30
7.3.160.0030.02016.26
7.3.120.0030.01314.90
7.3.10.0130.00016.69
7.3.00.0040.00416.65
7.2.330.0150.00416.61
7.2.320.0130.01016.59
7.2.310.0060.01216.29
7.2.300.0100.01316.35
7.2.290.0000.02116.76
7.2.130.0030.00917.01
7.2.120.0000.01516.86
7.2.110.0060.01016.78
7.2.100.0000.01016.64
7.2.90.0070.00716.81
7.2.80.0040.01216.92
7.2.70.0070.00716.78
7.2.60.0020.01116.71
7.2.50.0030.00616.96
7.2.40.0030.00516.84
7.2.30.0100.00316.69
7.2.20.0040.01116.87
7.2.10.0060.00616.65
7.2.00.0050.00817.89
7.1.250.0000.00715.34
7.1.200.0000.01015.83
7.1.100.0250.01218.12
7.1.70.0110.00716.75
7.1.60.0110.01119.31
7.1.50.0130.00316.86
7.1.00.0030.07722.48
7.0.200.0000.00816.55
7.0.140.0000.07721.99
7.0.90.0530.05019.94
7.0.80.0570.07320.02
7.0.70.0500.04319.95
7.0.60.0570.07020.01
7.0.50.0530.04320.40
7.0.40.0030.04720.04
7.0.30.0170.07320.04
7.0.20.0100.08020.17
7.0.10.0000.08720.10
7.0.00.0100.04320.10
5.6.280.0100.07020.92
5.6.240.0070.05020.68
5.6.230.0030.04320.52
5.6.220.0100.08320.75
5.6.210.0100.08020.55
5.6.200.0070.06321.07
5.6.190.0100.04321.08
5.6.180.0170.07021.16
5.6.170.0100.05321.18
5.6.160.0070.04321.06
5.6.150.0070.05320.97
5.6.140.0000.08321.05
5.6.130.0170.03721.09
5.6.120.0000.06321.04
5.6.110.0130.05021.04
5.6.100.0070.08721.09
5.6.90.0100.08021.02
5.6.80.0070.06320.49
5.6.70.0100.06720.45
5.6.60.0030.05320.56
5.6.50.0030.08720.48
5.6.40.0130.06720.43
5.6.30.0070.08320.41
5.6.20.0130.07320.48
5.6.10.0070.03720.39
5.6.00.0170.04720.46
5.5.380.0070.08020.51
5.5.370.0130.03320.55
5.5.360.0070.08020.39
5.5.350.0100.08020.44
5.5.340.0070.04020.79
5.5.330.0070.04720.77
5.5.320.0070.07720.89
5.5.310.0130.04720.84
5.5.300.0100.05020.92
5.5.290.0030.04720.91
5.5.280.0100.05320.89
5.5.270.0070.08720.88
5.5.260.0070.04720.91
5.5.250.0170.04720.56
5.5.240.0100.04020.31
5.5.230.0100.07720.02
5.5.220.0100.07320.12
5.5.210.0100.05020.19
5.5.200.0130.05720.30
5.5.190.0000.05720.17
5.5.180.0100.07720.28
5.5.160.0100.03720.10
5.5.150.0100.08020.22
5.5.140.0030.08320.01
5.5.130.0100.06320.01
5.5.120.0070.04720.11
5.5.110.0100.07720.28
5.5.100.0100.08020.04
5.5.90.0070.08020.07
5.5.80.0130.06319.96
5.5.70.0100.07320.14
5.5.60.0070.07320.07
5.5.50.0030.05720.07
5.5.40.0030.08020.13
5.5.30.0130.07320.09
5.5.20.0070.08320.04
5.5.10.0030.04320.11
5.5.00.0100.08019.93
5.4.450.0100.04019.56
5.4.440.0130.07719.20
5.4.430.0100.07719.34
5.4.420.0030.07019.53
5.4.410.0100.07319.35
5.4.400.0070.03718.88
5.4.390.0100.07319.09
5.4.380.0030.08319.09
5.4.370.0100.07318.89
5.4.360.0100.08018.93
5.4.350.0130.07318.88
5.4.340.0030.06719.20
5.4.320.0170.06718.85
5.4.310.0070.06019.09
5.4.300.0130.06719.09
5.4.290.0070.07319.23
5.4.280.0070.05719.05
5.4.270.0070.07719.15
5.4.260.0100.04018.87
5.4.250.0030.06719.22
5.4.240.0070.07318.84
5.4.230.0070.05719.03
5.4.220.0000.08019.13
5.4.210.0130.07019.13
5.4.200.0070.05719.11
5.4.190.0030.04718.86
5.4.180.0130.06718.92
5.4.170.0070.07319.12
5.4.160.0170.03719.02
5.4.150.0070.04319.02
5.4.140.0030.04716.42
5.4.130.0170.04016.41
5.4.120.0000.06016.46
5.4.110.0000.04716.48
5.4.100.0100.06716.44
5.4.90.0030.04316.31
5.4.80.0030.04316.47
5.4.70.0100.05016.30
5.4.60.0030.07716.33
5.4.50.0100.07316.41
5.4.40.0030.06716.53
5.4.30.0070.06316.42
5.4.20.0000.05016.41
5.4.10.0000.04716.48
5.4.00.0100.05715.85
5.3.290.0030.05714.72
5.3.280.0100.07014.70
5.3.270.0030.08314.55
5.3.260.0070.05714.72
5.3.250.0030.06714.61
5.3.240.0100.07014.64
5.3.230.0130.07314.65
5.3.220.0070.07714.59
5.3.210.0070.05014.61
5.3.200.0000.08014.57
5.3.190.0130.04014.70
5.3.180.0100.06014.57
5.3.170.0130.06714.68
5.3.160.0030.07714.57
5.3.150.0070.07714.62
5.3.140.0070.05014.59
5.3.130.0030.05014.54
5.3.120.0100.07014.59
5.3.110.0030.08314.59
5.3.100.0130.07314.05
5.3.90.0070.07714.01
5.3.80.0070.07713.95
5.3.70.0100.06713.96
5.3.60.0000.08314.04
5.3.50.0030.07314.04
5.3.40.0100.06013.99
5.3.30.0030.07013.87
5.3.20.0030.04313.86
5.3.10.0100.06713.71
5.3.00.0030.07713.55
5.2.170.0000.04711.24
5.2.160.0070.04711.32
5.2.150.0000.06311.29
5.2.140.0030.04011.23
5.2.130.0030.03011.01
5.2.120.0070.05011.24
5.2.110.0100.06011.13
5.2.100.0030.03711.18
5.2.90.0000.04011.24
5.2.80.0130.04011.21
5.2.70.0030.06311.27
5.2.60.0000.07011.11
5.2.50.0230.03011.11
5.2.40.0070.06010.92
5.2.30.0070.03311.06
5.2.20.0130.05311.02
5.2.10.0030.05010.82
5.2.00.0130.04310.73
5.1.60.0070.0339.91
5.1.50.0000.03710.12
5.1.40.0100.04710.00
5.1.30.0100.05010.38
5.1.20.0070.03710.46
5.1.10.0000.03710.19
5.1.00.0070.05310.11
5.0.50.0100.0408.68
5.0.40.0030.0478.54
5.0.30.0030.0608.39
5.0.20.0130.0338.35
5.0.10.0030.0438.29
5.0.00.0030.0638.28
4.4.90.0000.0207.46
4.4.80.0030.0237.46
4.4.70.0030.0337.46
4.4.60.0030.0377.46
4.4.50.0070.0207.46
4.4.40.0070.0477.46
4.4.30.0030.0177.46
4.4.20.0000.0207.46
4.4.10.0000.0337.46
4.4.00.0030.0537.46
4.3.110.0070.0237.46
4.3.100.0030.0337.46
4.3.90.0070.0307.46
4.3.80.0000.0537.46
4.3.70.0030.0337.46
4.3.60.0000.0377.46
4.3.50.0070.0307.46
4.3.40.0070.0477.46
4.3.30.0000.0277.46
4.3.20.0000.0277.46
4.3.10.0000.0377.46
4.3.00.0070.0307.46

preferences:
43.51 ms | 401 KiB | 5 Q