3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getAge($dob) { $dob = strtotime($dob); $y = date('Y', $dob); if (($m = (date('m') - date('m', $dob))) < 0) { $y++; } elseif ($m == 0 && date('d') - date('d', $dob) < 0) { $y++; } return date('Y') - $y; } /*** a date before 1970 ***/ $dob = "April 20 1961"; /*** another date ***/ $tdate = "21-04-2009"; /*** show the date ***/ echo getAge( $dob, $tdate );
Output for git.master, git.master_jit, rfc.property-hooks
54

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