If you need to backtrack from the lat/long to the "H" key, why not build a reverse lookup array? $arr[$lat . ":" . $long] = $hvalue; ? -TG = = = Original message = = = [snip] > a. loop through it and recognize when I have com upon a new sub-array so > that I can do 'new' output > 2. OR get each of the sub-arrays out as individual arrays. This might help get you going in the right direction... <script language="php"> ~ function print_elements( $var ) ~~~ if( is_array( $var )) ~~~~~ foreach( $var as $k => $v ) ~~~~~~~ if( is_array( $v )) ~~~~~~~~~ print_elements( $v ); ~~~~~~~ else ~~~~~~~~~ echo "$k~ => $v<br>"; ~~~~~~~ ~~~~~ ~~~ ~ ~ $array = array(); ~ $array['H7'][] = array( 'lon' => -99.2588, 'lat' => 29.1918 ); ~ $array['H7'][] = array( 'lon' => -99.2205, 'lat' => 29.1487 ); ~ $array['H7'][] = array( 'lon' => -99.242, 'lat' => 29.1575 ); ~ $array['H7'][] = array( 'lon' => -99.2588, 'lat' => 29.1545 ); ~ $array['H6'][] = array( 'lon' => -99.0876, 'lat' => 29.216 ); ~ $array['H6'][] = array( 'lon' => -99.0618, 'lat' => 29.179 ); ~ array_walk( $array, 'print_elements' ); </script> [snip] Okay, that is cool too, but it still lacks one key ingredient, I need to know which 'H' each lat an lon belongs to. Here is the pseudo-code for what I am attempting, I fear I may not have explained myself clearly enough earlier; Loop Get the current H While current H output the points of current H end while next H End loop It is gotten to the point where I am tempted to put each H in its own file, open it, do the stuff, close it, go to the next file as it might have been quicker but I so wanted to do this with the array. The complication is that when the file is sent the H's are not in order, so they have to be grouped together (with changing their order in the file) so that the output occurs logically. Thanks everyone! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___________________________________________________________ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php