3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = Array('Article_1 - Subtype a.ext','Article_1 - Subtype b.ext','Article_2 - Subtype a.ext','Article_2 - Subtype b.ext','Article_2 - Subtype c.ext'); $new_array = array(); foreach($array as $arr) { $exploded_array = explode("-", $arr); $new_array[$exploded_array[0]][] = $arr; } echo "<pre/>"; print_r($new_array); ?><?php $array = Array('Article_1 - Subtype a.ext','Article_1 - Subtype b.ext','Article_2 - Subtype a.ext','Article_2 - Subtype b.ext','Article_2 - Subtype c.ext'); $new_array = array(); foreach($array as $arr) { $exploded_array = explode("-", $arr); $new_array[$exploded_array[0]][] = $arr; } echo "<pre/>"; print_r($new_array); ?>

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.5.00.0140.00819.84
8.4.150.0020.00014.05
8.4.140.0110.01117.47
8.4.130.0130.00817.85
8.4.120.0120.00720.37
8.4.110.0110.00922.35
8.4.100.0110.00917.89
8.4.90.0120.00718.96
8.4.80.0130.00517.89
8.4.70.0110.00719.61
8.4.60.0140.00719.70
8.4.50.0110.01020.18
8.4.40.0090.00918.95
8.4.30.0060.01320.38
8.4.20.0140.01021.45
8.4.10.0060.00319.76
8.3.280.0130.01018.53
8.3.270.0070.01216.48
8.3.260.0120.00716.68
8.3.250.0080.00618.87
8.3.240.0130.00816.51
8.3.230.0080.00216.65
8.3.220.0040.00316.99
8.3.210.0100.00918.57
8.3.200.0110.00916.79
8.3.190.0050.00817.05
8.3.180.0080.00619.15
8.3.170.0060.01217.23
8.3.160.0100.01018.41
8.3.150.0090.00917.26
8.3.140.0040.00416.63
8.3.130.0430.00416.61
8.3.120.0340.00616.57
8.3.110.0380.00316.59
8.3.100.0370.00816.49
8.3.90.0280.01416.18
8.3.80.0390.00716.25
8.3.70.0390.00616.50
8.3.60.0370.00916.46
8.3.50.0340.00616.18
8.3.40.0250.01117.73
8.3.30.0340.00417.77
8.3.20.0430.01017.37
8.3.10.0300.00417.23
8.3.00.0130.00917.35
8.2.290.0040.00520.47
8.2.280.0110.00516.60
8.2.270.0090.00616.76
8.2.260.0150.00016.95
8.2.250.0280.00616.66
8.2.240.0280.00316.64
8.2.230.0260.00616.52
8.2.220.0260.00716.31
8.2.210.0260.00716.26
8.2.200.0350.00316.64
8.2.190.0290.01016.36
8.2.180.0240.01416.37
8.2.170.0300.00717.90
8.2.160.0340.00317.53
8.2.150.0330.00717.63
8.2.140.0340.00717.33
8.2.130.0340.00617.45
8.2.120.0410.00017.57
8.2.110.0320.01017.24
8.2.100.0370.00317.45
8.2.90.0250.01417.63
8.2.80.0300.00917.41
8.2.70.0360.00417.23
8.2.60.0310.00717.35
8.2.50.0280.00617.47
8.2.40.0300.00017.66
8.2.30.0210.01017.26
8.2.20.0220.00717.53
8.2.10.0240.01217.41
8.2.00.0270.01117.35
8.1.330.0130.00622.04
8.1.320.0070.00516.07
8.1.310.0000.00716.67
8.1.300.0300.01016.18
8.1.290.0370.00316.18
8.1.280.0280.00916.18
8.1.270.0290.01217.04
8.1.260.0270.00717.61
8.1.250.0280.01217.13
8.1.240.0270.00317.49
8.1.230.0320.00317.29
8.1.220.0250.01117.50
8.1.210.0240.01417.11
8.1.200.0250.00917.27
8.1.190.0260.01017.06
8.1.180.0330.00316.93
8.1.170.0220.01317.25
8.1.160.0260.00317.19
8.1.150.0290.00017.26
8.1.140.0340.00017.04
8.1.130.0370.00416.96
8.1.120.0340.00917.28
8.1.110.0260.00617.39
8.1.100.0210.01017.45
8.1.90.0290.00417.31
8.1.80.0300.00617.21
8.1.70.0300.01017.14
8.1.60.0380.00317.16
8.1.50.0350.00417.44
8.1.40.0310.00417.04
8.1.30.0270.01217.58
8.1.20.0350.00417.33
8.1.10.0290.01017.06
8.1.00.0420.00017.38

preferences:
60.75 ms | 403 KiB | 5 Q