From: Jason R. <ja...@ho...> - 2008-11-14 18:32:19
|
off the top of my head, I dont know of any other way than traversing the array.. something like: $aln=count($arToday); $rec=0; $found=0; $title=''; $currenttime=[however you want to construct this]; while($rec<$aln){ if( $arToday[$rec]['starttime']==$currenttime ){ $found=$rec; $title=$arToday[$rec]['title']; $rec=$aln; // skip rest of loop } $rec++; } that was just typed without testing, so beware typos ;-).. there _may be_ some better multi-dimensional array index function built in to PHP but it would, in essence do the same as above.. Steve Gadlin wrote: > 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 |