3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // http://stackoverflow.com/questions/13128854/php-datetime-class-change-first-day-of-the-week-to-monday?rq=1 $test = new DateTime('2012-11-04'); // 2012-11-05 // I expect to get 2012-10-29 echo $test->modify('Monday this week')->format('Y-m-d');
based on CQgNj
Output for 5.6.28, 7.0.20 - 7.2.0
2012-10-29
Output for 5.3.21 - 5.6.21, 7.0.0 - 7.0.6
2012-11-05