Removing a value from a PHP Array

前端 未结 3 823
逝去的感伤
逝去的感伤 2021-01-14 19:39

Using PHP I\'m trying to remove an element from an array based on the value of the element.

For example with the following array:

Array
(
    [671] =         


        
3条回答
  •  臣服心动
    2021-01-14 20:34

    foreach($array as $id => $data){
        foreach($data as $index => $offending_val){
             if($offending_val === 100){
                unset($array[$id][$index]);
             }
        }
    }
    

提交回复
热议问题