Haven't really looked at it - but elseif is one word - or do you mean
else then an if...

Respectfully,
Ligaya Turmelle

-----Original Message-----
From: jekillen [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 23, 2007 4:03 PM
To: PHP General List
Subject: [PHP] having trouble with is_file() and is_dir() on 5.1.2

Hello php developers:
I am having a problem with the following code:
OS: FreeBSD v6.0
Apache 1.3.34
php 5.1.2
-> $cont is an array produced from opening and reading a
directory:
for($i = 0; $i < count($cont); $i++)
      {
        print $cont[$i].'<br>';
         if(is_file($cont[$i]))
           {
              print "is file: ".$cont[$i].'<br>';
              //array_push($files, $cont[$i]);
             }
        else if(is_dir($cont[$i]))
             {
                 print "is dir: ".$cont[$i]."<br>";
                  //array_push($dirs, $cont[$i]);
              }
       }

The print statements produce the following:

collections
groups
in
index.php
lists.php
new_multi.php
new_single.php
out
pref_code
pref_funct.php
process.php
requests
rlists
routing.php
send.php
steps.php
store
templates

is dir: templates  <- only directory recognized (extra line breaks added
here for readability)

usr_config.php
usr_pref.php

everything without an extension is a directory You will notice that the
only directory detected by this code is templates. There are no files
detected by this code. Does this have something to do with stat cache? I
want to make one array with directories and one array with files. I
can't see any syntax or logic problems.
Thanks in advance;
JK

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to