3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Aggregation { protected function callAggregation($method, $arguments) { var_dump($method, $arguments); } protected function foo() { } } class AggregateWithUse { use Aggregation { Aggregation::foo as public; Aggregation::callAggregation as __call; } } class AggregateManually { use Aggregation; public function __call($method, $arguments) { $this->callAggregation($method, $arguments); } } (new AggregateWithUse())->test(42); (new AggregateManually())->test(42);

preferences:
33.28 ms | 402 KiB | 5 Q