3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class PluginClientFactory { private static $factory; public static function setFactory(callable $factory) { static::$factory = $factory; } public function createClient($client, array $plugins = [], array $options = []) { if (static::$factory) { return static::$factory($client, $plugins, $options); } return new PluginClient($client, $plugins, $options); } } PluginClientFactory::setFactory(function () {}); $factory = new PluginClientFactory(); $factory->createClient('client');
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.27, 8.4.1 - 8.4.14
Warning: Undefined variable $factory in /in/WA5ek on line 15 Fatal error: Uncaught Error: Method name must be a string in /in/WA5ek:15 Stack trace: #0 /in/WA5ek(25): PluginClientFactory->createClient('client') #1 {main} thrown in /in/WA5ek on line 15
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Notice: Undefined variable: factory in /in/WA5ek on line 15 Fatal error: Uncaught Error: Function name must be a string in /in/WA5ek:15 Stack trace: #0 /in/WA5ek(25): PluginClientFactory->createClient('client') #1 {main} thrown in /in/WA5ek on line 15
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.26
Fatal error: Uncaught Error: Function name must be a string in /in/WA5ek:15 Stack trace: #0 /in/WA5ek(25): PluginClientFactory->createClient('client') #1 {main} thrown in /in/WA5ek on line 15
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Notice: Undefined variable: factory in /in/WA5ek on line 15 Fatal error: Function name must be a string in /in/WA5ek on line 15
Process exited with code 255.

preferences:
178.03 ms | 410 KiB | 5 Q