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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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 05:01:27 2024 UTC