class Cart
{
var $items;
//item in our shopping cart
// ada $num articles of $artnr to the cart
function add_item ($artnr, $num)
{ $this->items[$artnr]+= $num;
}
//take $num article of $artnr out of the cart
function remove_item($artnr,$num)
{
if($this->items[$artnr]>$num)
{
$this->items[$artnr]-=$num; return true;
}
else
{
return false;
}
}
}
//how to use it?
$cart = new Cart;
echo "test";
$cart->add_item("10",1);
?>
Jumat, Februari 13, 2009
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar