note 91055 deleted from function.return by danbrown
| From: | danbrown@php.net | Date: | Fri, 22 May 2009 14:40:24 +0000 |
| Subject: | note 91055 deleted from function.return by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155879@lists.php.net to get a copy of this message | ||
Note Submitter: kranthi117 at gmail dot com
----
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)