| 
<?php
 ///////////////////////////////////////
 // Example of how `registry` can be
 // used to retrieve variables within
 // any scope of the application.
 ///////////////////////////////////////
 
 //calls registry class
 require_once 'registry.php';
 
 //sets and registers a variable
 $item = 'Here is a registered variable';
 registry::add('Variable', $item);
 
 /**
 * Test class that echos a registered variable
 */
 class test
 {
 private $item;
 
 public function __construct()
 {
 $this->item = registry::get('Variable');
 }
 
 public function get()
 {
 echo '<p>'.$this->item.'</p>';
 }
 }
 
 //will return "Here is a registered variable"
 $test = new test();
 $test->get();
 
 //tests if "Variable" exists
 if (registry::exists('Variable')) {
 echo '<p>"Variable" exists</p>';
 } else {
 echo '<p>"Variable" does not exists</p>';
 }
 
 //tests if "variable" exists
 if (registry::exists('variable')) {
 echo '<p>"variable" exists</p>';
 } else {
 echo '<p>"variable" does not exists</p>';
 }
 
 //removes "Variable"
 registry::remove('Variable');
 
 ?>
 |