Hi,

I am making use of a reference to an array of objects in a foreach loop. I think I am missing something. I keep getting the following warning:

Code:
Invalid argument supplied for foreach()
I am aware that warnings can be ignored, but I thought if I can eliminate them, its better for my code.

As an example, consider:
PHP Code:

//getObjectArray() retrieves an array of objects
$objArr = &getObjectArray();

foreach(
$objArr as $obj)//warning generated here
{
   echo 
"Name:" $obj->name;
   echo 
"Surnam:"$obj->surname;

Any help on how I can eliminate the warning will be most appreciated!

tino