XHP is a PHP extension which augments the syntax of the language such that XML document fragments become valid PHP expressions. This allows you to use PHP as a stricter templating engine and offers much more straightforward implementation of reusable components.
XHP automatically escapes all input data making it near-fool proof to XSS vulnerabilities. Because XHP augments the syntax of the language you don't need to manually sanitize any input which passes through XHP.
XHP is also dynamic and contains reusable objects. This means that we don't have to constantly define the same HTML code (Think defining a variable in PHP).
Lastly, XHP forces valid HTML markup at compile time (and will fail completely if it's invalid). Invalid markup is a thing of the past with XHP.
Source: https://coderwall.com/p/3leegq