test2($var)." />

Can I declare something global at the class level in PHP?

You're getting an error because you're using "self" instead of "this i.e. $this->test2($var).

You're getting an error because you're using "self" instead of "this". I.e. $this->test2($var).

Thanks that saved me a lot of time – jasondavis Sep 23 '09 at 3:22.

I may be misunderstanding the question, but I think what you want is an instance variable: bar . "\n"; } function a() { $this->bar = "green"; } function b() { $this->bar = "red"; } }? > In this case, $bar is the instance variable, accessible from each method.

The following code, using the Foo class: $newFoo = new Foo(); $newFoo->output(); $newFoo->a(); $newFoo->output(); $newFoo->b(); $newFoo->output(); Would create the following output: blue green red.

Heere $objtest is the object of the test() class: $objtest=new test(); echo $objtest->test1(),""; $objtest->test3("GREEN"); echo $objtest->test1(),""; echo ""; echo $objtest->stest1(),""; $objtest->stest3("S_GREEN"); echo $objtest->stest1(),""; test::$s_var="S_BLUE"; echo $objtest->stest1(); Would create the following output RED GREEN S_RED S_GREEN S_BLUE Using static variable(test::$s_var) you can achieve what you want. If you have any confusion about self and $this then you can read this document.

Currently if I use global $session; I have to add it into every method that uses it even if all the methods are in the same class. In this case I am getting this error below, do I need to use global or what?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions