3v4l.org

run code in 500+ PHP versions simultaneously
<?php trait PersonPL{ public function sayHello($name){ echo 'Witaj, nazywam się '.$name; } public function whereFrom($country){ echo 'Jestem z '.$country; } } trait PersonENG{ public function sayHello($name){ echo 'Hi, my name is '.$name; } public function whereFrom($country){ echo 'I am form '.$country; } } trait PersonDE{ public function sayHello($name){ echo 'Hallo! Mein Name ist '.$name; } public function whereFrom($country){ echo 'Ich komme aus '.$country; } } class TestB{ use PersonPL, PersonENG, PersonDE{ PersonPL::sayHello insteadof PersonENG, PersonDE; PersonPL::whereFrom insteadof PersonENG, PersonDE; } } $objectB = new TestB(); $objectB->sayHello('Anna'); $objectB->sayHello('Polski');
Output for rfc.property-hooks, git.master, git.master_jit
Witaj, nazywam się AnnaWitaj, nazywam się Polski

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
35.01 ms | 1497 KiB | 4 Q