3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Wl\A; class B { public function get() { return "BBBBB"; } } class A { public function b(B $b) { print_r($b::get()); } } $a = new A(); $reflection = new \ReflectionFunction($closure); $arguments = $reflection->getParameters(); echo "ARGS:\n"; var_dump($arguments); exit; try { $a->b(""); } catch (\Exception $e) { echo "catched"; } catch (\TypeError $e) { echo "subidubi"; }
Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: Undefined variable $closure in /in/LW4UO on line 18 Deprecated: ReflectionFunction::__construct(): Passing null to parameter #1 ($function) of type Closure|string is deprecated in /in/LW4UO on line 18 Fatal error: Uncaught ReflectionException: Function () does not exist in /in/LW4UO:18 Stack trace: #0 /in/LW4UO(18): ReflectionFunction->__construct('') #1 {main} thrown in /in/LW4UO on line 18
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Warning: Undefined variable $closure in /in/LW4UO on line 18 Fatal error: Uncaught ReflectionException: Function () does not exist in /in/LW4UO:18 Stack trace: #0 /in/LW4UO(18): ReflectionFunction->__construct('') #1 {main} thrown in /in/LW4UO on line 18
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: closure in /in/LW4UO on line 18 Fatal error: Uncaught ReflectionException: Function () does not exist in /in/LW4UO:18 Stack trace: #0 /in/LW4UO(18): ReflectionFunction->__construct('') #1 {main} thrown in /in/LW4UO on line 18
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Fatal error: Uncaught ReflectionException: Function () does not exist in /in/LW4UO:18 Stack trace: #0 /in/LW4UO(18): ReflectionFunction->__construct('') #1 {main} thrown in /in/LW4UO on line 18
Process exited with code 255.
Output for 5.4.1 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
Notice: Undefined variable: closure in /in/LW4UO on line 18 Fatal error: Uncaught exception 'ReflectionException' with message 'Function () does not exist' in /in/LW4UO:18 Stack trace: #0 /in/LW4UO(18): ReflectionFunction->__construct('') #1 {main} thrown in /in/LW4UO on line 18
Process exited with code 255.

preferences:
239.92 ms | 402 KiB | 269 Q