Get gid of group node How do I get (in PHP) the gid of a node that is a group?

The group_audience field is present but empty, and I can't seem to populate it; presumably it is because that node is the only group, and it cannot itself be a member of the group it defines. (Why not is another issue that won't matter if I can just get the gid.)
Note that the entity id is the gid in the current OG 2.x version(s) (there is some confusion around the change from earlier OG versions where GIDs were NOT entity ids)

From


  ... the group ID is the identifier of the entity. if i have a group which is a node the group ID will the be node ID. If i create a group which is a user the group ID will be the user ID and if i have a group which is a taxonomy term the group ID will the term ID.


Use og_is_group to determine if the node in question is acting as a group.