PHP chgrp() Function

Definition and Usage

The chgrp() function changes the group of the file.

Returns TRUE if successful, otherwise returns FALSE.

Syntax

chgrp(file,group)
Parameter Description
file Required. Specify the file to be checked.
group Optional. Specify a new group. It can be a group name or the ID of the group.

Description

try to change the file file change the group to group (Specified by group name or group ID).

Only super users can arbitrarily modify the group of the file, other users may only change the group of the file to the group they belong to.

Example

<?php
chgrp("test.txt","admin")
?>