Return all array elements except for a given key

后端 未结 7 1323
暖寄归人
暖寄归人 2021-02-02 09:06

Simple one, I was just wondering if there is a clean and eloquent way of returning all values from an associative array that do not match a given key(s)?

$array          


        
相关标签:
7条回答
  • 2021-02-02 09:35

    You can easily remove an array item by its key using this..

    unset($array['key']); 
    

    DEMO http://codepad.org/EA9vTwzR

    0 讨论(0)
提交回复
热议问题