Re: [PHP] Classes and arrays

2001-05-09 Thread Wieger Uffink
Hi, write $this->items[$id] instead of $this->$items[$id] bye Wieger Stefan Kostopoulos wrote: > > Hi! > > Can anybody explain to me why this script outputs: > > oneone > > instead of: > > zeroone > > ??? > > Thanks, > > stefan > > class Cart { > var $items; // Items in o

[PHP] Classes and arrays

2001-05-08 Thread Stefan Kostopoulos
Hi! Can anybody explain to me why this script outputs: oneone instead of: zeroone ??? Thanks, stefan $items[$id] = $text; } function output($id){ echo $this->$items[$id]; } } $c = new Cart; $c->add_item(0,"zero"); $c->add_ite