我是新手,有人可以幫我嗎?獲取數組中的列
我有一個數組
array(2) {
["Peter"]=>
object(stdClass)#504 (2) {
["id"]=>
string(4) "2226"
["name"]=>
string(4) "Peter"
}
["Sam"]=>
object(stdClass)#505 (2) {
["id"]=>
string(4) "2227"
["name"]=>
string(14) "Sam"
}
}
我想從列「ID」然後放入SQL獲得元素循環
$idcol = array()
foreach($info as $item){
$idcol[] = $item['id'];
}
但我不知道爲什麼我不能讓id列。
對於循環,如何把$ idcol的數組元素放入sql中? get_sql是一個函數
for($i=0;$i<count($idcol);$i++){
$rate = get_sql($idcol);
}
我不知道爲什麼我使用array_column時不能得到任何東西 – user2210819
array_column無法使用,因爲在不是數組。 – Yaroslav