note 110762 added to control-structures.alternative-syntax
| From: | klebercal at gmail dot com | Date: | Tue, 04 Dec 2012 18:21:52 +0000 |
| Subject: | note 110762 added to control-structures.alternative-syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-192270@lists.php.net to get a copy of this message | ||
The example below does not work with echo() because it evaluates the print() return value.
Remember that print() always returns 1, while echo does not return anything.
That's why this works and simulates an IF statement:
<?php
$value = 'Something';
isset($value) AND print('Works');
?>
While this gives you a parse error:
<?php
$value = 'Something';
isset($value) AND echo('Works');
?>
----
Server IP: 187.73.33.52
Probable Submitter: 186.204.217.183
----
Manual Page -- http://www.php.net/manual/en/control-structures.alternative-syntax.php
Edit -- https://master.php.net/note/edit/110762
Del: integrated -- https://master.php.net/note/delete/110762/integrated
Del: useless -- https://master.php.net/note/delete/110762/useless
Del: bad code -- https://master.php.net/note/delete/110762/bad+code
Del: spam -- https://master.php.net/note/delete/110762/spam
Del: non-english -- https://master.php.net/note/delete/110762/non-english
Del: in docs -- https://master.php.net/note/delete/110762/in+docs
Del: other reasons-- https://master.php.net/note/delete/110762
Reject -- https://master.php.net/note/reject/110762
Search -- https://master.php.net/manage/user-notes.php