|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #870 A new language construct
Submitted: 1998-10-22 16:08 UTC Modified: 1999-06-01 15:21 UTC
From: zmievski at ispi dot net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 3.0.5 OS: Solaris 2.6
Private report: No CVE-ID: None
 [1998-10-22 16:08 UTC] zmievski at ispi dot net

A construct that will iterate through several arrays at once, making current values for each one available inside the loop.


$ProjectID = array("ID001", "ID002", "ID003");
$ProjectName = array("Name1", "Name2", "Name3");
$ProjectManager = array("joe", "bob", "ted");

loop($ProjectID, $ProjectName, $ProjectManager)
    echo "$ProjectName ($ProjectID) - $ProjectManager<br>\n";

This will print out:

Name1 (ID001) - joe
Name2 (ID002) - bob
Name2 (ID003) - ted

This could be extended to allow skip and max values, similar to LIMIT in MySQL.

loop(skip=1, max=2; $ProjectID, $ProjectName, $ProjectManager)'



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1999-06-01 15:21 UTC] jim at cvs dot php dot net
You can already achieve the same results using the
existing looping structures. This syntax seems more
confusing than useful.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Feb 23 03:01:30 2024 UTC