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: 2020-12-09 17:36 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: Suspended 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
 [2020-12-09 17:36 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2020-12-09 17:36 UTC] cmb@php.net
This is debatable, and since this bug tracker is not suitable for
such discussion, please forward the feature request to the
internals mailing list.  For the time being, I'm suspending this
ticket.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 03:01:28 2024 UTC