title: How to search through nested JSON arrays in PHP
body: <p>I'm sorry if I don't use the correct terminology, I'm still learning. I'm trying to figure out how to search a JSON array that has nested arrays in it for a specific value, and then return an associated value. </p>
  
  <p>My problem is similar to this answered question on StackOverflow (<a href="https://stackoverflow.com/questions/6987611/how-to-search-through-a-json-array-in-php">How to search through a JSON Array in PHP</a>), but I want to be able to find an <strong>item by id</strong> in either <strong>people</strong> or <strong>dog</strong> or <strong>any other nested array</strong>. Essentially I want to convert <code>people</code> below in the foreach to a wildcard. </p>
  
  <p>Here is my JSON data - <a href="http://foothillertech.com/student/webdesign/2018/2018benrud2/tinker/dataIntro2/test/data.json" rel="nofollow noreferrer">http://foothillertech.com/student/webdesign/2018/2018benrud2/tinker/dataIntro2/test/data.json</a></p>
  
  <pre><code>foreach($json-&gt;people as $item)
  {
      if($item-&gt;id == "8097")
      {
          echo $item-&gt;content;
      }
  }
  </code></pre>
  
  <p>Any help is greatly appreciated. </p>