Shawn McKenzie schreef: > tedd wrote: >> At 9:56 AM +0100 2/16/09, Jochem Maas wrote: >>> for any reasonable number of items my tests show tedd's version >>> pisses on McKenzies from a great height (note that I actually >>> optimized Mckenzies variant by halfing the number of calls to >>> strtotime()). >> ROTFLOL. <-- I seldom say that! > > Haha! Yes, I was trolling and got a good one from Jochem! I would say > ROTFLMAO! >> From a great height!!! Now that's funny! > > Too funny. I'll have to remember to work this in to some conversation > today at work. ;-) fair play, well taken :-) glad we got it sorted out ;-) > >>> I added a third variant, as a sort of control, which runs pretty >>> much on par with tedd's version but uses rather less LOC >>> (tedd you might like it as a little example of using array_multisort(), >>> i.e. a way of avoiding writing the double foreach loop in this case) >> The speed of the sort doesn't matter at all. The maximum number of data >> that needed to be sorted in my problem would have been 126 (18 different >> times for 7 days). >> >> I only presented part of the problem here. It was a distilled version of >> the problem I was working on, which was to allow people to enter times >> that they were available for tutoring in two hour chunks. >> >> So, a person might say they were available from 7:00 am to 9:00 am AND >> also state that they were available from 7:30 am to 9:30 am, which was a >> "no-no". >> >> Having two loops allowed me to check after converting to seconds AND >> sorting to see if there were any overlaps. In such case I simply deleted >> the offending data from the array before converting everything back into >> normal time (min:sec). >> >> Re this post -- all I needed was a push in the right direction. I was >> thinking about sorting, but I didn't even consider converting everything >> to seconds and then sorting. >> >> That's really all I needed AND another reason why this list is so great! >> Not only did I get a push in the right direction, but I got a good laugh >> out of it -- "from great heights" indeed. :-) >> >> Thanks and Cheers, >> >> tedd >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php