3v4l.org

run code in 300+ PHP versions simultaneously
<?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;
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key 1 in /in/tgSWp on line 5 Warning: Undefined array key 2 in /in/tgSWp on line 5 Deprecated: checkdate(): Passing null to parameter #1 ($month) of type int is deprecated in /in/tgSWp on line 7 Fatal error: Uncaught TypeError: checkdate(): Argument #2 ($day) must be of type int, string given in /in/tgSWp:7 Stack trace: #0 /in/tgSWp(7): checkdate(NULL, '21-12-2013', NULL) #1 /in/tgSWp(24): dataBr('21-12-2013', 'YYYY-MM-dd') #2 {main} thrown in /in/tgSWp on line 7
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
32.47 ms | 401 KiB | 8 Q