mkosmosports Posted January 21, 2007 Share Posted January 21, 2007 Still not getting the clear picture.Array( [Arsenal] => Array ( [teamid] => 1 [fullname] => Arsenal London [linkable] => y [sdate] => 05 [edate] => ) [Aston Villa] => Array ( [teamid] => 2 [fullname] => Aston Villa [linkable] => y [sdate] => 05 [edate] => ))Out of this md array. How can I loop through and pull out the the second level id (ex. Aston Villa) where [sdate] = 05 for example. I just cant seem to get it right..Any help appreciated.Marek Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 21, 2007 Share Posted January 21, 2007 if your array is called $foo -$arsen = $foo['Arsenal'];$sdate = $arsen['sdate'];Or $foo['Arsenal']['sdate'];It's in the manualhttp://us2.php.net/manual/en/language.types.array.php Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted January 21, 2007 Share Posted January 21, 2007 you would want to do something like this... I'll join the bandwagon and assume your master array is called $foo[code=php:0]$matchingFullnames = array(); // Make an array to hold our namesforeach($foo as $item) { // Loop through foo if($item['sdate'] == 05) { $matchingFullnames[] = $item['fullname']; // Add the fullname to our array }}print_r($matchingFullnames); // It will display the two entries since both of their sdates are 05[/code] Quote Link to comment Share on other sites More sharing options...
mkosmosports Posted January 21, 2007 Author Share Posted January 21, 2007 Beautiful. Not only is that what Im looking for, I fully understand whats going on. Initially, I think I was thinking a little too hard about it.. :PThanks guys! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.