LostCore
8/6/2014 - 12:06 PM

Age from birthday

Age from birthday

<?php

$dateStr = "13/09/1986"; //it format

$date = preg_replace("|/|","-",$dateStr); //replace / with -

$from = new DateTime($date);
$to = new DateTime("today");

return $from->diff($to)->y;