PHP filegroup() Function Last Updated : 28 Apr, 2025 Comments Improve Suggest changes Like Article Like Report The filegroup() is an inbuilt function in PHP that returns the filegroup. This function returns a group id that can resolve using posix_getgrigid() to a name. Syntax: filegroup(string $filename): int|falseParameter: This function has only one parameter. filename: A name of the file or path of the fileReturn value: This function returns the numerical group id if the function is successful otherwise the function will return "false". Group id can resolve using the posix_getgrgid() function. Example 1: The following code demonstrates the filegroup() function. PHP <?php $file = 'text.txt'; $group_id = filegroup($file); // ID of the group we want to check for $expected_group_id = 1000; if ($group_id === $expected_group_id) { echo "The file $file is owned by the expected group."; } else { echo "The file $file is not owned by the expected group."; } ?> Output: The file text.txt is owned by the expected group. Example 2: In this program, we will print the group id of the file. PHP <?php $fileName = 'text.txt' ; print_r(filegroup($fileName)); ?> Note: Output will be different according to your system. Output: 1000 Reference: https://www.php.net/manual/en/function.filegroup.php Comment More infoAdvertise with us Next Article PHP filegroup() Function neeraj3304 Follow Improve Article Tags : PHP PHP-function PHP-Filesystem Similar Reads PHP count() Function The count() function in PHP is used to count the number of elements in an array or the countable properties of an object. The function returns an integer value representing the number of items present.Syntax:count($array, mode)In this syntax:$array (mandatory): Refers to the array, whose elements ar 3 min read PHP end() Function The end() function is an inbuilt function in PHP and is used to find the last element of the given array. The end() function changes the internal pointer of an array to point to the last element and returns the value of the last element.Syntax:end($array)Parameters:This function accepts a single par 2 min read PHP Arrow Functions PHP arrow functions are a shorthand syntax for anonymous functions. It was introduced in PHP 7.4, which provides a shorter way to write anonymous functions. They allow you to create functions with fewer lines of code while maintaining functionality. They provide an easy-to-read syntax, particularly 5 min read PHP | each() Function The each() function is an inbuilt function in PHP which basically returns an array with four elements, two elements (1 and Value) for the element value, and two elements (0 and Key) for the element key and moves the cursor forward. Syntax: each(array) Parameters: Array: It specifies the array which 2 min read PHP each() Function The each() function is an inbuilt function in PHP and is used to get the current element key-value pair of the given array to which the internal pointer is currently pointing. After returning the key and value of the current element the internal pointer is incremented by one in the array. Note: You 2 min read PHP compact() Function The compact() function is an inbuilt function in PHP and it is used to create an array using variables. This function is the opposite of the extract() function. It creates an associative array whose keys are variable names and their corresponding values are array values. Syntax: array compact("varia 2 min read PHP explode() Function The explode() function is an inbuilt function in PHP used to split a string into different strings. The explode() function splits a string based on a string delimiter, i.e. this function returns an array containing the strings formed by splitting the original string. Syntax:array explode(separator, 3 min read PHP extract() Function The extract() Function is an inbuilt function in PHP. The extract() function does array to variable conversion. That is it converts array keys into variable names and array values into variable value. In other words, we can say that the extract() function imports variables from an array to the symbo 3 min read PHP array() Function The array() function is an inbuilt function in PHP which is used to create an array. There are three types of array in PHP: Indexed array: The array which contains numeric index. Syntax: array( val1, val2, val3, ... ) Associative array: The array which contains name as keys. Syntax: array( key=>v 2 min read PHP | fstat( ) Function The fstat() function in PHP is an inbuilt function which is used to return information about an open file. The file name is sent as a parameter to the fstat() function and it returns an array with the following elements : Numeric Associative Description 0 dev Device number 1 ino inode number* 2 mode 3 min read Like