I'm not quite sure how to correctly put this question. I want to dynamically call functions that are contained in classes (I think this means they are called 'methods').
Here is an example of my code which I hope helps explain what I am trying to achieve.
In this instance $result returns all the different modules that are loaded. This then checks if the module's PHP file has been included with it's class, then if that class exists - trys to call the class directly.
foreach ($results as $result) {
$moduleclass_name = 'TestClassName_' . $result->module_name . '::FunctionToCall';
if (method_exists($moduleclass_name, 'FunctionToCall'))
$VariableToRetrieve = $modulefunction_name($Parameter1, $Parameter2);
}
This returns an error
"Call to undefined function TestClassName_modulename::FunctionToCall()"
although the 'TestClassName' has been declared correctly.
Can someone tell me what I'm doing wrong?