PHP Code:
/*
using
echo Birthday("22", "09", "1989");
*/
function Birthday($day="01", $month="01", $year="1980"){$rform = ";$dayval = range('1','31');
foreach ($dayval as $key){
if($key<10){$keyadd = "0$key";
}else{$keyadd = "$key";
}
if($day==$keyadd){$rform .= ";
}else{$rform .= ";
}
}$rform .= " ";$rform .= ";$monthval = array('1'=>'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
foreach ($monthval as $val => $months){
if($val<10){$keyadd = "0$val";
}else{$keyadd = "$val";
}
if($month==$keyadd){$rform .= ";
}else{$rform .= ";
}
}$rform .= " ";$rform .= ";$yearval = range('1950','2009');//you can define range year here from year -> to year
foreach ($yearval as $key){
if($year==$key){$rform .= ";
}else{$rform .= ";
}
}$rform .= "";
return $rform;
}
No comments:
Post a Comment