3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = new \DateTime('now'); $a->sub(new DateInterval(sprintf('P%dD', 7 + $a->format('w')))); echo $a->format('Y-m-d');

preferences:
44.92 ms | 402 KiB | 5 Q