PHP chgrp() Function
In this chapter you will learn:
- What is PHP chgrp() Function
- PHP chgrp() Function syntax
- PHP chgrp() function parameter
- PHP chgrp() Function Return Value
- Example - changes the usergroup of the specified file
Definition
The chgrp() function changes the usergroup of the specified file.
Syntax
PHP chgrp() Function has the following syntax.
chgrp(file,group)
Parameter
Parameter | Is Required | Description |
---|---|---|
file | Required. | File to check |
group | Required. | New group. Can be a group name or a group ID |
Return
Returns TRUE on success and FALSE on failure.
Example
<?php//from java 2s . 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));
?>
Next chapter...
What you will learn in the next chapter:
- What is PHP chmod() Function
- PHP chmod() Function Syntax
- Parameter for PHP chmod() Function
- PHP chmod() Function Return Value
- Example - changes permissions of the specified file
Home » PHP Tutorial » PHP File Functions