Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

posix_getgrnam

Description

The posix_getgrnam of POSIX for PHP returns information about a group by name.

Syntax

posix_getgrnam(
    string $name
): array|false

Parameters

name

The name of the group

Return

Returns an array of elements on success, or false on failure.

ElementDescription
nameThe name element contains the name of the group. This is a short, usually less than 16 character "handle" of the group, not the real, full name. This should be the same as the name parameter used when calling the function, and hence redundant.
passwdThe passwd element contains the group's password in an encrypted format. Often, for example on a system employing "shadow" passwords, an asterisk is returned instead.
membersThis consists of an array of string's for all the members in the group.
gidGroup ID of the group in numeric form.

Examples

1 · name

<?

$name = "toons";

$return = posix_getgrnam($name);

print_r($return);

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