Currently I'm using <?php echo date('F', strtotime('-1 month')); ?>, which has been working fine but today it the 31st of July, but there are only 30 days in June.
For some reason echo date('F', strtotime('-1 month'))
and echo date('F') return the same month e.g. July. Then echo date('F', strtotime('-2 month')) and echo date('F', strtotime('-3 month')) return May and so on.