3v4l.org

run code in 300+ PHP versions simultaneously
<?php //get First day of Month //get Last day of Month $first_day_of_month = strtotime(date('m-01-Y')); $last_day_of_month = strtotime(date('m-t-Y')); echo "First Day of Month: "; echo $first_day_of_month; echo "<br />"; echo "Last Day of Month: "; echo $last_day_of_month; $datetest = array('11-30-2014', '11-31-2014', '11-08-2014', '11-8-2014', '11-9-2014', '11-11-2014', '11-24-2014', '11-1-2014', '10-30-2014', '12-1-2014', '11-1-1997'); echo "<br /><br />\n\n"; foreach ($datetest as $datetesta) { $comp_date = strtotime($datetesta); if (($comp_date >= $first_day_of_month) && ($comp_date <= $last_day_of_month)){ echo "$datetesta :"; echo " Is in Month!"; echo "<br />\n"; } else { echo "$datetesta :"; echo "Not in Month!"; echo "<br />\n"; } }

preferences:
51.02 ms | 402 KiB | 5 Q