I work with Silex Framework and I would like to add $age to $result after the calculation of the age Is that possible??
$result = $app['db']->fetchAll($sql);
foreach ($result as $DN) {
$DT = $DN['dateN'];
$am = explode('-', $DT);
$an = explode('/', date('Y/m/d'));
$age = $an[0] - $am[0];
echo $age;
}
return $app['twig']->render('page.html',array('list' => $result,'age'=>$age));
$result['age'] = $age;?