What does the => operator mean in the following code?
foreach ($user_list as $user => $pass)
The code is a comment at PHP.net.
The user does not specify the value of $user_list, $user or $pass.
I normally see that => means equal or greater than.
However, I am not sure about its purpose here because it is not assigned.
I read the code as
- process a list of users in integers
- such that the value of each user is equal or greater than password
The above does not make sense to me.
=>is the separator for associative arrays. In the context of that foreach loop, it assigns the key of the array to$userand the value to$pass.Example:
Note that this can be used for numerically indexed arrays too.
Example: