Re: [PHP] Going loopy with arrays.....

2006-03-31 Thread Jim Lucas
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-ar

RE: [PHP] Going loopy with arrays.....

2006-03-31 Thread tg-php
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 ea

Re: [PHP] Going loopy with arrays.....

2006-03-31 Thread tg-php
Yeah.. or something like this! (Chris' looks better than mine.. maybe his brain's working at 70% today :) -TG = = = Original message = = = > 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 individua

RE: [PHP] Going loopy with arrays.....

2006-03-31 Thread Jay Blanchard
[snip] I'm guessing you wouldn't ask this, Jay, unless there was an issue with not knowing the depth of the data. [/snip] Exactly. I have another department that sends the data as text files and I knew that I could send them to a database and all would be well, or relatively so. But that adds a la

RE: [PHP] Going loopy with arrays.....

2006-03-31 Thread tg-php
Yeah, that foreach is outright printing the arrays (foreach $parent... print $parent?) I'm guessing you wouldn't ask this, Jay, unless there was an issue with not knowing the depth of the data. I saw something once with doing recursive function calls to dig down into an array or something. S

RE: [PHP] Going loopy with arrays.....

2006-03-31 Thread Jay Blanchard
[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...   function print_elements( $var ) {     if( is_array( $var )) {    

Re: [PHP] Going loopy with arrays.....

2006-03-31 Thread Chris Boget
> 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... function print_elements( $var ) { if( is_array( $var )) { fore

RE: [PHP] Going loopy with arrays.....

2006-03-31 Thread Jay Blanchard
[snip] that's a dump of the arraycan you paste the source? [/snip] Not really. The original array was manipulated to get the point (H) groups together for the new array so that I could break the points back out together (they are not together in the original file). Here is how I got there

Re: [PHP] Going loopy with arrays.....

2006-03-31 Thread Anthony Ettinger
that's a dump of the arraycan you paste the source? On 3/31/06, Jay Blanchard <[EMAIL PROTECTED]> wrote: > [snip] > can you paste the array you're using? > [/snip] > > It was in the original post. > > Array > ( > [H7] => Array > ( > [0] => Array > (

RE: [PHP] Going loopy with arrays.....

2006-03-31 Thread Jay Blanchard
[snip] can you paste the array you're using? [/snip] It was in the original post. Array ( [H7] => Array ( [0] => Array ( [lon] => -99.2588 [lat] => 29.1918 ) [1] => Array

Re: [PHP] Going loopy with arrays.....

2006-03-31 Thread Anthony Ettinger
can you paste the array you're using? On 3/31/06, Jay Blanchard <[EMAIL PROTECTED]> wrote: > [snip] > foreach ($parent as $child) > { > print $parent; > > foreach ($child as $item) { > print $child . "=" . $item; > } > > } > > didn't test it, but this should work. > [/snip]

RE: [PHP] Going loopy with arrays.....

2006-03-31 Thread Jay Blanchard
[snip] foreach ($parent as $child) { print $parent; foreach ($child as $item) { print $child . "=" . $item; } } didn't test it, but this should work. [/snip] Didn't work, returns ArrayArray=ArrayArrayArray=ArrayArray=Array -- PHP General Mailing List (http://www.php.net

Re: [PHP] Going loopy with arrays.....

2006-03-31 Thread Anthony Ettinger
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 <[EMAIL PROTECTED]> wrote: > Howdy all! > > Here is hoping that Friday is just another day in paradis