The chgrp() function changes the usergroup of the specified file.
PHP chgrp() Function has the following syntax.
chgrp(file,group)
Parameter | Is Required | Description |
---|---|---|
file | Required. | File to check |
group | Required. | New group. Can be a group name or a group ID |
Returns TRUE on success and FALSE on failure.
<?php//from ww w .j a va 2 s .c om
chgrp("test.txt","admin");
$filename = 'my_file.txt';
printf(filegroup($filename));
chgrp($filename, 8);
print "\n";
clearstatcache(); // do not cache filegroup() results
printf(filegroup($filename));
?>