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 = date("d/m/Y",strtotime("$dia/$mes/$ano")); // $hoje= date("d/m/Y"); echo $hoje; echo $ultimo;
based on Hehvn
Output for 5.1.0 - 7.1.0
31/07/201401/01/1970
Output for 4.3.0 - 5.0.5
31/07/201407/06/2015