简体   繁体   English

如何在数组中获取PHP中的数组对象元素

[英]how to fetch array object elements in php within an array

I am going through a php script which has something like this 我正在通过一个类似这样的PHP脚本

echo "<pre>";
var_export($someObj->details);
echo "</pre>";

and the output is something like : http://pastebin.com/gEAFg6R4 输出类似于: http : //pastebin.com/gEAFg6R4

now how do I fetch paricular lines for eg if I just want to fetch the height, if have vehicle or not and is male or female ? 现在如何获取特定线,例如,如果我只是想获取高度,是否有车辆并且是男性还是女性? what is var_export($someObj->details); 什么是var_export($ someObj-> details); doing ? 在做什么?

Please study the PHP manual on arrays http://php.net/manual/en/language.types.array.php - the third example shows how to access nested array contents. 请学习有关数组的PHP手册http://php.net/manual/zh/language.types.array.php-第三个示例显示了如何访问嵌套数组的内容。

In your case it would be: 您的情况是:

print $someObj->details["city"];

print $someObj->details["details"]["have_vehicle"];

Can't tell for the rest, as your output paste is incomplete. 由于您的输出粘贴不完整,因此无法说明其他情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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