private static function get_connection() { if (empty(self::$connection)) { if (!(self::$connection = ldap_connect('your.ldap.server.com', 389))) { return false; } ldap_set_option(self::$connection, LDAP_OPT_PROTOCOL_VERSION, 3); if (!ldap_bind(self::$connection)) { return false; } } return self::$connection; }