How to use simplexml load file in PHP
In this article I will explain how simplexml load file used in PHP.
simplexml_load_file() Function
This function loads an XML document into an object.
Syntax
simplexml_load_file(file,class,options,ns,is_prefix) |
Example
XML File
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Rock</to>
<from>Sachin</from>
<heading>Reminder</heading>
<body>I Love India</body>
</note> |
PHP Code
<html>
<body>
<?php
if (file_exists('parse.xml'))
{
$xml = simplexml_load_file('parse.xml');
var_dump($xml);
}
else
{
exit('Error.');
}
?>
</body>
</html> |
Output

You may also want to read these related articles Click here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here