3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = (new \DateTime('27-05-2018')); if (($weekDay = $date->format('N')) < 4) { // If the date is already a Monday, return it as-is $date->modify('next thursday'); } elseif ($weekDay > 4) { // Otherwise, return the date of the nearest Monday in the past // This includes Sunday in the previous week instead of it being the start of a new week $date->modify('last thursday'); } var_dump($weekDay); var_dump($date);

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.3.60.0150.00018.40
8.3.50.0110.00416.76
8.3.40.0110.01118.94
8.3.30.0120.00318.69
8.3.20.0080.00019.22
8.3.10.0080.00020.81
8.3.00.0030.00517.89
8.2.180.0160.00018.31
8.2.170.0150.00419.08
8.2.160.0030.01022.96
8.2.150.0100.00024.18
8.2.140.0000.00824.66
8.2.130.0000.00719.95
8.2.120.0080.00326.35
8.2.110.0090.00022.25
8.2.100.0060.00617.97
8.2.90.0040.00419.30
8.2.80.0050.00319.32
8.2.70.0060.00317.88
8.2.60.0030.00618.05
8.2.50.0030.00618.07
8.2.40.0000.00820.00
8.2.30.0040.00418.18
8.2.20.0050.00318.18
8.2.10.0000.00818.06
8.2.00.0040.00419.59
8.1.280.0140.00725.92
8.1.270.0090.00022.26
8.1.260.0040.00426.35
8.1.250.0030.00528.09
8.1.240.0090.00022.54
8.1.230.0080.00321.02
8.1.220.0080.00018.77
8.1.210.0050.00318.82
8.1.200.0030.00617.60
8.1.190.0050.00217.51
8.1.180.0060.00318.10
8.1.170.0040.00418.61
8.1.160.0040.00419.07
8.1.150.0040.00419.02
8.1.140.0050.00217.77
8.1.130.0000.00719.13
8.1.120.0070.00017.65
8.1.110.0040.00417.65
8.1.100.0000.00717.70
8.1.90.0040.00417.69
8.1.80.0090.00017.70
8.1.70.0070.00017.62
8.1.60.0000.00817.72
8.1.50.0040.00417.75
8.1.40.0030.00517.66
8.1.30.0080.00017.82
8.1.20.0000.00717.80
8.1.10.0040.00417.64
8.1.00.0040.00417.65
8.0.300.0000.00820.14
8.0.290.0040.00417.16
8.0.280.0000.00818.55
8.0.270.0030.00317.34
8.0.260.0000.00817.40
8.0.250.0000.00717.24
8.0.240.0040.00417.18
8.0.230.0030.00317.12
8.0.220.0000.00917.05
8.0.210.0030.00317.16
8.0.200.0050.00317.17
8.0.190.0000.00717.26
8.0.180.0060.00317.15
8.0.170.0090.00017.13
8.0.160.0000.00717.04
8.0.150.0000.00717.08
8.0.140.0000.00817.10
8.0.130.0000.00613.48
8.0.120.0040.00417.12
8.0.110.0040.00417.01
8.0.100.0020.00517.12
8.0.90.0070.00017.13
8.0.80.0020.01617.11
8.0.70.0080.00017.03
8.0.60.0000.00717.09
8.0.50.0030.00617.23
8.0.30.0070.00917.31
8.0.20.0070.01317.41
8.0.10.0040.00417.23
8.0.00.0090.00916.91
7.4.330.0000.00615.55
7.4.320.0030.00616.70
7.4.300.0030.00316.80
7.4.290.0030.00316.61
7.4.280.0050.00516.61
7.4.270.0020.00516.62
7.4.260.0070.00016.77
7.4.250.0070.00016.78
7.4.240.0000.00716.82
7.4.230.0070.00016.49
7.4.220.0000.00816.59
7.4.210.0050.01116.81
7.4.200.0030.00616.70
7.4.160.0080.00816.71
7.4.140.0070.01317.86
7.4.130.0130.00316.80
7.4.120.0070.01316.70
7.4.110.0060.01616.77
7.4.100.0070.01016.64
7.4.90.0120.00616.82
7.4.80.0120.00919.39
7.4.70.0110.00716.61
7.4.60.0110.00616.91
7.4.50.0110.00416.58
7.4.40.0120.01216.63
7.4.00.0040.01315.07
7.3.330.0000.00513.35
7.3.320.0030.00313.26
7.3.310.0000.00716.39
7.3.300.0000.00716.46
7.3.290.0000.00716.43
7.3.280.0100.00816.46
7.3.260.0110.00716.50
7.3.240.0120.00716.56
7.3.230.0050.01116.64
7.3.210.0100.00616.57
7.3.200.0100.00716.48
7.3.190.0090.00916.74
7.3.180.0130.00716.50
7.3.170.0090.01216.84
7.3.160.0050.01416.64
7.3.120.0020.01314.80
7.3.110.0060.01015.20
7.3.100.0070.00514.96
7.3.90.0040.01114.92
7.3.80.0110.00315.03
7.3.70.0090.00914.95
7.3.60.0090.00715.07
7.3.50.0040.00915.06
7.3.40.0070.01215.04
7.3.30.0070.00914.91
7.3.20.0050.00716.80
7.3.10.0070.00916.72
7.3.00.0070.00716.90
7.2.330.0120.01216.88
7.2.320.0090.01516.84
7.2.310.0160.00416.86
7.2.300.0050.01416.90
7.2.290.0090.00916.52
7.2.250.0080.00815.14
7.2.240.0050.01315.12
7.2.230.0050.00915.02
7.2.220.0060.00815.22
7.2.210.0080.00815.15
7.2.200.0080.00315.13
7.2.190.0100.00515.05
7.2.180.0030.01014.91
7.2.170.0080.00615.23
7.2.160.0070.00715.14
7.2.150.0030.01016.75
7.2.140.0110.00417.12
7.2.130.0080.00317.02
7.2.120.0030.01017.12
7.2.110.0070.00716.89
7.2.100.0120.00316.85
7.2.90.0090.00617.09
7.2.80.0150.00416.98
7.2.70.0070.00716.95
7.2.60.0110.00416.12
7.2.50.1400.00716.04
7.2.40.0110.01116.30
7.2.30.4280.01016.27
7.2.20.0180.00916.24
7.2.10.0110.01216.07
7.2.00.0120.01016.44
7.1.330.0080.00815.86
7.1.320.0100.00615.97
7.1.310.0080.00815.77
7.1.300.0070.00616.06
7.1.290.0020.00915.92
7.1.280.0070.00815.95
7.1.270.0040.00815.69
7.1.260.0040.01215.96
7.1.250.0040.00416.13
7.1.240.0000.01716.04
7.1.230.0040.00416.04
7.1.220.0000.00816.02
7.1.210.0080.00415.91
7.1.200.0050.01016.09
7.1.190.0000.01215.92
7.1.180.0090.00315.88
7.1.170.0130.00914.76
7.1.160.0100.00816.43
7.1.150.8120.01416.20
7.1.140.2100.00716.63
7.1.130.0150.01216.46
7.1.120.0130.01016.56
7.1.110.3360.00916.11
7.1.100.0910.01016.16
7.1.90.6910.00716.15
7.1.80.6070.00916.27
7.1.70.2830.00615.79
7.1.60.3770.01024.58
7.1.50.5200.00924.40
7.1.40.6230.01024.18
7.1.30.5570.00824.57
7.1.20.0280.01224.44
7.1.10.0090.00915.45
7.1.00.0100.01215.54
7.0.330.0030.00615.59
7.0.320.0030.00615.32
7.0.310.0000.01415.34
7.0.300.0000.01115.68
7.0.290.0080.00415.76
7.0.280.0030.00915.38
7.0.270.0120.00315.55
7.0.260.0060.00915.66
7.0.250.0060.00615.66
7.0.240.0070.00715.34
7.0.230.0030.01415.35
7.0.220.0000.01715.57
7.0.210.0120.00615.45
7.0.200.0090.00315.77
7.0.190.0100.00715.54
7.0.180.0000.01415.55
7.0.170.0070.01015.31
7.0.160.0060.01015.71
7.0.150.0030.01015.60
7.0.140.0120.00315.36
7.0.130.0100.00615.52
7.0.120.0090.00615.50
7.0.110.0060.00315.48
7.0.100.0080.00415.68
7.0.90.0070.00715.64
7.0.80.0090.00615.65
7.0.70.0070.01015.76
7.0.60.0100.00715.75
7.0.50.0090.00015.86
7.0.40.0060.00613.39
7.0.30.0000.01313.71
7.0.20.0030.00613.56
7.0.10.0000.01213.84
7.0.00.0030.00613.73
5.6.400.0060.00314.67
5.6.390.0040.00814.74
5.6.380.0100.00314.43
5.6.370.0030.00614.51
5.6.360.0030.01014.73
5.6.350.0000.01114.29
5.6.340.0000.01414.20
5.6.330.0030.01414.59
5.6.320.0060.00614.41
5.6.310.0100.00614.55
5.6.300.0070.00714.32
5.6.290.0030.01414.28
5.6.280.0060.00914.40
5.6.270.0070.01014.42
5.6.260.0040.00414.55
5.6.250.0070.00714.72
5.6.240.0030.01014.42
5.6.230.0120.00314.47
5.6.220.0090.00614.38
5.6.210.0100.00314.19
5.6.200.0030.00714.60
5.6.190.0040.00814.64
5.6.180.0090.00314.28
5.6.170.0000.01214.44
5.6.160.0070.01014.25
5.6.150.0090.00314.32
5.6.140.0040.00814.54
5.6.130.0150.00414.30
5.6.120.0000.01514.37
5.6.110.0040.00414.29
5.6.100.0110.00014.18
5.6.90.0030.00614.59
5.6.80.0100.00014.34
5.6.70.0000.00914.23
5.6.60.0000.00714.12
5.6.50.0130.00014.44
5.6.40.0000.01414.04
5.6.30.0090.00314.43
5.6.20.0060.00314.35
5.6.10.0040.01114.23
5.6.00.0030.01014.38

preferences:
63.35 ms | 400 KiB | 5 Q