 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to display XML in HTML in PHP?
If the string is pre-formatted, and a plain text representation of the same is needed, it can be wrapped in a HTML <pre/> tag and html entities can be used to escape the angle brackets. This has been shown below −
<?PHP echo '<pre>', htmlentities($string), '</pre>'; ?>
The string is assigned to a string type and the above is used to show XML in HTML −
Example
<?php $string = " <example> <example> <example_value>EXAMPLE</example_value> </example> </example> "; echo '<pre>', htmlentities($string), '</pre>'; ?>
Output
This will produce the following output −
<example> <example> <example_value>EXAMPLE</example_value> </example> </example>
Advertisements
 