Check if a value exists in array (Laravel or Php)
<p>I have this array:</p>
<pre><code>$list_desings_ids = array('hc1wXBL7zCsdfMu','dhdsfHddfD','otheridshere');
</code></pre>
<p>With a die() + var_dump() this array return me:</p>
<pre><code>array:2 [▼
  0 =&gt; &quot;hc1wXBL7zCsdfMu&quot;
  1 =&gt; &quot;dhdsfHddfD&quot;
  2 =&gt; &quot;otheridshere&quot;
]
</code></pre>
<p>I want check if a design_id exists in $list_desings_ids array.</p>
<p>For example:</p>
<pre><code>foreach($general_list_designs as $key_design=&gt;$design) {
    #$desing-&gt;desing_id return me for example: hc1wXBL7zCsdfMu
    if(array_key_exists($design-&gt;design_id, $list_desings_ids))
    $final_designs[] = $design;
}
</code></pre>
<p>But this not works to me, what is the correct way?</p>