Req #31627 [Com]: return statement should return

From: Date: Thu, 21 Jul 2011 03:36:12 +0000
Subject: Req #31627 [Com]: return statement should return
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-162068@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=31627&edit=1

 ID:                 31627
 Comment by:         binarycleric at gmail dot com
 Reported by:        mnemo at minimum dot se
 Summary:            return statement should return
 Status:             Open
 Type:               Feature/Change Request
 Package:            Scripting Engine problem
 Operating System:   *
 PHP Version:        *
 Block user comment: N
 Private report:     N

 New Comment:

That really isn't what return does because it's not a conditional.  Similar 
behaviour can be achieved by using: 

return (mysql_connect($blah) !== false) ? true : false;


Previous Comments:
------------------------------------------------------------------------
[2005-01-20 19:28:40] mnemo at minimum dot se

Description:
------------
I wish "return doh" was treated like an expression when though this expression will never
be computable.

The reason is that I want to write this:

mysql_connect(blah) or return false;

Just like I do with die etc.



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=31627&edit=1


Thread (6 messages)

« previous php.bugs (#162068) next »