我有一個數組我建立這樣的:PHP foreach循環需要數組元素不是爲了
$acids = array();
foreach ($sortedArray as $h)
{
$acids[] = $h['account_id'];
}
$uniqueAids = array_unique($acids);
當我再通過該陣列來輸出運行它,我希望這樣的:
Array
(
[0] => 353
[1] => 176
[2] => 9
)
,但我得到這樣的:
Array
(
[0] => 353
[1] => 176
[4] => 9
)
你可以像這樣排序數組; sort($ acids); –