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('21/12/2013', 'YYYY-MM-dd'); $dt_final = dataBr('30/12/2013', 'YYYY-MM-dd'); $qt_dias += diasEntreDatas($dt_inicio, $dt_final) + 1; print $qt_dias; print ' '; print ($qt_dias != 30 && $qt_dias != 15 && $qt_dias != 10 && $qt_dias != 20);
Output for 5.0.4 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined variable: qt_dias in /in/UI1p4 on line 26 10
Output for hhvm-3.10.0 - 3.13.2
10
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: qt_dias in /in/UI1p4 on line 26 10