3v4l.org

run code in 300+ PHP versions simultaneously
<?php $select = [ 'foo', 'bar', [ 'size' => 128, 'type' => 'png' ], 'baz', 'qux' ]; function convert($in) { $out = []; for ($i = 0, $m = count($in); $i < $m; $i++) { $current = $in[$i]; $next = $in[$i + 1] ?? null; if (!is_string($current)) { throw new \Exception('Malformed field list.'); } if (is_array($next)) { $out[$current] = $next; $i++; } else { $out[$current] = true; } } return $out; } var_dump(convert($select));

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.01316.38
8.3.50.0070.00716.13
8.3.40.0180.00718.53
8.3.30.0120.00318.56
8.3.20.0040.00420.25
8.3.10.0070.00021.96
8.3.00.0040.00423.68
8.2.180.0170.00318.43
8.2.170.0130.00322.96
8.2.160.0070.00719.52
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0000.00826.16
8.2.120.0090.00019.36
8.2.110.0000.00819.36
8.2.100.0040.00818.05
8.2.90.0030.00619.17
8.2.80.0050.00317.97
8.2.70.0090.00017.63
8.2.60.0040.00418.04
8.2.50.0000.00818.07
8.2.40.0040.00419.88
8.2.30.0000.00717.62
8.2.20.0040.00418.03
8.2.10.0030.00517.98
8.2.00.0000.00818.11
8.1.280.0110.00725.92
8.1.270.0070.00023.99
8.1.260.0000.00926.35
8.1.250.0040.00428.09
8.1.240.0000.00922.42
8.1.230.0120.00017.77
8.1.220.0030.00617.79
8.1.210.0080.00018.77
8.1.200.0000.00917.35
8.1.190.0030.00517.13
8.1.180.0100.00318.10
8.1.170.0090.00018.52
8.1.160.0050.00322.11
8.1.150.0030.00618.53
8.1.140.0040.00419.48
8.1.130.0070.00018.80
8.1.120.0000.00717.35
8.1.110.0030.00517.37
8.1.100.0040.00417.45
8.1.90.0080.00017.42
8.1.80.0040.00417.45
8.1.70.0030.00317.50
8.1.60.0070.00017.60
8.1.50.0080.00017.48
8.1.40.0060.00317.56
8.1.30.0070.00017.63
8.1.20.0000.00717.54
8.1.10.0040.00417.52
8.1.00.0000.00717.38
8.0.300.0040.00418.77
8.0.290.0030.00616.75
8.0.280.0030.00318.43
8.0.270.0000.00816.71
8.0.260.0000.00618.88
8.0.250.0000.00716.82
8.0.240.0090.00016.94
8.0.230.0070.00016.91
8.0.220.0070.00016.86
8.0.210.0000.00716.76
8.0.200.0030.00316.87
8.0.190.0060.00316.84
8.0.180.0000.00816.89
8.0.170.0070.00016.87
8.0.160.0000.00716.97
8.0.150.0040.00416.87
8.0.140.0000.00716.89
8.0.130.0030.00313.39
8.0.120.0070.00016.91
8.0.110.0040.00416.75
8.0.100.0030.00316.71
8.0.90.0030.00316.90
8.0.80.0080.00816.84
8.0.70.0000.00716.95
8.0.60.0080.00016.83
8.0.50.0000.00816.99
8.0.30.0090.00917.06
8.0.20.0140.00817.40
8.0.10.0000.00816.88
8.0.00.0110.00516.75
7.4.330.0000.00615.55
7.4.320.0000.00716.50
7.4.300.0030.00316.54
7.4.290.0030.00316.57
7.4.280.0030.00816.50
7.4.270.0030.00316.57
7.4.260.0000.00716.43
7.4.250.0040.00416.49
7.4.240.0040.00416.51
7.4.230.0000.00716.59
7.4.220.0030.01516.68
7.4.210.0100.00516.69
7.4.200.0070.00016.54
7.4.160.0060.01016.49
7.4.150.0110.00617.40
7.4.140.0070.01417.86
7.4.130.0140.00316.41
7.4.120.0130.00716.50
7.4.110.0040.01916.39
7.4.100.0160.00316.39
7.4.90.0120.00616.48
7.4.80.0090.00919.39
7.4.70.0080.00816.47
7.4.60.0100.00616.59
7.4.50.0070.00716.39
7.4.40.0080.00716.46
7.4.30.0060.01216.30
7.4.10.0080.00814.77
7.4.00.0090.00714.63
7.3.330.0020.00213.34
7.3.320.0030.00313.21
7.3.310.0030.00316.19
7.3.300.0080.00016.37
7.3.290.0080.00716.37
7.3.280.0100.00816.33
7.3.270.0120.00617.40
7.3.260.0100.00716.45
7.3.250.0040.01216.48
7.3.240.0080.00916.49
7.3.230.0120.00616.50
7.3.210.0000.02416.56
7.3.200.0040.01316.46
7.3.190.0080.00816.41
7.3.180.0070.01016.69
7.3.170.0170.00316.64
7.3.160.0060.01016.49
7.3.130.0000.01414.61
7.3.120.0000.01314.74
7.3.110.0040.01214.72
7.3.100.0070.00414.84
7.3.90.0060.00914.51
7.3.80.0000.01515.10
7.3.70.0040.01114.47
7.3.60.0040.00814.47
7.3.50.0090.00614.75
7.3.40.0040.00714.84
7.3.30.0070.01114.77
7.3.20.0060.00616.42
7.3.10.0040.01116.38
7.3.00.0000.01316.67
7.2.330.0090.00916.63
7.2.320.0120.01216.50
7.2.310.0040.01316.71
7.2.300.0040.01116.73
7.2.290.0000.01516.77
7.2.260.0100.00715.19
7.2.250.0070.01115.25
7.2.240.0060.00614.95
7.2.230.0000.01215.05
7.2.220.0100.00315.08
7.2.210.0000.00915.16
7.2.200.0070.00415.11
7.2.190.0100.00715.08
7.2.180.0140.00315.02
7.2.170.0070.01015.02
7.2.160.0040.01115.09
7.2.150.0000.01616.66
7.2.140.0030.01316.61
7.2.130.0040.01116.80
7.2.120.0030.01317.00
7.2.110.0060.01016.86
7.2.100.0050.00516.97
7.2.90.0000.00917.07
7.2.80.0030.01016.99
7.2.70.0060.00316.64
7.2.60.0060.00816.92
7.2.50.0060.00916.66
7.2.40.0030.01116.64
7.2.30.0040.01217.14
7.2.20.0070.00717.14
7.2.10.0000.01116.72
7.2.00.0040.00716.64
7.1.330.0030.01115.52
7.1.320.0060.00615.90
7.1.310.0040.00715.76
7.1.300.0030.01015.82
7.1.290.0000.00815.53
7.1.280.0050.00515.70
7.1.270.0040.01115.41
7.1.260.0090.00315.80
7.1.250.0040.00715.61
7.1.240.0030.01015.73
7.1.230.0000.01015.78
7.1.220.0040.00415.82
7.1.210.0030.00615.80
7.1.200.0030.00615.90
7.1.190.0090.00315.85
7.1.180.0070.00715.63
7.1.170.0060.00915.74
7.1.160.0070.00415.84
7.1.150.0060.00615.79
7.1.140.0040.01115.73
7.1.130.0070.00315.84
7.1.120.0030.01015.63
7.1.110.0040.00715.95
7.1.100.0000.01315.67
7.1.90.0080.00517.01
7.1.80.0060.00916.90
7.1.70.0050.00816.54
7.1.60.0100.00925.29
7.1.50.0130.00625.24
7.1.40.0060.01125.01
7.1.30.0090.01225.11
7.1.20.0080.01225.02
7.1.10.0030.00916.29
7.1.00.0080.00516.25
7.0.330.0040.00815.27
7.0.320.0060.00615.40
7.0.310.0080.00315.39
7.0.300.0030.00615.43
7.0.290.0030.00715.16
7.0.280.0000.00815.57
7.0.270.0000.01015.47
7.0.260.0060.00615.37
7.0.250.0030.00715.35
7.0.240.0030.01515.54
7.0.230.0050.01116.73
7.0.220.0070.00916.55
7.0.210.0050.00715.89
7.0.200.0040.00716.05
7.0.190.0090.00316.04
7.0.180.0060.00615.85
7.0.170.0030.01115.88
7.0.160.0030.01015.76
7.0.150.0040.00815.87
7.0.140.0050.00715.74
7.0.130.0070.00415.78
7.0.120.0020.01115.82
7.0.110.0030.00915.90
7.0.100.0070.00515.84
7.0.90.0080.00615.93
7.0.80.0020.01315.81
7.0.70.0040.00715.78
7.0.60.0070.00715.57
7.0.50.0050.00816.08
7.0.40.0050.00714.93
7.0.30.0020.00914.95
7.0.20.0070.00614.91
7.0.10.0080.00514.97
7.0.00.0040.00914.97
5.6.400.0030.00914.39
5.6.390.0100.00314.16
5.6.380.0100.00014.05
5.6.370.0050.00814.36
5.6.360.0000.01414.05
5.6.350.0050.00514.23
5.6.340.0030.00914.04
5.6.330.0030.01014.22
5.6.320.0060.00614.10
5.6.310.0060.00614.12
5.6.300.0040.00714.03
5.6.290.0040.00714.05
5.6.280.0100.00013.83
5.6.270.0040.00713.87
5.6.260.0070.00313.86
5.6.250.0070.00414.14
5.6.240.0030.00614.19
5.6.230.0140.00314.07
5.6.220.0040.00813.89
5.6.210.0000.01114.02
5.6.200.0080.00313.93
5.6.190.0000.00914.06
5.6.180.0050.00514.18
5.6.170.0000.00914.16
5.6.160.0030.01014.26
5.6.150.0040.00414.08
5.6.140.0030.01014.36
5.6.130.0030.00514.02
5.6.120.0000.01114.32
5.6.110.0040.00713.99
5.6.100.0110.00413.83
5.6.90.0080.00013.93
5.6.80.0070.00713.83
5.6.70.0060.01014.14
5.6.60.0040.00713.92
5.6.50.0040.00814.05
5.6.40.0070.00814.03
5.6.30.0070.00714.21
5.6.20.0130.00314.11
5.6.10.0060.01213.98
5.6.00.0000.01113.99

preferences:
63.32 ms | 401 KiB | 5 Q