// Beispiel Factory-Pattern: Referenz-Rückgabe ist hier erwünscht.function &Factory($type){ $res = new $type(); if( !($res instanceof MyObjectBaseClass ) throw "$type muss MyObjectBaseClass sein"; $res->Init(); //... return $res;}$obj = Factory("MyVeryOwnSubClass");// Beispiel Objektverifizierungfunction EnsureProperties(&$obj){ $obj->dataBase = getDBReference(); $obj->Init(); $obj->A = "DONE"; //...}$obj = new SomeClass();EnsureProperties($obj);echo $obj->A;