3v4l.org

run code in 500+ PHP versions simultaneously
<?php $resultSet = [ 0 => [ 'id' => 123, 'name' => 'ABC', 'start_date' => '2019-12-18 20:00:00' ], 1 => [ 'id' => 124, 'name' => 'CDE', 'start_date' => '2019-12-19 20:00:00' ], 2 => [ 'id' => 125, 'name' => 'TEST', 'start_date' => '2019-12-23 20:00:00' ], 3 => [ 'id' => 126, 'name' => 'BWM', 'start_date' => '2019-12-18 20:00:00' ], 4 => [ 'id' => 127, 'name' => 'XYZ', 'start_date' => '2019-12-19 20:00:00' ], 5 => [ 'id' => 128, 'name' => 'GHJ', 'start_date' => '2019-12-21 20:00:00' ], 6 => [ 'id' => 129, 'name' => 'GHJK', 'start_date' => '2019-12-22 20:00:00' ], 7 => [ 'id' => 130, 'name' => 'GHL', 'start_date' => '2019-12-20 20:00:00' ], 8 => [ 'id' => 131, 'name' => 'JKL', 'start_date' => '2019-12-25 20:00:00' ] ]; $s = new DateTime(); $s->modify('+2 days'); // in fact today is 2019-12-16, but you've choose 2019-12-18 //echo $s->format('Y-m-d H:i:s').PHP_EOL; // today $today = $s->format('Ymd'); // format 20191218 echo $today.' <- today'.PHP_EOL; // today $nextmonday = $s->modify('next monday')->format('Ymd'); echo $nextmonday.' <- next monday'.PHP_EOL.PHP_EOL; // next monday, format 20191223 foreach($resultSet as $rec){ $d = date('Ymd', strtotime($rec['start_date'])); $d2 = date('l', strtotime($rec['start_date'])); echo $d.' --- '.$d2.PHP_EOL; if ($d == $today) { // 2019-12-18 == 2019-12-18 $res['today'][] = $rec; } else if ($d - $today == 1) { // 2019-12-19 - 2019-12-18 == 1 $res['tomorrow'][] = $rec; } else if (in_array($d2,['Friday','Saturday','Sunday']) && $d < $nextmonday){ // < 2019-12-23 and by day name $res['this_weekend'][] = $rec; } else if ($d >= $nextmonday){ // next week (not a weekend) $res['next_weekend'][] = $rec; } } echo PHP_EOL; print_r($res);

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.70.0090.01016.96
8.5.60.0110.00917.16
8.5.50.0060.00816.73
8.5.30.0090.00817.57
8.5.20.0090.00919.64
8.5.10.0110.00819.06
8.5.00.0120.01120.31
8.4.220.0060.00319.68
8.4.210.0070.00319.71
8.4.180.0120.01119.83
8.4.170.0090.00920.51
8.4.160.0140.00823.94
8.4.150.0080.00616.93
8.4.140.0160.00619.36
8.4.130.0110.01018.83
8.4.120.0090.00823.99
8.4.110.0060.00320.61
8.4.100.0110.00918.98
8.4.90.0120.00820.42
8.4.80.0120.00920.51
8.4.70.0140.00618.09
8.4.60.0100.01019.07
8.4.50.0130.00919.59
8.4.40.0110.00018.10
8.4.30.0030.01720.42
8.4.20.0100.01017.88
8.4.10.0180.00319.71
8.3.310.0110.00618.78
8.3.300.0110.01021.00
8.3.290.0090.01220.84
8.3.280.0110.01018.74
8.3.270.0110.00816.79
8.3.260.0130.00516.54
8.3.250.0110.00818.92
8.3.240.0110.00617.14
8.3.230.0120.00816.82
8.3.220.0090.01019.00
8.3.210.0140.00518.60
8.3.200.0070.00216.67
8.3.190.0110.00816.87
8.3.180.0120.00819.09
8.3.170.0110.00719.04
8.3.160.0100.01018.56
8.3.150.0140.00017.36
8.3.140.0110.00716.71
8.3.130.0040.00418.48
8.3.120.0080.01120.63
8.3.110.0090.00916.80
8.3.100.0080.00016.82
8.3.90.0120.00626.77
8.3.80.0030.01019.36
8.3.70.0130.01016.88
8.3.60.0070.01418.68
8.3.50.0100.01023.71
8.3.40.0170.00319.22
8.3.30.0120.00319.02
8.3.20.0040.00421.82
8.3.10.0030.00520.21
8.3.00.0000.00821.87
8.2.310.0110.01118.29
8.2.300.0110.01022.16
8.2.290.0120.00520.59
8.2.280.0110.00918.61
8.2.270.0140.00716.94
8.2.260.0180.00020.50
8.2.250.0090.00618.45
8.2.240.0100.00619.03
8.2.230.0070.00320.94
8.2.220.0040.00424.06
8.2.210.0080.00026.77
8.2.200.0170.00318.88
8.2.190.0000.01517.13
8.2.180.0040.01116.75
8.2.170.0070.00722.96
8.2.160.0040.01120.26
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0040.00426.16
8.2.110.0030.00721.08
8.2.100.0080.00418.16
8.2.90.0040.00418.09
8.2.80.0090.00018.00
8.2.70.0060.00318.16
8.2.60.0050.00318.27
8.2.50.0030.00518.10
8.2.40.0030.00819.45
8.2.30.0050.00319.38
8.2.20.0080.00018.18
8.2.10.0050.00219.38
8.2.00.0020.00519.32
8.1.340.0120.01017.90
8.1.330.0080.00821.75
8.1.320.0120.00618.36
8.1.310.0040.00418.61
8.1.300.0080.00816.45
8.1.290.0070.00730.84
8.1.280.0070.00725.92
8.1.270.0000.00820.98
8.1.260.0000.00726.35
8.1.250.0030.00528.09
8.1.240.0030.00622.14
8.1.230.0060.00622.17
8.1.220.0050.00317.85
8.1.210.0030.00919.02
8.1.200.0000.01017.47
8.1.190.0000.00817.48
8.1.180.0080.00019.04
8.1.170.0030.00518.75
8.1.160.0000.00819.20
8.1.150.0040.00418.94
8.1.140.0050.00222.13
8.1.130.0030.00320.27
8.1.120.0040.00417.60
8.1.110.0000.00717.73
8.1.100.0050.00317.70
8.1.90.0080.00017.61
8.1.80.0040.00417.76
8.1.70.0090.00017.60
8.1.60.0030.00517.80
8.1.50.0030.00617.77
8.1.40.0000.00917.68
8.1.30.0080.00017.87
8.1.20.0040.00417.79
8.1.10.0030.00517.74
8.1.00.0040.00417.79
8.0.300.0030.00520.15
8.0.290.0030.00517.13
8.0.280.0000.00718.60
8.0.270.0070.00017.12
8.0.260.0040.00420.16
8.0.250.0000.00717.25
8.0.240.0030.00817.30
8.0.230.0000.00817.16
8.0.220.0000.00717.13
8.0.210.0050.00217.24
8.0.200.0000.00717.32
8.0.190.0040.00417.29
8.0.180.0000.00917.27
8.0.170.0040.00417.26
8.0.160.0040.00417.13
8.0.150.0000.00817.23
8.0.140.0090.00417.21
8.0.130.0030.00313.63
8.0.120.0000.00817.18
8.0.110.0040.00417.15
8.0.100.0020.00517.13
8.0.90.0030.00617.19
8.0.80.0040.01217.17
8.0.70.0000.00817.06
8.0.60.0080.00017.01
8.0.50.0030.00517.04
8.0.30.0030.01617.42
8.0.20.0110.01117.27
8.0.10.0000.00717.39
8.0.00.0070.01117.04
7.4.330.0030.00315.55
7.4.320.0030.00316.84
7.4.300.0070.00016.86
7.4.290.0070.00016.77
7.4.280.0030.00616.59
7.4.270.0000.00716.75
7.4.260.0060.00013.44
7.4.250.0000.00716.82
7.4.240.0040.00316.67
7.4.230.0050.00316.79
7.4.220.0040.00316.71
7.4.210.0080.01016.78
7.4.200.0000.00716.92
7.4.130.0150.00616.93
7.4.120.0170.00816.91
7.4.110.0100.00716.66
7.4.100.0070.01116.68
7.4.90.0090.00916.75
7.4.80.0090.00919.39
7.4.70.0040.01416.82
7.4.60.0110.01116.79
7.4.50.0060.00616.63
7.4.40.0100.00716.73
7.4.00.0040.01715.05
7.3.330.0040.00416.52
7.3.320.0060.00013.26
7.3.310.0000.00816.63
7.3.300.0000.00716.49
7.3.290.0050.01116.54
7.3.280.0090.00916.53
7.3.260.0070.01116.68
7.3.240.0070.01016.67
7.3.230.0090.00916.77
7.3.210.0120.01316.82
7.3.200.0180.00316.82
7.3.190.0060.01216.71
7.3.180.0130.00316.52
7.3.170.0060.00916.55
7.3.160.0110.00716.81
7.3.120.0110.00715.00
7.3.110.0100.01014.88
7.3.100.0070.01315.14
7.3.90.0050.01015.12
7.3.80.0050.01415.00
7.3.70.0100.01015.01
7.3.60.0080.00814.80
7.3.50.0080.00815.04
7.3.40.0150.01414.89
7.3.30.0040.01415.09
7.3.20.0090.01215.01
7.3.10.0090.00915.13
7.3.00.0000.02114.71
7.2.330.0070.01117.04
7.2.320.0150.00317.12
7.2.310.0070.01116.70
7.2.300.0130.00617.01
7.2.290.0160.00616.79
7.2.250.0130.00715.09
7.2.240.0090.01315.22
7.2.230.0080.01115.54
7.2.220.0090.00914.98
7.2.210.0070.01015.36
7.2.200.0080.01515.24
7.2.190.0060.01514.98
7.2.180.0160.00015.30
7.2.170.0060.01515.19
7.2.160.0110.00615.32
7.2.150.0050.01115.19
7.2.140.0050.01315.19
7.2.130.0090.00915.34
7.2.120.0120.01215.29
7.2.110.0030.01515.27
7.2.100.0000.01915.30
7.2.90.0070.01115.60
7.2.80.0120.00615.12
7.2.70.0110.00715.18
7.2.60.0060.01215.16
7.2.50.0060.01215.46
7.2.40.0030.01715.41
7.2.30.0070.01015.48
7.2.20.0150.00715.52
7.2.10.0080.00815.12
7.2.00.0080.01115.42

preferences:
52.71 ms | 2063 KiB | 5 Q