2010-02-19 91 views

回答

5

看看Countable::count

class MyClass implements Countable { 
    public function count() { 
     //return count 
    } 
} 

$c = new MyClass(); 
count($c); //calls $c->count();