I can see my function or should i say more correctly weedpackets age calculator has been put to some use.
I have a few questions however..
echo '<PRE>'; print_r(func_get_args ()); echo '</PRE>';
😕 whats this actually trying to acheive
Also where is this variable coming from $get_age?
There is a return for a reason
return $age;
print $age;
Once a function returns a result the function has ended thus making the print $age useless.
Also
//your putting the arguments in the wrong way
checkCurAge($month,$day,$year);
If you cannot tell variables are named according what they are used for
function checkCurAge($year,$month,$day='') {
To use this function the way it was intended here is an implementation
<?php
function checkCurAge($year,$month,$day='') {
$day=(empty($day))?'1':$day;
list($this_year, $this_month, $this_day) = explode(' ',date('Y n j'));
$age = $this_year - $year;
if ($month>$this_month||($this_month==$month&&$this_day<$day)) {
$age--;
}
return $age;
}
$month = '5';
$day='12';
$year='1987';
echo checkCurAge($year,$month,$day);
?>
Hope that helps