PHP passing parameters while creating new object, call_user_func_array for objects

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-03-31T03:40:54Z Indexed on 2010/03/31 3:43 UTC
Read the original article Hit count: 250

Filed under:

Hi all,

I would like to dynamically create a PHP object, and parameters would be optional.

For example, instead of doing this:

$test = new Obj($param);

I would like to do something like this (create new ob is fictional):

$test = create_new_obj('Obj', $param);

Is there such function in php? Something similar to call_user_func_array, but for object instead.

© Stack Overflow or respective owner

Related posts about php