Get group for the current DirectoryIterator item in PHP

Description

The following code shows how to get group for the current DirectoryIterator item.

Example


/*from w w w  . j  av a2s  . c  o m*/
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
$groupid  = $iterator->getGroup();
echo 'Directory belongs to group id ' . $groupid . "\n";
print_r(posix_getgrgid($groupid));
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    File »




Directory
DirectoryIterator
Drive
File
File Permission
File Read Save
FileSystemIterator
Path
Zip