3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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_mar) { echo "The date $currentDate is in March";} elseif($timestamp >= $current && $timestamp <= $end_apr) { echo "The date $currentDate is in April";} elseif($timestamp >= $current && $timestamp <= $end_may) { echo "The date $currentDate is in May";} elseif($timestamp >= $current && $timestamp <= $end_jun) { echo "The date $currentDate is in June";} elseif($timestamp >= $current && $timestamp <= $end_jul) { echo "The date $currentDate is in July";} elseif($timestamp >= $current && $timestamp <= $end_aug) { echo "The date $currentDate is in August";} elseif($timestamp >= $current && $timestamp <= $end_sep) { echo "The date $currentDate is in September";} elseif($timestamp >= $current && $timestamp <= $end_oct) { echo "The date $currentDate is in October";} elseif($timestamp >= $current && $timestamp <= $end_nov) { echo "The date $currentDate is in November";} elseif($timestamp >= $current && $timestamp <= $end_dec) { echo "The date $currentDate is in December";} else { echo "Something has gone wrong!"; }
Output for 4.3.0 - 5.6.24, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
The date 01/15/2014 is in January