ArticleslgStudy

computer science

HipHop for PHP

HipHop for PHP is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand HipHop for PHP rather than just read about it. In short: HipHop for PHP (HPHPc) is a discontinued PHP transpiler created by Facebook. By using HPHPc as a source-to-source compiler, PHP code is translated into C++, compiled into a binary and run as an executable, as opposed to the PHP's usual execution path of PHP code being transformed into opcodes and interpreted.

Key takeaways

  • HipHop for PHP belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect HipHop for PHP to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of HipHop for PHP from memory before moving on to harder problems.

Reference excerpt

HipHop for PHP (HPHPc) is a discontinued PHP transpiler created by Facebook. By using HPHPc as a source-to-source compiler, PHP code is translated into C++, compiled into a binary and run as an executable, as opposed to the PHP's usual execution path of PHP code being transformed into opcodes and interpreted. HPHPc consists mainly of C++, C and PHP source codes, and it is free and open-source software distributed under the PHP License. The original motivation behind HipHop was to save resources on Facebook servers, given the large PHP codebase of facebook.com. As the development of HipHop progressed, it was realised that HipHop could substantially increase the speed of PHP applications in general. Increases in web page generation throughput by factors of up to six have been observed over the Zend PHP. A stated goal of HPHPc was to provide a high level of compatibility for Zend PHP, where most Zend-based PHP programs run unmodified on HPHPc. HPHPc was originally open sourced in early 2010. As an addition to HPHPc, Facebook engineers also created a "developer mode" of HipHop (interpreted version of a PHP execution engine, known as HPHPi) and the HipHop debugger (known as HPHPd). These additions allow developers to run PHP code through the same logic provided by HPHPc while making it possible to interactively debug PHP code by defining watches, breakpoints, etc. Running the code through HPHPi yields lower performance when compared to HPHPc, but the developer benefits were, at the time, worth having to maintain these two execution engines for production and development. HPHPi and HPHPd were also open sourced in 2010. By many accounts HPHPc fulfilled its goals, especially within Facebook as it allowed facebook.com to run much faster while using fewer resources. However, in early 2013 Facebook deprecated HPHPc in favor of the HipHop Virtual Machine (HHVM), which is a just-in-time (JIT) compilation-based execution engine for PHP, also developed by Facebook. There were many reasons for this; one of them was HPHPc's flattened curve for further performance improvements. Also, HPHPc did not fully support the PHP language, including the create_function() and eval() constructs, and it involved a specific time- and resource-consuming deployment process that required a bigger than 1 GB binary to be compiled and distributed to many servers in short order. In addition, maintaining HPHPc and HPHPi in parallel (as they needed to be, for the consistency of production and development environments) was becoming cumbersome. Finally, HPHPc was not a drop-in replacement for Zend, requiring external customers to change their whole development and deployment processes to use HPHPc.

See also

Parrot virtual machine Phalanger

References

Worked examples

Example 1 — a first encounter with HipHop for PHP

Start with the simplest possible case. Write down what HipHop for PHP claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to HipHop for PHP before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about HipHop for PHP ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of HipHop for PHP

In research
HipHop for PHP appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses HipHop for PHP in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
HipHop for PHP is common in secondary-school and first-year university syllabi. It links to neighbouring topics 2010 software, Facebook software, Free and open source compilers, so understanding it makes those chapters shorter.
In everyday life
Look for HipHop for PHP outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “HipHop for PHP” →

How to study HipHop for PHP in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what HipHop for PHP means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain HipHop for PHP out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is HipHop for PHP in simple terms?

HipHop for PHP (HPHPc) is a discontinued PHP transpiler created by Facebook. By using HPHPc as a source-to-source compiler, PHP code is translated into C++, compiled into a binary and run as an executable, as opposed to the PHP's usual execution path of PHP code being transformed into opcodes and i…

Why does HipHop for PHP matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study HipHop for PHP?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on HipHop for PHP.

Tags

  • 2010 software
  • Facebook software
  • Free and open source compilers
  • Free software programmed in C++
  • Free software programmed in OCaml
  • Free software programmed in Rust
  • PHP
  • Software using the PHP license
  • Source-to-source compilers

Keep exploring