3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $datesarray = array('2012-10-01', '2012-10-03', '2012-10-04', '2012-10-05', '2012-10-08', '2012-10-09'); $count = 0; $result = "Nothing found"; foreach ($datesarray as $value) { if(strtotime($datesarray[$count]) - strtotime($datesarray[$count-1]) - strtotime($datesarray[$count-2]) == -1349150400) { $result = "3 Consecutive dates found"; } $count++; } echo "Result: $result";
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined offset: -1 in /in/M14Xf on line 8 Notice: Undefined offset: -2 in /in/M14Xf on line 8 Notice: Undefined offset: -1 in /in/M14Xf on line 8 Result: Nothing found
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined index: -1 in /in/M14Xf on line 8 Notice: Undefined index: -2 in /in/M14Xf on line 8 Notice: Undefined index: -1 in /in/M14Xf on line 8 Result: Nothing found
Output for 5.1.0 - 5.2.17
Notice: Undefined offset: -1 in /in/M14Xf on line 8 Notice: Undefined offset: -2 in /in/M14Xf on line 8 Notice: Undefined offset: -1 in /in/M14Xf on line 8 Result: Nothing found
Output for 5.0.1 - 5.0.5
Notice: Undefined offset: -1 in /in/M14Xf on line 8 Warning: strtotime(): Called with an empty time parameter. in /in/M14Xf on line 8 Notice: Undefined offset: -2 in /in/M14Xf on line 8 Warning: strtotime(): Called with an empty time parameter. in /in/M14Xf on line 8 Notice: Undefined offset: -1 in /in/M14Xf on line 8 Warning: strtotime(): Called with an empty time parameter. in /in/M14Xf on line 8 Result: Nothing found
Output for 4.3.2 - 5.0.0
Notice: Undefined offset: -1 in /in/M14Xf on line 8 Notice: strtotime(): Called with empty time parameter in /in/M14Xf on line 8 Notice: Undefined offset: -2 in /in/M14Xf on line 8 Notice: strtotime(): Called with empty time parameter in /in/M14Xf on line 8 Notice: Undefined offset: -1 in /in/M14Xf on line 8 Notice: strtotime(): Called with empty time parameter in /in/M14Xf on line 8 Result: Nothing found
Output for 4.3.0 - 4.3.1
Notice: Undefined offset: -1 in /in/M14Xf on line 8 Notice: strtotime() [http://www.php.net/function.strtotime]: Called with empty time parameter in /in/M14Xf on line 8 Notice: Undefined offset: -2 in /in/M14Xf on line 8 Notice: strtotime() [http://www.php.net/function.strtotime]: Called with empty time parameter in /in/M14Xf on line 8 Notice: Undefined offset: -1 in /in/M14Xf on line 8 Notice: strtotime() [http://www.php.net/function.strtotime]: Called with empty time parameter in /in/M14Xf on line 8 Result: Nothing found