title: php get value based on key in array
body: <p>I am trying to get a new array with all the codes that I get from an array called $houses. I loop thru it. To get the codes I tried <code>$house['code']</code> This works in the dd but not in the <code>$code = $house['code']</code>.<br>
  I would like to know why and what the solution to this is.</p>
  
  <pre><code>$houses = $project['data']['houses'];
  $codes = [];
  
  foreach($houses as $house) {
      $code = array_column($house, 'code');
      //dd($house['code']);  //Returns the code "AB12-CD34-EF56-GH78"
      if(!$code) {
          continue;
      } else {
          array_push($codes, $code);
      }
  }
  
  dd($codes); //Returns []
  </code></pre>
  
  <p>EDIT:
  var_dump $houses:</p>
  
  <pre><code>array:60 [
  0 =&gt; array:30 [
      "id" =&gt;
      "city" =&gt; ""
      "code" =&gt; "AB12-CD34-EF56-GH78"
      "streetName" =&gt; ""
      "houseNumber" =&gt; ""
      //And some other stuff that is not relevant to the question
  ]
  ]
  </code></pre>