4
使用SplFixedArray時,我看到count($ arr,COUNT_RECURSIVE)有一些奇怪的行爲。就拿這個代碼塊,比如...PHP COUNT_RECURSIVE和SplFixedArray
$structure = new SplFixedArray(10);
for($r = 0; $r < 10; $r++)
{
$structure[ $r ] = new SplFixedArray(10);
for($c = 0; $c < 10; $c++)
{
$structure[ $r ][ $c ] = true;
}
}
echo count($structure, COUNT_RECURSIVE);
結果...
> 10
您所期望的110結果這是正常的行爲,因爲這樣的事實,我築巢SplFixedArray對象?
正是我一直在尋找。今天早上我檢查了一下,但沒有找到任何東西。我知道我忽略了一些東西。謝謝! – wlvrn