Page 1 of 1
help please
Posted: Wed Oct 18, 2006 10:02 pm
by silverbux
is this possible?
$var = 'name';
$this->$$var = 'mark';
echo($this->name);
Posted: Wed Oct 18, 2006 10:19 pm
by John Cartwright
Please read the forum descriptions before posting.
Moved to PHP Code.
And not to sound blunt, but have you even tried? There is nothing more fufilling than learning for yourself.
Posted: Thu Oct 19, 2006 2:14 am
by itsmani1
no its not possible, you can't use this when something is not in object context.
Posted: Thu Oct 19, 2006 8:01 am
by Chris Corbyn
If that was inside a class it would work yes. You may need curly braces around the variable-variable. i.e.
$this->{$$var}