3v4l.org

run code in 300+ PHP versions simultaneously
<?php class my { function fu() {} } var_dump(new \ReflectionMethod('my::fu')); var_dump(\ReflectionMethod::createFromMethodName('my::fu'));
Output for 8.3.0 - 8.3.14
object(ReflectionMethod)#1 (2) { ["name"]=> string(2) "fu" ["class"]=> string(2) "my" } object(ReflectionMethod)#1 (2) { ["name"]=> string(2) "fu" ["class"]=> string(2) "my" }
Output for 8.1.0 - 8.1.30, 8.2.0 - 8.2.25
object(ReflectionMethod)#1 (2) { ["name"]=> string(2) "fu" ["class"]=> string(2) "my" } Fatal error: Uncaught Error: Call to undefined method ReflectionMethod::createFromMethodName() in /in/dQVe4:7 Stack trace: #0 {main} thrown in /in/dQVe4 on line 7
Process exited with code 255.

preferences:
44.5 ms | 407 KiB | 5 Q