[Resolvido] __toString
porque desse erro ? :P primeira vez que uso o __toString algo errado no uso ?
<?php
class MonthChange{
private $ArrayMonth;
private $Month;
public function __construct($Month){
$this->ArrayMonth =
array(1 => 'Janeiro',
2 => 'Fevereiro',
3 => 'Março',
4 => 'Abril',
5 => 'Maio',
6 => 'Junho',
7 => 'Julho',
8 => 'Agosto',
9 => 'Setembro',
10 => 'Outubro',
11 => 'Novembro',
12 => 'Dezembro'
);
$this->Month = $Month;
}
public function __toString(){
return $this->ArrayMonth[$this->Month];
}
}
echo New MonthChange(4);
> Catchable fatal error: Method MonthChange::__toString() must return a string value
valww
Discussão (6)
Carregando comentários...