php数组和子数组

I`ve seen the following notation here: http://www.php.net/manual/en/features.http-auth.php

What is

($users[$data['username']] 

for?

Is it array and sub array?

Would you please give me a clear example

Thanks

$data['username'] is just key for assocative array

$data = Array(
  'username' => 'george';
);
$users = Array(
  'george' => "George Clooney",
  'angelina' => "Angelina Jolie"
);

echo $users['george']; // George Clooney
echo $users['angelina']; // Angelina Jolie
echo $users[$data['username']]; // George Clooney
echo $data['username']; // george

You should think of it like this:

$username = $data['username'];
$user = $users[$username];

It uses the value from $data['username'] as a key in $users to find a particular user record.

$users is an associate array (see the declaration). $data['username'] is the key used to extract a specific value from that array.