Hi all,
I am a c++ programmer and starting with php out of interest. I have a doubt regarding xml parsing. In the function call xml_set_element_handler we pass the first argument as the resource. What it is that xml_parser_create returns ? I think the second and the third argument are the function pointers in the function xml_set_element_handler. The first one is the xml resourse created using xml_parser_create(). Inside the call back function when we say to print $parser ($parser is the return value of xml_parser_create()) it prints "Resourse id #1" a number of times. But at the same time print $depth[$parser] prints the depth of the present xml node. I would like to know the data type of $parser.


var_dump($parser) prints "resource of type(xml)"
print gettype($parser) prints "resource"

The manual does not talk about resource in depth (just that it holds reference to an external resource). Is there any good documentation for resource and How can user defined resources be created and used apart from the resources provided like that of defined in /usr/share/doc/php-manual_en-4.2.3/resource.html ?

Is a resource similar to struct or class. How does the $depth[$parser] prints the depth, does php has the concept of overloading and "[]" is an overloaded operator ?

Can anybody clarify ?

Thanks
Indru