3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); trait Foo{ public function bar(int $int){ echo $int * 2; } public function callBar(){ $this->bar(123); } } class A{ use Foo; public function bar(string $string){ // incompatible signature! // prevents callBar from working correctly } } $a = new A; $a->bar("123"); $a->callBar();
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: A::bar(): Argument #1 ($string) must be of type string, int given, called in /in/Ca8CP on line 11 and defined in /in/Ca8CP:18 Stack trace: #0 /in/Ca8CP(11): A->bar(123) #1 /in/Ca8CP(27): A->callBar() #2 {main} thrown in /in/Ca8CP on line 18
Process exited with code 255.

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:
30.02 ms | 406 KiB | 5 Q