3v4l.org

run code in 300+ PHP versions simultaneously
<?php function RS_GET_DATE_WITH_DAYNAME_POSITION_FORMAT($day_name, $position = 'future', $format = 'Y-m-d H:i:s', $today_is_past = true) { $day = ucfirst($day_name); $today_name = date('l', time()); $today = date($format, time()); $next = date($format, strtotime('next '.$day_name)); $last = date($format, strtotime('last '.$day_name)); if($today_name == $day_name) { return date($format, time()); } else if(abs(time()-strtotime('next '.$day_name)) < abs(time()-strtotime('last '.$day_name))) { return date($format, strtotime('next '.$day_name)); } else { return date($format, strtotime('last '.$day_name)); } if($position == 'future') { if($today_name != $day_name) { return $next; } else { if($today_is_past) return $next; else return $today; } } else { if($today_name != $day_name) { return $last; } else { if($today_is_past) return $today; else return $last; } } } echo RS_GET_DATE_WITH_DAYNAME_POSITION_FORMAT('Sunday', 'future');

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)
7.3.10.0000.01416.56
7.3.00.0040.00816.60
7.2.130.0080.00316.99
7.2.120.0070.00717.18
7.2.110.0100.00317.02
7.2.100.0100.00317.21
7.2.90.0030.01016.89
7.2.80.0000.01016.86
7.2.70.0040.01116.92
7.2.60.0030.01017.24
7.2.50.0070.00617.08
7.2.40.0000.01516.90
7.2.30.0070.00717.27
7.2.20.0100.00716.97
7.2.10.0070.00417.25
7.2.00.0070.00518.17
7.1.250.0030.00616.00
7.1.240.0030.01015.91
7.1.230.0050.00516.00
7.1.220.0110.00315.80
7.1.210.0100.00015.82
7.1.200.0050.00816.00
7.1.190.0040.01116.06
7.1.180.0000.01115.91
7.1.170.0030.01316.09
7.1.160.0030.00615.87
7.1.150.0100.00315.88
7.1.140.0030.01016.09
7.1.130.0100.00715.99
7.1.120.0110.00415.75
7.1.110.0080.00316.11
7.1.100.0070.00715.93
7.1.90.0040.01215.85
7.1.80.0070.00716.14
7.1.70.0030.00916.75
7.1.60.0050.00516.63
7.1.50.0080.00516.69
7.1.40.0040.01115.70
7.1.30.0040.01115.97
7.1.20.0030.00716.04
7.1.10.0100.00315.77
7.1.00.0020.03719.05
7.0.330.0040.00815.39
7.0.320.0090.00315.27
7.0.310.0090.00615.11
7.0.300.0060.00315.41
7.0.290.0000.01515.42
7.0.280.0080.00415.12
7.0.270.0060.00915.25
7.0.260.0000.01215.29
7.0.250.0090.00315.24
7.0.240.0140.00015.35
7.0.230.0100.00015.41
7.0.220.0060.00615.27
7.0.210.0030.01015.58
7.0.200.0050.01016.13
7.0.190.0080.00015.66
7.0.180.0060.00615.37
7.0.170.0030.01015.74
7.0.160.0060.00315.50
7.0.150.0080.00415.25
7.0.140.0020.04018.79
7.0.130.0120.00315.49
7.0.120.0040.01718.78
7.0.110.0100.00015.51
7.0.100.0000.00715.22
7.0.90.0060.00615.65
7.0.80.0090.03217.73
7.0.70.0090.01517.60
7.0.60.0080.02517.75
7.0.50.0130.03017.96
7.0.40.0080.03816.77
7.0.30.0060.04116.72
7.0.20.0070.02216.78
7.0.10.0030.02816.83
7.0.00.0000.02916.90
5.6.380.0000.01214.31
5.6.370.0140.00314.18
5.6.360.0050.00514.43
5.6.350.0030.01014.24
5.6.340.0090.00614.23
5.6.330.0030.00614.27
5.6.320.0070.00714.31
5.6.310.0070.01014.39
5.6.300.0090.00314.37
5.6.290.0060.00614.22
5.6.280.0040.04017.51
5.6.270.0030.00714.45
5.6.260.0030.00914.23
5.6.250.0080.00014.05
5.6.240.0040.00414.46
5.6.230.0020.02517.38
5.6.220.0030.02217.44
5.6.210.0080.02017.37
5.6.200.0080.01917.77
5.6.190.0080.02317.82
5.6.180.0050.02217.72
5.6.170.0080.04417.85
5.6.160.0030.02417.83
5.6.150.0080.02317.63
5.6.140.0070.04317.78
5.6.130.0080.04017.85
5.6.120.0070.02417.71
5.6.110.0010.02817.98
5.6.100.0040.04417.95
5.6.90.0030.03717.67
5.6.80.0100.03517.34
5.6.70.0030.02517.32
5.6.60.0100.03517.46
5.6.50.0030.02917.21
5.6.40.0030.02517.19
5.6.30.0030.03817.26
5.6.20.0050.02017.22
5.6.10.0050.02417.34
5.6.00.0050.02217.36
5.5.380.0030.01011.64
5.5.370.0050.02116.00
5.5.360.0060.01816.03
5.5.350.0020.02516.01
5.5.340.0050.02216.26
5.5.330.0000.02216.26
5.5.320.0030.03216.26
5.5.310.0070.03216.22
5.5.300.0000.02416.23
5.5.290.0080.03316.28
5.5.280.0060.02316.27
5.5.270.0050.02316.26
5.5.260.0030.02716.24
5.5.250.0070.02516.11
5.5.240.0080.04315.97
5.5.230.0030.02215.95
5.5.220.0040.02015.88
5.5.210.0060.02615.97
5.5.200.0100.03315.90
5.5.190.0080.02715.88
5.5.180.0030.02315.90
5.5.170.0030.00511.64
5.5.160.0000.04315.91
5.5.150.0080.03215.96
5.5.140.0030.04315.93
5.5.130.0050.02315.89
5.5.120.0040.02415.93
5.5.110.0030.02115.81
5.5.100.0060.01915.86
5.5.90.0050.02215.90
5.5.80.0050.02015.87
5.5.70.0020.02515.79
5.5.60.0060.01815.82
5.5.50.0050.02715.90
5.5.40.0030.02315.78
5.5.30.0060.01815.90
5.5.20.0040.02115.78
5.5.10.0000.02715.88
5.5.00.0060.02515.84
5.4.450.0080.03315.41
5.4.440.0050.02215.54
5.4.430.0020.03415.54
5.4.420.0050.02215.46
5.4.410.0020.02415.45
5.4.400.0050.03715.33
5.4.390.0030.01915.33
5.4.380.0070.02815.29
5.4.370.0020.01915.36
5.4.360.0020.04015.38
5.4.350.0070.02715.31
5.4.340.0030.03715.33
5.4.330.0000.01011.64
5.4.320.0060.03315.38
5.4.310.0090.03615.44
5.4.300.0050.02615.40
5.4.290.0070.01315.43
5.4.280.0040.01715.27
5.4.270.0020.02815.24
5.4.260.0030.03115.42
5.4.250.0030.02215.34
5.4.240.0040.02715.33
5.4.230.0020.03215.38
5.4.220.0020.02015.34
5.4.210.0020.03515.38
5.4.200.0060.02015.33
5.4.190.0030.02915.38
5.4.180.0020.03515.24
5.4.170.0080.02515.43
5.4.160.0020.02615.29
5.4.150.0020.02115.35
5.4.140.0030.04014.04
5.4.130.0100.02514.02
5.4.120.0000.02414.04
5.4.110.0070.03814.00
5.4.100.0070.03313.98
5.4.90.0050.01914.04
5.4.80.0000.02214.04
5.4.70.0070.01814.04
5.4.60.0100.02513.94
5.4.50.0050.02214.00
5.4.40.0020.02714.08
5.4.30.0100.01614.04
5.4.20.0030.02314.01
5.4.10.0030.03813.98
5.4.00.0050.02013.71
5.3.290.0030.02013.17
5.3.280.0030.04113.13
5.3.270.0070.03513.12
5.3.260.0020.04213.09
5.3.250.0050.02213.14
5.3.240.0030.01813.12
5.3.230.0050.04313.11
5.3.220.0030.03913.13
5.3.210.0060.02113.09
5.3.200.0050.02813.07
5.3.190.0000.03613.11
5.3.180.0100.03113.15
5.3.170.0050.03513.16
5.3.160.0050.03013.15
5.3.150.0050.02113.17
5.3.140.0060.03013.11
5.3.130.0030.04313.08
5.3.120.0010.02813.06
5.3.110.0050.03713.13
5.3.100.0010.02612.86
5.3.90.0030.03812.91
5.3.80.0060.02212.89
5.3.70.0030.02312.83
5.3.60.0020.02212.85
5.3.50.0020.02412.82
5.3.40.0040.02212.79
5.3.30.0080.03812.75
5.3.20.0020.02712.63
5.3.10.0030.02512.70
5.3.00.0090.03412.68
5.2.170.0030.02111.40
5.2.160.0010.02911.45
5.2.150.0040.03611.45
5.2.140.0070.02211.40
5.2.130.0060.03111.39
5.2.120.0000.02111.42
5.2.110.0000.04011.33
5.2.100.0020.02011.33
5.2.90.0070.02711.44
5.2.80.0030.02211.43
5.2.70.0000.01711.39
5.2.60.0030.01611.34
5.2.50.0020.01711.34
5.2.40.0030.01511.32
5.2.30.0050.02611.28
5.2.20.0010.01811.31
5.2.10.0030.02211.26
5.2.00.0030.01511.24
5.1.60.0000.02410.87
5.1.50.0070.01910.82
5.1.40.0020.02110.84
5.1.30.0030.02611.03
5.1.20.0020.02211.05
5.1.10.0040.01410.90
5.1.00.0020.02510.92
5.0.50.0060.00810.10
5.0.40.0030.01110.06
5.0.30.0000.0199.86
5.0.20.0020.0189.93
5.0.10.0000.0259.93
5.0.00.0020.0259.92
4.4.90.0000.0109.50
4.4.80.0010.0109.50
4.4.70.0000.0159.50
4.4.60.0030.0179.50
4.4.50.0020.0179.50
4.4.40.0020.0179.50
4.4.30.0010.0119.50
4.4.20.0010.0189.50
4.4.10.0000.0109.50
4.4.00.0020.0139.50
4.3.110.0030.0169.50
4.3.100.0000.0139.50
4.3.90.0020.0099.50
4.3.80.0040.0109.50
4.3.70.0020.0089.50
4.3.60.0030.0149.50
4.3.50.0020.0119.50
4.3.40.0030.0119.50
4.3.30.0020.0109.50
4.3.20.0000.0119.50
4.3.10.0020.0119.50
4.3.00.0000.0179.50

preferences:
28.79 ms | 401 KiB | 5 Q