3v4l.org

run code in 300+ PHP versions simultaneously
<?php class myClass { private $a; public function __construct() { $this->a = 10; } public function printValue() { print "The Value is: {$this->a}\n"; } public function changeValue($val, $obj = null) { if(is_null($obj)) { $this->a = $val; } else { $obj->a = $val; } } public function getValue() { return $this->a; } } $obj_one = new myClass(); $obj_two = new myClass(); $obj_one->changeValue(20, $obj_two); $obj_two->changeValue($obj_two->getValue(), $obj_one); $obj_two->printValue(); $obj_one->printValue();
Output for git.master, git.master_jit, rfc.property-hooks
The Value is: 20 The Value is: 20

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:
40.15 ms | 401 KiB | 8 Q