callback problem

[email protected] (Burak DAYIOGLU)
Newsgroups php.pear
Message-ID <[email protected]>
Hello,
I am trying to build up a class with some sort of a callback mechanism.
A simplified code is given below:

<?php

class provider {
        function myfunction() { echo "burak"; }
}

class dispatcher {
        function process($p1,$p2,$p3) {
                call_user_method($p1,$$p2,$p3);
        }
}

$x= new provider();    $y= new dispatcher();
$y->process("returnI","x","");

?>

I am expecting to be able to call a method of the "provider"
by giving a reference to it as a string or whatever. However
the script above does not run.

My goal is to build a form-validator class, which gets some
field definitions and validation function pointers. It will
attempt to validate each field by calling the associated
function. It will return OK if all the validators are ok and
ERROR when at least one validation has failed. The issue is,
the validation functions might either be methods of a class
instance or seperate functions.

Anyone has any idea to make such a callback work?

regards,
-bd
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.