Can U explain me why in the following file, the last call to the fonction $cart->printle(); doesnt print anything?
Why doesn't the class panier keep all the items added to the panier in the var $item ?
Thanks,
lejoe
<?php
class Panier {
var $items;
function add_item ($artnr, $num) {
$this->items[$artnr] += $num;
}
function printle () {
print_r($items);
}
}
$cart = new Panier;
$cart->add_item("0", 0);
$cart->add_item("1", 1);
$cart->add_item("2", 2);
$cart->printle();
?>