3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait SmartObject { public function __call(string $name, array $args) { return 'smart ' . $name; } } class Component { use SmartObject; } class FormControl extends Component { public function __call(string $name, array $args): mixed { return 'control ' . $name; } } class CustomFormControl extends FormControl { //use SmartObject; } var_dump((new FormControl)->foo()); var_dump((new CustomFormControl)->foo());
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
string(11) "control foo" string(11) "control foo"

preferences:
48.69 ms | 402 KiB | 62 Q