Page 1 of 1

Accessing Varible inside a class

Posted: Thu Aug 14, 2008 6:16 am
by Steve007
Class XX extends blah
{
protected $yyy = array('test', 'test1', 'test2');
}

Ok, so here is the hard part.

I have $classname (currently set to XX)

So:

$classname = 'XX';

How can I get the value of XX's $yyy without creating an object?

Re: Accessing Varible inside a class

Posted: Thu Aug 14, 2008 9:59 am
by pickle

Code: Select all

$importedYYY = XX::$yyy
Not 100% sure where the '$' goes.

You'll need to either make $yyy 'public' or make a function (getYYY() or a magic __get()) to retrieve the value.