PHP wrote:
Problem:
Class test {
var $foo = 0;
function __construct() {
$this->myfunc("foo", 1);
}
function myfunc($name, $val) {
$this->$name = $val;
}
}
Now, PHP correctly evaluates $this->$name as 0; i.e. the default property
value of $this->foo.
However, what I really need to have happen is for $this->$name = $val to be
evaluated as $this->foo = 1;
Works fine here: http://dev.stut.net/php/classvar.php
What do you get?
-Stut
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php