Re: Going loopy with arrays.....

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



foreach ($parent as $child)
{
    print $parent;

    foreach ($child as $item) {
            print $child . "=" . $item;
    }

}

didn't test it, but this should work.


On 3/31/06, Jay Blanchard <jblanchard@xxxxxxxxxx> wrote:
> Howdy all!
>
> Here is hoping that Friday is just another day in paradise for everyone.
>
> I have an array, a multi-dimensional array. I need to either
>
> 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.
>
> Here is a sample;
>
> Array
> (
>     [H7] => Array
>         (
>             [0] => Array
>                 (
>                     [lon] => -99.2588
>                     [lat] => 29.1918
>                 )
>
>             [1] => Array
>                 (
>                     [lon] => -99.2205
>                     [lat] => 29.1487
>                 )
>
>             [2] => Array
>                 (
>                     [lon] => -99.23
>                     [lat] => 29.1575
>                 )
>
>             [3] => Array
>                 (
>                     [lon] => -99.242
>                     [lat] => 29.1545
>                 )
>         )
>
>     [H6] => Array
>         (
>             [0] => Array
>                 (
>                     [lon] => -99.0876
>                     [lat] => 29.216
>                 )
>
>             [1] => Array
>                 (
>                     [lon] => -99.0618
>                     [lat] => 29.179
>                 )
> And so on ....
>
> I am sure that it has something to do with my lack of sleep and the
> looming of deadlines and this being something that I thought would be
> trivial. Can someone drop-kick me in the right direction please? The sub
> arrays need to be the points in each of the arrays with a H identifier
> (H7, H6 etc.)
>
> Thanks!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux