- date: documentation ( source)
- strtotime: documentation ( source)
<?php
$day = '2012-10-04';
echo 'last sunday : '.date("Y-m-d",strtotime($day." last Sunday "));
$x=1;
echo date("Y-m-d",strtotime($day." last Sunday ")).'_'.$x;
?>