3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getDay($day) { $days = ['Monday' => 1, 'Tuesday' => 2, 'Wednesday' => 3, 'Thursday' => 4, 'Friday' => 5, 'Saturday' => 6, 'Sunday' => 7]; $today = new \DateTime(); $today->setISODate((int)$today->format('o'), (int)$today->format('W'), $days[ucfirst($day)]); return $today; } var_dump(getDay('Saturday')->format('d F Y')); var_dump(getDay('Sunday')->format('dS F Y'));
Output for 5.4.8 - 5.4.45, 5.6.28, 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
string(17) "26 September 2015" string(19) "27th September 2015"
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 string(17) "26 September 2015" string(19) "27th September 2015"
Output for 5.6.21, 7.0.6
string(11) "07 May 2016" string(13) "08th May 2016"
Output for 5.5.30, 5.6.14 - 5.6.16, 7.0.5
string(13) "02 April 2016" string(15) "03rd April 2016"
Output for 5.5.33, 5.6.19, 7.0.4
string(13) "12 March 2016" string(15) "13th March 2016"
Output for 5.5.32, 5.6.17 - 5.6.18, 7.0.3
string(13) "19 March 2016" string(15) "20th March 2016"
Output for 5.5.31, 7.0.0 - 7.0.2
string(13) "26 March 2016" string(15) "27th March 2016"
Output for 5.6.20
string(13) "09 April 2016" string(15) "10th April 2016"
Output for 5.5.29, 5.5.34, 5.6.13
string(13) "16 April 2016" string(15) "17th April 2016"
Output for 5.5.27 - 5.5.28, 5.6.11 - 5.6.12
string(13) "23 April 2016" string(15) "24th April 2016"
Output for 5.5.25 - 5.5.26, 5.6.8 - 5.6.10
string(13) "30 April 2016" string(13) "01st May 2016"
Output for 5.5.35
string(11) "21 May 2016" string(13) "22nd May 2016"
Output for 5.5.24
string(11) "28 May 2016" string(13) "29th May 2016"
Output for 5.4.1 - 5.4.7
string(15) "31 October 2015" string(18) "01st November 2015"

preferences:
230.27 ms | 401 KiB | 271 Q