3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 'This is option: one', 'This is option: two', 'This is option: 😜' ]; $target = [ 'This is option:' => [ 'one', 'two', '😜' ] ]; function convertArr(array $src): array { $prevString = null; $newArray = []; foreach ($src as $string) { if ($prevString) { // stuck here } $prevString = $string; } return $newArray; } assert(convertArr($arr) === $target);

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.4.120.0130.00720.41
8.4.110.0060.00318.60
8.4.100.0060.00418.66
8.4.90.0140.00620.41
8.4.80.0110.00820.44
8.4.70.0110.01018.04
8.4.60.0110.00918.89
8.4.50.0110.00820.53
8.4.40.0100.00317.83
8.4.30.0160.00320.62
8.4.20.0070.01118.89
8.4.10.0100.01017.84
8.3.250.0130.00519.00
8.3.240.0030.00616.45
8.3.230.0130.00616.46
8.3.220.0100.00719.01
8.3.210.0100.00816.41
8.3.200.0050.00416.62
8.3.190.0080.01117.20
8.3.180.0120.00716.61
8.3.170.0120.00618.72
8.3.160.0090.00916.88
8.3.150.0060.01019.09
8.3.140.0110.00716.69
8.3.130.0040.00418.35
8.3.120.0060.00918.30
8.3.110.0030.00616.61
8.3.100.0050.00516.56
8.3.90.0110.00718.48
8.3.80.0060.00318.31
8.3.70.0100.01018.68
8.3.60.0070.01318.56
8.3.50.0110.00517.13
8.3.40.0040.01118.98
8.3.30.0070.00718.88
8.3.20.0080.00020.60
8.3.10.0030.00522.14
8.3.00.0040.00422.43
8.2.290.0120.00420.39
8.2.280.0100.01020.41
8.2.270.0060.01217.41
8.2.260.0040.01116.42
8.2.250.0040.00417.11
8.2.240.0030.01617.03
8.2.230.0080.00020.94
8.2.220.0070.00024.06
8.2.210.0000.00826.77
8.2.200.0000.01018.41
8.2.190.0060.01018.66
8.2.180.0070.01018.43
8.2.170.0060.01322.96
8.2.160.0120.00322.21
8.2.150.0070.00025.66
8.2.140.0060.00324.66
8.2.130.0080.00026.16
8.2.120.0040.00426.16
8.2.110.0060.00320.94
8.2.100.0080.00317.84
8.2.90.0040.00419.64
8.2.80.0000.00817.97
8.2.70.0040.00417.93
8.2.60.0060.00318.16
8.2.50.0040.00418.10
8.2.40.0050.00219.42
8.2.30.0040.00419.11
8.2.20.0000.00717.94
8.2.10.0070.00019.48
8.2.00.0040.00419.27
8.1.330.0100.00822.07
8.1.320.0110.00816.31
8.1.310.0080.00020.20
8.1.300.0030.00619.92
8.1.290.0090.00018.88
8.1.280.0160.00025.92
8.1.270.0040.00424.66
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0050.00323.87
8.1.230.0110.00022.75
8.1.220.0050.00317.79
8.1.210.0040.00419.00
8.1.200.0090.00317.48
8.1.190.0060.00317.35
8.1.180.0060.00318.10
8.1.170.0030.00518.55
8.1.160.0030.00318.83
8.1.150.0000.00818.88
8.1.140.0000.00720.13
8.1.130.0030.00317.38
8.1.120.0070.00017.45
8.1.110.0040.00417.45
8.1.100.0040.00417.43
8.1.90.0090.00017.44
8.1.80.0030.00517.50
8.1.70.0070.00017.37
8.1.60.0040.00417.56
8.1.50.0060.00317.43
8.1.40.0030.00517.43
8.1.30.0000.00917.54
8.1.20.0040.00417.62
8.1.10.0060.00317.56
8.1.00.0030.00517.36
8.0.300.0000.00721.40
8.0.290.0060.00316.75
8.0.280.0040.00418.36
8.0.270.0000.00717.21
8.0.260.0040.00416.86
8.0.250.0080.00017.00
8.0.240.0030.00316.97
8.0.230.0000.00717.00
8.0.220.0040.00416.98
8.0.210.0000.00716.96
8.0.200.0060.00016.98
8.0.190.0000.00717.07
8.0.180.0040.00416.95
8.0.170.0060.00316.88
8.0.160.0000.00816.86
8.0.150.0000.00816.87
8.0.140.0000.00816.95
8.0.130.0030.00313.41
8.0.120.0000.00716.82
8.0.110.0060.00316.97
8.0.100.0000.00717.05
8.0.90.0080.00016.82
8.0.80.0120.00316.91
8.0.70.0060.00316.82
8.0.60.0000.00716.98
8.0.50.0050.00316.89
8.0.30.0040.01617.06
8.0.20.0110.00717.05
8.0.10.0060.00316.96
8.0.00.0090.00916.77
7.4.330.0020.00215.55
7.4.320.0060.00016.45
7.4.300.0070.00016.41
7.4.290.0030.00516.58
7.4.280.0040.00516.58
7.4.270.0070.00316.52
7.4.260.0000.00513.28
7.4.250.0070.00016.58
7.4.240.0060.00216.46
7.4.230.0030.00316.50
7.4.220.0000.00716.39
7.4.210.0070.00716.47
7.4.200.0030.00316.68
7.4.130.0070.01016.63
7.4.120.0110.01116.54
7.4.110.0090.01216.52
7.4.100.0030.01516.77
7.4.90.0040.01516.52
7.4.80.0100.01019.39
7.4.70.0100.01316.42
7.4.60.0100.00716.59
7.4.50.0070.01116.40
7.4.40.0140.00716.65
7.4.10.0100.00615.14
7.4.00.0090.00615.04
7.3.330.0030.00616.21
7.3.320.0030.00313.37
7.3.310.0030.00316.40
7.3.300.0030.00316.30
7.3.290.0070.00016.47
7.3.280.0070.01016.32
7.3.260.0090.01016.50
7.3.240.0060.01216.39
7.3.230.0070.01416.50
7.3.210.0070.01016.28
7.3.200.0090.00616.43
7.3.190.0090.00616.25
7.3.180.0070.01016.65
7.3.170.0200.00316.48
7.3.160.0120.00316.43
7.3.130.0090.00814.63
7.3.120.0070.01014.96
7.3.110.0030.01614.77
7.3.100.0120.00714.86
7.3.90.0090.00514.65
7.3.80.0050.00915.08
7.3.70.0050.00914.72
7.3.60.0110.00414.73
7.3.50.0110.00614.73
7.3.40.0050.01014.79
7.3.30.0070.00814.61
7.3.20.0290.01215.69
7.3.10.0120.00715.79
7.3.00.0380.01215.90
7.2.330.0090.00916.70
7.2.320.0070.01016.45
7.2.310.0090.00916.51
7.2.300.0080.00816.60
7.2.290.0070.01016.46
7.2.260.0030.01014.90
7.2.250.0000.01615.19
7.2.240.0080.00815.27
7.2.230.0060.00915.22
7.2.220.0030.00914.90
7.2.210.0060.00915.09
7.2.200.0040.01014.91
7.2.190.0040.01014.80
7.2.180.0100.00315.11
7.2.170.0080.00714.87
7.2.160.0060.00715.07
7.2.150.0140.01315.73
7.2.140.0250.01015.92
7.2.130.0310.00716.01
7.2.120.0300.00615.84
7.2.110.0350.01115.92
7.2.100.0260.00816.00
7.2.90.0430.01016.02
7.2.80.0170.01215.96
7.2.70.0210.00516.08
7.2.60.0170.00915.91
7.2.50.0320.00715.95
7.2.40.0180.01015.96
7.2.30.0290.01016.03
7.2.20.0630.00915.81
7.2.10.0280.00516.07
7.2.00.0330.00915.75
7.1.330.0000.01615.96
7.1.320.0270.00514.83
7.1.310.0240.00414.80
7.1.300.0200.00714.84
7.1.290.0400.00514.84
7.1.280.0260.00514.94
7.1.270.0310.00314.86
7.1.260.0160.00814.84
7.1.250.0110.00814.71
7.1.240.0060.00915.79
7.1.230.0030.00515.75
7.1.220.0060.00915.78
7.1.210.0040.00715.91
7.1.200.0040.01115.93
7.1.190.0040.00815.90
7.1.180.0030.01015.97
7.1.170.0030.01015.95
7.1.160.0130.00015.80
7.1.150.0000.01116.01
7.1.140.0060.00915.68
7.1.130.0120.00315.89
7.1.120.0070.00715.75
7.1.110.0100.00715.97
7.1.100.0030.00715.59
7.1.90.0080.00415.94
7.1.80.0040.00815.71
7.1.70.0040.01116.04
7.1.60.0080.00315.92
7.1.50.0070.00715.78
7.1.40.0090.00015.61
7.1.30.0060.00615.88
7.1.20.0070.00715.59
7.1.10.0060.00615.87
7.1.00.0110.00415.59

preferences:
28.67 ms | 403 KiB | 5 Q