PHP Countdown v


©2006 Nathan Bolender
www.nathanbolender.com

countdown( int month, int day [, int year [, int hour [, int minute [, int second]]]] )

This function will generate the information for your countdown and return it in an array like this:

array(
'years' => int years,
'months' => int months,
'days' => int days,
'hours' => int hours,
'minutes' => int minutes,
'seconds' => int seconds,
'now' => str now,
'then' => str then,

'passed' => int passed
)

This information can be formatted as you like, or you can use printcountdown() to display it.

printcountdown( array countdown, [, int mode [, str name]] )

This function will return a string containing your countdown from countdown() in a human-readable format. Countdown needs to be an array returned from countdown() or an array in the same format in order for this function to work.

There are 4 possible modes for this function:
0 (default): Time until My Birthday! - 02:33:00 11/21/05: 6 hours, 28 minutes, and 36 seconds.
1: My Birthday! - 02:33:00 11/21/05: 6 hours, 28 minutes, and 36 seconds.
2: 6 hours, 28 minutes, and 36 seconds.
3: 6 hours, 28 minutes, and 36 seconds

Examples


'; echo printcountdown(countdown(11,28), 1, 'Kyle\'s Birthday').'

'; echo printcountdown(countdown(12,25), 0, 'Christmas').'

'; echo printcountdown(countdown(5,12,2008), 2, 'E3 2008'); ?>