php - How do I call a Class->Method from strings? -



php - How do I call a Class->Method from strings? -

it possible phone call class , method strings?

something like:

// $_request['var'] = 'house-kitchen'; $var = explode('-',$_request['var']); echo $var[0]->$var[1];

the improve way try.

i did seek :

$house = new stdclass(); $house->kitchen = "visible result"; $_request['var'] = 'house-kitchen'; $var = explode('-',$_request['var']); echo $$var[0]->$var[1];

it works. careful : need utilize double $ first element (to utilize variable $var[0] name).

and careful : it's high security breach (you allow phone call methods on current defined class).

php string class function methods

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -