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 = "@[\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[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], "\r\n\"'/"); } } } echo json_encode(array('あ'=>'"/'));

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.0070.01418.18
8.3.60.0120.00616.88
8.3.50.0090.01022.03
8.3.40.0040.01418.85
8.3.30.0120.00918.79
8.3.20.0040.00420.16
8.3.10.0050.00323.71
8.3.00.0000.00720.71
8.2.180.0180.00416.75
8.2.170.0060.00922.96
8.2.160.0170.00322.18
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0050.00226.16
8.2.120.0070.00022.13
8.2.110.0000.00922.26
8.2.100.0060.00617.72
8.2.90.0000.00819.08
8.2.80.0000.00817.97
8.2.70.0060.00317.63
8.2.60.0040.00417.92
8.2.50.0000.01018.07
8.2.40.0040.00418.22
8.2.30.0000.00718.04
8.2.20.0000.00717.58
8.2.10.0000.00819.41
8.2.00.0090.00017.67
8.1.280.0070.01025.92
8.1.270.0040.00423.70
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0090.00023.75
8.1.230.0040.00819.11
8.1.220.0080.00017.74
8.1.210.0000.00818.77
8.1.200.0000.00817.13
8.1.190.0030.00617.51
8.1.180.0090.00018.10
8.1.170.0080.00018.72
8.1.160.0060.00322.11
8.1.150.0070.00018.63
8.1.140.0000.00717.50
8.1.130.0000.00717.87
8.1.120.0020.00517.42
8.1.110.0040.00417.41
8.1.100.0000.00717.45
8.1.90.0000.00717.49
8.1.80.0030.00317.39
8.1.70.0080.00017.36
8.1.60.0000.00917.58
8.1.50.0000.00817.51
8.1.40.0000.00817.49
8.1.30.0040.00417.46
8.1.20.0000.00817.63
8.1.10.0070.00017.41
8.1.00.0000.00817.47
8.0.300.0040.00418.77
8.0.290.0070.00017.30
8.0.280.0000.00718.49
8.0.270.0040.00417.37
8.0.260.0040.00416.84
8.0.250.0030.00317.00
8.0.240.0000.01117.00
8.0.230.0040.00416.92
8.0.220.0030.00316.87
8.0.210.0040.00416.80
8.0.200.0030.00316.96
8.0.190.0080.00017.00
8.0.180.0000.00716.91
8.0.170.0030.00516.91
8.0.160.0000.00916.89
8.0.150.0040.00416.79
8.0.140.0040.00416.87
8.0.130.0030.00313.32
8.0.120.0040.00416.75
8.0.110.0000.00816.92
8.0.100.0040.00416.96
8.0.90.0040.00416.95
8.0.80.0060.01016.84
8.0.70.0050.00216.96
8.0.60.0030.00516.78
8.0.50.0000.00716.80
8.0.30.0090.00917.19
8.0.20.0100.01017.40
8.0.10.0040.00416.82
8.0.00.0150.00416.72
7.4.330.0030.00315.00
7.4.320.0030.00316.50
7.4.300.0040.00416.48
7.4.290.0040.00416.61
7.4.280.0030.00316.55
7.4.270.0030.00316.55
7.4.260.0000.00816.42
7.4.250.0000.00716.53
7.4.240.0040.00316.51
7.4.230.0000.00716.34
7.4.220.0130.00616.47
7.4.210.0080.00916.50
7.4.200.0000.00716.35
7.4.190.0030.00516.55
7.4.160.0060.00916.59
7.4.150.0080.00917.40
7.4.140.0060.01117.86
7.4.130.0140.00516.61
7.4.120.0110.01116.43
7.4.110.0030.01316.53
7.4.100.0080.01216.49
7.4.90.0130.00716.39
7.4.80.0040.01616.53
7.4.70.0100.01316.32
7.4.60.0080.00816.44
7.4.50.0000.00716.49
7.4.40.0040.00822.77
7.4.30.0080.00816.37
7.4.00.0000.01714.73
7.3.330.0060.00013.24
7.3.320.0020.00213.20
7.3.310.0040.00416.06
7.3.300.0000.00616.16
7.3.290.0030.01216.25
7.3.280.0040.01316.22
7.3.270.0130.00417.40
7.3.260.0090.00916.22
7.3.250.0080.01116.29
7.3.240.0030.01416.27
7.3.230.0060.01116.44
7.3.210.0100.00716.56
7.3.200.0120.00619.39
7.3.190.0150.00816.34
7.3.180.0110.01116.27
7.3.170.0190.00316.27
7.3.160.0060.00916.38
7.3.120.0090.00314.82
7.2.330.0080.01216.36
7.2.320.0100.00716.49
7.2.310.0090.00916.58
7.2.300.0100.01016.55
7.2.290.0030.01416.56
7.2.00.0060.00319.31
7.1.100.0110.00017.59
7.1.70.0080.00017.13
7.1.60.0090.00919.29
7.1.50.0040.01816.84
7.1.00.0030.06722.45
7.0.200.0040.00414.90
7.0.140.0130.06322.05
7.0.90.0070.04019.96
7.0.80.0070.05719.92
7.0.70.0500.03019.93
7.0.60.0130.04019.98
7.0.50.0300.05320.29
7.0.40.0070.08020.12
7.0.30.0070.08320.13
7.0.20.0030.08320.00
7.0.10.0100.07720.14
7.0.00.0030.08320.01
5.6.280.0000.07320.84
5.6.240.0070.04020.77
5.6.230.0070.04020.77
5.6.220.0100.04720.69
5.6.210.0100.04020.67
5.6.200.0070.07020.97
5.6.190.0100.04021.05
5.6.180.0130.04321.02
5.6.170.0170.07321.04
5.6.160.0130.07321.03
5.6.150.0070.08321.16
5.6.140.0030.05021.08
5.6.130.0030.09020.97
5.6.120.0070.08321.18
5.6.110.0200.07720.94
5.6.100.0100.08320.96
5.6.90.0100.07721.05
5.6.80.0000.08320.54
5.6.70.0070.04320.50
5.6.60.0070.08320.43
5.6.50.0000.08320.52
5.6.40.0200.06320.41
5.6.30.0130.07720.46
5.6.20.0100.06720.38
5.6.10.0100.07720.53
5.6.00.0000.05720.38
5.5.380.0000.04320.44
5.5.370.0100.04320.41
5.5.360.0000.04320.57
5.5.350.0100.03320.43
5.5.340.0030.05020.84
5.5.330.0000.04320.78
5.5.320.0000.06320.66
5.5.310.0130.07320.82
5.5.300.0070.08720.82
5.5.290.0030.06720.90
5.5.280.0030.09020.81
5.5.270.0030.08720.83
5.5.260.0100.07720.87
5.5.250.0130.07020.74
5.5.240.0070.08020.20
5.5.230.0130.06720.28
5.5.220.0100.07320.15
5.5.210.0100.08320.19
5.5.200.0070.07320.13
5.5.190.0170.07720.17
5.5.180.0000.06020.14
5.5.160.0170.07020.01
5.5.150.0070.08020.16
5.5.140.0230.06320.17
5.5.130.0130.07320.12
5.5.120.0230.04020.25
5.5.110.0200.06720.23
5.5.100.0030.07320.12
5.5.90.0100.07719.96
5.5.80.0030.06720.09
5.5.70.0130.06020.08
5.5.60.0030.08319.97
5.5.50.0100.07720.04
5.5.40.0100.06320.16
5.5.30.0170.06020.08
5.5.20.0100.04019.95
5.5.10.0030.06720.02
5.5.00.0100.04320.12
5.4.450.0070.07719.46
5.4.440.0130.07719.42
5.4.430.0100.05319.37
5.4.420.0100.07719.44
5.4.410.0130.06719.11
5.4.400.0070.07719.18
5.4.390.0100.07719.13
5.4.380.0100.07719.05
5.4.370.0070.05318.94
5.4.360.0030.05719.23
5.4.350.0100.05719.04
5.4.340.0000.05719.13
5.4.320.0100.07318.84
5.4.310.0170.06319.04
5.4.300.0100.07019.05
5.4.290.0100.07019.04
5.4.280.0100.07019.23
5.4.270.0100.07319.12
5.4.260.0070.06719.02
5.4.250.0170.06718.87
5.4.240.0070.04719.12
5.4.230.0000.07319.08
5.4.220.0130.07718.89
5.4.210.0030.05019.17
5.4.200.0100.07719.02
5.4.190.0100.03719.19
5.4.180.0070.07719.22
5.4.170.0100.07719.02
5.4.160.0130.05019.10
5.4.150.0030.08319.12
5.4.140.0070.07716.20
5.4.130.0070.04716.41
5.4.120.0000.05016.36
5.4.110.0000.07716.52
5.4.100.0030.05716.52
5.4.90.0030.07316.45
5.4.80.0070.05016.55
5.4.70.0030.05016.54
5.4.60.0070.07316.30
5.4.50.0130.05016.48
5.4.40.0170.06316.54
5.4.30.0070.07716.47
5.4.20.0070.08016.25
5.4.10.0030.06716.33
5.4.00.0000.06315.81
5.3.290.0170.06714.67
5.3.280.0000.08014.74
5.3.270.0070.04714.55
5.3.260.0000.08014.74
5.3.250.0100.07714.63
5.3.240.0070.06714.59
5.3.230.0200.06314.60
5.3.220.0100.03714.71
5.3.210.0070.03714.57
5.3.200.0070.07314.51
5.3.190.0130.07014.61
5.3.180.0000.07714.57
5.3.170.0100.07314.70
5.3.160.0130.07314.52
5.3.150.0100.06314.72
5.3.140.0100.07014.52
5.3.130.0030.07714.58
5.3.120.0070.04014.54
5.3.110.0070.08314.59
5.3.100.0030.04714.13
5.3.90.0170.05314.14
5.3.80.0030.08013.95
5.3.70.0100.07713.97
5.3.60.0100.07314.05
5.3.50.0030.07714.03
5.3.40.0130.04713.91
5.3.30.0070.07313.96
5.3.20.0030.06313.61
5.3.10.0130.06713.69
5.3.00.0070.07013.65
5.2.170.0000.07011.20
5.2.160.0100.05711.32
5.2.150.0070.06311.21
5.2.140.0130.06011.25
5.2.130.0030.06311.20
5.2.120.0070.06011.07
5.2.110.0100.04011.19
5.2.100.0030.05311.03
5.2.90.0030.04711.03
5.2.80.0030.06711.11
5.2.70.0070.06011.18
5.2.60.0070.06010.99
5.2.50.0030.05310.96
5.2.40.0030.06011.06
5.2.30.0070.06010.92
5.2.20.0070.06011.09
5.2.10.0100.04010.82
5.2.00.0070.06010.66
5.1.60.0100.05310.02
5.1.50.0070.05710.11
5.1.40.0070.05310.11
5.1.30.0030.05010.36
5.1.20.0100.04710.30
5.1.10.0070.0439.94
5.1.00.0030.04010.11
5.0.50.0030.0408.68
5.0.40.0100.0378.46
5.0.30.0000.0708.30
5.0.20.0030.0408.09
5.0.10.0000.0478.33
5.0.00.0030.0438.27
4.4.90.0030.0207.38
4.4.80.0070.0277.38
4.4.70.0000.0377.38
4.4.60.0000.0377.38
4.4.50.0100.0337.38
4.4.40.0030.0507.38
4.4.30.0070.0337.38
4.4.20.0030.0337.38
4.4.10.0030.0377.38
4.4.00.0000.0577.38
4.3.110.0000.0337.38
4.3.100.0070.0237.38
4.3.90.0070.0337.38
4.3.80.0000.0477.38
4.3.70.0070.0307.38
4.3.60.0030.0307.38
4.3.50.0030.0337.38
4.3.40.0030.0507.38
4.3.30.0000.0277.38
4.3.20.0030.0277.38
4.3.10.0000.0337.38
4.3.00.0000.0307.38

preferences:
54.84 ms | 401 KiB | 5 Q