3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ageMonths($dob) { //new date time $dob must be Y-m-d format $dobObject = DateTime::createFromFormat('Y-m-d',$dob); //current date $nowObject = new DateTime('2014-03-11'); //difference $diff = $nowObject->diff($dobObject); return "{$nowObject->format(Y-m-d)} - $dob = {$diff->y}-{$diff->m}-{$diff->d} / days: {$diff->days}"; } $date = new DateTime('2014-03-11'); while ($date > new DateTime('2014-01-01')) { $date->sub(new DateInterval('P1D')); var_dump(ageMonths($date->format('Y-m-d'))); }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Undefined constant "Y" in /in/PE99C:13 Stack trace: #0 /in/PE99C(20): ageMonths('2014-03-10') #1 {main} thrown in /in/PE99C on line 13
Process exited with code 255.

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:
44.04 ms | 401 KiB | 8 Q