Modifying PHP array values In a loop
It is possible to iterate over a PHP array in a loop using two ways:
First one is to access array elements using copy of the array. Second option is to use reference to the original array.
If an element of the array is modified in a loop, then the original array will be unchanged, however if accessing of array is done via reference, then original array will be modified.
Accessing array by reference is done using ampersand sign before the name of the array.
Comments
Post a Comment