3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $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'); // $hoje= new DateTime(null, new DateTimeZone('America/Sao_Paulo')); if ($ultimo==$hoje) echo "verdadeiro"; else echo "falso";
based on Hc094
Output for 5.3.0 - 5.6.28, hhvm-3.10.0, 7.0.0 - 7.1.0
falso
Output for hhvm-3.12.0
Fatal error: Uncaught exception 'Exception' with message '__construct() expects parameter 1 to be string, null given' in /in/NQgMu:16 Stack trace: #0 /in/NQgMu(16): DateTime->__construct() #1 {main}
Process exited with code 255.
Output for 5.2.10 - 5.2.17
Fatal error: Call to undefined method DateTime::createFromFormat() in /in/NQgMu on line 14
Process exited with code 255.
Output for 5.2.0 - 5.2.9
Fatal error: Call to undefined method DateTime::createfromformat() in /in/NQgMu on line 14
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/NQgMu on line 14
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Undefined class name 'datetime' in /in/NQgMu on line 14
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Undefined class name 'datetime' in /in/NQgMu on line 14