3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $a; public function getA() { return $this->a; } public function setA($a) { $this->a = $a; } } $a = new A(); $a->setA("coucou"); echo $a->getA(); modifyA($a); echo $a->getA(); $b = 'b'; testA(null); testA($b); function modifyA(A $a) { $a->setA('B'); } function testA(A $a) { }
Output for git.master, git.master_jit, rfc.property-hooks
coucouB Fatal error: Uncaught TypeError: testA(): Argument #1 ($a) must be of type A, null given, called in /in/jl6eE on line 26 and defined in /in/jl6eE:35 Stack trace: #0 /in/jl6eE(26): testA(NULL) #1 {main} thrown in /in/jl6eE on line 35
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:
32.44 ms | 401 KiB | 8 Q