3v4l.org

run code in 300+ PHP versions simultaneously
<?php $currentDate = date('m/d/Y'); $end_jan = strtotime('01/31/14'); $end_feb = strtotime('02/28/14'); $end_mar = strtotime('03/31/14'); $end_apr = strtotime('04/30/14'); $end_may = strtotime('05/31/14'); $end_jun = strtotime('06/30/14'); $end_jul = strtotime('07/31/14'); $end_aug = strtotime('08/31/14'); $end_sep = strtotime('09/30/14'); $end_oct = strtotime('10/31/14'); $end_nov = strtotime('11/30/14'); $end_dec = strtotime('12/31/14'); $current = strtotime($currentDate); $timestamp = strtotime($currentDate); if($timestamp >= $current && $timestamp <= $end_jan) { echo "The date $currentDate is in January";} elseif($timestamp >= $current && $timestamp <= $end_feb) { echo "The date $currentDate is in February";} elseif($timestamp >= $current && $timestamp <= $end_feb) { echo "The date $currentDate is in March";} elseif($timestamp >= $current && $timestamp <= $end_feb) { echo "The date $currentDate is in April";} elseif($timestamp >= $current && $timestamp <= $end_feb) { echo "The date $currentDate is in May";} elseif($timestamp >= $current && $timestamp <= $end_feb) { echo "The date $currentDate is in June";} elseif($timestamp >= $current && $timestamp <= $end_feb) { echo "The date $currentDate is in July";} elseif($timestamp >= $current && $timestamp <= $end_feb) { echo "The date $currentDate is in August";} elseif($timestamp >= $current && $timestamp <= $end_feb) { echo "The date $currentDate is in September";} elseif($timestamp >= $current && $timestamp <= $end_feb) { echo "The date $currentDate is in October";} elseif($timestamp >= $current && $timestamp <= $end_feb) { echo "The date $currentDate is in November";} elseif($timestamp >= $current && $timestamp <= $end_feb) { echo "The date $currentDate is in December";} else { echo "Something has gone wrong!"; }
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
The date 01/15/2014 is in January

preferences:
232.11 ms | 406 KiB | 456 Q