tedd wrote:
> At 4:15 PM -0500 2/14/09, John Corry wrote:
>> 1. convert the string representation of times to timestamps using
>> strtotime()
>> 2. sort the timestamps
>> 3. display the timestamps as strings using date('format', timestamp)
>>
>> Would that work?
>>
>> John Corry
>> email: [email protected]
>
>
> John:
>
> Bingo -- that worked!
>
> Thanks.
>
> tedd
>
> ---
>
> Here's the code.
>
> <?php
> // ====== returns a time array sorted
>
> function sortTime($in_times)
> {
> $time = array();
> foreach ($in_times as $t)
> {
> $time [] = strtotime($t);
> }
>
> sort($time);
>
> $sort_time = array();
> foreach ($time as $t)
> {
> $sort_time[] = date('g:ia', $t);
> }
> return $sort_time;
> }
> ?>
>
>
Yeah, hif I had known that you wanted a function where you loop through
your array twice, that would have done it. Bravo.
--
Thanks!
-Shawn
http://www.spidean.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php