Facebook engineer Marcel Laverdet has written up the XHP project on which he has been working at Facebook, and which he says is “quickly becoming a cornerstone of front-end PHP development at Facebook”. XHP enables XML fragments to be valid PHP expressions. In addition, most HTML elements have been pre-defined as variables. The project is hosted on github and you can read a quick summary here. PHP inventor Rasmus Lerdorf has had a quick look and says:
The main interest, at least to me, is that because PHP now understands the XML it is outputting, filtering can be done in a context-sensitive manner. The input filtering built into PHP can not know which context a string is going to be used in. If you use a string inside an on-handler or a style attribute, for example, you need radically different filtering from it being used as regular XML PCDATA in the html body. Some will say this form is more readable as well, but that isn’t something that concerns me very much.