Re: What is meant by this code?

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

 



On 31/01/15 02:06, Ken Robinson wrote:
>> Hello,
>>
>> I'm new to PHP. I came across the following code:
>>
>> ....
>> ....
>> $exif = exif_read_data($image);
>> foreach ($exif as $key => $section) {
>> foreach ($section as $name => $val) {
>> .....
>> .....
>>
>> What are we doing here in the "foreach"? What is "as"?
> 
> RTFM
> 
> http://php.net/manual/en/control-structures.foreach.php

I've read the manual ... now I'm more confused :)
Seriously ... If one is starting to use PHP reading the manual is the
LAST place to start, but there is not a good alternative to direct
people to. Most tutorials are simply last in old style practices!

Abdul ...
A useful little trick is print_r($exif);
This will show just what has been returned by exif_read ... which is an
multi level array of data. foreach simply scans the array converting
each element of the array - in this case creating a copy of an element
in $section, but $section is an array itself so the second foreach pulls
out the values.

Now hopefully reading the manual will make a little more sense :)

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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