Facebook's XHP adds XML to PHP's syntax

I recently came across a very interesting post about XHP on the Facebook Engineering's Notes blog. XHP is a PHP extension they have developed which adds XML comprehension to PHP, allowing you to include XML fragments inline in your PHP code. Using XHP has several intriguing benefits; it tends to make your code look cleaner, it protects you against XSS vulnerabilities because it automatically escapes PHP variables and results from PHP statements that are embedded in the XML fragments. It also helps avoid malformed tags since the XML fragments are parsed by PHP and it will choke and not run until you fix your bad markup.

Previous: A couple of great articles about using OOP in PHP

Next: Pure CSS3 tab widget with :target