src/ICal/ICal.php
public function sortEventsWithOrder(array $events, $sortOrder = SORT_ASC)
    {
        $extendedEvents = array();
        $timestamp      = array();

        foreach ($events as $key => $anEvent) {
            $extendedEvents[] = $anEvent;
            $timestamp[$key]  = $anEvent->dtstart_array[2];
        }

        array_multisort($timestamp, $sortOrder, $extendedEvents);

        return $extendedEvents;
    }
public function sortEventsWithOrder(array $events, $sortOrder = SORT_ASC)
    {
        $extendedEvents = array();
        $timestamp      = array();

        foreach ($events as $key => $anEvent) {
            $extendedEvents[] = $anEvent;
            $timestamp[$key]  = $anEvent->dtstart_array[2];
        }

        array_multisort($timestamp, $sortOrder, $extendedEvents);

        return $extendedEvents;
    }
public function sortEventsWithOrder ( array $ events , $ sortOrder = SORT_ASC ) { $ extendedEvents = array ( ) ; $ timestamp = array ( ) ; foreach ( $ events as $ key => $ anEvent ) { $ extendedEvents [ ] = $ anEvent ; $ timestamp [ $ key ] = $ anEvent -> dtstart_array [ 2 ] ; } array_multisort ( $ timestamp , $ sortOrder , $ extendedEvents ) ; return $ extendedEvents ; }
Sorts events based on a given sort order

@param  array   $events
@param  integer $sortOrder Either SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING
@return array
Sorts events based on a given sort order