Array problems
Posted: Sun Dec 15, 2002 12:48 pm
Hi,
I'm having problems using array that I cannot figure out at all,
I have a small class, Category, theres two methods(of concern) which are defined as:
Anyway, I use the class by creating various categories, an extract from that section
Right, now comes my problem, when I try to find out whether a page exists it always returns true, whether or not it is, I done a small test and it seems that when an element does not exist it return 'Documentation'(when working with the Development array element)
Can anybody please help me, thankyou!
I'm having problems using array that I cannot figure out at all,
I have a small class, Category, theres two methods(of concern) which are defined as:
Code: Select all
function add($link, $name)
{
$this->$pages[$link] = $name;
}
function hasPage($page_link)
{
return !empty($this->$pages[$page_link]);
}Code: Select all
$dev = new Category;
$dev->catPage("dev");
$dev->add("bugs", "Bugs List");
$dev->add("history", "History");
$dev->add("todolist", "Todo");
$dev->add("docu", "Documentation");
$categories['Development'] = $dev;
$down = new Category;
$down->catPage("download");
$categories['Download'] = $down;Can anybody please help me, thankyou!