Topic: Problem with function as parameter


I am trying to pass a class and a method as parameters to a xajax function and this is the result:

$retorno .= "<button class=\"btn btn-primary\" type=\"button\" onclick=\"xajax_carrega_xajax('recursos/metodos/classes_sistema/instalacao/class.instalar.php', 'instalar', 'validacao($versao_php, $banco_dados)', 'retorno')\">Atualizar validação</button>";
class carregador_xajax{
    function carrega_xajax($caminho, $classe, $funcao, $div_retorno)
        $objResponse = new xajaxResponse();
        $classe = new $classe;
        $retorno = $classe -> $funcao;
        //$retorno = "aa";
        $objResponse->assign($div_retorno,"innerHTML", $retorno);
        return $objResponse;

The Debug panel shows me this

Mon Jan 21 2013 16:20:22 GMT-0300 (Horário de Verão Brasil Central)
RECEIVED [status: 200, size: 377 bytes, time: 140ms]:
<br />
<b>Notice</b>:  Undefined property: instalar::$validacao(0, 1) in <b>C:\Users\Administrador\Documents\Desenvolvimento\WEB\Em_desenvolvimento\Renovare_esterelizacao_admin\recursos\metodos\classes_sistema\sistema\class.carregador_xajax.php</b> on line <b>10</b><br />
<?xml version="1.0" encoding="utf-8" ?>
<cmd cmd="as" id="retorno" prop="innerHTML">*</cmd>

Why does the $ appears before validacao(0, 1)?


Re: Problem with function as parameter

  $retorno = $classe -> $funcao;
could it be that you pass a string to a class? i thin you should get information on the php function "eval"