faqts : Computers : Programming : Languages : PHP : Common Problems : Strings

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

Is it possible to call n object method in a heredoc syntax string?

Mar 22nd, 2006 09:54
Guillaume B,


Hello,
I have noticed that you cannot call an object method in a 
heredoc syntax, for example:

class toto {
    function method() {
        return "coucou";
    } 
}

$toto = new toto();
echo <<<EOT
toto method : {$toto->method()}
EOT;

Should ouput "toto method : coucou", yet
it outputs: Parse error: parse error, unexpected '(', expecting '}'

Is there a way to do that or not?
Thanks to all