3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TestCounter { private $private = 1; protected $protected = 2; public $public1 = 3; public $public2 = 4; public function countSelf() { return count($this); } } $test = new TestCounter; var_dump(count($test), $test->countSelf()); $test->prop1 = 3; var_dump(count($test), $test->countSelf()); $test->prop2 = 4; var_dump(count($test), $test->countSelf());

preferences:
54.81 ms | 402 KiB | 5 Q