On Sat, June 25, 2005 2:01 pm, bruce said: > feel kind of foolish posting this.. but i can't seem to figure it out for > now.. Here's a way to tackle this kind of thing in the future: Divide and Conquer. print_r($foo) prints out a BUNCH of stuff. Focus only on the outer layer: > i have an array, i can do a print_r($foo) and get the following: > Array > ( > [bookmark] => 1 > [facets] => Array . . . Then simply do: print_r($foo['facets']); Now you can ignore a bunch of crap you don't care about. Focus on the outer layer and begin again: Array ( [0] => Array ( [lastname] => <form id="facet-lastname"> <input type="hidden" name="list" value="" /> <input type="hidden" name="offset" value="0" /> <input type="hidden" name="orderBy" value="username" /> <input type="hidden" name="sort" value="asc" /> <strong>Name:</strong> <input type="text" name="_lastname" value="" style="width: 125px" /> <input type="submit" value="Search" /> </form> } Okay, now we have: print_r($foo['facets'][0]); Array ( [lastname] => <form id="facet-lastname"> <input type="hidden" name="list" value="" /> <input type="hidden" name="offset" value="0" /> <input type="hidden" name="orderBy" value="username" /> <input type="hidden" name="sort" value="asc" /> <strong>Name:</strong> <input type="text" name="_lastname" value="" style="width: 125px" /> <input type="submit" value="Search" /> </form> } Finally, print_r($foo['facets'][0]['lastname'] is your answer. It won't always be [] -- If you are using objects you might need -> in there somewhere. Figuring out where gets a lot easier if you focus on the Big Picture -- only the outer layer of your data structure, and drill down. If at some point you know you need *ALL* the elements of an array, that's easy enough. That's the point at which you put in a loop to walk through them. BUUUUUT During your development, write the loop, see that it dumps out all the elements, or at least a whole lot of stuff, and then stick an "exit;" at the end, and focus on JUST the first element to tear that apart. You can take the exit; out when you are all done, and it will work for all the elements, assuming your data is well-formed. In the meantime, focus on the outer layer, and focus on just ONE element at a time, to avoid confusing yourself. I do this all the time, especially when I'm dealing with somebody else's structured data, and I don't really know what they've done. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php