You are here

function _birthdays_get_age in Birthdays 5

Same name and namespace in other branches
  1. 6 birthdays.module \_birthdays_get_age()

Get age from a given date of birth

array containing fields with keys 'year', 'month' and 'day'

Return value

int age

1 call to _birthdays_get_age()
birthdays_load_user in ./birthdays.module
Inject information on a user load

File

./birthdays.module, line 1402
The Birthdays module allows users to add their birthday to their profile. It lists birthdays on a seperate page and in different blocks. Users can receive an e-mail on their birthday automatically, and the administrator can receive daily reminders of…

Code

function _birthdays_get_age($date) {

  // If date is not empty
  if (is_array($date)) {

    // extract date
    extract($date);

    // call main age function (no overloading in PHP)
    return _birthdays_calculate_age($day, $month, $year);
  }
  else {
    return NULL;
  }
}