3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test implements Countable { public $prop1, $prop2,$prop3,$prop4; private $propa, $propb,$propc,$propd; protected $propx, $propy,$propz,$propzz; public function Greet() { return 'hello world'; } public function getCount() { $res = (array) $this; return count($res); } public function count() { return $this->getCount(); } } $t = new Test; echo $t->Greet(),"\n"; echo count( (array) $t),"\n"; echo $t->getCount(),"\n"; echo count($t),"\n"; echo count( array_keys(get_object_vars($t)));

preferences:
46.68 ms | 402 KiB | 5 Q