Jump to content

[SOLVED] Counting Directories


pugboy

Recommended Posts

Taken from the manual, with a very slight modification (http://www.php.net/class.dir):

 

<?php
$i = 0;
$d = dir("/etc/php5");
echo "Handle: " . $d->handle . "\n";
echo "Path: " . $d->path . "\n";
while (false !== ($entry = $d->read())) {
   if (is_dir($entry)) {
      $i++;
   }
}
$d->close();

echo "Number of directories: " . $i;
?>

Cool, thanks! Should have looked there first ;)

 

Uh oh... Errors :(

 

Warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(..) is not within the allowed path(s): (/tmp:/var/tmp:/var/www/errors:/usr/share/php:/home/vol4/xxxx/flpsm_1828562/xxxxxx/htdocs) in /home/vol4/xxxxx/flpsm_1828562/xxxxx/htdocs/index.php on line 40

 

I put in the x's because I would like to keep the site private for now :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.