3v4l.org

run code in 300+ PHP versions simultaneously
<?php class cls {} $c = (new ReflectionMethod('SplStack', 'count'))->getClosure(); $c = $c->bindTo(new cls); $c();
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Fatal error: Uncaught ValueError: ReflectionMethod::getClosure(): Argument #1 ($object) cannot be null for non-static methods in /in/OCkA3:4 Stack trace: #0 /in/OCkA3(4): ReflectionMethod->getClosure() #1 {main} thrown in /in/OCkA3 on line 4
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 0 given in /in/OCkA3 on line 4 Fatal error: Uncaught Error: Call to a member function bindTo() on null in /in/OCkA3:5 Stack trace: #0 {main} thrown in /in/OCkA3 on line 5
Process exited with code 255.
Output for 5.6.0 - 5.6.38
Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 0 given in /in/OCkA3 on line 4 Fatal error: Call to a member function bindTo() on null in /in/OCkA3 on line 5
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 0 given in /in/OCkA3 on line 4 Fatal error: Call to a member function bindTo() on a non-object in /in/OCkA3 on line 5
Process exited with code 255.

preferences:
237.77 ms | 402 KiB | 340 Q