Select custom class function

I have a custom PHP class with few methods in it. Is is possible to call class method this way:

class someClass{
  function someMethod_somename_1(){
    echo 'somename1';       

  function someMethod_somename_2(){
    echo 'somename2';   
$obj = new someClass();
$methodName = $_GET['method_name'];
$obj->someMethod_{$methodName}(); //calling method

My real world application is more complex, but here I provide just this simple example to get the main idea. Maybe I can use eval function here?

Leave a Reply


Hire Me
Follow Me!
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.