One of the examples of a foreach
loop in PHP is
foreach ($row as $key => $value) {
// somecode
}
I am having trouble understanding what the =>
is doing. Can anyone run me through how it is "seen" or evaluated by PHP?
What is the order of operation, what value is assigned to $key
?
What makes it different from:
foreach ($row as $value) {
// somecode
}
?
I logically I thought that the value of $value
would be assigned to $key
, then it would be assigned as a row of $row
, but that is obviously incorrect...