- getdate: documentation ( source)
- explode: documentation ( source)
<?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;