Skip to Content
Mastering PHP 7
book

Mastering PHP 7

by Branko Ajzele
June 2017
Intermediate to advanced
536 pages
9h 49m
English
Packt Publishing
Content preview from Mastering PHP 7

XML extensions

There are several ways to read and write XML documents in PHP, including regular expressions and specialized classes and methods. The regex approach is error-prone, especially with complex XML documents, which is why the use of extensions is advised. PHP provides several extensions for this purpose, the most common ones being as follows:

  • XMLWriter: This allows us to generate streams or files of XML data
  • XMLReader: This allows to read the XML data 
  • SimpleXML: This converts XML to an object and allows for an object to be processed with normal property selectors and array iterators
  • DOM: This allows us to operate on XML documents through the DOM API

The basics of dealing with an XML document are about proper reading and writing ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning PHP 7

Learning PHP 7

Antonio L Zapata (GBP)
Upgrading to PHP 5

Upgrading to PHP 5

Adam Trachtenberg

Publisher Resources

ISBN: 9781785882814Supplemental Content