Converting array keys to variables?

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

 




   I have an array that looks like this:

   [hours] => Array
       (
           [0] => Array
               (
                   [file] => capture.0400.jpg
                   [path] => spool/.2006/11/17/04
                   [year] => 2006
                   [month] => 11
                   [day] => 17
                   [hhmm] => 0400
               )

           [1] => Array
               (
                   [file] => capture.0500.jpg
                   [path] => spool/.2006/11/17/05
                   [year] => 2006
                   [month] => 11
                   [day] => 17
                   [hhmm] => 0500
               )
       )

Is there a way that I can simply loop through each array and convert the keys into variables? I want to avoid having to write lines of:

   $file = $array[0][file];
   $path = $array[0][path];
   $year = $array[0][year];
   $month = $array[0][month];
   $day = $array[0][day];
   $hhmm = $array[0][hhmm];

   -- A

--
W | It's not a bug - it's an undocumented feature.
 +--------------------------------------------------------------------
 Ashley M. Kirchner <mailto:ashley@xxxxxxxxxx>   .   303.442.6410 x130
 IT Director / SysAdmin / Websmith             .     800.441.3873 x130
 Photo Craft Imaging                       .     3550 Arapahoe Ave. #6
 http://www.pcraft.com ..... .  .    .       Boulder, CO 80303, U.S.A.

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