What is the name of Facebook's programming language that adds static typing to PHP?

The story behind the answer

Facebook's programming language that adds static typing to PHP is Hack. Facebook introduced Hack in 2014 to improve the reliability and maintainability of the enormous PHP codebase behind its website while preserving PHP's rapid development style.

Hack was designed for the HipHop Virtual Machine, or HHVM, Facebook's runtime technology for executing PHP-related code. Its type system is gradual: developers can add type annotations incrementally instead of converting an entire application at once. Hack supports annotations for function parameters, return values, and class properties, while allowing dynamically typed code to coexist with statically typed code.

This approach addressed a practical problem at Facebook's scale. PHP made it easy to iterate quickly, but large dynamically typed codebases can make errors harder to detect before runtime. Hack added features such as generics, collections, nullable types, and improved tooling, including fast type checking and editor assistance.

Hack is not the same as PHP, TypeScript, Dart, or Kotlin. TypeScript adds typing to JavaScript, while Hack grew directly from PHP and was designed to interoperate with it. Facebook open-sourced Hack alongside HHVM, and the language remains closely associated with Meta's infrastructure.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: