3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class my_private_class { private function my_private_method() { echo 'execute me!'; } } class another_class { public function execute_private_methods($instance) { $instance->my_private_method(); } } $object = new my_private_class(); $reflection = new \ReflectionClass('my_private_class'); $method = $reflection->getMethod('my_private_method'); $method->setAccessible(true); $method->invokeArgs($object);
based on HUFOV
Output for 5.6.0 - 7.3.0alpha1
Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 1 given in /in/ZjYjG on line 19