PHP chgrp() Function

Definition

The chgrp() function changes the usergroup of the specified file.

Syntax

PHP chgrp() Function has the following syntax.

chgrp(file,group)

Parameter

ParameterIs RequiredDescription
fileRequired.File to check
groupRequired.New group. Can be a group name or a group ID

Return

Returns TRUE on success and FALSE on failure.

Example


<?php//  w  w  w  .j ava2  s .c o m
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));
?>




















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions