2015-10-08 18 views
-3

我有一個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)) 

回答

0
foreach($array as $key => $val){ 

    echo $val->posts; 

} 
相關問題