3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function getDay($day) { $days = ['Monday' => 1, 'Tuesday' => 2, 'Wednesday' => 3, 'Thursday' => 4, 'Friday' => 5, 'Saturday' => 6, 'Sunday' => 7]; $today = new \DateTime(); $today->setISODate($today->format('o'), $today->format('W'), $days[ucfirst($day)]); return $today; } var_dump(getDay('Monday')); $fulldate = getDay('Friday')->format('y') ."-".getDay('Friday')->format('m') ."-". getDay('Friday')->format('d'); var_dump($fulldate);
Output for 7.1.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-06-02 11:45:39.004098" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "14-06-06"
Output for 5.6.28, 7.0.14
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-06-02 11:45:39.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "14-06-06"
Output for 7.0.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-02 03:26:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-05-06"
Output for 7.0.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-28 16:39:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-01"
Output for 7.0.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-07 02:18:40.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-03-11"
Output for 7.0.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-14 02:31:15.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-03-18"
Output for 7.0.2
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-21 13:04:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-03-25"
Output for 7.0.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-21 13:17:31.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-03-25"
Output for 7.0.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-21 15:40:48.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-03-25"
Output for hhvm-3.12.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-07 08:04:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-03-11"
Output for hhvm-3.10.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-28 21:41:10.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-01"
Output for 5.6.21
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-25 22:29:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-29"
Output for 5.6.20
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-04 11:52:36.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-08"
Output for 5.6.19
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-07 01:01:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-03-11"
Output for 5.6.18
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-14 12:56:30.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-03-18"
Output for 5.6.17
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-14 06:59:37.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-03-18"
Output for 5.6.16
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-21 17:26:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-03-25"
Output for 5.6.15
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-28 18:18:48.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-01"
Output for 5.6.14
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-28 20:54:24.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-01"
Output for 5.6.13
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 00:51:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-15"
Output for 5.6.12
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-18 13:56:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-22"
Output for 5.6.11
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-18 21:13:01.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-22"
Output for 5.6.10
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-18 22:51:10.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-22"
Output for 5.6.9
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-25 04:03:30.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-29"
Output for 5.6.8
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-25 11:46:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-29"
Output for 5.6.7
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-23 23:10:10.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-05-27"
Output for 5.5.35
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-16 01:53:22.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-05-20"
Output for 5.5.34
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-04 17:49:42.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-08"
Output for 5.5.33
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-07 13:10:51.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-03-11"
Output for 5.5.32
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-14 18:53:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-03-18"
Output for 5.5.31
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-14 09:51:30.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-03-18"
Output for 5.5.30
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-28 20:20:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-01"
Output for 5.5.29
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-11 14:52:29.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-15"
Output for 5.5.28
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-18 17:14:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-22"
Output for 5.5.27
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-18 19:41:48.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-22"
Output for 5.5.26
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-25 01:20:35.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-29"
Output for 5.5.25
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-25 07:20:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-29"
Output for 5.5.24
object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-25 14:45:39.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "16-04-29"
Output for 5.4.42 - 5.4.45
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-10-12 13:09:45.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "15-10-16"
Output for 5.4.38 - 5.4.41
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-10-12 13:09:46.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "15-10-16"
Output for 5.4.34 - 5.4.37
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-10-12 13:09:47.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "15-10-16"
Output for 5.4.30 - 5.4.32
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-10-12 13:09:48.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "15-10-16"
Output for 5.4.29
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-12 13:09:48" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "15-10-16"
Output for 5.4.26 - 5.4.28
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-12 13:09:49" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "15-10-16"
Output for 5.4.23 - 5.4.25
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-12 13:09:50" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "15-10-16"
Output for 5.4.19 - 5.4.22
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-12 13:09:51" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "15-10-16"
Output for 5.4.16 - 5.4.18
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-12 13:09:52" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "15-10-16"
Output for 5.4.12 - 5.4.15
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-12 13:09:53" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "15-10-16"
Output for 5.4.9 - 5.4.11
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-12 13:09:54" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "15-10-16"
Output for 5.4.5 - 5.4.8
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-12 13:09:55" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "15-10-16"
Output for 5.4.0 - 5.4.4
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-10-12 13:09:56" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(8) "15-10-16"
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/r1NtZ on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/r1NtZ on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/r1NtZ on line 4
Process exited with code 255.