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

Querying if an Index Exists

To find out if a particular index in the registry has been set, use the static method isRegistered().

Example 691. Example of isRegistered() Method Usage

<?php
if (Zend_Registry::isRegistered($index)) {
    
$value Zend_Registry::get($index);
}

To find out if a particular index in a registry array or object has a value, use the isset() function as you would with an ordinary array.

Example 692. Example of isset() Method Usage

<?php
$registry 
Zend_Registry::getInstance();

// using array access syntax
if (isset($registry['index'])) {
    
var_dump$registry['index'] );
}

// using object access syntax
if (isset($registry->index)) {
    
var_dump$registry->index );
}

Zend Framework