Check if a value exits in array (Laravel or Php)

前端 未结 4 737
天涯浪人
天涯浪人 2021-02-18 17:38

I have this array:

$list_desings_ids = array(\'hc1wXBL7zCsdfMu\',\'dhdsfHddfD\',\'otheridshere\');

With a die() + var_dumo() this array return

4条回答
  •  [愿得一人]
    2021-02-18 18:31

    Your array not have key .
    try this

    foreach($general_list_designs as $key_design=>$design) {
           #$desing->desing_id return me for example: hc1wXBL7zCsdfMu
           if(in_array($design->design_id, $list_desings_ids))
           $final_designs[] = $design;
     }
    

提交回复
热议问题