Hello, before I was looking at the registry pattern and from what I read I can pass in values to store in an array as storage.
PHP Code:
$obj = new Registry();
$obj->set('anything', 'anyvalue');
However, I've just seen some examples whereby rather than using a set method to just pass in a key and a value as a string, it can pass in the 'new' keyword with a pre-defined class like
PHP Code:
$obj = new Registry();
$obj->set('anything', new ArrayIterator);
//or
$obj->set('anything', new stdClass);
So using the registry class can you pass in only predefined classes? Or could I pass my own class I create in the registry pattern?
If you can pass in one of your own classes, how would you use it within the registry pattern? Does anyone have a basic example, or is it mainly used when passing in strings as per my first code example?
Thank you very much.