3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function dataBr($valor, $formato = 'YYYY-MM-dd') { if (strlen($valor) == 10) { list($dia, $mes, $ano) = explode("/", substr($valor, 0, 10)); if (checkdate($mes, $dia, $ano)) return $ano . "-" . $mes . "-" . $dia; else return "NULL"; } else return "NULL"; } function diasEntreDatas($dataInicio, $dataFim) { list($ano1, $mes1, $dia1) = explode('-', $dataInicio); list($ano2, $mes2, $dia2) = explode('-', $dataFim); $diferencaSegundos = mktime(0, 0, 0, $mes2, $dia2, $ano2) - mktime(0, 0, 0, $mes1, $dia1, $ano1); return intval($diferencaSegundos / (60 * 60 * 24)); } $dt_inicio = dataBr('2013-10-14', 'YYYY-MM-dd'); $dt_final = dataBr('2013-10-28', 'YYYY-MM-dd'); $qt_dias += diasEntreDatas($dt_inicio, $dt_final) + 1; print $qt_dias; print ' '; if ($qt_dias != 30 && $qt_dias != 15 && $qt_dias != 10 && $qt_dias != 20) { print 'lol'; }
Output for 7.0.0 - 7.1.0
Notice: Undefined offset: 1 in /in/UrBu4 on line 5 Notice: Undefined offset: 2 in /in/UrBu4 on line 5 Notice: A non well formed numeric value encountered in /in/UrBu4 on line 7 Notice: Undefined offset: 1 in /in/UrBu4 on line 5 Notice: Undefined offset: 2 in /in/UrBu4 on line 5 Notice: A non well formed numeric value encountered in /in/UrBu4 on line 7 Notice: Undefined offset: 1 in /in/UrBu4 on line 16 Notice: Undefined offset: 2 in /in/UrBu4 on line 16 Notice: Undefined offset: 1 in /in/UrBu4 on line 17 Notice: Undefined offset: 2 in /in/UrBu4 on line 17 Warning: mktime() expects parameter 6 to be integer, string given in /in/UrBu4 on line 19 Warning: mktime() expects parameter 6 to be integer, string given in /in/UrBu4 on line 19 Notice: Undefined variable: qt_dias in /in/UrBu4 on line 26 1 lol
Output for 5.3.0 - 5.6.28
Notice: Undefined offset: 2 in /in/UrBu4 on line 5 Notice: Undefined offset: 1 in /in/UrBu4 on line 5 Notice: A non well formed numeric value encountered in /in/UrBu4 on line 7 Notice: Undefined offset: 2 in /in/UrBu4 on line 5 Notice: Undefined offset: 1 in /in/UrBu4 on line 5 Notice: A non well formed numeric value encountered in /in/UrBu4 on line 7 Notice: Undefined offset: 2 in /in/UrBu4 on line 16 Notice: Undefined offset: 1 in /in/UrBu4 on line 16 Notice: Undefined offset: 2 in /in/UrBu4 on line 17 Notice: Undefined offset: 1 in /in/UrBu4 on line 17 Warning: mktime() expects parameter 6 to be long, string given in /in/UrBu4 on line 19 Warning: mktime() expects parameter 6 to be long, string given in /in/UrBu4 on line 19 Notice: Undefined variable: qt_dias in /in/UrBu4 on line 26 1 lol
Output for 5.1.0 - 5.2.17
Notice: Undefined offset: 2 in /in/UrBu4 on line 5 Notice: Undefined offset: 1 in /in/UrBu4 on line 5 Notice: A non well formed numeric value encountered in /in/UrBu4 on line 7 Notice: Undefined offset: 2 in /in/UrBu4 on line 5 Notice: Undefined offset: 1 in /in/UrBu4 on line 5 Notice: A non well formed numeric value encountered in /in/UrBu4 on line 7 Notice: Undefined offset: 2 in /in/UrBu4 on line 16 Notice: Undefined offset: 1 in /in/UrBu4 on line 16 Notice: Undefined offset: 2 in /in/UrBu4 on line 17 Notice: Undefined offset: 1 in /in/UrBu4 on line 17 Warning: mktime() expects parameter 6 to be long, string given in /in/UrBu4 on line 19 Warning: mktime() expects parameter 6 to be long, string given in /in/UrBu4 on line 19 Notice: Undefined variable: qt_dias in /in/UrBu4 on line 26 1 lol
Output for 5.0.4 - 5.0.5
Notice: Undefined offset: 2 in /in/UrBu4 on line 5 Notice: Undefined offset: 1 in /in/UrBu4 on line 5 Warning: checkdate() expects parameter 2 to be long, string given in /in/UrBu4 on line 7 Notice: Undefined offset: 2 in /in/UrBu4 on line 5 Notice: Undefined offset: 1 in /in/UrBu4 on line 5 Warning: checkdate() expects parameter 2 to be long, string given in /in/UrBu4 on line 7 Notice: Undefined offset: 2 in /in/UrBu4 on line 16 Notice: Undefined offset: 1 in /in/UrBu4 on line 16 Notice: Undefined offset: 2 in /in/UrBu4 on line 17 Notice: Undefined offset: 1 in /in/UrBu4 on line 17 Notice: Undefined variable: qt_dias in /in/UrBu4 on line 26 1 lol
Output for 4.3.4 - 5.0.3
Notice: Undefined offset: 2 in /in/UrBu4 on line 5 Notice: Undefined offset: 1 in /in/UrBu4 on line 5 Warning: checkdate() expects parameter 2 to be long, string given in /in/UrBu4 on line 7 Notice: Undefined offset: 2 in /in/UrBu4 on line 5 Notice: Undefined offset: 1 in /in/UrBu4 on line 5 Warning: checkdate() expects parameter 2 to be long, string given in /in/UrBu4 on line 7 Notice: Undefined offset: 2 in /in/UrBu4 on line 16 Notice: Undefined offset: 1 in /in/UrBu4 on line 16 Notice: Undefined offset: 2 in /in/UrBu4 on line 17 Notice: Undefined offset: 1 in /in/UrBu4 on line 17 Notice: Undefined variable: qt_dias in /in/UrBu4 on line 26 1 lol
Output for 4.3.0 - 4.3.3
Notice: Undefined offset: 2 in /in/UrBu4 on line 5 Notice: Undefined offset: 1 in /in/UrBu4 on line 5 Notice: Undefined offset: 2 in /in/UrBu4 on line 5 Notice: Undefined offset: 1 in /in/UrBu4 on line 5 Notice: Undefined offset: 2 in /in/UrBu4 on line 16 Notice: Undefined offset: 1 in /in/UrBu4 on line 16 Notice: Undefined offset: 2 in /in/UrBu4 on line 17 Notice: Undefined offset: 1 in /in/UrBu4 on line 17 Notice: Undefined variable: qt_dias in /in/UrBu4 on line 26 1 lol