If you want the previous year and month relative to a specific date and have DateTime available then you can do this:
$d = new DateTime('2013-01-01', new DateTimeZone('UTC'));
$d->modify('first day of previous month');
$year = $d->format('Y'); //2012
$month = $d->format('m'); //12