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 = '"'. addcslashes($k, '"\\') . '"'; $data[] = $k . ':' . $v; } else { $data[] = $v; } } if ($assoc) { $spl = '{'; $spr = '}'; } else { $spl = '['; $spr = ']'; } return $spl . implode(',', $data) . $spr; } 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 = "/\r|(\n)|((?:[^\x09\x0A\x0D\x20-\x7E]{3})+)/"; return preg_replace_callback($pattern, '_js_uc_esc_cb', $value); } function _js_uc_esc_cb($matches) { switch (true) { case isset($matches[2]): $char = mb_convert_encoding($matches[2], '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; case isset($matches[1]): return '\\n'; default: return '\\r'; } } } echo json_encode(array('<a href="">'));

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.70.0040.01116.38
8.3.60.0150.00318.30
8.3.50.0050.01022.05
8.3.40.0140.00718.85
8.3.30.0160.00318.92
8.3.20.0050.00320.13
8.3.10.0040.00422.09
8.3.00.0100.00622.43
8.2.180.0140.00416.50
8.2.170.0070.00722.96
8.2.160.0140.00320.94
8.2.150.0120.00324.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00419.36
8.2.110.0060.00322.34
8.2.100.0030.00917.75
8.2.90.0040.00419.28
8.2.80.0040.00418.04
8.2.70.0060.00617.63
8.2.60.0040.00417.90
8.2.50.0060.00318.07
8.2.40.0080.00318.11
8.2.30.0040.00417.93
8.2.20.0000.00817.55
8.2.10.0000.00817.65
8.2.00.0000.00717.64
8.1.280.0120.00625.92
8.1.270.0040.00423.78
8.1.260.0080.00026.35
8.1.250.0060.00328.09
8.1.240.0060.00323.98
8.1.230.0090.00319.16
8.1.220.0090.00017.74
8.1.210.0060.00318.77
8.1.200.0090.00317.25
8.1.190.0000.00817.30
8.1.180.0090.00018.10
8.1.170.0030.00518.53
8.1.160.0080.00022.09
8.1.150.0070.00018.57
8.1.140.0040.00417.36
8.1.130.0000.00817.83
8.1.120.0040.00417.36
8.1.110.0040.00417.48
8.1.100.0040.00417.32
8.1.90.0070.00017.54
8.1.80.0000.00717.33
8.1.70.0070.00017.43
8.1.60.0040.00717.47
8.1.50.0050.00317.55
8.1.40.0030.00517.46
8.1.30.0040.00417.65
8.1.20.0050.00317.68
8.1.10.0040.00417.46
8.1.00.0000.00917.45
8.0.300.0000.00718.77
8.0.290.0030.00617.18
8.0.280.0000.00718.36
8.0.270.0000.00717.25
8.0.260.0050.00516.76
8.0.250.0030.00316.89
8.0.240.0080.00016.93
8.0.230.0070.00016.96
8.0.220.0040.00416.80
8.0.210.0030.00316.82
8.0.200.0000.00616.97
8.0.190.0040.00417.00
8.0.180.0030.00516.91
8.0.170.0080.00016.80
8.0.160.0000.00716.85
8.0.150.0070.00016.85
8.0.140.0040.00416.79
8.0.130.0030.00313.38
8.0.120.0040.00416.82
8.0.110.0080.00016.88
8.0.100.0040.00416.80
8.0.90.0050.00316.78
8.0.80.0120.00916.87
8.0.70.0020.00516.85
8.0.60.0000.00716.96
8.0.50.0000.00816.91
8.0.30.0080.01417.12
8.0.20.0120.00717.42
8.0.10.0070.00016.90
8.0.00.0130.00416.74
7.4.330.0050.00215.03
7.4.320.0030.00316.61
7.4.300.0070.00016.55
7.4.290.0000.00716.60
7.4.280.0030.00316.61
7.4.270.0000.00716.51
7.4.260.0000.00716.63
7.4.250.0080.00016.37
7.4.240.0050.00316.46
7.4.230.0000.00716.30
7.4.220.0140.01316.41
7.4.210.0050.01216.57
7.4.200.0040.00416.54
7.4.190.0080.00016.34
7.4.160.0120.00416.38
7.4.150.0160.00317.40
7.4.140.0130.00517.86
7.4.130.0070.01116.42
7.4.120.0050.01316.53
7.4.110.0120.01216.50
7.4.100.0120.00616.38
7.4.90.0070.01116.38
7.4.80.0160.00716.44
7.4.70.0100.00716.30
7.4.60.0100.00716.39
7.4.50.0040.00416.21
7.4.40.0030.01222.77
7.4.30.0120.01216.57
7.4.00.0030.01214.88
7.3.330.0000.00513.13
7.3.320.0050.00013.27
7.3.310.0040.00416.27
7.3.300.0070.00016.26
7.3.290.0030.01216.19
7.3.280.0070.01116.23
7.3.270.0070.01017.40
7.3.260.0180.00716.45
7.3.250.0080.00916.55
7.3.240.0190.00016.30
7.3.230.0100.00616.56
7.3.210.0090.00916.27
7.3.200.0150.00919.39
7.3.190.0030.01516.39
7.3.180.0120.01216.58
7.3.170.0060.01716.34
7.3.160.0060.01016.26
7.3.120.0000.01214.95
7.2.330.0030.01616.65
7.2.320.0120.00616.42
7.2.310.0110.00716.63
7.2.300.0100.00716.39
7.2.290.0070.01016.66
7.2.00.0000.00919.25
7.1.100.0000.01318.05
7.1.70.0000.01017.10
7.1.60.0040.01419.82
7.1.50.0070.00316.75
7.1.00.0070.07322.44
7.0.200.0030.00316.66
7.0.140.0100.06722.21
7.0.90.0100.08019.97
7.0.80.0070.04319.99
7.0.70.0530.07719.89
7.0.60.0600.07720.03
7.0.50.0470.05320.36
7.0.40.0030.08020.14
7.0.30.0100.07320.19
7.0.20.0100.04720.13
7.0.10.0170.07019.99
7.0.00.0070.08320.04
5.6.280.0170.06021.04
5.6.240.0100.08020.65
5.6.230.0030.05320.47
5.6.220.0130.07720.70
5.6.210.0070.04020.72
5.6.200.0070.09021.13
5.6.190.0070.07721.09
5.6.180.0000.09021.19
5.6.170.0000.08020.95
5.6.160.0030.08721.04
5.6.150.0100.07021.13
5.6.140.0070.07721.03
5.6.130.0100.04020.95
5.6.120.0100.03720.98
5.6.110.0100.03721.06
5.6.100.0030.04021.17
5.6.90.0030.07321.02
5.6.80.0070.03320.41
5.6.70.0000.04320.50
5.6.60.0030.04020.52
5.6.50.0130.03020.45
5.6.40.0070.04320.46
5.6.30.0030.04020.38
5.6.20.0070.05020.49
5.6.10.0000.04320.45
5.6.00.0030.04020.38
5.5.380.0070.07320.33
5.5.370.0070.06320.34
5.5.360.0130.04720.47
5.5.350.0100.07720.38
5.5.340.0100.04020.89
5.5.330.0130.07320.95
5.5.320.0070.08720.95
5.5.310.0170.07720.88
5.5.300.0070.05320.84
5.5.290.0130.05720.88
5.5.280.0070.04020.66
5.5.270.0030.04720.93
5.5.260.0000.04320.93
5.5.250.0000.04720.66
5.5.240.0030.04320.32
5.5.230.0100.03320.22
5.5.220.0030.04020.22
5.5.210.0030.04020.27
5.5.200.0070.05020.13
5.5.190.0070.03720.14
5.5.180.0030.04020.13
5.5.160.0100.03020.17
5.5.150.0070.03720.21
5.5.140.0070.03020.12
5.5.130.0070.06020.12
5.5.120.0130.03020.24
5.5.110.0100.03720.16
5.5.100.0130.03020.07
5.5.90.0030.04020.09
5.5.80.0030.03720.12
5.5.70.0030.04720.05
5.5.60.0030.03720.07
5.5.50.0030.05020.10
5.5.40.0070.04319.98
5.5.30.0000.05020.12
5.5.20.0070.05020.15
5.5.10.0030.07720.02
5.5.00.0070.04720.03
5.4.450.0030.04019.23
5.4.440.0030.04719.47
5.4.430.0030.04719.38
5.4.420.0000.04319.19
5.4.410.0070.03319.24
5.4.400.0070.03319.24
5.4.390.0070.03019.09
5.4.380.0070.03319.18
5.4.370.0030.04019.12
5.4.360.0070.06319.05
5.4.350.0070.03719.03
5.4.340.0000.04319.16
5.4.320.0000.04319.05
5.4.310.0000.04019.16
5.4.300.0130.03719.23
5.4.290.0030.03718.87
5.4.280.0000.04018.88
5.4.270.0030.04019.02
5.4.260.0030.03719.18
5.4.250.0030.03719.15
5.4.240.0070.03319.05
5.4.230.0070.03318.89
5.4.220.0000.04018.84
5.4.210.0070.04019.23
5.4.200.0070.03718.90
5.4.190.0030.03719.08
5.4.180.0070.03019.20
5.4.170.0170.05719.04
5.4.160.0000.03719.22
5.4.150.0070.04019.11
5.4.140.0030.07316.26
5.4.130.0130.06316.46
5.4.120.0030.04716.34
5.4.110.0000.07016.39
5.4.100.0100.06716.49
5.4.90.0130.06716.54
5.4.80.0170.06016.51
5.4.70.0070.07316.56
5.4.60.0070.07016.41
5.4.50.0170.05316.30
5.4.40.0070.07316.39
5.4.30.0030.08016.35
5.4.20.0070.07316.47
5.4.10.0030.03716.31
5.4.00.0100.07015.85
5.3.290.0030.03714.68
5.3.280.0000.04014.74
5.3.270.0030.09014.75
5.3.260.0030.04314.75
5.3.250.0070.03314.75
5.3.240.0070.06314.65
5.3.230.0130.06714.55
5.3.220.0170.06714.61
5.3.210.0030.05314.54
5.3.200.0130.06014.66
5.3.190.0070.04014.65
5.3.180.0070.07014.64
5.3.170.0170.05014.66
5.3.160.0000.08014.68
5.3.150.0000.04714.51
5.3.140.0070.06014.57
5.3.130.0100.07014.68
5.3.120.0030.04714.71
5.3.110.0130.05714.68
5.3.100.0070.04713.99
5.3.90.0130.03014.10
5.3.80.0100.05714.10
5.3.70.0070.05313.98
5.3.60.0070.07313.96
5.3.50.0030.07014.02
5.3.40.0100.04313.90
5.3.30.0070.03713.88
5.3.20.0030.04313.71
5.3.10.0070.07013.79
5.3.00.0000.06313.75
5.2.170.0070.03711.21
5.2.160.0100.05011.30
5.2.150.0030.03011.09
5.2.140.0030.04711.30
5.2.130.0030.05011.14
5.2.120.0130.02311.23
5.2.110.0030.04711.18
5.2.100.0030.03311.23
5.2.90.0100.02711.25
5.2.80.0030.05711.18
5.2.70.0030.06311.12
5.2.60.0030.04011.21
5.2.50.0100.04011.19
5.2.40.0000.04311.11
5.2.30.0070.04010.91
5.2.20.0170.05311.05
5.2.10.0030.03310.91
5.2.00.0030.04010.61
5.1.60.0100.04010.11
5.1.50.0030.03710.14
5.1.40.0030.04710.07
5.1.30.0070.04710.27
5.1.20.0030.06010.39
5.1.10.0130.05010.19
5.1.00.0100.04710.16
5.0.50.0000.0338.43
5.0.40.0030.0408.35
5.0.30.0070.0338.15
5.0.20.0000.0378.33
5.0.10.0000.0378.30
5.0.00.0000.0378.05
4.4.90.0000.0206.63
4.4.80.0070.0176.63
4.4.70.0030.0336.63
4.4.60.0000.0306.63
4.4.50.0030.0206.63
4.4.40.0030.0276.63
4.4.30.0030.0376.63
4.4.20.0070.0306.63
4.4.10.0030.0206.63
4.4.00.0030.0306.63
4.3.110.0070.0176.63
4.3.100.0030.0336.63
4.3.90.0070.0276.63
4.3.80.0030.0436.63
4.3.70.0070.0306.63
4.3.60.0030.0336.63
4.3.50.0030.0306.63
4.3.40.0070.0536.63
4.3.30.0000.0276.63
4.3.20.0000.0406.63
4.3.10.0000.0236.63
4.3.00.0030.0336.63

preferences:
44.84 ms | 401 KiB | 5 Q