Re: I am stumped

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux