Re: Going loopy with arrays.....

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

 



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 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>

thnx,
Chris


___________________________________________________________
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


[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