How to enable XHP on Hiphop for PHP

A quick primer on how to enable XHP on Hiphop for PHP:

  1. Set the Eval.EnableXHP to true to that XHP will work on the interpreter if you need that. This will enable the XHP processor which will convert xml syntax to the __xhp classes.
  2. Get the XHP PHP extension from https://github.com/facebook/xhp
  3. Copy the files in the php-lib/ folder to your project
  4. Include them in the source files where you want to use XHP.
You can now use the XML syntax in PHP.
The authors of XHP added array dereferencing as a bonus to XHP, so you can now also use that.
Advertisement

About this entry