Welcome Guest, Not a member yet? Register   Sign In
Variables in class problem
#1

[eluser]Michal1[/eluser]
Hey guys I would like to ask about an usage of variables in class.

Lets say I have a class "site". in this class I have two functions, first is index and second is "test".

in index function I have then this

Code:
function index()

{

$example = 'blablabla';

}
and now I want to use this same variable in function and use for example echo on this. So I have:

Code:
function test()

{

echo $example;

}

But when I do this I receive an error: Undefined variable: example

So my question is what do I need to do to have a variable which can I use through the whole class?

Thank you


Messages In This Thread
Variables in class problem - by El Forum - 02-17-2011, 04:51 AM
Variables in class problem - by El Forum - 02-17-2011, 05:10 AM
Variables in class problem - by El Forum - 02-17-2011, 05:39 AM
Variables in class problem - by El Forum - 02-17-2011, 05:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB