PHP treats all arrays as associative, so there aren't any built in functions. PHP將全部數組視爲關聯數組,所以沒有任何內置函數。 Can anyone recommend a fairly efficient way to check if an array contains only numeric keys? 誰能推薦一種至關有效的方法來檢查數組是否僅包含數字鍵? 數組
Basically, I want to be able to differentiate between this: 基本上,我但願可以區分如下二者: app
$sequentialArray = array('apple', 'orange', 'tomato', 'carrot');
and this: 和這個: 函數
$assocArray = array('fruit1' => 'apple', 'fruit2' => 'orange', 'veg1' => 'tomato', 'veg2' => 'carrot');