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'); $c=''; var_export($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.55
8.3.50.0150.00721.27
8.3.40.0120.00318.54
8.3.30.0100.00320.32
8.3.20.0000.00820.34
8.3.10.0000.00822.13
8.3.00.0040.00422.42
8.2.180.0120.00616.50
8.2.170.0120.00622.96
8.2.160.0070.00722.12
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0040.00420.57
8.2.110.0070.00322.26
8.2.100.0040.00717.97
8.2.90.0040.00419.27
8.2.80.0030.00517.97
8.2.70.0000.00817.50
8.2.60.0040.00418.04
8.2.50.0000.00818.07
8.2.40.0040.00418.22
8.2.30.0000.00719.50
8.2.20.0030.00517.72
8.2.10.0040.00417.62
8.2.00.0040.00417.62
8.1.280.0080.01225.92
8.1.270.0000.00823.99
8.1.260.0000.00726.35
8.1.250.0000.00728.09
8.1.240.0060.00622.14
8.1.230.0040.00717.45
8.1.220.0030.00517.74
8.1.210.0080.00018.77
8.1.200.0060.00317.36
8.1.190.0040.00417.53
8.1.180.0000.00819.01
8.1.170.0000.00818.64
8.1.160.0030.00518.80
8.1.150.0000.00918.64
8.1.140.0030.00517.44
8.1.130.0030.00317.87
8.1.120.0080.00017.38
8.1.110.0000.00717.44
8.1.100.0050.00217.43
8.1.90.0070.00017.52
8.1.80.0030.00317.36
8.1.70.0000.00717.48
8.1.60.0040.00417.60
8.1.50.0040.00417.41
8.1.40.0040.00417.56
8.1.30.0050.00317.58
8.1.20.0040.00417.68
8.1.10.0080.00017.42
8.1.00.0040.00717.22
8.0.300.0040.00418.77
8.0.290.0080.00516.63
8.0.280.0070.00018.48
8.0.270.0000.00717.18
8.0.260.0060.00016.73
8.0.250.0030.00316.96
8.0.240.0030.00716.97
8.0.230.0050.00216.97
8.0.220.0040.00416.85
8.0.210.0000.00616.89
8.0.200.0000.00716.88
8.0.190.0070.00016.96
8.0.180.0000.00716.93
8.0.170.0070.00016.97
8.0.160.0000.00716.76
8.0.150.0040.00416.73
8.0.140.0000.00716.89
8.0.130.0000.00613.29
8.0.120.0080.00016.72
8.0.110.0040.00416.87
8.0.100.0000.00816.74
8.0.90.0030.00616.88
8.0.80.0100.00616.90
8.0.70.0030.00516.91
8.0.60.0050.00316.94
8.0.50.0000.00816.95
8.0.30.0070.01217.05
8.0.20.0110.00817.40
8.0.10.0080.00016.84
8.0.00.0060.01616.82
7.4.330.0050.00015.00
7.4.320.0000.00816.50
7.4.300.0030.00316.54
7.4.290.0000.00716.65
7.4.280.0070.00016.45
7.4.270.0030.00316.62
7.4.260.0000.00513.32
7.4.250.0040.00416.49
7.4.240.0000.00816.59
7.4.230.0040.00416.58
7.4.220.0120.01216.53
7.4.210.0070.00816.54
7.4.200.0070.00016.25
7.4.190.0040.00416.55
7.4.160.0090.00916.31
7.4.150.0110.00717.40
7.4.140.0040.01317.86
7.4.130.0060.01316.47
7.4.120.0090.00816.63
7.4.110.0350.02116.42
7.4.100.0070.01016.45
7.4.90.0070.01116.50
7.4.80.0100.01519.39
7.4.70.0100.00716.51
7.4.60.0130.00316.48
7.4.50.0020.00216.69
7.4.40.0030.01322.77
7.4.30.0080.00816.61
7.4.00.0000.01114.85
7.3.330.0050.00013.17
7.3.320.0000.00513.31
7.3.310.0040.00416.06
7.3.300.0030.00316.13
7.3.290.0030.01216.23
7.3.280.0050.01216.25
7.3.270.0140.00917.40
7.3.260.0100.00716.57
7.3.250.0080.01116.33
7.3.240.0100.00716.32
7.3.230.0060.01016.39
7.3.210.0100.00616.61
7.3.200.0110.01119.39
7.3.190.0130.00716.38
7.3.180.0090.00616.38
7.3.170.0150.00016.46
7.3.160.0050.01016.23
7.3.120.0040.01214.94
7.3.10.0120.00916.04
7.3.00.0110.00516.10
7.2.330.0140.00716.71
7.2.320.0140.00916.35
7.2.310.0060.00916.43
7.2.300.0070.01016.39
7.2.290.0090.00916.52
7.2.130.0200.01116.40
7.2.120.0260.01116.70
7.2.110.0180.01116.54
7.2.100.0150.00616.62
7.2.90.0260.00016.59
7.2.80.0100.00716.38
7.2.70.0140.00716.70
7.2.60.0100.00316.63
7.2.50.0090.00916.73
7.2.40.0070.01116.16
7.2.30.0100.01016.56
7.2.20.0150.00416.45
7.2.10.0100.00316.17
7.2.00.0060.00818.03
7.1.250.0090.01315.36
7.1.200.0060.00615.89
7.1.100.0140.00317.99
7.1.70.0030.00617.16
7.1.60.0110.01419.32
7.1.50.0090.01216.89
7.1.00.0070.03322.37
7.0.200.0000.01016.90
7.0.140.0100.07021.94
7.0.90.0330.07019.97
7.0.80.0430.07019.98
7.0.70.0500.04019.93
7.0.60.0430.08319.98
7.0.50.0500.06020.26
7.0.40.0070.04720.05
7.0.30.0030.05319.92
7.0.20.0070.03720.10
7.0.10.0070.03720.00
7.0.00.0100.03320.02
5.6.280.0000.07721.11
5.6.240.0070.07720.64
5.6.230.0070.04320.69
5.6.220.0070.04720.50
5.6.210.0030.08320.45
5.6.200.0130.06321.02
5.6.190.0130.07320.99
5.6.180.0030.05021.04
5.6.170.0070.06321.11
5.6.160.0100.03320.99
5.6.150.0100.03321.04
5.6.140.0130.03321.05
5.6.130.0000.05321.13
5.6.120.0100.03321.10
5.6.110.0100.03320.95
5.6.100.0130.03321.13
5.6.90.0000.04020.94
5.6.80.0000.04320.38
5.6.70.0070.03320.41
5.6.60.0000.04320.54
5.6.50.0070.04020.33
5.6.40.0070.03720.53
5.6.30.0070.05720.32
5.6.20.0070.07020.39
5.6.10.0000.05320.47
5.6.00.0070.03720.30
5.5.380.0100.07320.35
5.5.370.0100.07320.52
5.5.360.0100.04320.41
5.5.350.0000.08720.34
5.5.340.0100.03720.86
5.5.330.0070.04020.79
5.5.320.0100.05720.79
5.5.310.0000.04320.80
5.5.300.0070.07020.88
5.5.290.0030.05020.91
5.5.280.0070.07320.63
5.5.270.0030.04020.90
5.5.260.0070.07720.80
5.5.250.0030.04320.55
5.5.240.0000.04020.22
5.5.230.0030.04020.23
5.5.220.0130.03020.15
5.5.210.0070.03720.30
5.5.200.0130.03319.96
5.5.190.0030.04020.08
5.5.180.0100.03720.11
5.5.160.0030.04020.10
5.5.150.0030.05020.21
5.5.140.0070.06720.15
5.5.130.0070.07720.11
5.5.120.0070.05020.18
5.5.110.0070.04020.21
5.5.100.0070.07720.06
5.5.90.0130.05320.17
5.5.80.0030.04320.17
5.5.70.0170.07320.05
5.5.60.0000.04720.00
5.5.50.0170.07020.05
5.5.40.0130.07019.96
5.5.30.0030.08019.96
5.5.20.0070.04720.05
5.5.10.0030.08319.97
5.5.00.0230.06320.12
5.4.450.0070.03319.49
5.4.440.0030.04019.42
5.4.430.0000.04319.55
5.4.420.0030.04019.53
5.4.410.0100.03319.04
5.4.400.0030.03718.88
5.4.390.0000.04019.12
5.4.380.0100.04319.23
5.4.370.0030.04719.09
5.4.360.0070.03319.18
5.4.350.0030.03719.05
5.4.340.0070.04019.09
5.4.320.0000.04019.04
5.4.310.0070.03018.90
5.4.300.0070.06719.23
5.4.290.0030.04019.20
5.4.280.0030.04319.21
5.4.270.0030.06318.90
5.4.260.0070.04018.87
5.4.250.0030.07719.07
5.4.240.0030.04318.97
5.4.230.0030.07019.06
5.4.220.0030.07719.02
5.4.210.0100.05019.15
5.4.200.0100.04019.02
5.4.190.0070.07719.17
5.4.180.0030.04019.11
5.4.170.0200.06019.16
5.4.160.0170.03319.14
5.4.150.0130.06019.15
5.4.140.0070.04016.44
5.4.130.0170.06316.41
5.4.120.0000.05316.45
5.4.110.0070.07316.56
5.4.100.0170.06316.57
5.4.90.0070.07316.37
5.4.80.0070.04316.46
5.4.70.0000.08016.36
5.4.60.0070.07016.37
5.4.50.0170.06316.44
5.4.40.0100.03316.39
5.4.30.0000.07316.36
5.4.20.0070.03716.36
5.4.10.0000.07016.48
5.4.00.0070.04015.82
5.3.290.0070.03314.60
5.3.280.0100.03714.63
5.3.270.0030.07714.72
5.3.260.0030.06014.60
5.3.250.0100.07014.73
5.3.240.0130.06314.60
5.3.230.0100.07014.65
5.3.220.0030.06714.52
5.3.210.0100.06314.71
5.3.200.0100.07014.60
5.3.190.0170.06014.50
5.3.180.0000.06014.52
5.3.170.0070.04314.57
5.3.160.0000.05714.67
5.3.150.0030.06714.70
5.3.140.0070.04014.51
5.3.130.0030.04714.61
5.3.120.0030.04014.69
5.3.110.0100.06314.64
5.3.100.0170.07014.11
5.3.90.0030.07314.08
5.3.80.0100.04014.00
5.3.70.0030.06014.16
5.3.60.0000.04713.93
5.3.50.0170.06313.97
5.3.40.0100.07013.96
5.3.30.0030.07713.81
5.3.20.0000.07713.68
5.3.10.0030.06313.77
5.3.00.0030.07013.72
5.2.170.0130.04711.27
5.2.160.0030.06011.16
5.2.150.0070.06311.05
5.2.140.0070.05011.13
5.2.130.0070.06011.11
5.2.120.0100.03711.02
5.2.110.0030.05310.99
5.2.100.0130.03011.12
5.2.90.0070.06011.16
5.2.80.0030.04310.98
5.2.70.0000.04011.20
5.2.60.0030.06011.11
5.2.50.0000.04310.95
5.2.40.0000.06311.10
5.2.30.0070.05311.04
5.2.20.0130.05311.08
5.2.10.0030.04711.00
5.2.00.0130.03010.84
5.1.60.0070.05010.11
5.1.50.0030.04710.00
5.1.40.0070.0509.97
5.1.30.0070.05310.38
5.1.20.0070.05710.38
5.1.10.0000.04710.19
5.1.00.0070.05310.13
5.0.50.0070.0408.62
5.0.40.0000.0408.32
5.0.30.0030.0638.07
5.0.20.0030.0438.34
5.0.10.0030.0438.01
5.0.00.0030.0638.15
4.4.90.0000.0377.32
4.4.80.0000.0337.32
4.4.70.0030.0337.32
4.4.60.0030.0377.32
4.4.50.0070.0307.32
4.4.40.0000.0477.32
4.4.30.0030.0377.32
4.4.20.0100.0277.32
4.4.10.0070.0337.32
4.4.00.0000.0507.32
4.3.110.0000.0337.32
4.3.100.0000.0377.32
4.3.90.0000.0337.32
4.3.80.0030.0437.32
4.3.70.0000.0377.32
4.3.60.0100.0277.32
4.3.50.0000.0307.32
4.3.40.0000.0577.32
4.3.30.0000.0377.32
4.3.20.0070.0277.32
4.3.10.0000.0377.32
4.3.00.0000.0337.32

preferences:
45.31 ms | 401 KiB | 5 Q