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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
34 - 32 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Sun May 19 03:01:33 2024 UTC