I know SimpleXMLElement doesn't work in PHP4, but is there a something similar I can replace it with to make the script work with PHP 4?
3 Answers
Maybe Ister.org's simplexml44 - PHP4 backport of PHP5 SimpleXML might help you...
Disclaimer : I've never used it at all !
... But I wish you luck : XML-support is one of the "big stuff" that was added in PHP 5...
There were also some XML-related functions/classes in PHP 4 ; but nothing looking like SimpleXML :-(
For instance :
- DOM XML (PHP 4)
- and even some XSLT support (PHP4)
BTW : you should really think about switching to PHP 5 : PHP 4 is not supported anymore, even for security-related bugs !
Did you try your application on a PHP5-enabled server ? If it works, it might allow you to use SimpleXML ;-)
There were some problems switching from PHP 4 to PHP 5 ; but maybe not too many for you application ?

- 395,085
- 80
- 655
- 663
-
It does completely work great in php5, but I can't switch to PHP5, 4 is what is on the client's host offers, so I have to work within that. – Chris Aug 03 '09 at 18:09
-
Ho... This is really too bad :-( Is there absolutly no way to convince them that, in 2009, one year (in a few days ; see http://www.php.net/archive/2008.php#id2008-08-07-1 ) after the **last** version of PHP 4 ever, it is more than time to stop limiting their client to PHP 4 ? Or maybe it's time for your client to get some kind of real hosting provider ^^ – Pascal MARTIN Aug 03 '09 at 18:22
-
Time for your client to get a new host. – ceejayoz Aug 03 '09 at 18:23
PHP4 had DOM XML and the event-based sax parser. Neither are drop-in replacements for SimpleXml and if I remember correctly, neither were standard, meaning that you need them installed/enabled as extensions. The sax parser also exists on PHP5, so if you want your code to be forward compatible, that is probably the safest bet.

- 115,121
- 27
- 131
- 155
PHP5 saw its first release in 2004, and PHP4 end-of-lifed almost exactly a year ago. It's time to move up... and to switch webhosts if your current one doesn't even offer the option.

- 176,543
- 40
- 303
- 368