3v4l.org

run code in 300+ PHP versions simultaneously
<?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("-$dayOfWeek days"); // get the timestamp $monday = $thisWeek->format('U'); var_dump($monday);

preferences:
33.56 ms | 402 KiB | 5 Q