[PHP] Re: I am stumped
- Date: Sun, 29 Apr 2018 11:39:43 +0200
- From: "Christoph M. Becker" <cmbecker69@xxxxxx>
- Subject: [PHP] Re: I am stumped
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
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php