3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait T{ private function random_method(){ echo "random method \n"; } } class A { use T; public function public_method(){ echo "public method\n"; } protected function protected_method(){ echo "protected method\n"; } private function private_method(){ echo "private method\n"; } } class B extends A{ public function random_method(){ echo "random method 2\n"; } public function protected_method(){ echo "protected method 2\n"; } public function private_method(){ echo "private method 2\n"; } public function public_method(){ echo "public method 2\n"; } } $b = new B; $b->protected_method(); $b->private_method(); $b->public_method(); $b->random_method();
based on hHolq
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.1.0 - 7.3.0rc3
protected method 2 private method 2 public method 2 random method 2