3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test(array $array) { try { return isDictionary($array); } catch (Exception $e) { echo 'ss'; return 'error'; } } function isDictionary($array) { foreach($array as $key => $value) { return ! is_int($key); } return false; } assert(isDictionary(['', 'a', 'b'])); assert(isDictionary([1 => 'a', 2 => 'b', 3 => 'c'])); assert(isDictionary([0 => '', 2 => 'b'])); assert(isDictionary([0 => '', 2 => 'b', 1 => 'a'])); assert(isDictionary([0 => '', 3 => 'c', 2 => 'b'])); assert(isDictionary([0 => '', null => '', 2 => 'b'])); assert(isDictionary([null => '', 1 => 'a', 2 => '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.0190.00616.61
8.3.50.0130.01017.93
8.3.40.0110.00418.76
8.3.30.0110.00418.67
8.3.20.0040.00420.37
8.3.10.0000.00823.61
8.3.00.0000.00819.25
8.2.180.0060.00916.63
8.2.170.0090.01222.96
8.2.160.0070.00720.44
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0080.00017.50
8.2.120.0000.00826.35
8.2.110.0080.00020.54
8.2.100.0090.00318.05
8.2.90.0040.00419.17
8.2.80.0040.00417.97
8.2.70.0060.00317.63
8.2.60.0000.00917.80
8.2.50.0000.00818.07
8.2.40.0000.00819.53
8.2.30.0040.00420.58
8.2.20.0060.00317.72
8.2.10.0020.00517.98
8.2.00.0070.00018.04
8.1.280.0070.01425.92
8.1.270.0090.00024.02
8.1.260.0040.00428.09
8.1.250.0030.00528.09
8.1.240.0030.00722.59
8.1.230.0080.00417.79
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0090.00017.35
8.1.190.0030.00517.35
8.1.180.0040.00418.10
8.1.170.0020.00519.10
8.1.160.0000.00721.90
8.1.150.0070.00018.91
8.1.140.0040.00419.58
8.1.130.0000.00717.77
8.1.120.0050.00317.46
8.1.110.0000.00717.37
8.1.100.0000.00717.48
8.1.90.0000.00717.41
8.1.80.0050.00317.54
8.1.70.0000.00817.51
8.1.60.0070.00417.49
8.1.50.0060.00317.45
8.1.40.0050.00317.51
8.1.30.0040.00417.54
8.1.20.0030.00617.68
8.1.10.0000.00817.53
8.1.00.0040.00417.51
8.0.300.0080.00018.77
8.0.290.0000.00716.75
8.0.280.0000.00818.46
8.0.270.0030.00317.19
8.0.260.0060.00017.18
8.0.250.0070.00017.08
8.0.240.0000.00816.94
8.0.230.0070.00017.05
8.0.220.0030.00616.96
8.0.210.0080.00016.96
8.0.200.0030.00316.92
8.0.190.0040.00416.96
8.0.180.0080.00017.03
8.0.170.0080.00017.04
8.0.160.0030.00316.94
8.0.150.0000.00716.86
8.0.140.0000.00816.90
8.0.130.0030.00313.36
8.0.120.0000.00816.94
8.0.110.0000.00716.98
8.0.100.0000.00816.84
8.0.90.0040.00417.02
8.0.80.0080.00816.95
8.0.70.0040.00417.03
8.0.60.0060.00316.94
8.0.50.0050.00216.92
8.0.30.0100.01017.20
8.0.20.0150.01417.40
8.0.10.0000.00717.05
8.0.00.0080.01117.02
7.4.330.0000.00516.69
7.4.320.0030.00316.66
7.4.300.0000.00716.51
7.4.290.0000.00716.61
7.4.280.0030.00516.52
7.4.270.0000.00716.51
7.4.260.0070.00016.39
7.4.250.0000.00716.47
7.4.240.0040.00416.63
7.4.230.0000.00716.47
7.4.220.0170.01016.46
7.4.210.0050.00916.64
7.4.200.0030.00316.42
7.4.160.0100.00716.48
7.4.150.0140.00317.40
7.4.140.0080.01417.86
7.4.130.0090.01416.55
7.4.120.0130.00516.47
7.4.110.0150.00916.44
7.4.100.0130.00916.46
7.4.90.0030.01316.44
7.4.80.0070.01019.39
7.4.70.0130.00316.53
7.4.60.0070.01016.53
7.4.50.0060.01016.34
7.4.40.0130.00616.26
7.4.30.0150.00616.65
7.4.00.0020.01414.88
7.3.330.0080.00013.14
7.3.320.0000.00813.38
7.3.310.0040.00416.33
7.3.300.0000.00616.36
7.3.290.0060.01016.35
7.3.280.0090.01016.34
7.3.270.0200.02017.40
7.3.260.0070.01616.49
7.3.250.0080.00916.44
7.3.240.0080.01216.35
7.3.230.0040.01316.39
7.3.210.0160.00016.29
7.3.200.0060.01116.56
7.3.190.0120.00916.59
7.3.180.0100.00716.70
7.3.170.0070.01016.47
7.3.160.0040.01116.70
7.3.120.0070.00714.80
7.3.110.0040.01414.79
7.3.100.0060.01215.00
7.3.90.0040.00814.82
7.3.80.0030.00915.09
7.3.70.0030.01314.89
7.3.60.0030.01014.72
7.3.50.0070.00714.93
7.3.40.0060.00914.93
7.3.30.0030.00614.83
7.3.20.0130.00016.59
7.3.10.0050.00516.49
7.3.00.0040.00716.62
7.2.330.0120.00616.36
7.2.320.0060.01516.39
7.2.310.0130.00316.50
7.2.300.0090.00816.82
7.2.290.0160.00616.32
7.2.250.0070.00715.18
7.2.240.0060.01314.99
7.2.230.0140.00014.97
7.2.220.0030.01015.06
7.2.210.0080.00314.75
7.2.200.0060.00615.00
7.2.190.0090.00614.79
7.2.180.0070.01015.10
7.2.170.0040.01014.98
7.2.60.0170.00616.59
7.2.00.0070.00719.44
7.1.330.0090.00915.80
7.1.320.0060.00615.69
7.1.310.0040.01115.69
7.1.300.0100.00315.58
7.1.290.0070.00715.96
7.1.280.0060.00915.88
7.1.270.0000.01015.42
7.1.260.0040.01115.77
7.1.200.0040.00715.82
7.1.100.0060.00617.93
7.1.70.0060.00617.14
7.1.60.0200.00319.36
7.1.50.0100.01316.66
7.1.00.0030.07722.28
7.0.200.0050.00316.79
7.0.60.0100.05319.94
7.0.50.0130.08017.80
7.0.40.0070.04020.14
7.0.30.0370.07020.11
7.0.20.0300.07320.12
7.0.10.0170.04320.21
7.0.00.0130.08020.22
5.6.280.0000.03721.13
5.6.210.0100.08020.57
5.6.200.0130.07718.16
5.6.190.0070.08720.55
5.6.180.0500.04020.63
5.6.170.0230.03720.51
5.6.160.0100.07320.44
5.6.150.0170.05318.14
5.6.140.0030.06318.15
5.6.130.0070.07318.21
5.6.120.0030.04721.03
5.6.110.0100.04720.99
5.6.100.0100.08721.02
5.6.90.0170.06721.01
5.6.80.0070.03320.54
5.5.350.3700.03720.42
5.5.340.0100.06318.05
5.5.330.0030.05320.41
5.5.320.0070.06320.40
5.5.310.0300.05720.27
5.5.300.0030.08718.07
5.5.290.0070.08018.08
5.5.280.0130.05020.77
5.5.270.0030.04020.96
5.5.260.0070.08320.80
5.5.250.0030.04020.62
5.5.240.0330.04320.22

preferences:
87.75 ms | 400 KiB | 5 Q