3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function daysInWeek($weekNum) { $result = array(); $datetime = new DateTime(); $datetime->setISODate((int)$datetime->format('Y'), $weekNum, 1); $interval = new DateInterval('P1D'); $week = new DatePeriod($datetime, $interval, 6); foreach($week as $day){ $result[] = $day->format('D d m Y H:i:s'); } return $result; } var_dump(daysInWeek(24));
Output for 5.6.28, 7.0.14 - 7.1.0
array(7) { [0]=> string(23) "Mon 09 06 2014 05:44:51" [1]=> string(23) "Tue 10 06 2014 05:44:51" [2]=> string(23) "Wed 11 06 2014 05:44:51" [3]=> string(23) "Thu 12 06 2014 05:44:51" [4]=> string(23) "Fri 13 06 2014 05:44:51" [5]=> string(23) "Sat 14 06 2014 05:44:51" [6]=> string(23) "Sun 15 06 2014 05:44:51" }
Output for 7.0.6
array(7) { [0]=> string(23) "Mon 13 06 2016 15:31:20" [1]=> string(23) "Tue 14 06 2016 15:31:20" [2]=> string(23) "Wed 15 06 2016 15:31:20" [3]=> string(23) "Thu 16 06 2016 15:31:20" [4]=> string(23) "Fri 17 06 2016 15:31:20" [5]=> string(23) "Sat 18 06 2016 15:31:20" [6]=> string(23) "Sun 19 06 2016 15:31:20" }
Output for 7.0.5
array(7) { [0]=> string(23) "Mon 13 06 2016 04:06:59" [1]=> string(23) "Tue 14 06 2016 04:06:59" [2]=> string(23) "Wed 15 06 2016 04:06:59" [3]=> string(23) "Thu 16 06 2016 04:06:59" [4]=> string(23) "Fri 17 06 2016 04:06:59" [5]=> string(23) "Sat 18 06 2016 04:06:59" [6]=> string(23) "Sun 19 06 2016 04:06:59" }
Output for 7.0.4
array(7) { [0]=> string(23) "Mon 13 06 2016 15:32:09" [1]=> string(23) "Tue 14 06 2016 15:32:09" [2]=> string(23) "Wed 15 06 2016 15:32:09" [3]=> string(23) "Thu 16 06 2016 15:32:09" [4]=> string(23) "Fri 17 06 2016 15:32:09" [5]=> string(23) "Sat 18 06 2016 15:32:09" [6]=> string(23) "Sun 19 06 2016 15:32:09" }
Output for 7.0.3
array(7) { [0]=> string(23) "Mon 13 06 2016 16:12:51" [1]=> string(23) "Tue 14 06 2016 16:12:51" [2]=> string(23) "Wed 15 06 2016 16:12:51" [3]=> string(23) "Thu 16 06 2016 16:12:51" [4]=> string(23) "Fri 17 06 2016 16:12:51" [5]=> string(23) "Sat 18 06 2016 16:12:51" [6]=> string(23) "Sun 19 06 2016 16:12:51" }
Output for 7.0.2
array(7) { [0]=> string(23) "Mon 13 06 2016 22:18:45" [1]=> string(23) "Tue 14 06 2016 22:18:45" [2]=> string(23) "Wed 15 06 2016 22:18:45" [3]=> string(23) "Thu 16 06 2016 22:18:45" [4]=> string(23) "Fri 17 06 2016 22:18:45" [5]=> string(23) "Sat 18 06 2016 22:18:45" [6]=> string(23) "Sun 19 06 2016 22:18:45" }
Output for 7.0.1
array(7) { [0]=> string(23) "Mon 13 06 2016 02:38:54" [1]=> string(23) "Tue 14 06 2016 02:38:54" [2]=> string(23) "Wed 15 06 2016 02:38:54" [3]=> string(23) "Thu 16 06 2016 02:38:54" [4]=> string(23) "Fri 17 06 2016 02:38:54" [5]=> string(23) "Sat 18 06 2016 02:38:54" [6]=> string(23) "Sun 19 06 2016 02:38:54" }
Output for 7.0.0
array(7) { [0]=> string(23) "Mon 13 06 2016 04:37:40" [1]=> string(23) "Tue 14 06 2016 04:37:40" [2]=> string(23) "Wed 15 06 2016 04:37:40" [3]=> string(23) "Thu 16 06 2016 04:37:40" [4]=> string(23) "Fri 17 06 2016 04:37:40" [5]=> string(23) "Sat 18 06 2016 04:37:40" [6]=> string(23) "Sun 19 06 2016 04:37:40" }
Output for 5.6.21
array(7) { [0]=> string(23) "Mon 13 06 2016 10:42:46" [1]=> string(23) "Tue 14 06 2016 10:42:46" [2]=> string(23) "Wed 15 06 2016 10:42:46" [3]=> string(23) "Thu 16 06 2016 10:42:46" [4]=> string(23) "Fri 17 06 2016 10:42:46" [5]=> string(23) "Sat 18 06 2016 10:42:46" [6]=> string(23) "Sun 19 06 2016 10:42:46" }
Output for 5.6.20
array(7) { [0]=> string(23) "Mon 13 06 2016 03:03:23" [1]=> string(23) "Tue 14 06 2016 03:03:23" [2]=> string(23) "Wed 15 06 2016 03:03:23" [3]=> string(23) "Thu 16 06 2016 03:03:23" [4]=> string(23) "Fri 17 06 2016 03:03:23" [5]=> string(23) "Sat 18 06 2016 03:03:23" [6]=> string(23) "Sun 19 06 2016 03:03:23" }
Output for 5.6.19
array(7) { [0]=> string(23) "Mon 13 06 2016 23:16:00" [1]=> string(23) "Tue 14 06 2016 23:16:00" [2]=> string(23) "Wed 15 06 2016 23:16:00" [3]=> string(23) "Thu 16 06 2016 23:16:00" [4]=> string(23) "Fri 17 06 2016 23:16:00" [5]=> string(23) "Sat 18 06 2016 23:16:00" [6]=> string(23) "Sun 19 06 2016 23:16:00" }
Output for 5.6.18
array(7) { [0]=> string(23) "Mon 13 06 2016 08:09:06" [1]=> string(23) "Tue 14 06 2016 08:09:06" [2]=> string(23) "Wed 15 06 2016 08:09:06" [3]=> string(23) "Thu 16 06 2016 08:09:06" [4]=> string(23) "Fri 17 06 2016 08:09:06" [5]=> string(23) "Sat 18 06 2016 08:09:06" [6]=> string(23) "Sun 19 06 2016 08:09:06" }
Output for 5.6.17
array(7) { [0]=> string(23) "Mon 13 06 2016 20:05:16" [1]=> string(23) "Tue 14 06 2016 20:05:16" [2]=> string(23) "Wed 15 06 2016 20:05:16" [3]=> string(23) "Thu 16 06 2016 20:05:16" [4]=> string(23) "Fri 17 06 2016 20:05:16" [5]=> string(23) "Sat 18 06 2016 20:05:16" [6]=> string(23) "Sun 19 06 2016 20:05:16" }
Output for 5.6.16
array(7) { [0]=> string(23) "Mon 13 06 2016 05:26:47" [1]=> string(23) "Tue 14 06 2016 05:26:47" [2]=> string(23) "Wed 15 06 2016 05:26:47" [3]=> string(23) "Thu 16 06 2016 05:26:47" [4]=> string(23) "Fri 17 06 2016 05:26:47" [5]=> string(23) "Sat 18 06 2016 05:26:47" [6]=> string(23) "Sun 19 06 2016 05:26:47" }
Output for 5.6.15
array(7) { [0]=> string(23) "Mon 13 06 2016 06:19:06" [1]=> string(23) "Tue 14 06 2016 06:19:06" [2]=> string(23) "Wed 15 06 2016 06:19:06" [3]=> string(23) "Thu 16 06 2016 06:19:06" [4]=> string(23) "Fri 17 06 2016 06:19:06" [5]=> string(23) "Sat 18 06 2016 06:19:06" [6]=> string(23) "Sun 19 06 2016 06:19:06" }
Output for 5.6.14
array(7) { [0]=> string(23) "Mon 13 06 2016 08:20:00" [1]=> string(23) "Tue 14 06 2016 08:20:00" [2]=> string(23) "Wed 15 06 2016 08:20:00" [3]=> string(23) "Thu 16 06 2016 08:20:00" [4]=> string(23) "Fri 17 06 2016 08:20:00" [5]=> string(23) "Sat 18 06 2016 08:20:00" [6]=> string(23) "Sun 19 06 2016 08:20:00" }
Output for 5.6.13
array(7) { [0]=> string(23) "Mon 13 06 2016 12:31:57" [1]=> string(23) "Tue 14 06 2016 12:31:57" [2]=> string(23) "Wed 15 06 2016 12:31:57" [3]=> string(23) "Thu 16 06 2016 12:31:57" [4]=> string(23) "Fri 17 06 2016 12:31:57" [5]=> string(23) "Sat 18 06 2016 12:31:57" [6]=> string(23) "Sun 19 06 2016 12:31:57" }
Output for 5.6.12
array(7) { [0]=> string(23) "Mon 13 06 2016 02:53:22" [1]=> string(23) "Tue 14 06 2016 02:53:22" [2]=> string(23) "Wed 15 06 2016 02:53:22" [3]=> string(23) "Thu 16 06 2016 02:53:22" [4]=> string(23) "Fri 17 06 2016 02:53:22" [5]=> string(23) "Sat 18 06 2016 02:53:22" [6]=> string(23) "Sun 19 06 2016 02:53:22" }
Output for 5.6.11
array(7) { [0]=> string(23) "Mon 13 06 2016 09:27:37" [1]=> string(23) "Tue 14 06 2016 09:27:37" [2]=> string(23) "Wed 15 06 2016 09:27:37" [3]=> string(23) "Thu 16 06 2016 09:27:37" [4]=> string(23) "Fri 17 06 2016 09:27:37" [5]=> string(23) "Sat 18 06 2016 09:27:37" [6]=> string(23) "Sun 19 06 2016 09:27:37" }
Output for 5.6.10
array(7) { [0]=> string(23) "Mon 13 06 2016 11:20:52" [1]=> string(23) "Tue 14 06 2016 11:20:52" [2]=> string(23) "Wed 15 06 2016 11:20:52" [3]=> string(23) "Thu 16 06 2016 11:20:52" [4]=> string(23) "Fri 17 06 2016 11:20:52" [5]=> string(23) "Sat 18 06 2016 11:20:52" [6]=> string(23) "Sun 19 06 2016 11:20:52" }
Output for 5.6.9
array(7) { [0]=> string(23) "Mon 13 06 2016 16:27:10" [1]=> string(23) "Tue 14 06 2016 16:27:10" [2]=> string(23) "Wed 15 06 2016 16:27:10" [3]=> string(23) "Thu 16 06 2016 16:27:10" [4]=> string(23) "Fri 17 06 2016 16:27:10" [5]=> string(23) "Sat 18 06 2016 16:27:10" [6]=> string(23) "Sun 19 06 2016 16:27:10" }
Output for 5.6.8
array(7) { [0]=> string(23) "Mon 13 06 2016 01:07:26" [1]=> string(23) "Tue 14 06 2016 01:07:26" [2]=> string(23) "Wed 15 06 2016 01:07:26" [3]=> string(23) "Thu 16 06 2016 01:07:26" [4]=> string(23) "Fri 17 06 2016 01:07:26" [5]=> string(23) "Sat 18 06 2016 01:07:26" [6]=> string(23) "Sun 19 06 2016 01:07:26" }
Output for 5.5.35
array(7) { [0]=> string(23) "Mon 13 06 2016 15:23:09" [1]=> string(23) "Tue 14 06 2016 15:23:09" [2]=> string(23) "Wed 15 06 2016 15:23:09" [3]=> string(23) "Thu 16 06 2016 15:23:09" [4]=> string(23) "Fri 17 06 2016 15:23:09" [5]=> string(23) "Sat 18 06 2016 15:23:09" [6]=> string(23) "Sun 19 06 2016 15:23:09" }
Output for 5.5.34
array(7) { [0]=> string(23) "Mon 13 06 2016 05:18:24" [1]=> string(23) "Tue 14 06 2016 05:18:24" [2]=> string(23) "Wed 15 06 2016 05:18:24" [3]=> string(23) "Thu 16 06 2016 05:18:24" [4]=> string(23) "Fri 17 06 2016 05:18:24" [5]=> string(23) "Sat 18 06 2016 05:18:24" [6]=> string(23) "Sun 19 06 2016 05:18:24" }
Output for 5.5.33
array(7) { [0]=> string(23) "Mon 13 06 2016 02:21:11" [1]=> string(23) "Tue 14 06 2016 02:21:11" [2]=> string(23) "Wed 15 06 2016 02:21:11" [3]=> string(23) "Thu 16 06 2016 02:21:11" [4]=> string(23) "Fri 17 06 2016 02:21:11" [5]=> string(23) "Sat 18 06 2016 02:21:11" [6]=> string(23) "Sun 19 06 2016 02:21:11" }
Output for 5.5.32
array(7) { [0]=> string(23) "Mon 13 06 2016 11:41:18" [1]=> string(23) "Tue 14 06 2016 11:41:18" [2]=> string(23) "Wed 15 06 2016 11:41:18" [3]=> string(23) "Thu 16 06 2016 11:41:18" [4]=> string(23) "Fri 17 06 2016 11:41:18" [5]=> string(23) "Sat 18 06 2016 11:41:18" [6]=> string(23) "Sun 19 06 2016 11:41:18" }
Output for 5.5.31
array(7) { [0]=> string(23) "Mon 13 06 2016 22:50:32" [1]=> string(23) "Tue 14 06 2016 22:50:32" [2]=> string(23) "Wed 15 06 2016 22:50:32" [3]=> string(23) "Thu 16 06 2016 22:50:32" [4]=> string(23) "Fri 17 06 2016 22:50:32" [5]=> string(23) "Sat 18 06 2016 22:50:32" [6]=> string(23) "Sun 19 06 2016 22:50:32" }
Output for 5.5.30
array(7) { [0]=> string(23) "Mon 13 06 2016 08:12:36" [1]=> string(23) "Tue 14 06 2016 08:12:36" [2]=> string(23) "Wed 15 06 2016 08:12:36" [3]=> string(23) "Thu 16 06 2016 08:12:36" [4]=> string(23) "Fri 17 06 2016 08:12:36" [5]=> string(23) "Sat 18 06 2016 08:12:36" [6]=> string(23) "Sun 19 06 2016 08:12:36" }
Output for 5.5.29
array(7) { [0]=> string(23) "Mon 13 06 2016 02:52:05" [1]=> string(23) "Tue 14 06 2016 02:52:05" [2]=> string(23) "Wed 15 06 2016 02:52:05" [3]=> string(23) "Thu 16 06 2016 02:52:05" [4]=> string(23) "Fri 17 06 2016 02:52:05" [5]=> string(23) "Sat 18 06 2016 02:52:05" [6]=> string(23) "Sun 19 06 2016 02:52:05" }
Output for 5.5.28
array(7) { [0]=> string(23) "Mon 13 06 2016 06:04:26" [1]=> string(23) "Tue 14 06 2016 06:04:26" [2]=> string(23) "Wed 15 06 2016 06:04:26" [3]=> string(23) "Thu 16 06 2016 06:04:26" [4]=> string(23) "Fri 17 06 2016 06:04:26" [5]=> string(23) "Sat 18 06 2016 06:04:26" [6]=> string(23) "Sun 19 06 2016 06:04:26" }
Output for 5.5.27
array(7) { [0]=> string(23) "Mon 13 06 2016 08:05:20" [1]=> string(23) "Tue 14 06 2016 08:05:20" [2]=> string(23) "Wed 15 06 2016 08:05:20" [3]=> string(23) "Thu 16 06 2016 08:05:20" [4]=> string(23) "Fri 17 06 2016 08:05:20" [5]=> string(23) "Sat 18 06 2016 08:05:20" [6]=> string(23) "Sun 19 06 2016 08:05:20" }
Output for 5.5.26
array(7) { [0]=> string(23) "Mon 13 06 2016 13:59:25" [1]=> string(23) "Tue 14 06 2016 13:59:25" [2]=> string(23) "Wed 15 06 2016 13:59:25" [3]=> string(23) "Thu 16 06 2016 13:59:25" [4]=> string(23) "Fri 17 06 2016 13:59:25" [5]=> string(23) "Sat 18 06 2016 13:59:25" [6]=> string(23) "Sun 19 06 2016 13:59:25" }
Output for 5.5.25
array(7) { [0]=> string(23) "Mon 13 06 2016 20:36:21" [1]=> string(23) "Tue 14 06 2016 20:36:21" [2]=> string(23) "Wed 15 06 2016 20:36:21" [3]=> string(23) "Thu 16 06 2016 20:36:21" [4]=> string(23) "Fri 17 06 2016 20:36:21" [5]=> string(23) "Sat 18 06 2016 20:36:21" [6]=> string(23) "Sun 19 06 2016 20:36:21" }
Output for 5.5.24
array(7) { [0]=> string(23) "Mon 13 06 2016 03:35:47" [1]=> string(23) "Tue 14 06 2016 03:35:47" [2]=> string(23) "Wed 15 06 2016 03:35:47" [3]=> string(23) "Thu 16 06 2016 03:35:47" [4]=> string(23) "Fri 17 06 2016 03:35:47" [5]=> string(23) "Sat 18 06 2016 03:35:47" [6]=> string(23) "Sun 19 06 2016 03:35:47" }
Output for 5.4.39 - 5.4.45
array(7) { [0]=> string(23) "Mon 08 06 2015 10:01:22" [1]=> string(23) "Tue 09 06 2015 10:01:22" [2]=> string(23) "Wed 10 06 2015 10:01:22" [3]=> string(23) "Thu 11 06 2015 10:01:22" [4]=> string(23) "Fri 12 06 2015 10:01:22" [5]=> string(23) "Sat 13 06 2015 10:01:22" [6]=> string(23) "Sun 14 06 2015 10:01:22" }
Output for 5.4.29 - 5.4.38
array(7) { [0]=> string(23) "Mon 08 06 2015 10:01:23" [1]=> string(23) "Tue 09 06 2015 10:01:23" [2]=> string(23) "Wed 10 06 2015 10:01:23" [3]=> string(23) "Thu 11 06 2015 10:01:23" [4]=> string(23) "Fri 12 06 2015 10:01:23" [5]=> string(23) "Sat 13 06 2015 10:01:23" [6]=> string(23) "Sun 14 06 2015 10:01:23" }
Output for 5.4.21 - 5.4.28
array(7) { [0]=> string(23) "Mon 08 06 2015 10:01:24" [1]=> string(23) "Tue 09 06 2015 10:01:24" [2]=> string(23) "Wed 10 06 2015 10:01:24" [3]=> string(23) "Thu 11 06 2015 10:01:24" [4]=> string(23) "Fri 12 06 2015 10:01:24" [5]=> string(23) "Sat 13 06 2015 10:01:24" [6]=> string(23) "Sun 14 06 2015 10:01:24" }
Output for 5.4.11 - 5.4.20
array(7) { [0]=> string(23) "Mon 08 06 2015 10:01:25" [1]=> string(23) "Tue 09 06 2015 10:01:25" [2]=> string(23) "Wed 10 06 2015 10:01:25" [3]=> string(23) "Thu 11 06 2015 10:01:25" [4]=> string(23) "Fri 12 06 2015 10:01:25" [5]=> string(23) "Sat 13 06 2015 10:01:25" [6]=> string(23) "Sun 14 06 2015 10:01:25" }
Output for 5.4.2 - 5.4.10
array(7) { [0]=> string(23) "Mon 08 06 2015 10:01:26" [1]=> string(23) "Tue 09 06 2015 10:01:26" [2]=> string(23) "Wed 10 06 2015 10:01:26" [3]=> string(23) "Thu 11 06 2015 10:01:26" [4]=> string(23) "Fri 12 06 2015 10:01:26" [5]=> string(23) "Sat 13 06 2015 10:01:26" [6]=> string(23) "Sun 14 06 2015 10:01:26" }
Output for 5.3.24 - 5.4.1
array(7) { [0]=> string(23) "Mon 08 06 2015 10:01:27" [1]=> string(23) "Tue 09 06 2015 10:01:27" [2]=> string(23) "Wed 10 06 2015 10:01:27" [3]=> string(23) "Thu 11 06 2015 10:01:27" [4]=> string(23) "Fri 12 06 2015 10:01:27" [5]=> string(23) "Sat 13 06 2015 10:01:27" [6]=> string(23) "Sun 14 06 2015 10:01:27" }
Output for 5.3.15 - 5.3.23
array(7) { [0]=> string(23) "Mon 08 06 2015 10:01:28" [1]=> string(23) "Tue 09 06 2015 10:01:28" [2]=> string(23) "Wed 10 06 2015 10:01:28" [3]=> string(23) "Thu 11 06 2015 10:01:28" [4]=> string(23) "Fri 12 06 2015 10:01:28" [5]=> string(23) "Sat 13 06 2015 10:01:28" [6]=> string(23) "Sun 14 06 2015 10:01:28" }
Output for 5.3.5 - 5.3.14
array(7) { [0]=> string(23) "Mon 08 06 2015 10:01:29" [1]=> string(23) "Tue 09 06 2015 10:01:29" [2]=> string(23) "Wed 10 06 2015 10:01:29" [3]=> string(23) "Thu 11 06 2015 10:01:29" [4]=> string(23) "Fri 12 06 2015 10:01:29" [5]=> string(23) "Sat 13 06 2015 10:01:29" [6]=> string(23) "Sun 14 06 2015 10:01:29" }
Output for 5.3.0 - 5.3.4
array(7) { [0]=> string(23) "Mon 08 06 2015 10:01:30" [1]=> string(23) "Tue 09 06 2015 10:01:30" [2]=> string(23) "Wed 10 06 2015 10:01:30" [3]=> string(23) "Thu 11 06 2015 10:01:30" [4]=> string(23) "Fri 12 06 2015 10:01:30" [5]=> string(23) "Sat 13 06 2015 10:01:30" [6]=> string(23) "Sun 14 06 2015 10:01:30" }
Output for 5.2.0 - 5.2.17
Fatal error: Class 'DateInterval' not found in /in/JrOua on line 7
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/JrOua on line 5
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/JrOua on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/JrOua on line 5