<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Return info about a group by group id</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.posix-getgid.html">posix_getgid</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.posix-getgrnam.html">posix_getgrnam</a></div> <div class="up"><a href="ref.posix.html">POSIX Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.posix-getgrgid" class="refentry"> <div class="refnamediv"> <h1 class="refname">posix_getgrgid</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">posix_getgrgid</span> — <span class="dc-title">Return info about a group by group id</span></p> </div> <div class="refsect1 description" id="refsect1-function.posix-getgrgid-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">array</span> <span class="methodname"><strong>posix_getgrgid</strong></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$gid</code></span> )</div> <p class="para rdfs-comment"> Gets information about a group provided its id. </p> </div> <div class="refsect1 parameters" id="refsect1-function.posix-getgrgid-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">gid</code></em></span> <dd> <p class="para"> The group id. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.posix-getgrgid-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> The array elements returned are: <table class="doctable table"> <caption><strong>The group information array</strong></caption> <thead> <tr> <th>Element</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>name</td> <td> The 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. </td> </tr> <tr> <td>passwd</td> <td> The 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. </td> </tr> <tr> <td>gid</td> <td> Group ID, should be the same as the <em><code class="parameter">gid</code></em> parameter used when calling the function, and hence redundant. </td> </tr> <tr> <td>members</td> <td> This consists of an <span class="type"><a href="language.types.array.html" class="type array">array</a></span> of <span class="type"><a href="language.types.string.html" class="type string">string</a></span>'s for all the members in the group. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 changelog" id="refsect1-function.posix-getgrgid-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>4.2.0</td> <td> 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. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 examples" id="refsect1-function.posix-getgrgid-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-3655"> <p><strong>Example #1 Example use of <span class="function"><strong>posix_getgrgid()</strong></span></strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br />$groupid </span><span style="color: #007700">= </span><span style="color: #0000BB">posix_getegid</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$groupinfo </span><span style="color: #007700">= </span><span style="color: #0000BB">posix_getgrgid</span><span style="color: #007700">(</span><span style="color: #0000BB">$groupid</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$groupinfo</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output something similar to:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> Array ( [name] => toons [passwd] => x [members] => Array ( [0] => tom [1] => jerry ) [gid] => 42 ) </pre></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-function.posix-getgrgid-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.posix-getegid.html" class="function" rel="rdfs-seeAlso">posix_getegid()</a> - Return the effective group ID of the current process</span></li> <li class="member"> <span class="function"><a href="function.posix-getgrnam.html" class="function" rel="rdfs-seeAlso">posix_getgrnam()</a> - Return info about a group by name</span></li> <li class="member"> <span class="function"><a href="function.filegroup.html" class="function" rel="rdfs-seeAlso">filegroup()</a> - Gets file group</span></li> <li class="member"> <span class="function"><a href="function.stat.html" class="function" rel="rdfs-seeAlso">stat()</a> - Gives information about a file</span></li> <li class="member"><a href="ini.sect.safe-mode.html#ini.safe-mode-gid" class="link">safe_mode_gid</a></li> <li class="member">POSIX man page GETGRNAM(3)</li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.posix-getgid.html">posix_getgid</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.posix-getgrnam.html">posix_getgrnam</a></div> <div class="up"><a href="ref.posix.html">POSIX Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>