3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function lastWeekDay ($mnt) { $result = strtotime("last day of $mnt"); $day = date('D', $result); if ('Sun' === $day) { $result -= 86400 * 2; } if ('Sat' === $day) { $result -= 86400; } return $result; } $input = '01-04-2014'; $a = explode('-',$input); $result = $a[0].'-'.$a[0]; echo $result;
Output for 4.3.0 - 7.1.0
01-01