3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private function myPrivate() { return true; } } class Bar extends Foo {} $obj = new Bar; $reflMethod = new \ReflectionMethod($obj, 'myPrivate'); $reflMethod->setAccessible(true); $return = $reflMethod->invoke($obj); var_dump($return);

preferences:
50.05 ms | 404 KiB | 5 Q