3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = array('2014' => 0); end($date); echo key($date).'<br/>'; $year = key($date); $year = (int)$year; $newDate = new DateTime($year); echo $newDate->format('Y').'<br/>';
based on u9smI
Output for 5.3.18 - 5.4.45, 5.6.28, 7.0.20 - 7.2.0
2014<br/>2015<br/>
Output for 5.5.24 - 5.6.21, 7.0.0 - 7.0.6
2014<br/>2016<br/>