“Rivals can easily copy your improvements in quality and efficiency.
But they shouldn’t be able to copy your strategic positioning –
what distiguishes your company from all the rest.”

Michael A. Porter, 1996.

Jumat, Februari 13, 2009

PHP : CLASS

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);

?>

Tidak ada komentar:

Posting Komentar