title: Count Number of Entries in LDAP Search
body: <p>So I just got started with LDAP, and was reading this tutorial on LDAP with PHP.</p>
  
  <p><a href="http://www.devshed.com/c/a/PHP/Using-PHP-With-LDAP-part-1/4/" rel="nofollow">http://www.devshed.com/c/a/PHP/Using-PHP-With-LDAP-part-1/4/</a></p>
  
  <p>There, once the result set is obtained. There were two commands/functions I came across...</p>
  
  <pre><code>    &lt;?php // print number of entries found 
      echo "Number of entries found: " . ldap_count_entries($conn, $result) . "&lt;p&gt;"; ?&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>  &lt;?php // get entry data as array
    $info = ldap_get_entries($conn, $result); 
    // iterate over array and print data for each entry 
    for ($i=0; $i&lt;$info["count"]; $i++) { echo "dn is: ". $info[$i]["dn"] ."&lt;br&gt;";
    echo "first cn is: ". $info[$i]["cn"][0] ."&lt;br&gt;";
    echo "first email address is: ". $info[$i]["mail"][0] ."&lt;p&gt;"; 
    } ?&gt;
  </code></pre>
  
  <p>So, in what ways do ldap_count_entries and $info["count"] differ?</p>
  
  <p>Thanks in advance!</p>