The chgroup() function updates the file group. Remember that only the superuser has the authority to change the group of a file arbitrarily,
file_path − Set the path of file or directory to be checked. Required.
group − Set the new user group name or number.
The chgroup() function returns.
The following is an example that checks for file “one.txt” and changes its file group.
<?php $file_path1 = "/themes/myfiles/one.php"; $file_path2 = "/themes/myfiles/two.php"; // changing groups of two files chgrp($file_path1, "admin"); chgrp($file_path2, "guest"); ?>