php - 是否可以计算数组中的键数?

Ste*_*ven 2 php arrays

我用谷歌搜索了这个,但没有找到答案,所以我想这是不可能的.如果有办法,我很想知道.谢谢

Tom*_*igh 12

数组中的键数始终是数组中元素的数量,因为键必须是唯一的.所以:

$numKeys = count($array);
Run Code Online (Sandbox Code Playgroud)