开发者

how to extract the exact data from an array in php

开发者 https://www.devze.com 2022-12-18 14:49 出处:网络
i got this array from an database...how to get the exact value attribute...... Array ( [0] => TRowResult Object

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;
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消