- date: documentation ( source)
- strtotime: documentation ( source)
<?php
echo date(DATE_RFC2822, strtotime('first day of last month midnight')) . "\n";
echo date(DATE_RFC2822, strtotime('first day of this month midnight')) . "\n";
echo date(DATE_RFC2822, strtotime('last day of this month midnight')) . "\n";