php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46384 expr() or continue;
Submitted: 2008-10-25 13:08 UTC Modified: 2011-04-08 21:54 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: zyss at mail dot zp dot ua Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: 5.2.6 OS: RHEL4, WinXP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zyss at mail dot zp dot ua
New email:
PHP Version: OS:

 

 [2008-10-25 13:08 UTC] zyss at mail dot zp dot ua
Description:
------------
Why it is possible to write:

  foo() or die("Can't foo");

but impossible to write:

  foreach ($bars as $bar) {
    foo($bar) or contine; // or break
    do_something($bar);
  }

Having this functionality would be very convenient as a short form of the following:

  if (!foo($bar)) continue;  // or break


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-27 16:58 UTC] info at netmosfera dot it
because "break" and "continue" can't represents boolean values :)
 [2008-10-27 20:09 UTC] zyss at mail dot zp dot ua
Yes, that's pretty obvious, but PHP could be modified to be able to do that. This change will make code more clear (like ?: operator) therefore it is worth implementing.
 [2011-04-08 21:54 UTC] jani@php.net
-Package: Feature/Change Request +Package: Scripting Engine problem
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC