3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = "2001-01-01"; $b = "2016-02-15"; $i = date("Y", strtotime($a)); $result = array($i); while($i <= date("Y", strtotime($b))){ echo $i."\n"; array_push($result, $i); if(substr($i, 4, 2) == "12"){ $i = (date("Y", strtotime($i."01")) + 1); } else{ $i++; } } $result = array_slice($result, -10, 10, true); print_r($result);
Output for git.master, git.master_jit, rfc.property-hooks
2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 Array ( [7] => 2007 [8] => 2008 [9] => 2009 [10] => 2010 [11] => 2011 [12] => 2012 [13] => 2013 [14] => 2014 [15] => 2015 [16] => 2016 )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
81.2 ms | 401 KiB | 8 Q