title: PHP: How to get a value from a JSON file?
body: <p>I'm using PHP and json_decode to use a remote API and I'm having what seems to be a newbie problem for which I didn't even know what to search to find my answer.</p>
  
  <p>So on my script I have a $code = 392 and a json file which simplified version is:</p>
  
  <pre><code>{
      "result": {
          "items": [
              {
                  "name": "New York",
                  "code": 7294,
              },
              {
                  "name": "Miami",
                  "code": 392,
              },
              {
                  "name": "Los Angeles",
                  "code": 9182,
              }
          ]
      }
  }
  </code></pre>
  
  <p>So, simply put, having the code 392 I want to know which name corresponds to that code. How ?
  (The actual json result has thousands of "items", if that makes a difference)</p>