a little more info would help.
the only problem I see at the moment is the variable name.
'$this' is an object reference and as such shouldn't be attributed a value.
$this->varname = "value"; would be fine once the object has been instantiated.
what exactly are you trying to achieve?
on a different slant: if your function is not within a class, try globalizing the variable first
$fooey = "word";