PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Using the filter API to create search filters

Example 524. Create simple LDAP filters

<?php
$f1  
Zend_Ldap_Filter::equals('name''value');         // (name=value)
$f2  Zend_Ldap_Filter::begins('name''value');         // (name=value*)
$f3  Zend_Ldap_Filter::ends('name''value');           // (name=*value)
$f4  Zend_Ldap_Filter::contains('name''value');       // (name=*value*)
$f5  Zend_Ldap_Filter::greater('name''value');        // (name>value)
$f6  Zend_Ldap_Filter::greaterOrEqual('name''value'); // (name>=value)
$f7  Zend_Ldap_Filter::less('name''value');           // (name<value)
$f8  Zend_Ldap_Filter::lessOrEqual('name''value');    // (name<=value)
$f9  Zend_Ldap_Filter::approx('name''value');         // (name~=value)
$f10 Zend_Ldap_Filter::any('name');                     // (name=*)

Example 525. Create more complex LDAP filters

<?php
$f1 
Zend_Ldap_Filter::ends('name''value')->negate(); // (!(name=*value))

$f2 Zend_Ldap_Filter::equals('name''value');
$f3 Zend_Ldap_Filter::begins('name''value');
$f4 Zend_Ldap_Filter::ends('name''value');

// (&(name=value)(name=value*)(name=*value))
$f5 Zend_Ldap_Filter::andFilter($f2$f3$f4);

// (|(name=value)(name=value*)(name=*value))
$f6 Zend_Ldap_Filter::orFilter($f2$f3$f4);

Zend Framework