Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #13092 > unrolled thread
| Started by | richard <noreply@example.com> |
|---|---|
| First post | 2014-03-08 10:01 -0500 |
| Last post | 2014-03-17 12:05 +0100 |
| Articles | 7 — 3 participants |
Back to article view | Back to comp.lang.php
readdir lists randomly richard <noreply@example.com> - 2014-03-08 10:01 -0500
Re: readdir lists randomly Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-03-08 10:15 -0500
Re: readdir lists randomly Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-03-08 10:48 -0500
Re: readdir lists randomly richard <noreply@example.com> - 2014-03-08 11:43 -0500
Re: readdir lists randomly Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-03-08 11:58 -0500
Re: readdir lists randomly richard <noreply@example.com> - 2014-03-08 13:05 -0500
Re: readdir lists randomly Arno Welzel <usenet@arnowelzel.de> - 2014-03-17 12:05 +0100
| From | richard <noreply@example.com> |
|---|---|
| Date | 2014-03-08 10:01 -0500 |
| Subject | readdir lists randomly |
| Message-ID | <11mnh75k6r3xo$.1mbw4jguuswxw$.dlg@40tude.net> |
From the php manual
if ($handle = opendir('audio/1960')) {
echo "Directory handle: $handle\n";
echo "Entries:\n";
/* This is the correct way to loop over the directory. */
while (false !== ($entry = readdir($handle))) {
echo "$entry\n";
echo "<br>";
}
closedir($handle);
}
Is there a way to list the entries according to the order they are listed
in the directory?
such as
60-001
60-002
60-003
http://mroldies.net/readdir.php
[toc] | [next] | [standalone]
| From | Lew Pitcher <lew.pitcher@digitalfreehold.ca> |
|---|---|
| Date | 2014-03-08 10:15 -0500 |
| Message-ID | <wuGSu.6044$ZK6.2317@fx15.iad> |
| In reply to | #13092 |
On Saturday 08 March 2014 10:01, in comp.lang.php, "richard"
<noreply@example.com> wrote:
> From the php manual
>
>
> if ($handle = opendir('audio/1960')) {
> echo "Directory handle: $handle\n";
> echo "Entries:\n";
>
> /* This is the correct way to loop over the directory. */
> while (false !== ($entry = readdir($handle))) {
> echo "$entry\n";
> echo "<br>";
>
> }
>
> closedir($handle);
> }
>
> Is there a way to list the entries according to the order they are listed
> in the directory?
Yes, use readdir(). readdir() reads directory entries in the same order as
they exist in the directory.
> such as
> 60-001
> 60-002
> 60-003
Oh, you mean in a specific *sorted* order, and not by the order that the
directory entries are recorded.
For that, you are going to have to read the directory and sort it.
Sorry
--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request
[toc] | [prev] | [next] | [standalone]
| From | Lew Pitcher <lew.pitcher@digitalfreehold.ca> |
|---|---|
| Date | 2014-03-08 10:48 -0500 |
| Message-ID | <EZGSu.16476$AR1.6695@fx13.iad> |
| In reply to | #13093 |
On Saturday 08 March 2014 10:15, in comp.lang.php, "Lew Pitcher"
<lew.pitcher@digitalfreehold.ca> wrote:
> On Saturday 08 March 2014 10:01, in comp.lang.php, "richard"
> <noreply@example.com> wrote:
>
>> From the php manual
>>
>>
>> if ($handle = opendir('audio/1960')) {
>> echo "Directory handle: $handle\n";
>> echo "Entries:\n";
>>
>> /* This is the correct way to loop over the directory. */
>> while (false !== ($entry = readdir($handle))) {
>> echo "$entry\n";
>> echo "<br>";
>>
>> }
>>
>> closedir($handle);
>> }
>>
>> Is there a way to list the entries according to the order they are listed
>> in the directory?
>
> Yes, use readdir(). readdir() reads directory entries in the same order as
> they exist in the directory.
>
>> such as
>> 60-001
>> 60-002
>> 60-003
>
> Oh, you mean in a specific *sorted* order, and not by the order that the
> directory entries are recorded.
>
> For that, you are going to have to read the directory and sort it.
And, for that, you could use scandir()
See http://ca3.php.net/manual/en/function.scandir.php
--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2014-03-08 11:43 -0500 |
| Message-ID | <1fkskajoue6vl.yhtv4jv5l5jb$.dlg@40tude.net> |
| In reply to | #13093 |
On Sat, 08 Mar 2014 10:15:39 -0500, Lew Pitcher wrote:
> On Saturday 08 March 2014 10:01, in comp.lang.php, "richard"
> <noreply@example.com> wrote:
>
>> From the php manual
>>
>>
>> if ($handle = opendir('audio/1960')) {
>> echo "Directory handle: $handle\n";
>> echo "Entries:\n";
>>
>> /* This is the correct way to loop over the directory. */
>> while (false !== ($entry = readdir($handle))) {
>> echo "$entry\n";
>> echo "<br>";
>>
>> }
>>
>> closedir($handle);
>> }
>>
>> Is there a way to list the entries according to the order they are listed
>> in the directory?
>
> Yes, use readdir(). readdir() reads directory entries in the same order as
> they exist in the directory.
>
>> such as
>> 60-001
>> 60-002
>> 60-003
>
> Oh, you mean in a specific *sorted* order, and not by the order that the
> directory entries are recorded.
>
> For that, you are going to have to read the directory and sort it.
>
> Sorry
I can use it as is, just wasn't expecting the list to be shown that way.
Are you by any chance the same Lew Pitcher that is a radio dj in
Cincinnati?
[toc] | [prev] | [next] | [standalone]
| From | Lew Pitcher <lew.pitcher@digitalfreehold.ca> |
|---|---|
| Date | 2014-03-08 11:58 -0500 |
| Message-ID | <7%HSu.61783$zv.43124@fx32.iad> |
| In reply to | #13095 |
On Saturday 08 March 2014 11:43, in comp.lang.php, "richard" <noreply@example.com> wrote: [snip] > Are you by any chance the same Lew Pitcher that is a radio dj in > Cincinnati? Nope. Although I do think it would have been fun to work at WKRP during the heydey of Dr. Johnny Fever and Venus Flytrap. I always had a crush on Bailey. -- Lew Pitcher "In Skills, We Trust" PGP public key available upon request
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2014-03-08 13:05 -0500 |
| Message-ID | <e41ejqwgvbv3.ht6udl0g5pwd$.dlg@40tude.net> |
| In reply to | #13096 |
On Sat, 08 Mar 2014 11:58:42 -0500, Lew Pitcher wrote: > On Saturday 08 March 2014 11:43, in comp.lang.php, "richard" > <noreply@example.com> wrote: > [snip] >> Are you by any chance the same Lew Pitcher that is a radio dj in >> Cincinnati? > > Nope. > > Although I do think it would have been fun to work at WKRP during the heydey > of Dr. Johnny Fever and Venus Flytrap. I always had a crush on Bailey. Since you brought it up, I am in the first season! I was driving taxis that year. I was downtown apperaoching fountain square, stopped for the light and noticed a guy standing beside a huge hollywood style camera on tripod. The cab I was using that had a billboard on top of it for a local restaurant chain. I was surprised to see my cab on the opening scenes! Although the entire show was produced in Hollywood, the cast did make a couple of short appearancces in Cinci. When I mention the fact that WKRC-tv and WKRQ(fm) exist many people think I'm joking. WEBN radio lays claim to the show being patterned after their crazy antics they pull. But they weren't the only ones in town to do that stuf. The buikding they use in the show is just across the stree from WKRC-tv.
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2014-03-17 12:05 +0100 |
| Message-ID | <5326D6F0.9000005@arnowelzel.de> |
| In reply to | #13092 |
Am 08.03.2014 16:01, schrieb richard:
> From the php manual
>
>
> if ($handle = opendir('audio/1960')) {
> echo "Directory handle: $handle\n";
> echo "Entries:\n";
>
> /* This is the correct way to loop over the directory. */
> while (false !== ($entry = readdir($handle))) {
> echo "$entry\n";
> echo "<br>";
>
> }
>
> closedir($handle);
> }
>
> Is there a way to list the entries according to the order they are listed
> in the directory?
> such as
> 60-001
> 60-002
> 60-003
A directory does not have such "order". The sorting has to be done
afterwards.
--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web