title: Looping PHP Nested Arrays - Extract values into Blade Views (Laravel)
body: <p>I know there are many questions on this topic, but none quite deal with this (as far as I could see).</p>
  
  <p>I have a PHP array (which FYI, is returned via  Guzzle response) in a Laravel Project.</p>
  
  <p><strong>The PHP array</strong></p>
  
  <pre><code>$users = array(2) {
    ["error"]=&gt;
    bool(false)
    ["spirits"]=&gt;
    array(2) {
      [0]=&gt;
      array(2) {
        ["id"]=&gt;
        string(1) "1"
        ["name"]=&gt;
        string(5) "Foo"
      }
      [1]=&gt;
      array(2) {
        ["id"]=&gt;
        string(1) "2"
        ["name"]=&gt;
        string(3) "Bar"
      }
    }
  }
  </code></pre>
  
  <p>I simply want to extract the "id" and "name" keys below, to use in a view but I'm a little stumped. I've tried the suggestions below, but can't quite work it out.</p>
  
  <p><a href="https://stackoverflow.com/questions/1319903/how-to-flatten-a-multidimensional-array">How to Flatten a Multidimensional Array?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/3684463/php-foreach-with-nested-array">PHP foreach with Nested Array?</a></p>
  
  <p>I've also looked into <strong>array_walk_recursive</strong>.</p>
  
  <p>Any help would be awesome and appreciated! I want to be able to use these 2 keys in Laravel like so:</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>return View::make('users')-&gt;with('users',$users);
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code> @foreach ($users as $key =&gt; $user)
       {{ $user["id"] }}
       {{ $user["name"] }}
   @endforeach
  </code></pre>