<?php
class Factory {
private $_store = array();
function __construct(){
}
public function get($key) {
if(isset($this->_store[$key])) {
return $this->_store[$key];
}
return null;
}
public function set($key, $value = null) {
if($key){
$this->_store[$key] = $value;
}
}
}
$f1 = new Factory();
$f2 = new Factory();
$f1->set('f1','f1');
$f2->set('f2','f2');
var_dump($f1,$f2,$f1===$f2);
class Factory {
private $_store = array();
function __construct(){
}
public function get($key) {
if(isset($this->_store[$key])) {
return $this->_store[$key];
}
return null;
}
public function set($key, $value = null) {
if($key){
$this->_store[$key] = $value;
}
}
}
$f1 = new Factory();
$f2 = new Factory();
$f1->set('f1','f1');
$f2->set('f2','f2');
var_dump($f1,$f2,$f1===$f2);