
PHP - Jak použít magisckou metodu __toString()?
Ahoj,
stále dostávám chybu
Catchable fatal error: Method Template::__toString() must return a string value in
class Template {
function __toString()
{
return '<html>....</html>';
}
}
class AP {
function __toString()
{
$tpl = new Template ();
return $tpl;
}
}
$ap = new AP();
echo $ap;
Poradí někdo? pokud před return dám (string) tak všechno funguje. Díky