3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $timezone = new DateTimeZone('America/Sao_Paulo'); $mes = 07; $ano = 2014; $dias = 20; $ultimo = mktime(0, 0, 0, $mes, $dias, $ano); $dia = date("j", $ultimo); $dia_semana = date("w", $ultimo); if($dia_semana == 0){ $dia--; $dia--; } if($dia_semana == 6) $dia--; $ultimo = DateTime::createFromFormat('j-M-Y', '$dia-$mes-$ano',$timezone); $hoje= new DateTime(null, $timezone); if ($ultimo==$hoje) echo "verdadeiro"; else echo "falso";
based on NQgMu
Output for 5.3.0 - 7.2.0
falso
Output for 5.2.10 - 5.2.17
Fatal error: Call to undefined method DateTime::createFromFormat() in /in/jrWQj on line 15
Process exited with code 255.
Output for 5.2.0 - 5.2.9
Fatal error: Call to undefined method DateTime::createfromformat() in /in/jrWQj on line 15
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTimeZone' not found in /in/jrWQj on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetimezone in /in/jrWQj on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetimezone in /in/jrWQj on line 2