PHP将所有数组视为关联的,因此没有任何内置函数.任何人都可以推荐一种相当有效的方法来检查数组是否只包含数字键?
基本上,我希望能够区分这个:
$sequentialArray = array('apple', 'orange', 'tomato', 'carrot');
Run Code Online (Sandbox Code Playgroud)
还有这个:
$assocArray = array('fruit1' => 'apple',
'fruit2' => 'orange',
'veg1' => 'tomato',
'veg2' => 'carrot');
Run Code Online (Sandbox Code Playgroud)