i deleted the original message, but here's why your code wouldn't work:
you were using $this->$items...
drop the second $
try this:
<?
class Cart {
var $items; // Items in our shopping cart
function add_item ($id,$text) {
$this->items[$id] = $text;
}
function output($id){
echo $this->items[$id];
}
}
$c = new Cart();
$c->add_item(0,"zero");
$c->add_item(1,"one");
$c->add_item(2,"two");
$c->output(0);
$c->output(1);
$c->output(2);
?>
that should be what you're looking for
-jack
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]