This tutorial teaches you how to create an object with any class name and a variable number of arguments easily.
We're still paving the way for the Singleton pattern :)
This is the source code for this tutorial. Enjoy!
* Global Object storage.
* @return object
// I'm a .cpp coder, I'm an initialization maniac
static $Object = null;
// If empty, make an object happen
$Object = new \stdClass();
// Return the object
- I say $_GET, $_POST, ... etc are globals. Well, they're super-globals, I know :) But not sure everyone knows the difference.
- At minute 16 I say this would work with an array too. Yes, an array of objects exactly as shown in the next function.
Just wanted to make sure I make sense there. Pure arrays would return copies and defeat the purpose.