Re: Going loopy with arrays.....

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

 



Jay Blanchard 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.

Does this second option mean that instead of this

$arr['H7'][0][lon] = 23.233;

you want to have it

$H7[0][lon] = 23.233;

Would that be what you want?

if so, check out extract()  I think it is just what you are looking for.

Jim
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


[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