Facebook has introduced a new way ti write PHP
SOURCE: Marcel Georges laverdet II(Facebook Engineer)
Facebook reveals a new way to write PHP, XHP, which makes the web pages faster to load
“XHP has enabled us to build better websites faster; our Lite site was written entirely with XHP. Try XHP out for yourself.” said Marcel
this new code is available onGithub.com
XHP is described as a “PHP extension which augments the syntax of the language such that XML document fragments become valid PHP expressions.” According to Laverdet, XHP offers the following advantages over standard PHP websites:
.XHP improves the high-level readability of PHP code, specifically with respect to HTML generation
.XHP switches PHP from a relaxed default security model to a strong default security model (to prevent XSS Scripting attacks)
.Errors in your markup will now be detected on the server at parse time. That is, it is impossible to generate malformed webpages while using XHP.
.You can define your own elements which can condense a complex component into a simple XHP tag.
Even for well versed PHP developers, the above advantages may not be immediately obvious. For more details, the full XHP codebase is available via a Git repository and there is plenty of documentation as well. More information is also available in their blog post published earlier today.