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

 ID:                 27612
 Updated by:         ni...@php.net
 Reported by:        camka at email dot ee
 Summary:            "else" statement for "foreach" construct
-Status:             Open
+Status:             Duplicate
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   Any
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Closing as duplicate of https://bugs.php.net/bug.php?id=26411.


Previous Comments:
------------------------------------------------------------------------
[2004-03-16 04:05:39] camka at email dot ee

Description:
------------
"else" statement would be very useful and comfortable when the array_expression 
in foreach construct is empty. There'd be no need to calculate count(array) 
every time you need to execute some code in case of empty array. 
Smarty has such syntax and it really helps.

Reproduce code:
---------------
$count = count($array);

foreach($array as $arr)
{
...
}

if(!$count)
{
...
}

===============================

foreach($array as $arr)
{
...
}
else //may be [foreachelse] or [elseforeach]
{
...
}



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



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

Reply via email to