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 $same->getName(); print_r($same->getAndTestLocalVariableNameArray()); ?>

preferences:
60.53 ms | 402 KiB | 5 Q