Edit report at https://bugs.php.net/bug.php?id=26411&edit=1

 ID:                 26411
 Updated by:         larue...@php.net
 Reported by:        php at bellytime dot com
 Summary:            while {} else {}
-Status:             Open
+Status:             Wont fix
 Type:               Feature/Change Request
 Package:            Scripting Engine problem
 Operating System:   *
 PHP Version:        *
 Block user comment: N
 Private report:     N

 New Comment:

no such syntax in other languages.


Previous Comments:
------------------------------------------------------------------------
[2012-08-21 17:38:24] bensor987 at neuf dot fr

Why don't you go a little bit further ?

while ( $row = mysql_fetch_assoc( $result ) ){

} else for ( $i = 0; $i < $cpt; $i++ ) {

} else if ( $dude ) {

} else {

}

------------------------------------------------------------------------
[2012-04-26 02:13:36] ma-martin at hotmail dot de

Hey, i was also looking for some while {} else {} feature...
but i think it could be difficult to implement such a function in php.
Because the else{} event would start after the while{}-loop ends -> everytime 
after the last result!
think about it!

------------------------------------------------------------------------
[2012-01-25 12:16:57] hawkyhawk14 at gmail dot com

This is a great idea. I am currently needing something like this, but however 
got 
around it using flags and making the flag true in the while. It would be alot 
more 
convenient if there was an else!

Please add this feature!!!

------------------------------------------------------------------------
[2011-12-06 16:31:22] absimu at hotmail dot com

I agree. I think a while () else () will make things easier. I was researching 
and 
found out that it doesnt exist yet. 


while($row = mysqli_fetch_assoc($result)) { }

with al else I would fix it.. I am new in PHP,. I will try to find something to 
fix it. but if the while else is release in a new version that would be nice.

------------------------------------------------------------------------
[2011-02-18 01:14:34] ijrbiz at gmail dot com

Highly agreed, this request would be very practical for improved coding 
structure and 
follows logical language syntax nicely.

function remove_items (&$arr, $needle) {
        while ($key = array_search($needle, $arr)) {
                unset( $arr[$key] );
        } else return false; // No items present
        return true; // Item(s) removed
}

------------------------------------------------------------------------


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

Reply via email to