Fatal error: Cannot access empty property

Hi

I am having issues with the following code and it keeps giving me an error the part I am having issues with is in bold:

[php]
public function AddItem($product_id)
{
if (array_key_exists($product_id , $this->$items))
$this->items[$product_id] = $this->items[$product_id] + 1;
else
$this->items[$product_id] = 1;

}

[/php]

Sorry the error I am getting is:

Notice: Undefined variable: items &

Fatal error: Cannot access empty property.

All to do with:

$this->items[$product_id] = $this->items[$product_id] + 1;

Sponsor our Newsletter | Privacy Policy | Terms of Service