Nibinaear
February 23rd, 2008, 11:14 AM
I'm trying to use an array from a file in my object oriented method, but it can't see it. I've tried making the array global but it makes no difference. If I try and print the array in the same file then it works, but methods can't see it.
class Gallery
{
public function __construct(){}
public function getRows($images)
{
global $gallery_rows;
foreach($galery_rows as $r=>$s)
{
if($images>=$galery_rows[$r]['lower'] && $images<=$galery_rows[$r]['upper'])
{
return $galery_rows[$r]['rows'];
}
}
}
}
$gallery_rows is declared in a separate file but I know it has been included right. My error is:
Notice: Undefined variable: galery_rows in C:\webpages\rspca\classes\Gallery.php on line 32
class Gallery
{
public function __construct(){}
public function getRows($images)
{
global $gallery_rows;
foreach($galery_rows as $r=>$s)
{
if($images>=$galery_rows[$r]['lower'] && $images<=$galery_rows[$r]['upper'])
{
return $galery_rows[$r]['rows'];
}
}
}
}
$gallery_rows is declared in a separate file but I know it has been included right. My error is:
Notice: Undefined variable: galery_rows in C:\webpages\rspca\classes\Gallery.php on line 32