Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用以下代码,我可以遍历返回数组的元素:
foreach ($GLOBALS['myDB']->getAssets($i['uId']) as $x)
但我不知道如何在进入循环之前有效地检查返回数组的大小。
有任何想法吗?
$assets = $GLOBALS['myDB']->getAssets($i['uId']); $size = count($assets);
您可以使用 count 找出数组的长度
count($arrayName);