我想学习一种解包嵌套数组的智能方法.例如,我有一个数组变量$rma_data [‘status’],如下所示;
[status] => Array
(
[0] => Array
(
[created] => 1233062304107
[statusId] => 5
[statusName] => Open
)
[1] => Array
(
[created] => 1233061910603
[statusId] => 2
[statusName] => New
)
[2] => Array
(
[created] => 1233061910603
[statusId] => 1
[statusName] => Created
)
)
我想根据条件将Created timestamps和statusId存储到变量中:如果我们发现存在“Open”状态,我们将使用Open而不是“New”和“Created”.如果只有New和Created,我们将使用New.
当前版本的方式:
for($i=0; $i
{
switch($rma_data['status'][$i]['statusId'])
{
case 5:
case 2:
case 3:
}
有任何想法吗?