I've got a class that looks something like
var $myarray = array();
Class A {
function A($array) {
$this->myarray = $array;
}
}
then I've got a class that consumes a class A
Class Foo {
function doSomethingWithA($array) {
foreach ($array as $element) {
print $element;
}
}
}
Now, when I initally go to a php script that includes class Foo, I get the following error:
Invalid argument supplied for foreach() in .....
then, if i submit a form on that page that then calls class Foo with a new class A, everything works fine. Why do I initally get an error?
Thanks,
Jay