- print_r: documentation ( source)
<?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());
?>