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 - 7.1.0
Notice: Undefined offset: -1 in /in/fnI3a on line 9 Notice: Undefined offset: -2 in /in/fnI3a on line 9 Notice: Undefined offset: -1 in /in/fnI3a on line 9 Result: Nothing found
Output for 5.1.0 - 5.2.17
Notice: Undefined offset: -1 in /in/fnI3a on line 9 Notice: Undefined offset: -2 in /in/fnI3a on line 9 Notice: Undefined offset: -1 in /in/fnI3a on line 9 Result: Nothing found
Output for 5.0.1 - 5.0.5
Notice: Undefined offset: -1 in /in/fnI3a on line 9 Warning: strtotime(): Called with an empty time parameter. in /in/fnI3a on line 9 Notice: Undefined offset: -2 in /in/fnI3a on line 9 Warning: strtotime(): Called with an empty time parameter. in /in/fnI3a on line 9 Notice: Undefined offset: -1 in /in/fnI3a on line 9 Warning: strtotime(): Called with an empty time parameter. in /in/fnI3a on line 9 Result: Nothing found
Output for 4.3.2 - 5.0.0
Notice: Undefined offset: -1 in /in/fnI3a on line 9 Notice: strtotime(): Called with empty time parameter in /in/fnI3a on line 9 Notice: Undefined offset: -2 in /in/fnI3a on line 9 Notice: strtotime(): Called with empty time parameter in /in/fnI3a on line 9 Notice: Undefined offset: -1 in /in/fnI3a on line 9 Notice: strtotime(): Called with empty time parameter in /in/fnI3a on line 9 Result: Nothing found
Output for 4.3.0 - 4.3.1
Notice: Undefined offset: -1 in /in/fnI3a on line 9 Notice: strtotime() [http://www.php.net/function.strtotime]: Called with empty time parameter in /in/fnI3a on line 9 Notice: Undefined offset: -2 in /in/fnI3a on line 9 Notice: strtotime() [http://www.php.net/function.strtotime]: Called with empty time parameter in /in/fnI3a on line 9 Notice: Undefined offset: -1 in /in/fnI3a on line 9 Notice: strtotime() [http://www.php.net/function.strtotime]: Called with empty time parameter in /in/fnI3a on line 9 Result: Nothing found