沒有實現(xiàn) Countable 接口的類的對象被用于 count() 函數(shù)總是返回 1,這與類的成員數(shù)量沒有任何關系。
http://php.net/manual/zh/function.count.php
http://php.net/manual/zh/function.count.php
2018-02-10
http://blog.csdn.net/everything1209/article/details/51475281#%E8%87%AA%E5%AE%9A%E4%B9%89autoload%E5%87%BD%E6%95%B0%E8%A3%85%E8%BD%BD%E7%B1%BB
2018-01-26
<?php
$array = array("apple", "banana", "cherry", "damson", "elderberry");
$iterator = new ArrayIterator($array);
$iterator->seek(3);
echo $iterator->current();
?>
The above example will output something similar to:
damson
$array = array("apple", "banana", "cherry", "damson", "elderberry");
$iterator = new ArrayIterator($array);
$iterator->seek(3);
echo $iterator->current();
?>
The above example will output something similar to:
damson
2018-01-25
http://www.phptuku.com/php/basic/284.html 這個注釋“Countable 繼承了該接口的類可以直接調用count()得到元素個數(shù)”應該錯了吧,PHP手冊上的解釋也一樣 。應該改為“實現(xiàn)Countable 接口的類count($obj)相當于調用類中的count()方法。沒有實現(xiàn)Countable 接口的類,調用count($obj)得到類的元素個數(shù)
2018-01-25
count($obj),得到的結果并不是獲取自定義類中元素的個數(shù)。實在很不明白有什么作用,看表面的不就是訪問某個受保護屬性的值嗎?
2018-01-25
OuterIterator接口筆記http://www.phptuku.com/php/basic/285.html
2017-10-29