Return to Snippet

Revision: 19666
at October 28, 2009 10:53 by Zwendel


Updated Code
/* in the class foo*/
public function get( $var )
{
	return $this->$var;
}
/* example var, also in the class*/
protected $bar = 'hello world'

/*used like this*/
$foo = new Foo();
print $foo->get('bar');

Revision: 19665
at October 28, 2009 10:52 by Zwendel


Updated Code
/* in the class foo*/
public function get( $var )
{
	return $this->$var;
}
/* example var, also in the class*/
protected $bar = 'hello world'

/*used like this*/
$foo = new Foo();
print $foo-get('bar');

Revision: 19664
at October 28, 2009 08:38 by Zwendel


Initial Code
/* in the class foo*/
public function get( $var )
{
	return $this-$var;
}
/* example var, also in the class*/
protected $bar = 'hello world'

/*used like this*/
$foo = new Foo();
print $foo-get('bar');

Initial URL


Initial Description


Initial Title
function to access all protected vars in a class

Initial Tags
class, function

Initial Language
PHP