Countable {
/* 方法 */
abstract public count ( void ) : int
}class MyCount
{
private $num;
public function __construct($num)
{
$this->num = $num;
}
public function count()
{
return $this->num;
}
}
$obj = new MyCount(10);
echo count($obj);//返回1class MyCount implements \Countable
{
private $num;
public function __construct($num)
{
$this->num = $num;
}
public function count()
{
return $this->num;
}
}
$obj = new MyCount(10);
echo count($obj);//返回10
以上就是PHP SPL 标准库之 Countable的详细内容!
查看更多关于PHP SPL 标准库之 Countable的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did55533