简体   繁体   中英

PHP how remove array from multidimensional array and create new array

I have this array:

array(3) { 
["cod"]=> array(3) { 
    ["code"]=> string(3) "cod" 
    ["title"]=> string(38) "Pay on delivery" 
    ["sort_order"]=> string(1) "1" 
    } 
["pp_standard"]=> array(3) { 
    ["code"]=> string(11) "pp_standard" 
    ["title"]=> string(6) "PayPal" 
    ["sort_order"]=> string(1) "1" 
    } 

["bank_transfer"]=> array(3) { 
    ["code"]=> string(13) "bank_transfer" 
    ["title"]=> string(25) "bank_transfer" 
    ["sort_order"]=> string(1) "2" 
    } 
}

How I can remove full array

["cod"]=> array(3) {     
    ["code"]=> string(3) "cod" 
    ["title"]=> string(38) "Pay on delivery" 
    ["sort_order"]=> string(1) "1" 
    }    

from the multidimensional array above and create new multidimensional array without ["cod"] array? Thanks

unset($arr['cod']); is all you need. Docs: http://php.net/manual/en/function.unset.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM