Free Tech Updates

Hack a new language from Facebook

Hack is a programming language for HHVM that interoperates seamlessly with PHP. Hack reconciles the fast development cycle of PHP with the discipline provided by static typing, while adding many features commonly found in other modern programming languages.

Hack provides instantaneous type checking via a local server that watches the filesystem. It typically runs in less than 200 milliseconds, making it easy to integrate into your development workflow without introducing a noticeable delay.

Hack is a programming language for the HipHop Virtual Machine (HHVM) invented by Facebook.HipHop Virtual Machine (HHVM) is a process virtual machine based on just-in-time (JIT) compilation, serving as an execution engine for PHP and Hack programming languages. By using the principle of JIT compilation, executed PHP or Hack code is first transformed into intermediate HipHop bytecode (HHBC), which is then dynamically translated into the x86-64 machine code

The basic file structure of a Hack script is similar to a PHP script with a few changes. A Hack file starts with <?hh as opposed to <?php for a PHP script:
class MyClass {
  public function alpha(): int {
    return 1;

  public function beta(): string {
    return 'hi test';

function f(MyClass $my_inst): string {
  // Fix me!
  return $my_inst->alpha();


Post a Comment


Most Read


Blog Archive

Scroll To Top