我如何回显此数组中的单个元素
how can i echo individual elements from this array
我有一个 array
,它是我使用 PDO::FETCH_OBJ
从数据库查询中获得的。它包含用户对某些帖子的评论我需要 echo
每个人 values.How 我可以从这个 array
中获取元素值吗?
Array ( [0] => stdClass Object ( [posts] => lo;l;l ) [1] => stdClass Object ( [posts] => i am feeling well ! ) [2] => stdClass Object ( [posts] => it's 8 am in the morning .... ) [3] => stdClass Object ( [posts] => i am new here :) ) [4] => stdClass Object ( [posts] => farewell day !!!! ) [5] => stdClass Object ( [posts] => farewell day !!!! ) [6] => stdClass Object ( [posts] => farewell day !!!! ) [7] => stdClass Object ( [posts] => farewell day !!!! ) [8] => stdClass Object ( [posts] => bal ) [9] => stdClass Object ( [posts] => bal ) [10] => stdClass Object ( [posts] => halum ) )
foreach($array as $key => $val){
echo $val->posts;
}
我有一个 array
,它是我使用 PDO::FETCH_OBJ
从数据库查询中获得的。它包含用户对某些帖子的评论我需要 echo
每个人 values.How 我可以从这个 array
中获取元素值吗?
Array ( [0] => stdClass Object ( [posts] => lo;l;l ) [1] => stdClass Object ( [posts] => i am feeling well ! ) [2] => stdClass Object ( [posts] => it's 8 am in the morning .... ) [3] => stdClass Object ( [posts] => i am new here :) ) [4] => stdClass Object ( [posts] => farewell day !!!! ) [5] => stdClass Object ( [posts] => farewell day !!!! ) [6] => stdClass Object ( [posts] => farewell day !!!! ) [7] => stdClass Object ( [posts] => farewell day !!!! ) [8] => stdClass Object ( [posts] => bal ) [9] => stdClass Object ( [posts] => bal ) [10] => stdClass Object ( [posts] => halum ) )
foreach($array as $key => $val){
echo $val->posts;
}