我有一個PHP對象從MySQL中獲取,它是一個對象數組,如下所示。操縱PHP對象陣列
Array (
[0] => stdClass Object ([question_id] => 1 [question_type] => multiple_choice [question_unit] => 7 [question_difficulty] => 56.5956047853)
[1] => stdClass Object ([question_id] => 2 [question_type] => multiple_choice [question_unit] => 7 [question_difficulty] => 54.665002232 )
[2] => stdClass Object ([question_id] => 3 [question_type] => multiple_choice [question_unit] => 7 [question_difficulty] => 55.2923002984)
)
我試圖找出我怎麼能替換的對象[0]對象[2],或刪除的對象[0],並有其他對象指數下降1。是否有一個良好/快捷方式這樣做,還是我只需要遍歷並手動覆蓋全部? (我可以很簡單地爲數組做這個操作,但是找不到對象的類似函數/資源)。
在此先感謝。
對象的數組仍然是一個數組;-) –