获取关联数组的长度
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了获取关联数组的长度相关的知识,希望对你有一定的参考价值。
/** * Returns the length of an associative array or object similar function to Array.length * * @param $obj * @return int * */ public static function __getAssociativeArraySize($obj:Object):int { var length:int = 0; /* the length counter to be returned */ if ($obj != {} || $obj != null) { /* check if the object is null or has no elements and return zero as the length */ for (var s:String in $obj) { /* iterate on each element of the object and increase the counter */ length++; } } return length; /* return the length*/ }
以上是关于获取关联数组的长度的主要内容,如果未能解决你的问题,请参考以下文章