Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Community News:
XHP Released by Facebook (XML in PHP)
Feb 10, 2010 @ 16:10:23

Even before they've release the source for their much hyped HipHop PHP tool, Facebook has slipped another tool in under the radar and have already released it in github - XHP.

On the official announcement they describe what the tool is and what it can do for you:

XHP is a PHP extension which augments the syntax of the language to both make your front-end code easier to understand and help you avoid cross-site scripting attacks. XHP does this by making PHP understand XML document fragments, similar to what E4X does for ECMAScript (JavaScript). While PHP is typically used to write front-end code, by itself it isn't a very good language for generating HTML (as evidenced by the popularity of templating engines like Smarty). XHP is something between a programmatic UI library and a full templating system

Rasmus Lerdorf took the opportunity to play with this new tool and run some benchmarks on its performance in a more real situation than the form example Facebook gave:

The real question here is what is this runtime xml validation going to cost you. [...] Note that to build XHP you will need flex 2.5.35 which most distros won't have installed by default. Grab the flex tarball and ./configure && make install it. Then you are ready to go.

He created a simple class (a "singleton") and ran some benchmarks against it with Siege. I won't share the results of those benchmarks here, though - you'll need to visit Rasmus' site for those (but here's a hint, the future's not bright).

tagged: xhp facebook release github rasmuslerdorf