3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $thisWeek = new DateTime('@1408706174'); // get the day of the week, Monday = 0, Sunday = 6 $dayOfWeek = ((int)$thisWeek->format('N'))-1; $thisWeek->setTime(0,0,0); // subtract the day of the week to get Monday of this week $thisWeek->modify("-0 days"); // get the timestamp $monday = $thisWeek->format('U'); var_dump($monday);
based on 1RpW4
Output for 5.2.0 - 7.1.0
string(10) "1408665600"
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/lh8k4 on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/lh8k4 on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/lh8k4 on line 2