- var_dump: documentation ( source)
- simplexml_load_string: documentation ( source)
- strip_tags: documentation ( source)
- trim: documentation ( source)
<?php
$xmldata = <<< XML
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>XML Example</title>
</head>
<body>
<p>
<b>Hello, World!</b>
</p>
</body>
</html>
XML;
$sxe = simplexml_load_string($xmldata);
$p = $sxe->body->p;
var_dump($p);
$string = trim(strip_tags(($p->asXML())));
print $string;
?>