views:

34

answers:

2
A: 

It is NOT class variable but instance variable if you define/access it this way.

Most of the time in PHP, i forget including $ in variable name. Try as

$this->$res = "blah";

Atilla Ozgur
Are you sure about this?
fabrik
+2  A: 

You made a typo @

$x="blah" (missing ;)

Working code: http://ideone.com/jmICU

(Controller stripped out)

Please let me know if my answer has worked.

fabrik
Oops.. that was a typo while filling in this forum.. thanks for pointing it out..
Shrinath
I edited in http://ideone.com/brbGZ Check now.. It behaves as described in question
Shrinath
Your example provided in your question is not the same as you wrote @ Ideone. The problem is you define `$res` as string then later you assign a variable to it as an array. Please take a look @ http://ideone.com/0ayLi now it works again.
fabrik
works :) as you said, I shouldn't have initialized it to string.. or atleast, not to character '' (it worked when I tried $res=""). Cool man, if I had enough rep to give you a vote, i'd have :) thanks..
Shrinath
I'm glad to help you! :)
fabrik