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($a); $c=''; var_dump(isJson($c));

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.0100.00718.31
8.3.50.0120.00721.27
8.3.40.0110.00418.58
8.3.30.0000.01320.20
8.3.20.0050.00320.21
8.3.10.0080.00021.98
8.3.00.0040.00422.34
8.2.180.0120.00616.75
8.2.170.0030.01322.96
8.2.160.0030.01022.20
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0050.00220.74
8.2.110.0000.01022.26
8.2.100.0050.00517.84
8.2.90.0040.00418.03
8.2.80.0060.00317.97
8.2.70.0000.00817.50
8.2.60.0000.00818.03
8.2.50.0050.00318.07
8.2.40.0000.00818.03
8.2.30.0070.00019.44
8.2.20.0050.00317.68
8.2.10.0040.00417.66
8.2.00.0050.00317.63
8.1.280.0080.00825.92
8.1.270.0050.00323.99
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0050.00522.40
8.1.230.0100.00020.72
8.1.220.0030.00517.76
8.1.210.0040.00418.91
8.1.200.0070.00317.23
8.1.190.0060.00317.52
8.1.180.0000.00818.10
8.1.170.0080.00018.49
8.1.160.0000.00820.58
8.1.150.0000.01018.55
8.1.140.0050.00317.46
8.1.130.0070.00017.83
8.1.120.0000.00717.44
8.1.110.0080.00017.34
8.1.100.0030.00617.35
8.1.90.0070.00017.36
8.1.80.0040.00417.51
8.1.70.0040.00417.36
8.1.60.0040.00417.49
8.1.50.0040.00417.57
8.1.40.0000.00817.52
8.1.30.0070.00017.58
8.1.20.0040.00417.61
8.1.10.0040.00417.36
8.1.00.0030.00617.35
8.0.300.0040.00420.04
8.0.290.0080.00017.18
8.0.280.0030.00318.46
8.0.270.0070.00017.28
8.0.260.0000.00816.86
8.0.250.0030.00316.96
8.0.240.0040.00417.00
8.0.230.0030.00316.96
8.0.220.0050.00316.76
8.0.210.0050.00316.88
8.0.200.0030.00316.85
8.0.190.0000.00716.91
8.0.180.0030.00516.91
8.0.170.0040.00416.95
8.0.160.0030.00317.00
8.0.150.0000.00916.88
8.0.140.0050.00216.82
8.0.130.0000.00613.41
8.0.120.0060.00316.90
8.0.110.0040.00416.72
8.0.100.0070.00016.98
8.0.90.0100.00016.96
8.0.80.0130.00316.81
8.0.70.0060.00316.76
8.0.60.0030.00616.77
8.0.50.0040.00416.79
8.0.30.0080.01217.10
8.0.20.0110.01517.40
8.0.10.0030.00316.90
8.0.00.0110.00716.80
7.4.330.0000.00515.00
7.4.320.0040.00416.58
7.4.300.0000.00616.59
7.4.290.0030.00316.61
7.4.280.0030.00716.60
7.4.270.0000.00716.66
7.4.260.0030.00313.28
7.4.250.0080.00016.57
7.4.240.0050.00216.41
7.4.230.0070.00016.49
7.4.220.0030.01516.61
7.4.210.0080.00716.57
7.4.200.0030.00316.63
7.4.190.0000.00716.64
7.4.160.0080.00816.49
7.4.150.0070.01117.40
7.4.140.0080.01017.86
7.4.130.0080.01116.48
7.4.120.0110.00816.64
7.4.110.0180.00016.40
7.4.100.0120.00616.55
7.4.90.0060.01616.48
7.4.80.0130.00919.39
7.4.70.0110.00516.63
7.4.60.0070.01016.36
7.4.50.0040.00416.60
7.4.40.0020.01222.77
7.4.30.0070.01016.65
7.4.00.0040.01114.86
7.3.330.0030.00313.20
7.3.320.0070.00013.10
7.3.310.0070.00016.27
7.3.300.0000.00716.19
7.3.290.0050.01116.21
7.3.280.0090.00616.23
7.3.270.0120.00617.40
7.3.260.0070.01316.58
7.3.250.0080.00916.32
7.3.240.0100.00716.38
7.3.230.0030.02016.39
7.3.210.0120.00616.24
7.3.200.0060.01319.39
7.3.190.0030.02016.22
7.3.180.0100.00716.43
7.3.170.0120.00316.71
7.3.160.0150.00016.39
7.3.120.0030.00914.64
7.2.330.0130.00616.52
7.2.320.0130.00616.67
7.2.310.0160.00616.57
7.2.300.0100.00716.69
7.2.290.0060.01616.68
7.2.00.0030.00919.10
7.1.100.0150.00018.19
7.1.70.0030.01016.88
7.1.60.0070.01619.32
7.1.50.0040.01817.02
7.1.00.0070.07322.54
7.0.200.0030.00616.55
7.0.140.0000.08022.01
7.0.90.0130.06019.91
7.0.80.0130.07720.00
7.0.70.0170.07720.14
7.0.60.0030.06019.87
7.0.50.0100.08020.36
7.0.40.0130.08320.09
7.0.30.0130.08019.96
7.0.20.0100.08320.13
7.0.10.0100.05720.17
7.0.00.0030.06720.14
5.6.280.0100.06320.86
5.6.240.0170.07720.70
5.6.230.0030.08320.57
5.6.220.0030.08720.58
5.6.210.0130.06020.46
5.6.200.0070.07720.96
5.6.190.0200.07721.03
5.6.180.0070.08321.08
5.6.170.0070.08721.08
5.6.160.0070.05721.11
5.6.150.0000.06321.05
5.6.140.0070.04721.11
5.6.130.0070.05721.01
5.6.120.0070.06321.10
5.6.110.0070.08320.96
5.6.100.0130.08021.09
5.6.90.0230.07021.09
5.6.80.0130.06320.48
5.6.70.0170.05020.55
5.6.60.0100.06320.48
5.6.50.0070.06020.53
5.6.40.0100.06320.52
5.6.30.0070.04720.47
5.6.20.0030.08320.39
5.6.10.0130.07720.46
5.6.00.0070.04320.51
5.5.380.0030.04320.46
5.5.370.0030.05720.39
5.5.360.0130.07720.41
5.5.350.0030.05020.45
5.5.340.0100.05020.80
5.5.330.0070.09020.93
5.5.320.0030.06020.92
5.5.310.0070.08320.73
5.5.300.0200.07020.91
5.5.290.0000.06320.64
5.5.280.0100.04020.88
5.5.270.0170.07720.75
5.5.260.0100.08320.91
5.5.250.0030.06720.68
5.5.240.0000.04720.30
5.5.230.0100.04720.28
5.5.220.0070.04720.21
5.5.210.0100.07720.11
5.5.200.0130.08020.19
5.5.190.0070.08019.99
5.5.180.0030.08320.16
5.5.160.0030.06020.21
5.5.150.0100.08020.19
5.5.140.0130.05320.13
5.5.130.0130.06720.22
5.5.120.0000.08020.27
5.5.110.0070.07320.08
5.5.100.0070.08020.10
5.5.90.0000.08020.17
5.5.80.0070.08320.01
5.5.70.0130.07320.09
5.5.60.0100.06720.00
5.5.50.0100.07320.05
5.5.40.0030.06320.04
5.5.30.0130.07020.08
5.5.20.0100.08320.14
5.5.10.0100.04720.11
5.5.00.0130.04020.09
5.4.450.0100.04019.25
5.4.440.0100.07319.36
5.4.430.0030.04319.43
5.4.420.0170.07019.50
5.4.410.0030.08019.06
5.4.400.0130.07319.03
5.4.390.0100.06019.16
5.4.380.0070.04319.16
5.4.370.0070.07719.14
5.4.360.0130.05019.09
5.4.350.0100.07319.05
5.4.340.0030.04319.18
5.4.320.0000.04719.04
5.4.310.0000.08719.04
5.4.300.0070.07319.17
5.4.290.0070.04719.02
5.4.280.0070.08019.09
5.4.270.0030.07719.09
5.4.260.0070.08018.89
5.4.250.0170.06319.18
5.4.240.0030.07318.87
5.4.230.0070.07719.08
5.4.220.0070.06019.09
5.4.210.0030.05019.02
5.4.200.0100.07019.11
5.4.190.0030.07719.11
5.4.180.0030.08019.17
5.4.170.0000.08719.11
5.4.160.0100.05718.83
5.4.150.0030.05318.86
5.4.140.0070.05716.43
5.4.130.0000.06716.43
5.4.120.0000.04316.45
5.4.110.0030.04316.52
5.4.100.0030.08016.39
5.4.90.0130.06316.48
5.4.80.0070.06716.40
5.4.70.0070.03316.52
5.4.60.0170.05716.48
5.4.50.0130.05316.45
5.4.40.0000.04316.35
5.4.30.0070.03316.30
5.4.20.0130.05716.53
5.4.10.0070.07716.24
5.4.00.0070.07015.89
5.3.290.0070.05014.64
5.3.280.0070.04714.65
5.3.270.0030.04014.61
5.3.260.0100.04714.61
5.3.250.0000.06314.56
5.3.240.0000.07014.67
5.3.230.0030.07714.62
5.3.220.0030.04714.55
5.3.210.0030.07714.49
5.3.200.0030.05014.63
5.3.190.0030.06714.64
5.3.180.0100.03314.50
5.3.170.0000.04014.54
5.3.160.0200.06714.58
5.3.150.0000.08014.58
5.3.140.0100.04014.57
5.3.130.0000.04314.60
5.3.120.0070.04314.66
5.3.110.0000.04714.50
5.3.100.0100.03714.05
5.3.90.0070.05713.97
5.3.80.0070.03714.16
5.3.70.0030.04014.09
5.3.60.0100.05014.06
5.3.50.0070.04714.02
5.3.40.0170.06713.89
5.3.30.0070.04014.00
5.3.20.0100.06713.79
5.3.10.0100.07013.55
5.3.00.0070.05713.70
5.2.170.0100.03311.07
5.2.160.0000.07311.05
5.2.150.0070.05011.25
5.2.140.0000.03311.16
5.2.130.0000.05011.02
5.2.120.0070.04711.03
5.2.110.0100.05311.16
5.2.100.0030.05011.00
5.2.90.0030.06011.22
5.2.80.0030.06311.13
5.2.70.0070.05711.08
5.2.60.0000.06311.14
5.2.50.0070.06010.95
5.2.40.0100.05711.10
5.2.30.0130.03311.03
5.2.20.0130.05711.03
5.2.10.0070.04711.00
5.2.00.0030.06310.68
5.1.60.0070.05010.07
5.1.50.0100.04010.00
5.1.40.0100.04310.05
5.1.30.0030.03310.30
5.1.20.0070.05010.28
5.1.10.0030.05710.07
5.1.00.0130.0539.96
5.0.50.0030.0478.64
5.0.40.0030.0378.26
5.0.30.0070.0638.26
5.0.20.0000.0438.23
5.0.10.0030.0208.26
5.0.00.0070.0338.00
4.4.90.0030.0377.44
4.4.80.0030.0277.44
4.4.70.0030.0337.44
4.4.60.0030.0277.44
4.4.50.0000.0377.44
4.4.40.0000.0407.44
4.4.30.0000.0277.44
4.4.20.0000.0277.44
4.4.10.0030.0377.44
4.4.00.0000.0537.44
4.3.110.0070.0337.44
4.3.100.0030.0237.44
4.3.90.0000.0207.44
4.3.80.0070.0477.44
4.3.70.0070.0207.44
4.3.60.0030.0207.44
4.3.50.0000.0377.44
4.3.40.0030.0507.44
4.3.30.0000.0337.44
4.3.20.0000.0377.44
4.3.10.0000.0337.44
4.3.00.0030.0237.44

preferences:
41.3 ms | 401 KiB | 5 Q