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

Accessing the Registry as an Object

You may also find it convenient to access the registry in an object-oriented fashion by using index names as object properties. You must specifically construct the registry object using the ArrayObject::ARRAY_AS_PROPS option and initialize the static instance to enable this functionality.


You must set the ArrayObject::ARRAY_AS_PROPS option before the static registry has been accessed for the first time.

Known Issues with the ArrayObject::ARRAY_AS_PROPS Option

Some versions of PHP have proven very buggy when using the registry with the ArrayObject::ARRAY_AS_PROPS option.

Example 690. Example of Object Access

// in your application bootstrap:
$registry = new Zend_Registry(array(), ArrayObject::ARRAY_AS_PROPS)
$registry->tree 'apple';


// in a different function, elsewhere in your application:
$registry Zend_Registry::getInstance();

$registry->tree// echo's "apple"

$registry->index $value;


Zend Framework