Finding Last Day of Previous Month in PHP
echo date('Y-m-d', strtotime('last day of previous month'));
//2012-09-30
or
$date = new DateTime();
$date->modify("last day of previous month");
echo $date->format("Y-m-d");
Later edit: php.net documentation - relative formats for strtotime(), DateTime and date_create()
There is a php function for this.
echo date("t/m/Y", strtotime("last month"));