3v4l.org

run code in 300+ PHP versions simultaneously
<?php // the month to render and day to highlight $today = new DateTime(); // we'll need these to check if we're at the day we need to highlight // or if we're rendering a date that's outside $today's month $currentDay = $today->format('j'); $currentMonth = $today->format('n'); $daysInCurrentMonth = $today->format('t'); // figure out what Monday needs to kick off our table $date = (clone $today)->modify('first day of this month'); if ($date->format('w') != 1) { $date->modify('previous monday'); } $shouldStopRendering = false; echo '<table border="1">' . PHP_EOL; while (!$shouldStopRendering) { $weekDay = $date->format('w'); $month = $date->format('n'); $day = $date->format('j'); // start a new table row every time we hit a Monday, note that // since we forced $date to be a Monday above, our table should // now always start with a <tr> if ($weekDay == 1) { echo ' <tr>' . PHP_EOL; } if ($month != $currentMonth) { // we're either at the beginning or end of our table echo ' <td>&nbsp;</td>' . PHP_EOL; } else if ($day == $currentDay) { // highlight the current date echo ' <td bgcolor="#ff0000">' . $day . '</td>' . PHP_EOL; } else { echo ' <td>' . $day . '</td>' . PHP_EOL; } if ($weekDay == 0) { // every time we hit a Sunday, close the current table row echo ' </tr>' . PHP_EOL; // on a Sunday, if we've gone outside the current month **or** // this Sunday happens to be the last day we need to render, // stop looping so we can close the table if ($month != $currentMonth || $day == $daysInCurrentMonth) { $shouldStopRendering = true; } } // move on to the next day we need to display $date->modify('+1 day'); } echo '</table>';

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.0100.01018.16
8.4.120.0080.01220.52
8.4.110.0040.00422.52
8.4.100.0080.00419.25
8.4.90.0150.00520.63
8.4.80.0100.00718.72
8.4.70.0090.00718.16
8.4.60.0070.00219.14
8.4.50.0090.00718.47
8.4.40.0070.00317.64
8.4.30.0130.00317.95
8.4.20.0100.01020.64
8.4.10.0040.00417.89
8.3.260.0130.00616.79
8.3.250.0130.00719.09
8.3.240.0160.00416.86
8.3.230.0080.00016.67
8.3.220.0070.01118.84
8.3.210.0090.00818.45
8.3.200.0040.00516.60
8.3.190.0120.00617.35
8.3.180.0100.00917.30
8.3.170.0160.00320.66
8.3.160.0080.00016.72
8.3.150.0150.00616.53
8.3.140.0040.01117.15
8.3.130.0080.00818.63
8.3.120.0190.00917.53
8.3.110.0270.00518.71
8.3.100.0200.01020.20
8.3.90.0210.00721.71
8.3.80.0180.00617.20
8.3.70.0250.00717.67
8.3.60.0220.00917.63
8.3.50.0190.00617.92
8.3.40.0160.00918.10
8.3.30.0190.00718.03
8.3.20.0130.00518.03
8.3.10.0110.00819.02
8.3.00.0130.00419.67
8.2.290.0130.00620.33
8.2.280.0050.00318.86
8.2.270.0070.01319.16
8.2.260.0030.01616.96
8.2.250.0040.00416.80
8.2.240.0070.00717.03
8.2.230.0090.00619.52
8.2.220.0220.00227.13
8.2.210.0090.00621.68
8.2.200.0180.00516.61
8.2.190.0180.00517.73
8.2.180.0130.00817.09
8.2.170.0230.00519.57
8.2.160.0210.00719.29
8.2.150.0190.00619.91
8.2.140.0170.00620.22
8.2.130.0210.00518.87
8.2.120.0250.00420.48
8.2.110.0290.00118.90
8.2.100.0200.00817.77
8.2.90.0150.00918.02
8.2.80.0180.00618.19
8.2.70.0170.00817.79
8.2.60.0170.00817.90
8.2.50.0180.00817.85
8.2.40.0160.00818.33
8.2.30.0160.00718.70
8.2.20.0170.00417.92
8.2.10.0170.00417.96
8.2.00.0150.00617.84
8.1.330.0110.00822.04
8.1.320.0130.00718.08
8.1.310.0110.00718.45
8.1.300.0100.01316.46
8.1.290.0100.00623.49
8.1.280.0140.00820.00
8.1.270.0180.00218.59
8.1.260.0180.00720.46
8.1.250.0220.00321.16
8.1.240.0170.00418.14
8.1.230.0150.00718.78
8.1.220.0130.00617.74
8.1.210.0170.00418.05
8.1.200.0180.00517.47
8.1.190.0170.00517.60
8.1.180.0160.00717.70
8.1.170.0180.00618.07
8.1.160.0160.00818.14
8.1.150.0150.00718.11
8.1.140.0170.00718.03
8.1.130.0170.00718.49
8.1.120.0110.01117.74
8.1.110.0160.00817.74
8.1.100.0160.00617.63
8.1.90.0110.00717.76
8.1.80.0150.00617.69
8.1.70.0170.00317.67
8.1.60.0120.00717.67
8.1.50.0140.00718.13
8.1.40.0190.00617.66
8.1.30.0180.00417.78
8.1.20.0190.00317.73
8.1.10.0190.00617.67
8.1.00.0180.00817.73
8.0.300.0180.00418.29
8.0.290.0210.00517.14
8.0.280.0190.00417.72
8.0.270.0210.00417.61
8.0.260.0150.00818.32
8.0.250.0140.00717.23
8.0.240.0150.00417.29
8.0.230.0140.00917.27
8.0.220.0110.00417.28
8.0.210.0140.00717.16
8.0.200.0190.00317.20
8.0.190.0150.00217.21
8.0.180.0120.00717.33
8.0.170.0100.00817.21
8.0.160.0140.00317.29
8.0.150.0110.00417.23
8.0.140.0110.00417.28
8.0.130.0100.00716.10
8.0.120.0190.00117.23
8.0.110.0140.00417.19
8.0.100.0120.00617.21
8.0.90.0110.00417.26
8.0.80.0110.00617.24
8.0.70.0170.00217.26
8.0.60.0160.00617.14
8.0.50.0180.00517.23
8.0.30.0160.00517.22
8.0.20.0140.00817.29
8.0.10.0130.00817.32
8.0.00.0140.00917.23
7.4.330.0140.00116.61
7.4.320.0160.00716.99
7.4.300.0150.00516.96
7.4.290.0140.00516.98
7.4.280.0110.00816.99
7.4.270.0140.00516.89
7.4.260.0170.00517.05
7.4.250.0160.00716.99
7.4.240.0230.00116.99
7.4.230.0190.00616.93
7.4.220.0170.00517.13
7.4.210.0150.00416.82
7.4.200.0120.00817.04
7.4.190.0300.00217.21
7.4.180.0140.01217.24
7.4.160.0130.00616.86
7.4.150.0160.00816.94
7.4.140.0130.00817.33
7.4.130.0160.00816.79
7.4.120.0170.00716.73
7.4.110.0140.00816.81
7.4.100.0160.00716.80
7.4.90.0120.00916.85
7.4.80.0180.00717.21
7.4.70.0150.00616.83
7.4.60.0120.00916.81
7.4.50.0140.00716.74
7.4.40.0120.00716.80
7.4.30.0130.00716.82
7.4.20.0140.00616.91
7.4.10.0120.00716.37
7.4.00.0090.01016.14
7.3.330.0070.00615.85
7.3.320.0120.00415.76
7.3.310.0080.00816.84
7.3.300.0110.00416.79
7.3.290.0150.00516.90
7.3.280.0130.00716.79
7.3.270.0160.00416.82
7.3.260.0130.00916.76
7.3.250.0120.01016.88
7.3.240.0160.00516.73
7.3.230.0140.00716.78
7.3.220.0150.00716.77
7.3.210.0140.00816.85
7.3.200.0190.00516.77
7.3.190.0180.00716.80
7.3.180.0120.00816.78
7.3.170.0120.00816.75
7.3.160.0150.00716.72
7.3.150.0160.00716.79
7.3.140.0190.00616.82
7.3.130.0130.01116.23
7.3.120.0130.01016.33
7.3.110.0150.00816.26
7.3.100.0120.00916.29
7.3.90.0100.00916.28
7.3.80.0120.00816.16
7.3.70.0130.00916.34
7.3.60.0140.00916.31
7.3.50.0110.00716.28
7.3.40.0120.00716.35
7.3.30.0110.00816.27
7.3.20.0120.00716.58
7.3.10.0130.00716.59
7.3.00.0090.01116.64
7.2.340.0210.00416.92
7.2.330.0180.00616.93
7.2.320.0180.00716.89
7.2.310.0170.00916.86
7.2.300.0170.00716.97
7.2.290.0160.01116.93
7.2.280.0180.00816.82
7.2.270.0190.00816.90
7.2.260.0170.00816.47
7.2.250.0150.01016.36
7.2.240.0160.01016.51
7.2.230.0180.00816.49
7.2.220.0150.01216.51
7.2.210.0190.00616.42
7.2.200.0200.00616.43
7.2.190.0200.00816.43
7.2.180.0180.00716.37
7.2.170.0170.00816.50
7.2.160.0190.00616.48
7.2.150.0170.00816.80
7.2.140.0150.01016.77
7.2.130.0160.00816.86
7.2.120.0140.00916.88
7.2.110.0160.01116.82
7.2.100.0310.00716.69
7.2.90.0140.00716.57
7.2.80.0170.00516.67
7.2.70.0160.00816.59
7.2.60.0170.00916.68
7.2.50.0320.00816.60
7.2.40.0320.00816.71
7.2.30.0170.00716.68
7.2.20.0170.00716.72
7.2.10.0160.00916.62
7.2.00.0150.00816.65
7.1.330.0190.00815.80
7.1.320.0200.00715.92
7.1.310.0220.00815.82
7.1.300.0190.00815.85
7.1.290.0200.01015.89
7.1.280.0140.01015.85
7.1.270.0170.00715.81
7.1.260.0160.01015.83
7.1.250.0190.00615.86
7.1.240.0180.00815.85
7.1.230.0160.00915.82
7.1.220.0250.00715.60
7.1.210.0250.00615.50
7.1.200.0190.00815.61
7.1.190.0190.00815.60
7.1.180.0390.00615.72
7.1.170.0170.00715.81
7.1.160.0170.00715.74
7.1.150.0180.00815.68
7.1.140.0130.00915.74
7.1.130.0150.00715.81
7.1.120.0170.00715.73
7.1.110.0160.00815.72
7.1.100.0180.00715.76
7.1.90.0180.00815.70
7.1.80.0170.00615.78
7.1.70.0140.00815.79
7.1.60.0220.00718.35
7.1.50.0240.00718.35
7.1.40.0230.00818.35
7.1.30.0180.00718.32
7.1.20.0230.00918.32
7.1.10.0150.00715.78
7.1.00.0330.01015.77
7.0.330.0140.00715.75
7.0.320.0150.00815.71
7.0.310.0160.00815.76
7.0.300.0190.00515.74
7.0.290.0170.00615.69
7.0.280.0130.00815.81
7.0.270.0130.00815.80
7.0.260.0140.00815.77
7.0.250.0130.00915.90
7.0.240.0150.00615.72
7.0.230.0160.00515.75
7.0.220.0160.00615.84
7.0.210.0170.00815.80
7.0.200.0150.00915.74
7.0.190.0150.00915.77
7.0.180.0180.00715.75
7.0.170.0130.00915.76
7.0.160.0150.00815.71
7.0.150.0180.00515.71
7.0.140.0140.00915.86
7.0.130.0160.00715.78
7.0.120.0190.00815.75
7.0.110.0160.00915.72
7.0.100.0190.00915.79
7.0.90.0180.00815.84
7.0.80.0170.00615.69
7.0.70.0210.00615.73
7.0.60.0160.00815.79
7.0.50.0190.00715.71
7.0.40.0150.00915.76
7.0.30.0160.00915.77
7.0.20.0160.01115.72
7.0.10.0140.00815.83
7.0.00.0150.00815.74
5.6.400.0160.00815.77
5.6.390.0190.00515.81
5.6.380.0150.00815.47
5.6.370.0180.00615.80
5.6.360.0160.00715.78
5.6.350.0140.00915.76
5.6.340.0140.00615.78
5.6.330.0140.00915.81
5.6.320.0130.01115.78
5.6.310.0170.00615.79
5.6.300.0140.00915.80
5.6.290.0190.00615.77
5.6.280.0200.00715.77
5.6.270.0170.00815.77
5.6.260.0190.00715.80
5.6.250.0180.00815.76
5.6.240.0140.01215.79
5.6.230.0170.00715.78
5.6.220.0150.00915.80
5.6.210.0170.00915.78
5.6.200.0120.01115.72
5.6.190.0170.00815.91
5.6.180.0200.01015.80
5.6.170.0210.00315.75
5.6.160.0130.00915.82
5.6.150.0170.00815.81
5.6.140.0170.00715.75
5.6.130.0160.00715.88
5.6.120.0200.00615.80
5.6.110.0200.00715.73
5.6.100.0160.00815.85
5.6.90.0160.00715.70
5.6.80.0170.00615.77
5.6.70.0160.00815.70
5.6.60.0160.00515.73
5.6.50.0160.00715.78
5.6.40.0130.00915.73
5.6.30.0150.00715.70
5.6.20.0140.00815.75
5.6.10.0140.00915.75
5.6.00.0150.00915.71

preferences:
39.49 ms | 403 KiB | 5 Q