note 106473 added to control-structures.alternative-syntax
| From: | whitney dot a dot beckatgmaildotcom at osu1 dot php dot net | Date: | Fri, 11 Nov 2011 18:23:45 +0000 |
| Subject: | note 106473 added to control-structures.alternative-syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184400@lists.php.net to get a copy of this message | ||
@temec987 at gmail dot com
"This does not work with echo() for some reason. I find this extremely useful!"
As I understand it is because echo is a special language construct that does not return a value.
This is one of the critical distinctions between echo and print. Print, unlike echo, always returns
1. I can't say that this is the reason why echo cannot be chained with booleans the way you
described, as the real reason likely lies in the internal implementation details of echo and print.
To make your example work:
1 === 1 AND print "one equals one";
----
Server IP: 69.147.83.197
Probable Submitter: 74.93.14.187
----
Manual Page -- http://www.php.net/manual/en/control-structures.alternative-syntax.php
Edit -- https://master.php.net/note/edit/106473
Del: integrated -- https://master.php.net/note/delete/106473/integrated
Del: useless -- https://master.php.net/note/delete/106473/useless
Del: bad code -- https://master.php.net/note/delete/106473/bad+code
Del: spam -- https://master.php.net/note/delete/106473/spam
Del: non-english -- https://master.php.net/note/delete/106473/non-english
Del: in docs -- https://master.php.net/note/delete/106473/in+docs
Del: other reasons-- https://master.php.net/note/delete/106473
Reject -- https://master.php.net/note/reject/106473
Search -- https://master.php.net/manage/user-notes.php