php get first and last date of month code example
Example 1: get last month php
$currentMonth = date('M');// if number, then date('m');
//Last month
$lastMonth = Date("F", strtotime("first day of previous month");
$nextMonth = Date("F", strtotime("first day of next month");
Example 2: get first day of current month php
<?php
// First day of this month
$d = new DateTime('first day of this month');
echo $d->format('jS, F Y');
?>