path aliases in drupal 7 I want to calculate the path aliases for array of nids. But it always give me the path for latest content. Actually I can not get all the nids. My array structure is like below. When I used the command product_childnid = array_pop(array_keys($result['node'])); I always get the 100 nid but I want all of them for path aliases.

Array
(
[node] =&gt; Array
    (
        [78] =&gt; stdClass Object
            (
                [nid] =&gt; 78
                [vid] =&gt; 78
                [type] =&gt; product
            )

        [80] =&gt; stdClass Object
            (
                [nid] =&gt; 80
                [vid] =&gt; 80
                [type] =&gt; product
            )

        [82] =&gt; stdClass Object
            (
                [nid] =&gt; 82
                [vid] =&gt; 82
                [type] =&gt; product
            )

        [84] =&gt; stdClass Object
            (
                [nid] =&gt; 84
                [vid] =&gt; 84
                [type] =&gt; product
            )

        [86] =&gt; stdClass Object
            (
                [nid] =&gt; 86
                [vid] =&gt; 86
                [type] =&gt; product
            )

        [88] =&gt; stdClass Object
            (
                [nid] =&gt; 88
                [vid] =&gt; 88
                [type] =&gt; product
            )

        [90] =&gt; stdClass Object
            (
                [nid] =&gt; 90
                [vid] =&gt; 90
                [type] =&gt; product
            )

        [92] =&gt; stdClass Object
            (
                [nid] =&gt; 92
                [vid] =&gt; 92
                [type] =&gt; product
            )

        [94] =&gt; stdClass Object
            (
                [nid] =&gt; 94
                [vid] =&gt; 94
                [type] =&gt; product
            )

        [100] =&gt; stdClass Object
            (
                [nid] =&gt; 100
                [vid] =&gt; 100
                [type] =&gt; product
              )
          )
  )

$query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'node');
$query-&gt;entityCondition('bundle', 'product');
$query-&gt;propertyCondition('status', 1);
$query-&gt;fieldCondition('field_product_sub_cat', 'tid',array($leaf_nodes));
$result = $query-&gt;execute();
if (isset($result['node']))
{
  $product_childnid = array_pop(array_keys($result['node']));
}
$path = 'node/'.$product_childnid;
$product_alias = drupal_get_path_alias($path);
You have to iterate over all nodes in $result to do that. array_pop() only returns the last item in $result. So you'll have to do something like this:

$paths = array();
if (isset($result['node']))
{
  foreach($result['node'] as $key =&gt; $node) {
    $paths[$node-&gt;nid] = drupal_get_path_alias("node/$node-&gt;nid");
  }
}


After this $paths will contain an array of keys that map to each node id with a value that corresponds to its alias path.