php - Instantiating classes with params in singleton factory -


I have a class that produces singleton classes (note that for the purpose of this question class singleton {public function load ($ Classname, $ params) {$ filepath = 'Classes /'. $ Classname '. Php '; Need_once ($ filepath); Return $ classname (); }}

Now to say that I want to cross an array of parameters which can vary in size, what is the best way to do this, which is the creator of the class formed? I imagine something with the classes of call_user_func_array , but for classes?

You can get some interesting results with the use.
  Function Load ($ Square, $ Args) {$ reflection = new ReflectionClass ($ class); $ Object = $ reflection-> New instance ARGS ($ AGR); Return objects; }   

This is simplified and this means that the __autoload function is used, nor does it check the namespace if you use them It will also create a new example, every time you call it, you will need to apply an array of objects, which you have already created, etc. ...

And for the original document: $ square is a string with the name of that class that you have , And there is an array of $ args arguments, which you can call __structure () method.

Comments