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.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
string(11) "control foo" string(11) "control foo"

preferences:
66.27 ms | 406 KiB | 5 Q