3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TestClass { public function doIt() { echo 'done'; } } function is_instance_callable(array $definition) { return in_array($definition[1], get_class_methods($definition[0]), true); } $callable = ['ljkkjljlkj', 'doIt']; var_dump(is_instance_callable($callable));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.15, 8.5.0 - 8.5.1
Fatal error: Uncaught TypeError: get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, string given in /in/FG6mm:13 Stack trace: #0 /in/FG6mm(13): get_class_methods('ljkkjljlkj') #1 /in/FG6mm(18): is_instance_callable(Array) #2 {main} thrown in /in/FG6mm on line 13
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: in_array() expects parameter 2 to be array, null given in /in/FG6mm on line 13 NULL

preferences:
124.78 ms | 408 KiB | 5 Q