how to extract the exact data from an array in php
i got this array from an database...how to get the exact value attribute......
Array
(
[0] => TRowResult Object
(
[row] => tests
[columns] => Array
(
[a21ha:link_0] => TCell Object
(
[value] =>testsample
[timestamp] => 1265010584060
)
[a21ha:link_1] => TCell Object
(
[value] => example
[timestamp] => 1265092697040
)
开发者_如何学C
)
)
how to get the [value] alone in php
print $myArray[0]->columns['a21ha:link_0']->value;
This would give you the first. To get all, you'd have to loop through the contents.
foreach ($myArray[0]->columns as $column) {
print $column->value;
}
Supposed your array called $array:
foreach($array as $arridx => $rowobj){
foreach($rowobj->columns as $cellid => $rowcell){
echo $rowcell->value;
}
}
精彩评论