Home > Article > Backend Development > How to delete array elements in PHP?
Just remove both keys and values..
<code>foreach($arr as $k => $v ) { if($v>10) 删除arr[$k] } </code>
Just remove both keys and values..
<code>foreach($arr as $k => $v ) { if($v>10) 删除arr[$k] } </code>
<code>$arr = [ 'test' => 'test', 'test1' => 'test1' ]; unset($arr['test']) print_r($arr); #####输出 [ 'test1' => 'test1' ]</code>