Note: ldap_get_entries returns true even if no results are found, like this:
echo $entries=ldap_get_entries(...);
will print Array.
You have to check for number of row in the Array like this:
if($entries["count"]==0) return false;
Hope this helped someone...