php获取多维数组值

I have an array that looks like this:

'application_noreply_email' => array(
    'name' => 'example.com',
    'host' => 'smtp.gmail.com',
    'connection_class' => 'login',
    'port' => '587',
    'connection_config' => array(
        'ssl' => 'tls',
        'username' => 'username@gmail.com',
        'password' => 'pass',
    ),
), 

How can i get the value of username?

I have tried using it like this, as you suggeste but it doesnt work.

$config['application_noreply_email']['username']

but this works in different situations $config['application_noreply_email']

Just a series of bracketed key names:

$application_noreply_email['connection_config']['username']

From the way you formatted your question, it looks like application_noreply_email may be a key in a larger array, in which case you would do this:

$theArrayVariableName['application_noreply_email']['connection_config']['username']

You need to provide more data but this below will be able to help you.

echo $myarray[0]['username'];

If your array is called $myarray, then

$username = $myarray['application_noreply_email']['connection_config']['username'];

First question is what is the variable that is holding the array?

Example

$myArray = array(
  'application_noreply_email' => array(
  'name' => 'example.com',
  'host' => 'smtp.gmail.com',
  'connection_class' => 'login',
  'port' => '587',
  'connection_config' => array(
    'ssl' => 'tls',
    'username' => 'username@gmail.com',
    'password' => 'pass',
  ),
);

print $myArray['application_noreply_email']['connection_config']['username'];

If you want get information, you must loop through the array and display it.

foreach ( $application_noreply_email as $application) {

  echo '<dl style="margin-bottom: 1em;">';

  foreach ( $application as $key => $value ) {
    echo "<dt>$key</dt><dd>$value</dd>";
  }

  echo '</dl>';
}