如何检查 PHP 数组是关联数组还是顺序数组?

$sequentialArray = array('apple', 'orange', 'tomato', 'carrot');
$assocArray = array('fruit1' => 'apple', 
                    'fruit2' => 'orange', 
                    'veg1' => 'tomato', 
                    'veg2' => 'carrot');

答案