php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #24250 Shell like 'for arg in [list]' loop
Submitted: 2003-06-18 21:02 UTC Modified: 2003-06-19 00:30 UTC
From: jbreker at sympatico dot ca Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.3.2 OS:
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: jbreker at sympatico dot ca
New email:
PHP Version: OS:

 

 [2003-06-18 21:02 UTC] jbreker at sympatico dot ca
Description:
------------
Right now I am executing shell scripts (like the one below) in order to put pictures up on my site. I would prefer to do this entirely in php code. I looked at the foreach loop and at some filesystem functions but I can't see any combination working when you don't know the filename.

sample shell script example code:

for file in *.jpg
do
    echo "<a href=\"$file\"><img src=\"$file\"/></a><br/>"
done




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-19 00:30 UTC] derick@php.net
What's wrong with:

foreach(glob('*.jpg') as $file) {
    echo "<a href=\"$file\"><img src=\"$file\"/></a><br/>";
}

We're a scripting language here, not a shell :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC