【发布时间】:2012-10-16 01:37:32
【问题描述】:
只是好奇是否有办法在 If 开关中做到这一点
$account = array (
'{unkown value}' =>
array (
'accountID' => '4430290',
'accountStatus' => '1',
'parentAccountID' => '',
'offerID' => '746',
'billingModel' => '2.0',
),
);
if(array_pop($account)['billingModel'] == 'SomeValue') {
// do stuff
}
我目前正在这样做,但认为可能有更好的方法
$model = array_pop($accountInfo);
if ($model['billingModel'] == 'someValue') return false;
【问题讨论】:
-
较新版本的 php 允许您像这样链接表达式。
-
相信是5.4引入的
标签: php multidimensional-array arrayiterator