Get the nid of a node
it's just a property of the Node itself, the nid of the node. It is the value $node-&gt;nid.

EDIT

There is also entity_extract_ids() which is 1 level up from a Node in the object hierarchy and this function interacts with Entities -- if you're trying to do something more generic than merely interact with solely Nodes ... such as a process a Queue of Entity objects all of different types but sharing a field you want set with a certain value.


  Helper function to extract id, vid, and bundle name from an entity.
  
  Parameters
  
  $entity_type: The entity type; e.g. 'node' or 'user'.
  
  $entity: The entity from which to extract values.
  
  Return value
  
  A numerically indexed array (not a hash table) containing these
  elements:
  
  0: Primary ID of the entity.
  
  1: Revision ID of the entity, or NULL if $entity_type is not versioned.
  
  2: Bundle name of the entity, or NULL if $entity_type has no bundles.