3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php public 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"; } public 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;
Output for 5.4.0 - 5.4.24
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/0GMas on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_PUBLIC in /in/0GMas on line 3
Process exited with code 255.