If you need both the value and its offset or key while looping through an array in PHP, use foreach with both variables.
| |
That gives you the array value in $fruit and the corresponding index or key in $key.
If you need both the value and its offset or key while looping through an array in PHP, use foreach with both variables.
| |
That gives you the array value in $fruit and the corresponding index or key in $key.