[PHP] calling static class functions using a function variable
Hi all, Hope you can help. I have an class called xml and a class method called hi_handler. I am able to call this method statically as follows: xml::hi_handler($attrs); but when I try to call it like this, it fails miserably: $junk="xml::hi_handler"; $junk(); Fatal error: Call to undefined function: xml::hi_handler() Any ideas - besides the obvious way of using a dummy instance. I am using php 4.0.3pl1 Thanks, Shaun -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] calling static class functions using a function variable
Well, essentially, a static class method is a method that can be called without any instances of the class. It's just a nice way to group functions for your class. Check out chapter 13 of the php manual: http://www.php.net/manual/en/language.oop.php "Static class methods are apparently supported in php v4.02"... using :: notation. On Thu, 18 Jan 2001, Richard Lynch wrote: > > $junk="xml::hi_handler"; > > $junk(); > > > > Fatal error: Call to undefined function: xml::hi_handler() > > Perhaps this: > > $j1 = "xml"; > $j2 = "hi_handler"; > $j1::$j2(); > > Wait. Are you saying you don't have an instance of an xml object?... I'm > surprised you can even call xml::hi_handler() without one in the first > place > > By Day:|By Night: > Don't miss the Zend Web Store's| There's not enough room here... > Grand Opening on January 23, 2001! | Start here: > http://www.zend.com| http://l-i-e.com/artists.htm > > > > -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] XML parsing without the PHP4 XML functions
Wddx may also be an option. That would allow you to serialize the xml into php variables so that you could use them in your example. But if your provider won't compile xml in, I doubt you'll be able to get wddx. Shaun On Wed, 14 Feb 2001, Stefen Lars wrote: > Hello all > > I have recently been assigned the task of parsing an xml file and format the > contents of the file in HTML. The xml file lies on another server. Our web > space provider does not provide the XML functions (nor is he willing to > install them) :-gr. > > I am sure that I am not the only who has come across this problem. > > Would someone have already created a few functions to parse xml that they > are willing to share? > > I have the following structure to deal with: > > > > ProductName > Why does it not work > Because it is not turned on > > > > There are whole load of s in the file. > > I then want to display the contents a bit like this: > > echo $product; > echo $question; > > etc (of course with some HTML formatting, like a bulleted list). > > Any help would be really VERY appreciated! > > Thanks > > S > > > > _ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. > > > -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]