All pastes #987762 Raw Edit

Something

public text v1 · immutable
#987762 ·published 2008-04-16 22:34 UTC
rendered paste body
public function getBirthdays() {
		
		$bdays = array();
		
		$birthdays = $this->getDirectory('', 'birthday', 'first_name, last_name, birthday, display_age');
		
		for($i = 0; $i < count($birthdays) - 1; $i++) {
			//if(empty($birthdays[$i]['Profile']['birthday'])) continue;
			if($birthdays[$i]['Profile']['display_age']) {
				//calculate age
				$year = date('Y', strtotime($birthdays[$i]['Profile']['birthday']));
				$this_year = date('Y');
				$age = $this_year - $year;
				$bdays[$i]['age'] = $age;				
			}
			//set birthday to sort_date so we can sort with anniversaries
			$bdays[$i]['sort_date'] = $birthdays[$i]['Profile']['birthday'];
			//set the vals to a new array
			$bdays[$i]['first_name'] = $birthdays[$i]['Profile']['first_name'];
			$bdays[$i]['last_name'] = $birthdays[$i]['Profile']['last_name'];
			$bdays[$i]['birthday'] = $birthdays[$i]['Profile']['birthday'];
			$bdays[$i]['display_age'] = $birthdays[$i]['Profile']['display_age'];		
		}

		return $bdays;
		
	}