3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * http://www.php.net/manual/en/language.variables.scope.php */ class ClassWithPropertiesThatHaveTheSameName { private $name = 'something'; // here they are the same, but differentiated public function setName($name) { $this->name = $name; } /** * @returns String|Other */ public function getName() { return $this->name; } /** * @returns Array|Transversable */ public function getAndTestLocalVariableNameArray() { $name = array('value' => $this->name); return $name; } } $same = new ClassWithPropertiesThatHaveTheSameName(); $same->setName('oranges and pecans in a tea from a tree'); echo '$name = ' . $same->getName() . "\n\n"; echo '$nameLocalTest = '; print_r($same->getAndTestLocalVariableNameArray()); ?>
Output for git.master, git.master_jit, rfc.property-hooks
$name = oranges and pecans in a tea from a tree $nameLocalTest = Array ( [value] => oranges and pecans in a tea from a tree )

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