|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40712 return after "or"
Submitted: 2007-03-03 18:54 UTC Modified: 2007-03-04 04:09 UTC
From: s dot j dot t dot mocking at students dot uu dot nl Assigned:
Status: Not a bug Package: *Programming Data Structures
PHP Version: 5.2.1 OS: Linux (Debian Testing)
Private report: No CVE-ID:
 [2007-03-03 18:54 UTC] s dot j dot t dot mocking at students dot uu dot nl
"<statement> or die" works as expected, but "<statement> or return" results in syntax errors.

Haven't found anything in the documentation which describes this behavior. If it's not a bug, it's very counterintuitive.

Reproduce code:
This works:

function foo()
  0 or die("bla");

This produces a syntax error:

function bar()
  0 or return ("bla");

Expected result:
I would expect bar() to return bla

Actual result:
Parse error: syntax error, unexpected T_RETURN


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-04 04:09 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Sun Apr 26 17:01:41 2015 UTC