3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function firstDayOfWeek($date) { $day = DateTime::createFromFormat('d-m-Y', $date); $day->setISODate((int)$day->format('o'), (int)$day->format('W'), 1); return $day->format('d-m-Y'); } var_dump(firstDayOfWeek('17-07-2017'));
Output for 5.6.30, hhvm-3.15.4 - 3.22.0, 7.0.0 - 7.2.9
string(10) "17-07-2017"