title: Getting specific information from multidimensional array
body: <p>I have this multidimensional array, that I decoded from a JSON string, now I would like to output some of the data, but I can't? It's not a problem, if it's a single array.</p>
  
  <p>I already tried some foreach loops, but I can't get it to output the data I want. I keep getting an illegal offset error.</p>
  
  <pre><code>$someArray = array (
      'result' =&gt; 'success',
      'response' =&gt; 
      array (
        'server_info' =&gt; 
        array (
          'status' =&gt; 'success',
          'ipaddress' =&gt; '123.123.123.123',
          'hostname' =&gt; 'hostname.example.com',
          'template' =&gt; 'linux-centos-6.5-x86_64-min-gen2-v1',
          'hdd' =&gt; '32212254720',
          'memory' =&gt; '1073741824',
          'country' =&gt; 'FR',
          'city' =&gt; 'Paris',
          'plan' =&gt; 'Plan 02',
          'rootpassword' =&gt; '1q2w3e4r5t',
        ),
        'server_state' =&gt; 
        array (
          'status' =&gt; 'success',
          'state' =&gt; 'online',
          'mainipaddress' =&gt; '123.123.123.123',
          'ipaddresses' =&gt; '123.123.123.123',
          'bandwidth' =&gt; '2199023255552,112133881,2198911121671,0',
          'hdd' =&gt; '32212254720,0,32212254720,0',
          'pae' =&gt; 'off',
          'bootorder' =&gt; 'cd',
          'iso' =&gt; '',
        ),
        'templates' =&gt; 
        array (
          'linux-centos-7.1503.01-x86_64-minimal-gen2-v1' =&gt; 
          array (
            'name' =&gt; 'centos',
            'display' =&gt; 'CentOS 7.1503.01 64bits minimal  ',
          ),
          'linux-clearos-6.3-x86_64-gen2-v1' =&gt; 
          array (
            'name' =&gt; 'clearos',
            'display' =&gt; 'ClearOS 6.3 64bits  ',
          ),
          'linux-debian-6.0.6-x86_64-min-gen2-v1' =&gt; 
          array (
            'name' =&gt; 'debian',
            'display' =&gt; 'Debian 6.0.6 64bits ',
          ),
        ),
        'one_click_apps' =&gt; 
        array (
          'linux-ubuntu-14.04-server-x86_64-min-gen2-v1-oneapp-webuzo' =&gt; 
          array (
            'name' =&gt; 'Webuzo',
            'display' =&gt; 'Webuzo',
            'time' =&gt; '2',
            'version' =&gt; '2.5',
            'desc' =&gt; 'Webuzo is a LAMP STACK and a Single User Control Panel, it simplifies the development and deployment of your project by supporting more than 400 applications and 1115 classes. ',
            'steps' =&gt; 'You will be able to access the Webuzo setup and dashboard by entering the following syntax in your web browser: http://IP:2004',
            'os' =&gt; 'Ubuntu 14.04  64bits ',
          ),
        ),
        'iso_images' =&gt; 
        array (
          0 =&gt; 'FreeBSD-9.1-RELEASE-amd64-disc1',
          1 =&gt; 'CentOS-7.0-1406-x86_64-Minimal',
          2 =&gt; 'FreeBSD-9.3-RELEASE-amd64-bootonly',
          3 =&gt; 'FreeBSD-10.1-RELEASE-amd64-disc1',
          4 =&gt; 'FreeBSD-8.4-RELEASE-amd64-disc1',
        ),
        'log' =&gt; 
        array (
          0 =&gt; 
          array (
            'log' =&gt; '[Reinstall] - Virtual server: 12345 - App: Drupal on ubuntu 14.04 64bits ',
            'time' =&gt; '2042-04-02 16:20:42',
          ),
          1 =&gt; 
          array (
            'log' =&gt; '[Reinstall] - Virtual server: 12345 - OS: Ubuntu 14.04 server 64bits ',
            'time' =&gt; '2042-04-20 04:20:42',
          ),
          2 =&gt; 
          array (
            'log' =&gt; '[Change hostname] - Virtual server: 12345 - Hostname: new.hostname.com',
            'time' =&gt; '2042-04-02 04:20:00',
          ),
        ),
        'server_billing' =&gt; 
        array (
          'reg_date' =&gt; '2015-03-12',
          'next_due_date' =&gt; '2015-04-12',
          'payment_method' =&gt; 'paypal',
          'first_payment_amount' =&gt; '0.00',
          'recurring_amount' =&gt; '0.00',
          'billing_cycle' =&gt; 'Monthly',
          'status' =&gt; 'Active',
        ),
        'server_install' =&gt; 0,
      ),
  );
  
  
    $array = $someArray; 
    foreach($array as $key =&gt; $value) {
      echo $array[$key]["status"] .  "&lt;br&gt;";
    }
  
  &lt;/code&gt;
  </code></pre>
  
  <p>Here is what I get from <code>print_r</code>:</p>
  
  <pre><code>Array
  (
      [result] =&gt; success
      [response] =&gt; Array
          (
              [server_info] =&gt; Array
                  (
                      [status] =&gt; success
                      [ipaddress] =&gt; 123.123.123.123
                      [hostname] =&gt; hostname.example.com
                      [template] =&gt; linux-centos-6.5-x86_64-min-gen2-v1
                      [hdd] =&gt; 32212254720
                      [memory] =&gt; 1073741824
                      [country] =&gt; FR
                      [city] =&gt; Paris
                      [plan] =&gt; Plan 02
                      [rootpassword] =&gt; 1q2w3e4r5t
                  )
  
              [server_state] =&gt; Array
                  (
                      [status] =&gt; success
                      [state] =&gt; online
                      [mainipaddress] =&gt; 123.123.123.123
                      [ipaddresses] =&gt; 123.123.123.123
                      [bandwidth] =&gt; 2199023255552,112133881,2198911121671,0
                      [hdd] =&gt; 32212254720,0,32212254720,0
                      [pae] =&gt; off
                      [bootorder] =&gt; cd
                      [iso] =&gt; 
                  )
  
              [templates] =&gt; Array
                  (
                      [linux-centos-7.1503.01-x86_64-minimal-gen2-v1] =&gt; Array
                          (
                              [name] =&gt; centos
                              [display] =&gt; CentOS 7.1503.01 64bits minimal  
                          )
  
                      [linux-clearos-6.3-x86_64-gen2-v1] =&gt; Array
                          (
                              [name] =&gt; clearos
                              [display] =&gt; ClearOS 6.3 64bits  
                          )
  
                      [linux-debian-6.0.6-x86_64-min-gen2-v1] =&gt; Array
                          (
                              [name] =&gt; debian
                              [display] =&gt; Debian 6.0.6 64bits 
                          )
  
                  )
  
              [one_click_apps] =&gt; Array
                  (
                      [linux-ubuntu-14.04-server-x86_64-min-gen2-v1-oneapp-webuzo] =&gt; Array
                          (
                              [name] =&gt; Webuzo
                              [display] =&gt; Webuzo
                              [time] =&gt; 2
                              [version] =&gt; 2.5
                              [desc] =&gt; Webuzo is a LAMP STACK and a Single User Control Panel, it simplifies the development and deployment of your project by supporting more than 400 applications and 1115 classes. 
                              [steps] =&gt; You will be able to access the Webuzo setup and dashboard by entering the following syntax in your web browser: http://IP:2004
                              [os] =&gt; Ubuntu 14.04  64bits 
                          )
  
                  )
  
              [iso_images] =&gt; Array
                  (
                      [0] =&gt; FreeBSD-9.1-RELEASE-amd64-disc1
                      [1] =&gt; CentOS-7.0-1406-x86_64-Minimal
                      [2] =&gt; FreeBSD-9.3-RELEASE-amd64-bootonly
                      [3] =&gt; FreeBSD-10.1-RELEASE-amd64-disc1
                      [4] =&gt; FreeBSD-8.4-RELEASE-amd64-disc1
                  )
  
              [log] =&gt; Array
                  (
                      [0] =&gt; Array
                          (
                              [log] =&gt; [Reinstall] - Virtual server: 12345 - App: Drupal on ubuntu 14.04 64bits 
                              [time] =&gt; 2042-04-02 16:20:42
                          )
  
                      [1] =&gt; Array
                          (
                              [log] =&gt; [Reinstall] - Virtual server: 12345 - OS: Ubuntu 14.04 server 64bits 
                              [time] =&gt; 2042-04-20 04:20:42
                          )
  
                      [2] =&gt; Array
                          (
                              [log] =&gt; [Change hostname] - Virtual server: 12345 - Hostname: new.hostname.com
                              [time] =&gt; 2042-04-02 04:20:00
                          )
  
                  )
  
              [server_billing] =&gt; Array
                  (
                      [reg_date] =&gt; 2015-03-12
                      [next_due_date] =&gt; 2015-04-12
                      [payment_method] =&gt; paypal
                      [first_payment_amount] =&gt; 0.00
                      [recurring_amount] =&gt; 0.00
                      [billing_cycle] =&gt; Monthly
                      [status] =&gt; Active
                  )
  
              [server_install] =&gt; 0
          )
  
  )
  </code></pre>
  
  <p>I would like to output From:</p>
  
  <pre><code>Server_info
  -status
  -ipaddress
  -and so on
  server_state
  -same here
  </code></pre>
  
  <p>But I keep an illegal offset error or it outputs NULL</p>