3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A {} class B {} class Overloaded { protected $value; function setValue(string $x) { print __METHOD__ . '(string)' . PHP_EOL; $this->value = $x; } function setVаlue(int $x) { print __METHOD__ . '(int)' . PHP_EOL; $this->value = $x; } } $something = new Overloaded(); $something->setValue('120'); var_dump($something); $something->setVаlue(99); var_dump($something);
Output for git.master, git.master_jit, rfc.property-hooks
Overloaded::setValue(string) object(Overloaded)#1 (1) { ["value":protected]=> string(3) "120" } Overloaded::setVаlue(int) object(Overloaded)#1 (1) { ["value":protected]=> int(99) }

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:
51.18 ms | 1988 KiB | 4 Q