note 91055 added to function.return
| From: | kranthi117 at gmail dot com | Date: | Fri, 22 May 2009 13:52:45 +0000 |
| Subject: | note 91055 added to function.return | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-155877@lists.php.net to get a copy of this message | ||
since return is a language construct the parenthesis are of no use. moreover they may create
confusion
for example
<?php
return (1) * 2;
?>
returns 2.
the above satement applies to many language constructs like echo, print, etc
i had to scratch my head for 2 hours to know why
<?php
$a = print(4) + 3; // it should be obvious if i write $a = print 4 + 3
var_dump($a);
?>
outputs
7 int(1)
----
Server IP: 213.249.64.162
Probable Submitter: 203.110.246.230
----
Manual Page -- http://www.php.net/manual/en/function.return.php
Edit -- https://master.php.net/note/edit/91055
Del: integrated -- https://master.php.net/note/delete/91055/integrated
Del: useless -- https://master.php.net/note/delete/91055/useless
Del: bad code -- https://master.php.net/note/delete/91055/bad+code
Del: spam -- https://master.php.net/note/delete/91055/spam
Del: non-english -- https://master.php.net/note/delete/91055/non-english
Del: in docs -- https://master.php.net/note/delete/91055/in+docs
Del: other reasons-- https://master.php.net/note/delete/91055
Reject -- https://master.php.net/note/reject/91055
Search -- https://master.php.net/manage/user-notes.php