[TYPO3-dev] call_user_func and sending parameters

Tapio Markula tapio.markula at xetpoint.fi
Tue Aug 14 17:34:42 CEST 2007


Hi

I looked
http://fi2.php.net/manual/fi/function.call-user-func-array.php

  Object methods may also be invoked statically using this function by 
passing array($objectname, $methodname) to the function parameter.

<?php
class myclass {
     function say_hello()
     {
         echo "Hello!\n";
     }
}

$classname = "myclass";

call_user_func(array($classname, 'say_hello'));
?>

Well the problem is that I would need to set parameter for the called 
function. The page doesn't give example how to define that.
Let's presume that
<?php
class myclass {
     function say_hello($whatToSay)
     {
         echo $whatToSay;
     }
}

$classname = "myclass";

call_user_func(array($classname, 'say_hello'));
?>

That would tell about missing argument and the call would be anyway 
nonsense.

tx_tmcontentaccess_specialdoktypes::renderDoktype_2 can't be used
like this call_user_func($classname.'::'.$methodName,$this->doktype);




More information about the TYPO3-dev mailing list