<?php
$today=date('m');
echo $today."<br>";
$year=date('Y');
$months=$year."-".$today."-01";
echo $months; 
echo date('m', strtotime($months .'-1 months'));
echo "<br>";
echo date('m', strtotime($months .'-2 months'));
?>