Re: I am stumped
| From: | Christoph M. Becker | Date: | Sun, 29 Apr 2018 09:39:43 +0000 |
| Subject: | Re: I am stumped | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-326453@lists.php.net to get a copy of this message | ||
On 29.04.2018 at 06:16, Jeffry Killen wrote:
> if(($_DR = scandir($_dir)) === false)
[…]
> for($_itr = 1; $_itr < count($_DR); $_itr++)
>
> testBed is the directory being read for this
> Why is testBed/test_1 included and the value is 1
> instead of 'directory'. At the bottom of the list is test_1 listed as a file.
An array created by scandir() is indexed from 0 to count()-1. The first
two elements normally have the values '.' and '..', respectively.
You're starting from 1, so '.' is skipped, but '..' produces the test_1
in your case.
--
Christoph M. Becker