php-是否可以计算数组中键的数量? [英] php - Is it possible to count the number of keys in an array?

查看:76
本文介绍了php-是否可以计算数组中键的数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've googled this but found no answers, so I guess it's not possible. If there is a way, I'd love to know it. Thanks

推荐答案

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

The number of keys in the array will always be the number of elements in the array, as the keys must be unique. So:

$numKeys = count($array);

这篇关于php-是否可以计算数组中键的数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆