I've come across a Registry Class and I'm wondering whether to bother with this or just go constants, or are there separate uses for site-wide global variables such as database connection information, website URI, etc?
Here's the class I came across:
<?php
Class Registry {
private $vars = array();
public function __set($index, $value)
{
$this->vars[$index] = $value;
}
public function __get($index)
{
return $this->vars[$index];
}
}
?>
Basically just a class that has an array with magical getters/setters. Are there any disadvantages with this code as opposed to using constants?