note 105138 added to function.echo
| From: | fire at dls dot net | Date: | Fri, 29 Jul 2011 18:01:54 +0000 |
| Subject: | note 105138 added to function.echo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-181999@lists.php.net to get a copy of this message | ||
Pay attention to this part of the documentation:
echo() (unlike some other language constructs) does not behave like a function, so it cannot always
be used in the context of a function
I was trying to make certain that I was detecting errors and was trying code like this:
@alwaysFails() or echo('Surprise! It failed again');
This error was generated:
[29-Jul-2011 12:56:19] PHP Parse error: syntax error, unexpected T_ECHO in
/Applications/MAMP/test.php on line 12
Changing to die(), print() or a function I defined worked fine. Beware of this limitation of echo.
----
Server IP: 69.147.83.197
Probable Submitter: 75.149.80.178
----
Manual Page -- http://www.php.net/manual/en/function.echo.php
Edit -- https://master.php.net/note/edit/105138
Del: integrated -- https://master.php.net/note/delete/105138/integrated
Del: useless -- https://master.php.net/note/delete/105138/useless
Del: bad code -- https://master.php.net/note/delete/105138/bad+code
Del: spam -- https://master.php.net/note/delete/105138/spam
Del: non-english -- https://master.php.net/note/delete/105138/non-english
Del: in docs -- https://master.php.net/note/delete/105138/in+docs
Del: other reasons-- https://master.php.net/note/delete/105138
Reject -- https://master.php.net/note/reject/105138
Search -- https://master.php.net/manage/user-notes.php