' ); echo ( 'The time is now: '.date('Y M d H:i:s',$c->getTimestamp()).'
' ); $i = 1; echo ( '

First Iteration

' ); echo ( '

The first iteration is more "expensive", the calendar data structures having to be built.

' ); $start = getmicrotime(); $c->build(); while ( $e = $c->fetch() ) { $class = strtolower(get_class($e)); $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); $method = 'this'.str_replace('calendar_','',$class); echo ( "".$e->{$method}()." : " ); if ( ($i % 10) == 0 ) { echo ( '
' ); } $i++; } echo ( '

Took: '.(getmicrotime()-$start).' seconds

' ); $i = 1; echo ( '

Second Iteration

' ); echo ( '

This second iteration is faster, the data structures being re-used

' ); $start = getmicrotime(); while ( $e = $c->fetch() ) { $class = strtolower(get_class($e)); $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); $method = 'this'.str_replace('calendar_','',$class); echo ( "".$e->{$method}()." : " ); if ( ($i % 10) == 0 ) { echo ( '
' ); } $i++; } echo ( '

Took: '.(getmicrotime()-$start).' seconds

' ); ?>