I have been trying to access a public array inside a class, but it is freaking out on me. Should this be able to work?
$TestArra = array('Hello', ' ', 'World');
class Test
{
function Test()
{
$this->Display();
}
function Display()
{
foreach($TestArray as $value)
{
echo $value;
}
}
}
shouldn't that display "Hello World" on the page? instead i get this error:
Warning: Invalid argument supplied for foreach() in C:\xampplite\htdocs\xampp\Links\test.php on line
Maybe I just don't understand something. Any help would be great.
Thanks.
p.s. Also I can't create an array for some reason either. I tried $a = array('a');
and $a[0] = 'a';
neither would seem to work in the class.