我有一个数组,其中有另一个数组。我需要取消设置子数组的索引。取消设置另一个数组内的数组索引
array
0 =>
array
'country_id' => string '1' (length=1)
'description' => string 'test' (length=4)
1 =>
array
'country_id' => string '2' (length=1)
'description' => string 'sel' (length=5)
2 =>
array
'country_id' => string '3' (length=1)
'description' => string 'soul' (length=5)
现在我需要取消设置主数组的所有三个索引中的country_id
。我使用的PHP和我最初认为未设置会做,直到我意识到我的数组嵌套。
我该怎么做?
'的foreach($阵列作为&$ element){unset($ element ['country_id'];}' – Steve 2014-09-10 12:33:21
'foreach($ array as&$ sub)unset($ sub ['country_id']);' – 2014-09-10 12:33:24
[PHP - unset in一个多维数组](http:// stackoverflow的.com /问题/ 7260468/PHP-未设定功能于一个-多维阵列) – Joanvo 2014-09-10 12:52:49