One thing that's not entirely clear: you have a three-dimensional array and you're trying to sort on something in the third dimension.
If $iCaltoArray['person.ics'][3]['DTSTART'] = "20090221T193000Z" and $iCaltoArray['somethingelse.ics'][4]['DTSTART'] = "20090221T163000Z" (which is earlier) and $iCaltoArray['person.ics'][6]['DTSTART'] = "20090221T063000Z" (which is earlier still), do you want:
['person.ics'][6]['DTSTART']
['person.ics'][3]['DTSTART']
....
['somethingelse.ics'][4]['DTSTART']
(i.e., person.ics sorted separately from somethingelse.ics), or
['person.ics'][6]['DTSTART']
['somethingelse.ics'][4]['DTSTART']
['person.ics'][3]['DTSTART']
(mixing them all together, which would mean trashing some of the structure that this data has, perhaps by making 'person.ics' etc., an additional element in the third dimension)? Either could be done, but how depends on the requirements.
Is it possible to sort this data before/when building this array?
But: assuming the first case, where each array in $iCaltoArray[$key] is to keep to itself and not go mixing with the others....
function sort_by_dtstart($a, $b)
{
// One of the design features of ISO-formatted dates is
// that they sort correctly when treated as strings.
return strcmp($a['DTSTART'], $b['DTSTART']);
}
foreach($iCaltoArray as &$event)
{
usort($event, 'sort_by_dtstart');
}