Is there a "clean" way to make use of PHP builtins that use callbacks and 
point those call backs to a method inside the class/object:

A good example would be:

...

class XMLClass {

  var $parser;

  function XMLClass() {
    $this->parser = xml_parser_create();
    xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, TRUE);
    xml_set_element_handler($this->parser, "$this->start", "$this->end");
    xml_set_character_data_handler($this->parser, "$this->data");
  }

  function goodbye() { // a manual destructor
    xml_parser_free($this->parser);
    // other things possibly too
  }


  function start($p2, $name, $attr) {
    // do things here
  }

  function data($p2, $data) {
    // do some more here
  }

  function end($p2, $name) {
    // do even more things here
  }

  [... and so on ...]

...

But since there is no way to set a callback to "$this->[function_name]" one 
must create a global function that uses a global object and passes things to 
the method inside the class..

Is the a way to address this? or perhaps a better way to deal with callback 
function names?

--Douglas Marsh






_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to