10

I left the PHP world for few years and I was working in C#.Net since then. I am thinking about diving into the PHP again and today I came across http://hhvm.com/ and it seems way more similar to C# than pure PHP.

So my question is what is the difference between Hack programming language and PHP?

P. Camilleri
  • 12,664
  • 7
  • 41
  • 76
Vojtech B
  • 2,837
  • 7
  • 31
  • 59
  • 1
    http://hacklang.org/ - however (I have made nice PHP too) I always considered PHP just merely adequate as it was available everywhere. Hack seems married to PHP. A bit more main-stream language might be nicer. – Joop Eggen Apr 08 '14 at 12:25
  • HACK is an extension of PHP [read and see](http://www.elcaro-guide.com/news/hack-programming-language-released-by-facebook) – SMK Jul 01 '14 at 12:17
  • 9
    Nominatng to reopen based on bogus reason for closure in the first place: the differences between Hack and PHP are not *opinion*, they are objective facts. Ppl will not have differing *opinions* regarding - eg - Hack having generics and PHP not. – Adam Cameron Jan 15 '17 at 08:28
  • Also voting to reopen as I agree, there are objective differences and similarities between PHP and Hacklang. This question also ranks highly in search results and could be a very useful source. – Freedom_Ben Feb 01 '22 at 19:16

1 Answers1

1

This is a very old question, but as it's been reopened, an answer would likely help future readers. In order to understand how they're different, you first need to understand how they're similar.

Hack is derived from PHP. It was designed by Facebook during a time when PHP lacked various features now present in modern versions of PHP, such as return type declarations for functions, and is meant to run on the HHVM for performance improvements over PHP. It was also designed to be largely compatible with existing PHP scripts in order to keep their existing code functioning, allowing them to gradually migrate their pure PHP code over to Hack. Notably, however, there were some features that were intentionally not implemented in Hack for a variety of reasons (performance, security, legacy support, etc.).

Now with PHP 7 existing, the HHVM no longer officially supports PHP due to differences and incompatibilities between PHP and Hack. The two are, for all intents and purposes, completely different languages that just happen to have an older version of PHP as a common ancestor.

B. Fleming
  • 7,170
  • 1
  • 18
  • 36