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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tobiasoleary at mac dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Sun Oct 06 07:01:27 2024 UTC