PHP 5.4 and Facebook Hiphop compatibility PHP 5.4 and Facebook Hiphop compatibility php php

PHP 5.4 and Facebook Hiphop compatibility


Stay away from the following:

Trait Declaration:

trait vehicleInfo {    function getSpeed() { /*1*/ }    function getWheels() { /*2*/ }}class Car extends Vehicle {    use vehicleInfo;    /* ... */}class Motorcycle extends Vehicle {    use vehicleInfo;    /* ... */}

PHP 5.4 Array Instantiation:

$array = [    "name" => "John Smith",    "job" => "Basketweaver",];

Function array dereferencing:

function small_numbers() {    return array (0, 1, 2);}echo small_numbers()[0];

Class Member Access on Instantiation:

(new Foo)->bar();


HipHop currently supports all of the features Daniel Li pointed out, except possible binary numbers. In fact, HipHop supported closures for years. The runtime is constantly improving, so keep an eye out in the future for a feature you're waiting for to show up.

If in doubt, and you have the time, just try using a feature and seeing if it works or not.

akrieger@vb:~/www$ hhvm features.php2akrieger@vb:~/www$ cat features.php<?phptrait vehicleInfo {    function getSpeed() { /*1*/ }    function getWheels() { return [1,2,3,4]; }}class Vehicle {}class Car extends Vehicle {    use vehicleInfo;    /* ... */}class Motorcycle extends Vehicle {    use vehicleInfo;    /* ... */}$getMotorcycleWheels = function() {  return (new Motorcycle())->getWheels();};echo $getMotorcycleWheels()[1];echo "\n";akrieger@vb:~/www$