Req #71098 [Opn->Dup]: "return" can't be used after "or"
Edit report at https://bugs.php.net/bug.php?id=71098&edit=1
ID: 71098
Updated by: cmb@php.net
Reported by: admin at mvpro dot net
Summary: "return" can't be used after "or"
-Status: Open
+Status: Duplicate
Type: Feature/Change Request
-Package: *General Issues
+Package: Scripting Engine problem
Operating System: Any
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Duplicate of request #31627.
Previous Comments:
------------------------------------------------------------------------
[2015-12-11 22:20:47] admin at mvpro dot net
Description:
------------
"return" can't be used after "or". I think it's strange because
"die" for example can be used after "or".
Test script:
---------------
<?php
function connect()
{
mysql_connect('localhost', '', '') or return false;
return 1;
}
$connect = connect();
if( $connect == 1)
echo 'Successfully connected';
else
echo 'Connect failed!';
Expected result:
----------------
Connect failed!
Actual result:
--------------
Parse error: syntax error, unexpected 'return' (T_RETURN) on line 5
https://3v4l.org/3qAYN
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71098&edit=1
Thread (2 messages)