3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $today_day = 28; $day = date("d-m-Y", mktime(0,0,0,2, $today_day,date("Y"))); $firstday=$day; echo "firstday=$firstday\n"; echo "m=".date("m", strtotime($firstday)) . " | Y=" . date("Y", strtotime($firstday))."\n"; echo $day ."\n"; $today_day++; $day = date("d-m-Y", mktime(0,0,0,date("m", strtotime($firstday)),$today_day,date("Y", strtotime($firstday)))); echo "m=".date("m", strtotime($firstday)) . " | Y=" . date("Y", strtotime($firstday))."\n"; echo $day ."\n"; $today_day++; $day = date("d-m-Y", mktime(0,0,0,date("m", strtotime($firstday)),$today_day,date("Y", strtotime($firstday)))); echo $day ."\n"; ?>
Output for 5.1.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
firstday=28-02-2014 m=02 | Y=2014 28-02-2014 m=02 | Y=2014 01-03-2014 02-03-2014
Output for 5.1.0 - 5.1.2
firstday=28-02-2014 m=01 | Y=1970 28-02-2014 m=01 | Y=1970 29-01-1970 30-01-1970
Output for 4.3.0 - 5.0.5
firstday=28-02-2014 m=08 | Y=2033 28-02-2014 m=08 | Y=2033 29-08-2033 30-08-2033