3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isJson2($string) { try { json_decode($string); } catch (ErrorException $e) { return FALSE; } return (json_last_error() == JSON_ERROR_NONE); } /** * Checks whether a string is valid JSON. * * @param string $string * @return boolean */ function isJson($string) { // Make sure the string is not empty and whether it is a string. if(!empty($string) && is_string($string)) { json_decode($string); return (json_last_error() == JSON_ERROR_NONE); } return false; } $a=['arraiii'=>['dentro'=>234]]; $b=json_encode(['asdf'=>45]); $c=''; var_export(json_decode($b)); var_dump(isJson($b));

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.0070.00718.18
8.3.50.0110.00721.27
8.3.40.0150.00018.54
8.3.30.0070.00720.23
8.3.20.0070.00020.38
8.3.10.0070.00021.89
8.3.00.0040.00422.34
8.2.180.0150.00416.50
8.2.170.0040.01122.96
8.2.160.0110.00422.26
8.2.150.0030.00524.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0060.00320.62
8.2.110.0040.00422.18
8.2.100.0120.00017.84
8.2.90.0040.00419.23
8.2.80.0000.00919.40
8.2.70.0000.00917.63
8.2.60.0000.00817.93
8.2.50.0040.00418.07
8.2.40.0040.00418.22
8.2.30.0050.00319.30
8.2.20.0000.00717.77
8.2.10.0000.00817.68
8.2.00.0000.00817.85
8.1.280.0060.00925.92
8.1.270.0040.00423.99
8.1.260.0060.00326.35
8.1.250.0000.00728.09
8.1.240.0000.00823.84
8.1.230.0040.00719.07
8.1.220.0080.00017.80
8.1.210.0000.00818.77
8.1.200.0040.00417.22
8.1.190.0060.00317.53
8.1.180.0040.00419.01
8.1.170.0040.00418.64
8.1.160.0000.00718.94
8.1.150.0050.00318.55
8.1.140.0040.00417.46
8.1.130.0000.00717.88
8.1.120.0000.00717.35
8.1.110.0000.00817.49
8.1.100.0000.00817.42
8.1.90.0000.00717.46
8.1.80.0070.00017.36
8.1.70.0030.00317.41
8.1.60.0000.00817.59
8.1.50.0000.00717.50
8.1.40.0000.00817.55
8.1.30.0080.00017.65
8.1.20.0000.00817.66
8.1.10.0040.00417.39
8.1.00.0080.00317.45
8.0.300.0070.00018.77
8.0.290.0040.00417.05
8.0.280.0070.00018.45
8.0.270.0030.00317.27
8.0.260.0000.00616.82
8.0.250.0040.00416.86
8.0.240.0000.00817.04
8.0.230.0000.00716.90
8.0.220.0000.00716.81
8.0.210.0000.00716.79
8.0.200.0030.00516.84
8.0.190.0000.00716.84
8.0.180.0040.00416.84
8.0.170.0030.00516.90
8.0.160.0000.00716.96
8.0.150.0040.00716.80
8.0.140.0050.00316.90
8.0.130.0030.00313.36
8.0.120.0030.00616.81
8.0.110.0000.00716.90
8.0.100.0040.00416.83
8.0.90.0000.01016.91
8.0.80.0090.00616.86
8.0.70.0050.00316.91
8.0.60.0040.00416.76
8.0.50.0040.00416.79
8.0.30.0070.01316.98
8.0.20.0080.01217.40
8.0.10.0050.00217.10
8.0.00.0070.01116.81
7.4.330.0050.00015.00
7.4.320.0050.00516.46
7.4.300.0030.00316.59
7.4.290.0040.00416.61
7.4.280.0040.00416.51
7.4.270.0000.00716.57
7.4.260.0000.00513.28
7.4.250.0000.00816.52
7.4.240.0020.00616.57
7.4.230.0000.00716.40
7.4.220.0100.00716.55
7.4.210.0110.00416.56
7.4.200.0040.00416.70
7.4.190.0070.00016.55
7.4.160.0090.00616.59
7.4.150.0030.01417.40
7.4.140.0100.00717.86
7.4.130.0150.00216.41
7.4.120.0100.00716.61
7.4.110.0100.00616.54
7.4.100.0070.01016.68
7.4.90.0070.01116.41
7.4.80.0070.01119.39
7.4.70.0060.01016.47
7.4.60.0100.00616.63
7.4.50.0020.00216.34
7.4.40.0040.01422.77
7.4.30.0060.01216.69
7.4.00.0080.01014.93
7.3.330.0060.00013.26
7.3.320.0000.00513.12
7.3.310.0000.00716.19
7.3.300.0000.00716.21
7.3.290.0030.01016.26
7.3.280.0090.00616.21
7.3.270.0070.01017.40
7.3.260.0130.00516.51
7.3.250.0050.01216.44
7.3.240.0030.01316.16
7.3.230.0100.00616.39
7.3.210.0060.01316.36
7.3.200.0120.00619.39
7.3.190.0070.01016.34
7.3.180.0150.00016.51
7.3.170.0090.00916.41
7.3.160.0090.00616.48
7.3.120.0050.01214.88
7.3.110.0070.01114.73
7.3.100.0000.01315.01
7.3.90.0030.01314.89
7.3.80.0090.00914.69
7.3.70.0060.00314.86
7.3.60.0030.00714.82
7.3.50.0060.00914.90
7.3.40.0060.00814.77
7.3.30.0000.01014.42
7.3.20.0060.00916.57
7.3.10.0120.00316.38
7.3.00.0050.00516.64
7.2.330.0060.00916.83
7.2.320.0120.00616.59
7.2.310.0060.01016.63
7.2.300.0060.01216.76
7.2.290.0160.00616.58
7.2.250.0120.00614.76
7.2.240.0030.01714.77
7.2.230.0040.01415.17
7.2.220.0000.01315.04
7.2.210.0000.01015.25
7.2.200.0060.00315.16
7.2.190.0130.00314.98
7.2.180.0090.00615.00
7.2.170.0060.01214.98
7.2.110.0060.00616.51
7.2.60.0000.00916.92
7.2.00.0080.00419.41
7.1.330.0090.00615.97
7.1.320.0030.01015.76
7.1.310.0080.00815.66
7.1.300.0060.01015.41
7.1.290.0070.01015.86
7.1.280.0070.00715.80
7.1.270.0070.00715.79
7.1.260.0070.00715.71
7.1.200.0040.01115.46
7.1.100.1220.00312.25
7.1.70.0000.00716.90
7.1.60.0100.01319.32
7.1.50.0080.00416.88
7.1.00.0130.03022.28
7.0.200.0040.00416.72
7.0.140.0070.07322.05
7.0.90.0370.07319.87
7.0.80.0200.04319.95
7.0.70.0400.04319.88
7.0.60.0130.07020.09
7.0.50.0300.04720.19
7.0.40.0200.07320.18
7.0.30.0130.08020.18
7.0.20.0070.04320.10
7.0.10.0030.09019.98
7.0.00.0070.07720.10
5.6.280.0100.06721.07
5.6.240.0070.06320.70
5.6.230.0000.04320.59
5.6.220.0030.08720.65
5.6.210.0030.04320.70
5.6.200.0130.04021.07
5.6.190.0100.08021.11
5.6.180.0030.06021.04
5.6.170.0030.08721.17
5.6.160.0070.06321.04
5.6.150.0130.07721.14
5.6.140.0000.04721.04
5.6.130.0070.04721.11
5.6.120.0070.04021.05
5.6.110.0030.04321.02
5.6.100.0070.04020.93
5.6.90.0070.04721.06
5.6.80.0030.04020.35
5.6.70.0070.04720.43
5.6.60.0130.03320.51
5.6.50.0000.04720.35
5.6.40.0070.03720.31
5.6.30.0030.03320.44
5.6.20.0030.04020.49
5.6.10.0070.03720.30
5.6.00.0070.03720.30
5.5.380.0130.03020.43
5.5.370.0130.07320.35
5.5.360.0130.06720.36
5.5.350.0030.04720.43
5.5.340.0100.07720.89
5.5.330.0070.07720.89
5.5.320.0100.07020.89
5.5.310.0030.08020.80
5.5.300.0100.04020.75
5.5.290.0030.06320.80
5.5.280.0100.03720.73
5.5.270.0000.04720.86
5.5.260.0000.07720.92
5.5.250.0070.04020.64
5.5.240.0030.04020.15
5.5.230.0070.03720.11
5.5.220.0000.04320.02
5.5.210.0030.03320.29
5.5.200.0000.04320.11
5.5.190.0000.05020.26
5.5.180.0030.04320.13
5.5.160.0000.05020.21
5.5.150.0030.04020.20
5.5.140.0100.03320.27
5.5.130.0030.04020.23
5.5.120.0000.04320.11
5.5.110.0070.03720.23
5.5.100.0000.04319.96
5.5.90.0100.03320.11
5.5.80.0030.03320.09
5.5.70.0030.04019.96
5.5.60.0100.03320.14
5.5.50.0000.03320.15
5.5.40.0030.04320.14
5.5.30.0000.04320.05
5.5.20.0070.03720.05
5.5.10.0170.06720.02
5.5.00.0100.03319.97
5.4.450.0130.03319.49
5.4.440.0030.04019.46
5.4.430.0030.04019.45
5.4.420.0030.04019.27
5.4.410.0070.03719.38
5.4.400.0000.04318.88
5.4.390.0030.03719.14
5.4.380.0100.03019.14
5.4.370.0030.04019.16
5.4.360.0070.04019.13
5.4.350.0070.02718.94
5.4.340.0030.04318.95
5.4.320.0030.04318.88
5.4.310.0030.04018.92
5.4.300.0070.03319.20
5.4.290.0000.04019.21
5.4.280.0030.03319.03
5.4.270.0100.02718.87
5.4.260.0030.03719.21
5.4.250.0030.04019.21
5.4.240.0100.03019.04
5.4.230.0000.04319.02
5.4.220.0000.03318.90
5.4.210.0030.03719.02
5.4.200.0000.04019.11
5.4.190.0030.03719.11
5.4.180.0030.03719.24
5.4.170.0070.03318.91
5.4.160.0030.04019.04
5.4.150.0030.03719.07
5.4.140.0070.03316.35
5.4.130.0130.05316.41
5.4.120.0100.06316.20
5.4.110.0030.04316.56
5.4.100.0100.04716.49
5.4.90.0100.05316.57
5.4.80.0070.05716.53
5.4.70.0070.07016.50
5.4.60.0100.04716.31
5.4.50.0070.07316.41
5.4.40.0170.06316.55
5.4.30.0170.06716.38
5.4.20.0100.03316.39
5.4.10.0100.06316.41
5.4.00.0100.06715.75
5.3.290.0000.04014.81
5.3.280.0100.03314.69
5.3.270.0070.04714.53
5.3.260.0070.03314.59
5.3.250.0070.03714.61
5.3.240.0030.05714.56
5.3.230.0070.04014.61
5.3.220.0030.04014.57
5.3.210.0030.06314.68
5.3.200.0030.04714.55
5.3.190.0070.07314.62
5.3.180.0030.04314.55
5.3.170.0100.05014.69
5.3.160.0100.04014.70
5.3.150.0130.07014.59
5.3.140.0100.05714.57
5.3.130.0000.05014.57
5.3.120.0030.08014.69
5.3.110.0030.07014.61
5.3.100.0130.07014.16
5.3.90.0100.06714.14
5.3.80.0100.06014.13
5.3.70.0030.06714.02
5.3.60.0030.07713.89
5.3.50.0070.06014.09
5.3.40.0070.07014.01
5.3.30.0100.04714.02
5.3.20.0030.04013.71
5.3.10.0130.06313.75
5.3.00.0130.05713.70
5.2.170.0070.06011.21
5.2.160.0000.06711.07
5.2.150.0030.06311.16
5.2.140.0030.06311.03
5.2.130.0070.02711.24
5.2.120.0000.06711.09
5.2.110.0030.06311.24
5.2.100.0070.05011.13
5.2.90.0130.05011.17
5.2.80.0030.03710.98
5.2.70.0030.06311.00
5.2.60.0070.05711.08
5.2.50.0000.04710.94
5.2.40.0030.05711.05
5.2.30.0130.03011.07
5.2.20.0030.06311.06
5.2.10.0070.05310.88
5.2.00.0070.04710.63
5.1.60.0070.05310.06
5.1.50.0030.05310.11
5.1.40.0000.0579.87
5.1.30.0100.04010.29
5.1.20.0030.05310.27
5.1.10.0000.03710.13
5.1.00.0030.05310.14
5.0.50.0070.0438.42
5.0.40.0030.0438.40
5.0.30.0100.0538.22
5.0.20.0100.0338.32
5.0.10.0030.0438.28
5.0.00.0030.0478.00
4.4.90.0070.0307.00
4.4.80.0000.0337.00
4.4.70.0030.0177.00
4.4.60.0000.0237.00
4.4.50.0000.0377.00
4.4.40.0030.0307.00
4.4.30.0030.0337.00
4.4.20.0030.0377.00
4.4.10.0030.0337.00
4.4.00.0030.0477.00
4.3.110.0030.0377.00
4.3.100.0030.0377.00
4.3.90.0030.0337.00
4.3.80.0000.0507.00
4.3.70.0000.0237.00
4.3.60.0030.0207.00
4.3.50.0000.0377.00
4.3.40.0030.0477.00
4.3.30.0000.0237.00
4.3.20.0070.0277.00
4.3.10.0000.0207.00
4.3.00.0100.0137.00

preferences:
39.34 ms | 401 KiB | 5 Q