1.7. Zend::register($index, $newval)
Prev | Chapter 1. Zend | Next

## 1.7. Zend::register($index, $newval)

Registers the value $newval at the offset $index in the registry.

Example 1.1. register() / offsetSet() Example

    <?php
    Zend::register($index, $value);

    // or

    $registry = Zend::registry();
    $registry->offsetSet($index, $newval);

    ?>

The registry is a mechanism for providing singleton instances of values to the application space. By storing the value in the registry once, and then retrieving the value from the registry whenever it is needed, the same instance is always returned.

The `$index` is an arbitrary index to name the value in the registry. The same index may be passed to `Zend::registry()` in order to retrieve the stored value.

The semantics of the registry adhere to those of ArrayObject . This method simply wraps the offsetSet() method .

Prev | Up | Next
1.6. Zend::dump() | Home | 1.8. Zend::registry($index = null)