On 20 November 2006 22:55, Richard Lynch wrote: > On Fri, November 17, 2006 10:23 am, Ashley M. Kirchner wrote: > > [hours] => Array > > ( > > [0] => Array > > ( > > [file] => capture.0400.jpg > > [path] => spool/.2006/11/17/04 > > [year] => 2006 > > [month] => 11 > > [day] => 17 > > [hhmm] => 0400 > > ) > ... > > 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: > > foreach($array['hours'] as $key => $image_meta){ > list($file, $path, $year, $month, $day, $hhmm) = $image_meta; > //Do whatever you want with the variables. > } > > I personally would avoid 'extract' function, as a matter of principle, > as it's to easy to add something to an array and not realize it, and > then you start over-writing variables you didn't mean to, because your > key name matches some other variable you didn't mean to over-write... That's what the extract_type and prefix parameters are for. Although I wouldn't use extract() either, as I'd just address the array elements directly using a full set of subscripts. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: m.ford@xxxxxxxxxxxxxx Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php