![]() |
VOOZH | about |
The chgrp() function in PHP is an inbuilt function that is used to change the user group of the specified file. It returns true on success and false on failure. Only the superuser has the right to change the group of a file arbitrarily.
Syntax:
bool chgrp ( $filename, $group )
Parameters: The chgrp() function in PHP accepts two parameters which are filename and user.
Return Value: The chgrp() function returns true on success and false on failure.
Errors And Exception:
Examples:
Input : chgrp("gfg.txt", "administrator")
Output :true
Input : $filename = "/user/Desktop/geeksforgeeks/gfg.txt";
chgrp( $filename, "guest" );
Output :true
Below programs illustrate the chgrp() function:
Program 1:
Output:
true
Program 2:
Output:
true