From:             z_rules55 at hotmail dot com
Operating system: 
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  Use parentheses when returning an expression... *everything* 
is an expression!

Description:
------------
The docs section on "return"
(http://us3.php.net/manual/en/function.return.php) states that:
"Note that since return() is a language construct and not a function, the
parentheses surrounding its arguments are only required if the argument
contains an expression. It is common to leave them out while returning a
variable, and you actually should as PHP has less work to do in this
case."

But the docs on what an expression *is*
(http://us3.php.net/manual/en/language.expressions.php) say that:
"In PHP, almost anything you write is an expression. The simplest yet most
accurate way to define an expression is "anything that has a value"."
And then goes on to say that the literal '5' is an expression. It's
confusing.

What, then, is an expression in PHP? If parentheses are required when
returning the value of an expression, does that mean an expression as in a
calculation (return (1 + 2)), or an assignment (return ($GLOBALS['a'] =
$b)), or a function call (return (funky_function())), or what?


-- 
Edit bug report at http://bugs.php.net/?id=38723&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38723&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38723&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38723&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38723&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=38723&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38723&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38723&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38723&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38723&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38723&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=38723&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=38723&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38723&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38723&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38723&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38723&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38723&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38723&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38723&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38723&r=mysqlcfg

Reply via email to