Re: Going loopy with arrays.....

From: Date: Sat, 01 Apr 2006 01:01:00 +0000
Subject: Re: Going loopy with arrays.....
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-233030@lists.php.net to get a copy of this message
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!


« previous php.general (#233030) next »