PHP Manual
Prev |  | Next

# posix_getgrgid

(PHP 3 >= 3.0.13, PHP 4, PHP 5)

posix_getgrgid -- Return info about a group by group id

## Description

array posix_getgrgid ( int gid )

Gets information about a group provided its id.

## Parameters

`gid`

  The group id.

## Return Values

Returns an array of information about a group and `FALSE` on failure. If `gid` isn't a number then `NULL` is returned and an `E_WARNING` level error is generated.

## ChangeLog

Version | Description
--- | ---
4.2.0 | Prior to this version, members was simply an integer representing the number of members in the group, and the member names were returned with numerical indices.

## Examples

Example 1. Example use of posix_getgrgid()

`<?php $groupid = posix_getegid(); $groupinfo = posix_getgrgid($groupid); print_r($groupinfo); ?>`

The above example will output something similar to:

    Array
    (
        [name]    => toons
        [passwd]  => x
        [members] => Array
            (
                [0] => tom
                [1] => jerry
            )
        [gid]     => 42
    )

## See Also

posix_getegid()
filegroup()
stat()
safe_mode_gid

Prev | Home | Next
posix_getgid | Up | posix_getgrnam