Edit report at https://bugs.php.net/bug.php?id=26411&edit=1
ID: 26411
Comment by: rageclick at gmail dot com
Reported by: php at bellytime dot com
Summary: while {} else {}
Status: Wont fix
Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: *
PHP Version: *
Block user comment: N
Private report: N
New Comment:
I almost never join conversations or write comments online but I would also love to see this feature
as well. It's just nicer, easier to look at and it uses less code which is what I go for.
However... if there is a reason behind why you won't do this, I would understand.
while ($result = $get->fetch_assoc()) {
$in=1;
echo 'Something';
}
if(!$in){ echo 'Nothing'; }
WHEN I could be doing this
while ($result = $get->fetch_assoc()) {
echo 'Something';
}else{ echo 'Nothing'; }
Previous Comments:
------------------------------------------------------------------------
[2016-05-10 13:56:48] asd at asd dot asd
Hey, it's an awesome feature everyone would like. Let's reject it!
------------------------------------------------------------------------
[2016-05-04 13:26:08] nikic@php.net
Related To: Bug #72148
------------------------------------------------------------------------
[2015-06-10 12:11:38] cmb@php.net
Related To: Bug #67843
------------------------------------------------------------------------
[2014-10-12 14:24:55] nikic@php.net
Closing as Wfx as this feature was rejected in https://wiki.php.net/rfc/loop_or.
------------------------------------------------------------------------
[2013-02-04 21:34:15] sebi at max-vision dot ro
I'd love something like this: if there is at least one iteration, even with break or continue,
don't do "else", otherwise, enter the else.
Another great would be even better, something like "while(..){..}done{...}else{...}"
It could be a new keyword like "whileif".
Anyway, even the first proposed structure would be awesome.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=26411
--
Edit this bug report at https://bugs.php.net/bug.php?id=26411&edit=1