Php 从输出中获取数据

Php 从输出中获取数据,php,Php,我有一个对象,我正试图从中获取数据。但我似乎被卡住了,任何帮助都会很好,谢谢 function att($prop, $what){ $reflObj = new ReflectionObject($prop); $get = $reflObj->getProperty('attributes'); $get->setAccessible(true); $info = $get->getValue($prop); foreach($info as $inf){ $reflOb

我有一个对象,我正试图从中获取数据。但我似乎被卡住了,任何帮助都会很好,谢谢

function att($prop, $what){
$reflObj = new ReflectionObject($prop);
$get = $reflObj->getProperty('attributes');
$get->setAccessible(true);
$info = $get->getValue($prop);

foreach($info as $inf){
$reflObj = new ReflectionObject($inf);

$title = $reflObj->getProperty('name');
$title->setAccessible(true);
$description = $title->getValue($inf);

var_dump("$description");

}
}
到目前为止的输出示例:

string(11) "< Min Child"
string(9) "< Train S"
string(4) "<Pub"
string(5) "<Shop"
string(7) "Balcony"
string(4) "Bath"
string(9) "Bathrooms"
string(3) "BBQ"
string(5) "Beach"
string(9) "Bed Linen"
string(8) "Internet"
string(15) "Central Heating"
string(7) "Coast <"
string(3) "Cot"
string(11)“
$everything = array();
foreach($info as $inf){
    $reflObj = new ReflectionObject($inf);

    $title = $reflObj->getProperty('name');
    $title->setAccessible(true);
    $description = $title->getValue($inf);

    $everything[] = $description;

}
var_dump($everything);
$everything
现在是一个数组,用于保存由该输出排序的数据。按如下方式访问其值:

$everything[0]


将0替换为您所需的索引。例如,
3
将产生第四个成员,即
“您想一次全部读取数据吗?不仅仅是为了能够拾取和选择bitsAwesome,我现在得到了一个很好的输出。”。数组(83){[0]=>string(11)“string(9)“string(4)“string(5)”string(7)”阳台”[5]=>string(4)“Bath”[6]=>string(9)”浴室”[7]=>那么我如何从每个数据中推出相关数据?将这些值彼此分开的标识符是什么?我不确定你的意思是什么?你的意思是
$reflObj->getProperty('name')
每一个可能有效的调用?编辑我的答案,以防你需要的是数组访问。
$everything = array();
foreach($info as $inf){
    $reflObj = new ReflectionObject($inf);

    $title = $reflObj->getProperty('name');
    $title->setAccessible(true);
    $description = $title->getValue($inf);

    $everything[] = $description;

}
var_dump($everything);