ciao!
ho trovato questo esempio che stampa a video:

You ordered (2) 'Widget 22's at $4.90, for a total of: $9.80.

ma non capisco coma faccio ad associare alle variabili $item_name, $item_price, $item_qty le variabili $iName, $iPrice, $iQty

$item_name = 'Widget 22';
$item_price = 4.90;
$item_qty = 2;

class Item {
protected $name, $price, $qty, $total;

public function __construct($iName, $iPrice, $iQty) {
$this->name = $iName;
$this->price = $iPrice;
$this->qty = $iQty;
$this->calculate();
}

protected function calculate() {
$this->price = number_format($this->price, 2);
$this->total = number_format(($this->price * $this->qty), 2);
}

public function __toString() {
return " You ordered ($this->qty) '$this->name'" . ($this->qty == 1 ? "" : "s") .
" at \$$this->price, for a total of: \$$this->total.";
}
}