Get last date or total number of days in PHP

Do you want to find out the last date of the month in PHP. Here is a simple way by providing the valid date. It then takes the month from the date provided and returns the result.

1] Example to find out last date from the Month of the date parsed

     $date = '2016-05-05';
     echo date('Y-m-t', strtotime($date));


2] Example to find out total number of days from Month of the date parsed

     $date = '2016-05-05';
     echo date('t', strtotime($date));


You can also test with the following dates such as..

$date = 'February'; // Or
$date = 'today'; //Or
$date = "this month"; //..etc.