Fetching nid in drupal Here I want to fetch the nid of matching child term id from my content type product_categories.

I used the below code. 

$query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'node');
$query-&gt;entityCondition('bundle', 'product_categories');
$query-&gt;propertyCondition('status', 1);
$query-&gt;fieldCondition('field_product_sub_cat', 'tid', $child-&gt;tid, '=');
$result = $query-&gt;execute();


I execute the above query and it displays correct results.But now I want to fetch the nid, I used below code but its not working.

 $childnid = $result-&gt;nid; //Area to explore
//print "&lt;pre&gt;"; print_r ((int)$childnid);
print $childnid;`


can anybody please help me ??
$result is in array of items. 

Use this:

$first_nid = NULL; 
if (isset($result['node'])) {
   $first_nid = array_shift(array_keys($result['node']));
}