Could someone help me do this? Regardless, thank you all for your help on these forums!
Code: Select all
<?php
class Registry {
private $store = array();
public function __set($label, $object) {
if(!isset($this->store[$label]))
{
$this->store[$label] = $object;
}
}
public function __get($label) {
if(isset($this->store[$label]))
{
return $this->store[$label];
}
return false;
}
}
//Current example of usage
$registry = new Registry();
$registry->__set("Database Name", "mysql.internal");
echo $registry->__get("Database Name"); //Outputs "mysql.internal"
/* What I would like to add is some type of function that adds labels and objects from a settings file, so
something like::
$registry->import('/app/settings.ini');
*/
?>