This class goes a step further from default stdClass. It has __clone() method implemented that will be used by PHP to mae a true clone of the object that is extended from this class. And it uses improved constructor that allows passing of associated array that will be converted into class properties with array values assigned to them.

Here is an example:

[php]$example = new gdrClass(array("name" => "Example", "life" => 42));[/php]

Now, the $example object will have two properties: name and life with values as in the array.


Leave a Reply