- var_dump: documentation ( source)
e<?php
class foo {
function __construct() {
$this->a = "hello";
$this->b = "hi";
$this->val = "howdy";
$val = "a";
echo $this->{$val}; // outputs "hello"
echo "\n";
$val = "b";
echo $this->{$val}; // outputs "hi"
echo "\n";
echo $this->val; //outputs "howdy"
echo "\n";
echo $this->{"val"};
$this->setConfigParam('aVariableName', array('one', 'two', 'three'));
$aVariableName = 0;
echo $this->aVariableName;
var_dump($this->_aConfigParams);
}
public function setConfigParam( $sName, $sValue )
{
if ( isset( $this->$sName ) ) {
$this->$sName = $sValue;
} else {
$this->_aConfigParams[$sName] = $sValue;
}
}
}
$foo = new foo();