3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $someVar; private $anotherVar; public function setSomeVar($val) { $this->someVar = $val; } public function getSomeVar() { return $this->someVar; } public function setAnotherVar($val) { $this->anotherVar = $val; } public function getAnotherVar() { return $this->anotherVar; } } $foo = new Foo(); $foo->setSomeVar(12); $foo->setAnotherVar("Hello World"); $fooAsArray = (array) $foo; var_dump($fooAsArray); foreach($fooAsArray as $x) { var_dump($x); }
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { ["FoosomeVar"]=> int(12) ["FooanotherVar"]=> string(11) "Hello World" } int(12) string(11) "Hello World"

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:
158.58 ms | 405 KiB | 5 Q