<?php
//ini_set('display_errors', 1);
//ini_set('display_startup_errors', 1);
//error_reporting(E_ALL);



$dateOfBirth = $_REQUEST['dob'];
$today = date("Y-m-d");
$diff = date_diff(date_create($dateOfBirth), date_create($today));
$age=array();
$age['year']=$diff->format('%y');
$age['month']=$diff->format('%m');
$age['day']=$diff->format('%d');
echo json_encode($age);
//echo $diff->format('%y').'^'.format('%m').'^'.format('%d');
?>
