|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-09-22 09:29 UTC] nikic@php.net
[2012-09-22 09:29 UTC] nikic@php.net
-Status: Open
+Status: Duplicate
-Package: Feature/Change Request
+Package: *General Issues
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Feb 05 01:00:01 2026 UTC |
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] { ... }