简体   繁体   English

"Hack 和 PHP 有什么区别?"

[英]What is the difference between Hack and PHP?

I left the PHP world for few years and I was working in C#.Net since then.我离开 PHP 世界几年了,从那时起我就在 C#.Net 中工作。 I am thinking about diving into the PHP again and today I came across http:\/\/hhvm.com\/<\/a> and it seems way more similar to C# than pure PHP.我正在考虑再次深入 PHP,今天我遇到了http:\/\/hhvm.com\/<\/a> ,它似乎比纯 PHP 更类似于 C#。

So my question is what is the difference between Hack programming language and PHP<\/strong> ?所以我的问题是Hack 编程语言和 PHP<\/strong>有什么区别?

"

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. Hack 源自 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.它是由 Facebook 设计的,当时 PHP 缺乏现代版本的 PHP 中存在的各种功能,例如函数的返回类型声明,并且旨在在 HHVM 上运行以提高 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.它还被设计成与现有的 PHP 脚本在很大程度上兼容,以保持现有代码的功能,允许他们逐渐将纯 PHP 代码迁移到 Hack。 Notably, however, there were some features that were intentionally not implemented in Hack for a variety of reasons (performance, security, legacy support, etc.).然而,值得注意的是,出于各种原因(性能、安全性、遗留支持等),Hack 中有意没有实现一些功能。

Now with PHP 7 existing, the HHVM no longer officially supports PHP due to differences and incompatibilities between PHP and Hack.现在随着 PHP 7 的存在,由于 PHP 和 Hack 之间的差异和不兼容,HHVM 不再正式支持 PHP。 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.从所有意图和目的来看,这两者都是完全不同的语言,只是碰巧有一个旧版本的 PHP 作为共同的祖先。

"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM