3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dateSplitter = explode('-','1987-02-15'); $today = getDate(); $monDiff = $today['mon'] - $dateSplitter[1]; $dayDiff = $today['mday'] - $dateSplitter[2]; $yearDiff = $today['year'] - $dateSplitter[0]; $age = ($monDiff > 0 || ($monDiff == 0 && $dayDiff >= 0)) ? ($yearDiff) : ($yearDiff - 1); echo $age;
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
26