title: PHP - Object Loop Condition
body: <p>I have this object:</p>
  
  <pre><code>$boosts = array(
      "2x12" =&gt; 500,
      "2x24" =&gt; 800,
      "2x7d" =&gt; 4500,
      "3x12" =&gt; 700,
      "3x24" =&gt; 1300,
      "3x7d" =&gt; 6500
  );
  </code></pre>
  
  <p>And then a variable: <code>$type = "2x12";</code>
  What I want to do is check in a loop if the variable $type exists in $boosts. I tried a lot of codes but I couldn't get it.</p>
  
  <pre><code>foreach ($boosts as $savedTypes) {
      echo json_encode($savedTypes) . "|";
      if ($boosts[$type] === $type) {
          echo "VALID";
      }
  }
  </code></pre>