3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isWeekend($date) { if ($date instanceof DateTime) { $date = DateTimeImmutable::createFromMutable($date); } return $date->setTime(0,0,0) != $date->modify('this weekday'); } function isWeekendUnixTimestamp($dateValue) { return date('Yz', strtotime($dateValue)) != date('Yz', strtotime($dateValue . ' this weekday')); } echo 'DateTimeInterface Comparison:' . PHP_EOL; $sunday = new DateTimeImmutable('Sunday'); $periods = new DatePeriod($sunday, new DateInterval('P1D'), 6); foreach ($periods as $date) { echo $date->format('D') . ' is' . (isWeekend($date) ? '' : ' not') . ' a weekend' . PHP_EOL; } echo PHP_EOL . 'String Comparison:' . PHP_EOL; foreach ($periods as $date) { echo $date->format('D') . ' is' . (isWeekendUnixTimestamp($date->format('Y-m-d')) ? '' : ' not') . ' a weekend' . PHP_EOL; }

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.120.0140.00720.43
8.4.110.0120.00922.54
8.4.100.0100.00618.08
8.4.90.0100.00920.64
8.4.80.0040.00517.93
8.4.70.0040.00418.16
8.4.60.0140.00719.10
8.4.50.0110.01319.43
8.4.40.0040.00717.99
8.4.30.0120.00920.34
8.4.20.0110.00724.17
8.4.10.0100.01017.94
8.3.250.0140.00618.97
8.3.240.0120.00716.63
8.3.230.0110.00916.88
8.3.220.0090.01019.06
8.3.210.0100.00818.54
8.3.200.0040.00516.78
8.3.190.0100.00617.32
8.3.180.0090.00918.48
8.3.170.0110.00720.96
8.3.160.0150.00318.56
8.3.150.0130.00717.16
8.3.140.0090.00616.81
8.3.130.0100.01018.21
8.3.120.0030.00620.65
8.3.110.0090.00020.94
8.3.100.0060.00324.06
8.3.90.0030.00726.77
8.3.80.0050.00516.50
8.3.70.0100.00716.63
8.3.60.0070.01116.61
8.3.50.0120.00918.34
8.3.40.0090.00620.89
8.3.30.0070.00719.04
8.3.20.0080.00024.18
8.3.10.0070.00024.66
8.3.00.0040.00426.16
8.2.290.0120.00720.26
8.2.280.0130.00718.50
8.2.270.0110.00717.41
8.2.260.0110.00419.00
8.2.250.0040.00418.48
8.2.240.0040.00417.25
8.2.230.0000.00922.58
8.2.220.0250.00637.54
8.2.210.0120.00326.77
8.2.200.0000.00916.63
8.2.190.0130.00917.00
8.2.180.0200.00325.92
8.2.170.0160.00319.12
8.2.160.0060.00922.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0020.00521.02
8.2.110.0000.01020.52
8.2.100.0090.00317.91
8.2.90.0040.00418.46
8.2.80.0040.00419.44
8.2.70.0000.00918.00
8.2.60.0090.00318.16
8.2.50.0050.00518.07
8.2.40.0000.00818.28
8.2.30.0000.00918.21
8.2.20.0040.00418.09
8.2.10.0040.00419.38
8.2.00.0060.00319.32
8.1.330.0130.00622.02
8.1.320.0120.00716.54
8.1.310.0000.00817.07
8.1.300.0100.01020.20
8.1.290.0060.00330.84
8.1.280.0070.00725.92
8.1.270.0000.00823.99
8.1.260.0050.00326.35
8.1.250.0000.00728.09
8.1.240.0060.00322.18
8.1.230.0070.00421.03
8.1.220.0030.00617.77
8.1.210.0040.00418.95
8.1.200.0060.00317.60
8.1.190.0050.00317.60
8.1.180.0030.00618.10
8.1.170.0040.00918.77
8.1.160.0000.00719.03
8.1.150.0040.00418.89
8.1.140.0070.00017.83
8.1.130.0000.00717.75
8.1.120.0000.00717.77
8.1.110.0000.00817.78
8.1.100.0000.00817.68
8.1.90.0040.00417.77
8.1.80.0070.00417.66
8.1.70.0030.00917.63
8.1.60.0110.00217.65
8.1.50.0100.00317.63
8.1.40.0090.00517.66
8.1.30.0060.00917.92
8.1.20.0130.00117.78
8.1.10.0120.00417.77
8.1.00.0130.00317.74
8.0.300.0040.00420.20
8.0.290.0050.00316.88
8.0.280.0070.00018.59
8.0.270.0030.00518.23
8.0.260.0000.00717.11
8.0.250.0030.00317.19
8.0.240.0040.00417.23
8.0.230.0030.00517.13
8.0.220.0050.00217.11
8.0.210.0090.00217.06
8.0.200.0080.00417.14
8.0.190.0110.00317.14
8.0.180.0060.00517.05
8.0.170.0050.00717.15
8.0.160.0070.00417.07
8.0.150.0080.00417.03
8.0.140.0090.00317.11
8.0.130.0080.00415.88
8.0.120.0100.00317.13
8.0.110.0070.00517.15
8.0.100.0070.00517.09
8.0.90.0080.00517.12
8.0.80.0080.00417.14
8.0.70.0090.00317.06
8.0.60.0070.00517.05
8.0.50.0070.00517.09
8.0.30.0080.00617.08
8.0.20.0090.00317.16
8.0.10.0090.00517.18
8.0.00.0050.00517.25
7.4.330.0020.00215.55
7.4.320.0060.00016.73
7.4.300.0080.00416.66
7.4.290.0060.00616.71
7.4.280.0060.00616.61
7.4.270.0040.00616.80
7.4.260.0100.00515.54
7.4.250.0100.00516.74
7.4.240.0070.00716.74
7.4.230.0090.00616.64
7.4.220.0110.00316.77
7.4.210.0080.00416.70
7.4.200.0070.00416.75
7.4.190.0050.00616.71
7.4.180.0040.00816.74
7.4.160.0070.00416.78
7.4.150.0080.00316.76
7.4.140.0060.00516.66
7.4.130.0080.00316.67
7.4.120.0080.00416.67
7.4.110.0080.00516.69
7.4.100.0080.00416.63
7.4.90.0070.00516.67
7.4.80.0060.00516.57
7.4.70.0070.00516.68
7.4.60.0070.00416.65
7.4.50.0070.00516.50
7.4.40.0070.00316.48
7.4.30.0070.00516.67
7.4.20.0060.00516.66
7.4.10.0090.00316.65
7.4.00.0070.00416.65
7.3.330.0050.00616.49
7.3.320.0080.00415.54
7.3.310.0050.00616.60
7.3.300.0070.00616.53
7.3.290.0070.00416.61
7.3.280.0050.00616.53
7.3.270.0080.00416.48
7.3.260.0090.00316.56
7.3.250.0050.00616.55
7.3.240.0070.00416.60
7.3.230.0060.00616.39
7.3.220.0070.00416.50
7.3.210.0050.00616.58
7.3.200.0080.00416.49
7.3.190.0060.00616.53
7.3.180.0030.00916.45
7.3.170.0080.00516.53
7.3.160.0060.00516.50
7.3.150.0040.00716.55
7.3.140.0070.00516.46
7.3.130.0050.00716.48
7.3.120.0070.00416.46
7.3.110.0060.00716.43
7.3.100.0090.00316.42
7.3.90.0100.00316.77
7.3.80.0080.00416.46
7.3.70.0100.00216.56
7.3.60.0100.00216.62
7.3.50.0070.00516.67
7.3.40.0080.00516.71
7.3.30.0100.00316.59
7.3.20.0110.00418.00
7.3.10.0070.00517.98
7.3.00.0070.00617.79
4.3.00.0020.0009.81

preferences:
31.45 ms | 403 KiB | 5 Q