tags:

views:

34

answers:

1

How would I do something like this:

<?php
    class Controller
    {
     var $ActionName;
     var $PageParameters;

     function InvokeAction()
     {
      $actionFunctionName = ucfirst($this->ActionName);

      // Call a function named $actionFunctionName
                // where $actionFunctionName is in a subclass
     }

    }
?>

As a bonus, I would like to trap whether that function exists first.

+2  A: 
if (method_exists($this, $actionFunctionName))
{
    $this->$actionFunctionName();
}

that should do it

Janek
Thanks. works like a charm!
Daniel A. White