3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ 'color' => 'red', 'size' => 'large', 'shape' => 'circle', 'startdate' => '2011-08-17', ], [ 'color' => 'red', 'size' => 'large', 'shape' => 'circle', 'startdate' => '2011-08-18', ], [ 'color' => 'red', 'size' => 'large', 'shape' => 'square', 'startdate' => '2011-08-20', ], [ 'color' => 'red', 'size' => 'large', 'shape' => 'circle', 'startdate' => '2011-08-22', ], [ 'color' => 'red', 'size' => 'large', 'shape' => 'circle', 'startdate' => '2011-08-20', ], [ 'color' => 'red', 'size' => 'large', 'shape' => 'circle', 'startdate' => '2011-08-23', ], [ 'color' => 'red', 'size' => 'large', 'shape' => 'circle', 'startdate' => '2011-08-19', ], ]; usort($array, fn($a, $b) => $a['startdate'] <=> $b['startdate']); $result = []; foreach ($array as $row) { $compositeKey = implode( '_', [$row['color'], $row['size'], $row['shape']] ); if ( !isset($ref[$compositeKey]) || ($row['startdate'] != date('Y-m-d', strtotime(($ref[$compositeKey]['enddate'] ?? $ref[$compositeKey]['startdate']) . ' + 1 day'))) ) { if (isset($ref[$compositeKey])) { unset($ref[$compositeKey]); } $ref[$compositeKey] = $row; $result[] =& $ref[$compositeKey]; } else { $ref[$compositeKey]['enddate'] = $row['startdate']; } } var_export($result);

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.10.0130.00617.00
8.5.00.0140.00720.29
8.4.160.0110.01223.89
8.4.150.0020.00114.05
8.4.140.0080.01317.83
8.4.130.0050.00318.10
8.4.120.0120.00820.63
8.4.110.0170.00419.00
8.4.100.0130.00918.09
8.4.90.0030.00518.12
8.4.80.0130.00722.41
8.4.70.0140.00618.20
8.4.60.0120.00918.95
8.4.50.0090.00922.43
8.4.40.0000.01917.88
8.4.30.0160.00320.47
8.4.20.0200.00021.37
8.4.10.0090.00019.75
8.3.280.0020.00014.05
8.3.270.0100.01016.67
8.3.260.0090.00716.78
8.3.250.0130.00419.09
8.3.240.0060.00316.59
8.3.230.0170.00416.86
8.3.220.0110.00717.18
8.3.210.0090.01217.09
8.3.200.0050.00416.82
8.3.190.0130.00617.51
8.3.180.0060.00218.74
8.3.170.0090.00917.12
8.3.160.0110.00720.79
8.3.150.0000.01517.55
8.3.140.0120.00616.68
8.3.130.0290.01516.73
8.3.120.0280.01316.69
8.3.110.0330.00716.80
8.3.100.0370.00916.66
8.3.90.0380.00316.45
8.3.80.0350.00916.89
8.3.70.0360.01017.00
8.3.60.0420.00416.62
8.3.50.0370.00916.89
8.3.40.0410.00317.87
8.3.30.0250.00917.78
8.3.20.0290.00417.77
8.3.10.0240.01217.84
8.3.00.0150.00617.66
8.2.290.0120.00720.64
8.2.280.0070.00318.49
8.2.270.0100.00716.87
8.2.260.0040.00417.30
8.2.250.0300.01117.05
8.2.240.0340.00317.05
8.2.230.0330.00016.35
8.2.220.0330.00416.76
8.2.210.0230.01016.73
8.2.200.0280.00816.45
8.2.190.0350.00316.71
8.2.180.0270.01116.55
8.2.170.0340.00318.13
8.2.160.0310.00817.79
8.2.150.0370.00317.90
8.2.140.0370.00317.72
8.2.130.0260.01517.68
8.2.120.0350.00717.87
8.2.110.0370.01117.74
8.2.100.0460.00617.55
8.2.90.0350.00617.43
8.2.80.0330.00517.61
8.2.70.0300.00917.87
8.2.60.0330.00717.78
8.2.50.0300.00717.54
8.2.40.0200.01717.93
8.2.30.0260.01117.68
8.2.20.0250.01117.82
8.2.10.0250.01117.65
8.2.00.0360.00717.53
8.1.330.0140.00516.51
8.1.320.0140.00616.51
8.1.310.0100.00317.01
8.1.300.0360.00616.20
8.1.290.0280.00816.18
8.1.280.0290.00916.48
8.1.270.0340.00717.59
8.1.260.0260.00717.89
8.1.250.0250.01617.60
8.1.240.0310.00917.35
8.1.230.0360.00417.63
8.1.220.0250.01417.44
8.1.210.0360.00317.45
8.1.200.0300.00917.59
8.1.190.0290.00617.48
8.1.180.0350.00417.47
8.1.170.0280.01117.69
8.1.160.0300.00917.44
8.1.150.0330.00617.54
8.1.140.0410.00317.62
8.1.130.0260.01517.52
8.1.120.0360.00317.62
8.1.110.0330.00617.51
8.1.100.0320.00717.49
8.1.90.0210.01517.65
8.1.80.0350.00017.32
8.1.70.0210.01517.39
8.1.60.0310.00817.33
8.1.50.0240.01517.39
8.1.40.0360.00317.57
8.1.30.0270.01517.42
8.1.20.0310.00617.54
8.1.10.0300.00917.67
8.1.00.0340.00317.59

preferences:
37.31 ms | 403 KiB | 5 Q