3v4l.org

run code in 300+ PHP versions simultaneously
<?php $showtimes = [ "2014-01-20 20:00:00", "2014-01-21 20:00:00", "2014-01-22 14:00:00", "2014-01-22 20:00:00", "2014-01-23 20:00:00", "2014-01-25 20:00:00", "2014-01-26 20:00:00", "2014-01-31 20:00:00", "2014-02-01 20:00:00" ]; // 20th-23rd Jan 8pm, 22nd Jan 2pm, 25th-26th Jan 8pm, 31st Jan - 1st Feb 8pm foreach ($showtimes as $showtime) { $dt = new DateTime($showtime); $thisDay = $dt->format('Y-m-d H:i:s'); $nextDay = (clone $dt)->modify('+1 day')->format('Y-m-d H:i:s'); if (!isset($ref[$thisDay])) { $ref[$nextDay] = $dt->format('jS M ga'); $result[] =& $ref[$nextDay]; continue; } // if same month if (str_contains($ref[$thisDay], $dt->format('M'))) { // inject day $ref[$thisDay] = preg_replace( '/[tdh]\b\K[^ ]*/', $dt->format('-jS'), $ref[$thisDay] ); } else { // inject day and month $ref[$thisDay] = preg_replace( '/ (?=[^ ]*$)/', $dt->format(' - jS M '), $ref[$thisDay] ); } $ref[$nextDay] =& $ref[$thisDay]; } echo implode(', ', $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.4.130.0090.01218.78
8.4.120.0110.00824.29
8.4.110.0050.00518.94
8.4.100.0090.01019.16
8.4.90.0080.01220.58
8.4.80.0110.00918.90
8.4.70.0110.00818.21
8.4.60.0150.00618.84
8.4.50.0120.00818.70
8.4.40.0170.00318.11
8.4.30.0060.00918.79
8.4.20.0030.01619.94
8.4.10.0040.00419.64
8.3.260.0110.00917.19
8.3.250.0130.00618.91
8.3.240.0060.00417.35
8.3.230.0110.00717.03
8.3.220.0060.00219.09
8.3.210.0110.01018.97
8.3.200.0050.00416.93
8.3.190.0020.00619.07
8.3.180.0120.00717.23
8.3.170.0030.00518.89
8.3.160.0070.01116.99
8.3.150.0130.00717.24
8.3.140.0060.00317.11
8.3.130.0120.00317.01
8.3.120.0100.01020.69
8.3.110.0100.01020.94
8.3.100.0090.00616.75
8.3.90.0150.00618.67
8.3.80.0260.00730.84
8.3.70.0260.00330.84
8.3.60.0270.00330.84
8.3.50.0260.00430.84
8.3.40.0150.01030.84
8.3.30.0210.00430.84
8.3.20.0230.00430.84
8.3.10.0210.00430.84
8.3.00.0220.00630.84
8.2.290.0110.00820.53
8.2.280.0120.00818.61
8.2.270.0070.01117.19
8.2.260.0050.00319.09
8.2.250.0090.00018.76
8.2.240.0040.00419.01
8.2.230.0030.00622.58
8.2.220.0080.00024.06
8.2.210.0040.00426.77
8.2.200.0210.00430.84
8.2.190.0240.00330.84
8.2.180.0260.00330.84
8.2.170.0150.00930.84
8.2.160.0220.00330.84
8.2.150.0270.00030.84
8.2.140.0220.00530.84
8.2.130.0200.00530.84
8.2.120.0250.00330.84
8.2.110.0240.00630.84
8.2.100.0230.00330.84
8.2.90.0190.00630.84
8.2.80.0270.00030.84
8.2.70.0220.00430.84
8.2.60.0240.00030.84
8.2.50.0260.00330.84
8.2.40.0180.00630.84
8.2.30.0180.00330.84
8.2.20.0160.00630.84
8.2.10.0140.00730.84
8.2.00.0160.00530.84
8.1.330.0160.00521.85
8.1.320.0100.00820.19
8.1.310.0040.00416.94
8.1.300.0090.00018.43
8.1.290.0280.00030.84
8.1.280.0160.00830.84
8.1.270.0140.01130.84
8.1.260.0210.00530.84
8.1.250.0170.00930.84
8.1.240.0200.00330.84
8.1.230.0230.00730.84
8.1.220.0160.00630.84
8.1.210.0110.01130.84
8.1.200.0180.00630.84
8.1.190.0220.00030.84
8.1.180.0170.00630.84
8.1.170.0150.00630.84
8.1.160.0200.00230.84
8.1.150.0150.00930.84
8.1.140.0200.00330.84
8.1.130.0110.01130.84
8.1.120.0220.00430.84
8.1.110.0230.00330.84
8.1.100.0200.00230.84
8.1.90.0190.00330.84
8.1.80.0200.00030.84
8.1.70.0160.00530.84
8.1.60.0190.00830.84
8.1.50.0120.01530.84
8.1.40.0210.00930.84
8.1.30.0170.00730.84
8.1.20.0190.00430.84
8.1.10.0200.00730.84
8.1.00.0040.01630.84

preferences:
26.73 ms | 403 KiB | 5 Q