3v4l.org

run code in 200+ php & hhvm versions
<?php class MyRepo { public function find($id) { return null; } } class Foo { function bar($repository) { $result = $repository->find(100); echo get_class($result); } } $foo = new Foo(); $foo->bar(new MyRepo);
based on 4V2Ha
Output for 7.2.0 - 7.3.3
Warning: get_class() expects parameter 1 to be object, null given in /in/IA9QJ on line 17
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.1.27
Foo
Output for hhvm-3.18.5 - 3.22.0

Process exited with code 137.