From: Trevor O. <tr...@gm...> - 2008-11-14 18:55:27
|
And change my < to a <= I guess thsi just shows I should proofread my stuff before I post it here. The reason I assume < and > operators work on the timestamp is because if times are shown like so: 04:30:15 Then string comparison will work if it's 4:30:15, then it won't. 2008/11/14 Trevor Oldak <tr...@gm...> > gmail hid my clsoe bracket, but it's there. > > > 2008/11/14 Trevor Oldak <tr...@gm...> > >> ok, here's how i'd do it in practice: >> Assuming the < and > operators work on the timestamp given >> >> for($c = count($arToday)-1; $c >= 0; $c--){ >> if($arToday[$c]['starttime'] < $time) return $c >> >> } >> >> 2008/11/14 Trevor Oldak <tr...@gm...> >> >>> Actually forget my solution, it'll find the start times but it won't be >>> of much use with its output. >>> >>> >>> 2008/11/14 Trevor Oldak <tr...@gm...> >>> >>>> And yes, that is a bastardized way of doing it, but I've tried to move >>>> away from associative arrays and more into classes lately >>>> >>>> 2008/11/14 Trevor Oldak <tr...@gm...> >>>> >>>> If you really want it on one line, you could use a regex on print_r with >>>>> output set to true. >>>>> Otherwise, I'd suggest creating a Record class and using that. >>>>> >>>>> 2008/11/14 Steve Gadlin <sg...@wc...> >>>>> >>>>> Hey there, PHP-folks! >>>>>> >>>>>> I have an array question, and I was hoping someone here could point me >>>>>> in >>>>>> the right direction. >>>>>> >>>>>> So I¹ve got this array, see... >>>>>> >>>>>> $arToday[0][³title²] = ³Patty Duke² >>>>>> $arToday[0][³starttime²] = 12:00:00 >>>>>> $arToday[1][³title²] = ³Sesame Street² >>>>>> $arToday[1][³starttime²] = 12:30:00 >>>>>> ... >>>>>> ... >>>>>> Etc. >>>>>> >>>>>> Is there an easy way for me to ³query² this array to snag the index of >>>>>> the >>>>>> record whose starttime variable is current? Thereby selecting the >>>>>> name of >>>>>> the program that may be airing ³now²? >>>>>> >>>>>> Thanks so much for your help! If there¹s some other list I should be >>>>>> posting questions to instead of this one, let me know. >>>>>> >>>>>> Steve >>>>>> >>>>>> ------------------------------------------------------------------------- >>>>>> This SF.Net email is sponsored by the Moblin Your Move Developer's >>>>>> challenge >>>>>> Build the coolest Linux based applications with Moblin SDK & win great >>>>>> prizes >>>>>> Grand prize is a trip for two to an Open Source event anywhere in the >>>>>> world >>>>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>>>>> _______________________________________________ >>>>>> chiPHPug-discuss mailing list >>>>>> chi...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/chiphpug-discuss >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> -Trevor Oldak >>>>> >>>> >>>> >>>> >>>> -- >>>> -Trevor Oldak >>>> >>> >>> >>> >>> -- >>> -Trevor Oldak >>> >> >> >> >> -- >> -Trevor Oldak >> > > > > -- > -Trevor Oldak > -- -Trevor Oldak |