Req #21555 [Opn->Dup]: Possible extensions to alternative control syntax
| From: | nikic@php.net | Date: | Sat, 22 Sep 2012 09:26:28 +0000 |
| Subject: | Req #21555 [Opn->Dup]: Possible extensions to alternative control syntax | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-173635@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=21555&edit=1
ID: 21555
Updated by: nikic@php.net
Reported by: gabe at bravenet dot com
Summary: Possible extensions to alternative control syntax
-Status: Open
+Status: Duplicate
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: All
PHP Version: 4.3.0
Block user comment: N
Private report: N
New Comment:
Closing as duplicate of https://bugs.php.net/bug.php?id=26411. (This bug is
older, but the other one has more discussion.)
Previous Comments:
------------------------------------------------------------------------
[2003-01-09 15:48:14] gabe at bravenet dot com
The alternative control structure syntax (see http://php.benscom.com/manual/en/control-structures.alternative-syntax.php)
is very useful for templating purposes. However, I miss the smarty-style 'else' clauses:
foreachelse, whileelse etc.
I would like to be able to do this:
<?php foreach($array as $item): ?>
// if array has items, this is repeated once per item
<?php foreachelse: ?>
// we get here if $array has no items, then exit
<?php endforeach; >
...or this...
<?php while($something == $somestate): ?>
// repeated while condition is met
<?php whileelse: ?>
// if condition is never met we go here once and exit.
<?php endwhile; ?>
I think these additions would be fairly useful.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=21555&edit=1