如何从数组中获取价值 [英] How get value from array
本文介绍了如何从数组中获取价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个像这样的数组
Array
(
[0] => stdClass Object
(
[id] => 1
[org_name] => name
[field_name] => fullname
[new_name] => Name
[index] => 3
[modified] => 2016-05-17 10:45:17
)
[1] => stdClass Object
(
[id] => 3
[org_name] => reception_no
[field_name] => reception_no
[new_name] => Reception No.
[index] => 1
[modified] => 2016-05-17 10:45:17
)
[2] => stdClass Object
(
[id] => 4
[org_name] => pno
[field_name] => pno
[new_name] => Personel No.
[index] => 0
[modified] => 2016-05-17 10:45:17
)
例如,我想要在此示例中,对象具有'pno'的值将获得'index'的值,例如'0'有可能这样做吗?
and i want for example where object has 'pno' get value of 'index' in this example for example '0' is there possible to do that ?
推荐答案
foreach ($arr as $items)
{
if ($items->org_name=='pno')
$index=$items->index;
}
这篇关于如何从数组中获取价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文