premetto che le classi in PHP le ho iniziate ieri notte, sto nel caso 1, c'è un echo nella mia classe:
Codice PHP:
<?php
class Persona {
var $nome;
var $cognome;
var $sesso;
var $eta;
//Costruttore
function Persona($n,$c,$s,$e) {
$this->nome = $n;
$this->cognome = $c;
$this->sesso = $s;
$this->eta = $e;
}
function toString() {
echo $this->nome.' '.$this->cognome.'
'.$this->sesso.', '.$this->eta.' anni';
}
}
?>
Ma perchè non si può mettere?