All pastes #468875 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-03 12:47 UTC
rendered paste body
<?
class Winkelwagen {
	public $products = array(id, name); // Array met straks getalletjes
	public function addProduct($id,$name) { $this->products[id] = $ID; $this->products[name] = $name; } // Product op eerst vrije plaats ([]) toevoegen
	public function getProducts() { return $this->products; } // Gewoon productenarray teruggeven
}
?>

getProducts() zal een array terug geven: ID en NAME
zeg dat ID het volgende bevat:
ID[0] = 09
ID[1] = 08

NAME[0] = HOI
NAME[1] = HOER

ID[0] is productID van NAME[0].