3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ByRef { protected $argAge; protected $bothAge; public function assignJustArgByRef(&$age) { $this->argAge = $age; } public function assignArgAndExpressionByRef(&$age) { $this->bothAge =& $age; } public function getArgAge() { return $this->argAge; } public function getBothAge() { return $this->bothAge; } } $age = 0; $ByRef = new ByRef(); $ByRef->assignJustArgByRef($age); $age++; echo 'only param by ref: ' . $ByRef->getArgAge() . \PHP_EOL; $newAge = 0; $ByRef->assignArgAndExpressionByRef($newAge); $newAge++; echo 'param and expression by ref: ' . $ByRef->getBothAge() . \PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
only param by ref: 0 param and expression by ref: 1

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