Callback functions inside classes - how to?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi again,
 
I have always been wondering how this is done properly:
 
Here is an example:
 
[snip]
 class A {
   function name( $a, $b, $c) {
      $tmp = array();
      $tmp[a] = $a;
      .
     array_push( $GLOBALS['XMLStack'], $tmp );
  }
 
  function parse() {
    .. some definitions .
    $parser->set_handler( "root/page/title", "name" );
   . some more stuff here .
  }
}
[/snip]
 
What I want is to have the callback function name as it is in the above
example. But, obviously, the above code won't work. So, how do I tell the
set_handler function that it must use the name function from the class?
Using:
"A::name" or "$this->name" (if instantiated) . how do these callback
function calls work, because the same issue is with the xml handler
functions in php4 (have not as yet been to v5).
 
Also, how can I get the data from the callback function out without using
$GLOBALS? I cannot just return an array, can I?
 
Any ideas.
 
Thanks so  long.
 
Thomas

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux