php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #54802 Request for Alternative Syntax Control Structure for foreach
Submitted: 2011-05-18 00:01 UTC Modified: 2011-05-18 00:04 UTC
From: tobiasoleary at mac dot com Assigned:
Status: Closed Package: Output Control
PHP Version: 5.3.6 OS: Mac OS X
Private report: No CVE-ID: None
 [2011-05-18 00:01 UTC] tobiasoleary at mac dot com
Description:
------------
---
From manual page: http://www.php.net/control-structures.alternative-syntax
---

Request for Alternative Syntax Control Structure for foreach

I would like to do this:
<ul>
<?php foreach($myarray as $myvalue): ?>
<li><? print $myvalue; ?></li>
<?php endforeach; ?>
</ul>

Test script:
---------------
<ul>
$myarray = array(1, 2, 3);
<?php foreach($myarray as $myvalue): ?>
<li><? print $myvalue; ?></li>
<?php endforeach; ?>
</ul>

Expected result:
----------------
Generate a html list with 3 list items containing the text 1, 2, and 3, 
respectively.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-18 00:04 UTC] tobiasoleary at mac dot com
-Status: Open +Status: Closed
 [2011-05-18 00:04 UTC] tobiasoleary at mac dot com
Feature has already been added. I was being a dumb dumb.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC