SlideShare a Scribd company logo
1 of 70
Why choose Hack/HHVM
over PHP7
Intelligence, Ltd.
Yuji Otani
1
Presented on Feb 24, 2016
2
• Born in Shimonoseki, Yamaguchi Prefecture
• Software Engineer at Intelligence, Ltd
• I love cars and programming
• Be my friend on Facebook!
https://www.facebook.com/yuji.otani.16
About me:
3
5years
→ →
My main experiences with
programming languages:
7years
1year
4
Question 1
Have you used
Hack/HHVM?
5
Question 2
PHP7 has been released.
Are you uncertain about
what to use next?
6
Goal of this presentation:
Convey the qualities of Hack/HHVM
and make you consider it
7
We have adopted Hack/HHVM in many
projects here at Intelligence since 2015.
The Framework of our choice is FuelPHP.
8
Example: MIIDAS (job hunting service)
https://miidas.jp
9
Example: MyRefer (employee referral service)
https://i-myrefer.jp/
10
• a programming language developed by Facebook
• compatible with PHP
• runs on HHVM (virtual machine)
• based on PHP5.6
What is Hack?
• bug-free and fast coding
• enjoyable coding experience
• fast runtime
• fit for large scale systems
The goals of Hack:
http://growthhackjapan.com/2014-03-23-facebook-hack-released-to-the-public/
12
• we wanted to challenge something new while
leveraging the experience with PHP
• we wanted to deliver a performant service
• we wanted to keep the ease of readability and
maintainability even when the system grew bigger
• PHP7 was not available yet
Why we chose Hack:
13
At the end of last year, the big
happening
14
Dec 3, 2015
PHP7 was released!
15
Huge performance improvements!!
http://talks.php.net/fluent15#/wpbench
16
• Null coalesce operator
• EngineException (catchable fatal errors)
• anonymous classes
• scalar type hinting
• return type declaration
New language specifications
17
• optimized for 64-bit CPUs
• efficient use of CPU cache
• in-memory arrays became sequences (in PHP5 they were all
associative arrays)
• the memory usage by arrays has improved dramatically.
* PHP5 (72bytes) → PHP7 (32bytes)
New data structure
18
PHP7 incorporated many features
from Hack/HHVM
• scalar type hinting
• return value declaration
• great performance
• lower consumption of memory for arrays
• AST (abstract syntax tree) compiling
19
Currently PHP faces a big turning point.
That's precisely the reason why I want you to
know the qualities of Hack/HHVM.
20
Point 1
Powerful type hinting
21
What is type hinting?
You can specify the type of arguments and return values of
functions.
Class Sample {
public static function sampleFunc(int $a): string{
return "OK";
}
}
//OK
Sample::sampleFunc (1);
//Fatal Error
Sample::sampleFunc ("a");
22
Type hinting in PHP
Types that could be used in type hinting were gradually added.
PHP5.0 :Class
PHP5.1 :array
PHP5.4 :Closure and function
PHP7 :Scalar Type (int, float, string, bool)
23
There are major differences in type
hinting between Hack and PHP7
24
PHP7 type hinting
There are 2 modes:
• Weakly typed = automatic type casting
• Strongly typed = strict type checking
<?php
Class Sample {
public static function sampleFunc(int $a): string{
return "OK";
}
}
// OK in both modes
Sample::sampleFunc(1);
// OK only in weakly typed mode
Sample::sampleFunc("1");
25
PHP7 type hinting
• The default mode is “weakly typed”
• To switch to “strongly typed” mode, it is necessary to
declare it in the beginning of the source files
• It’s only possible to declare “strongly typed” mode per file,
i.e. it’s not possible to declare “strongly typed” mode in
configuration files
<?php
// "Strongly typed" mode is enabled in this file only
declare(strict_types=1);
26
PHP7 type hinting
• It is not possible to declare nullable or mixed types.
• Passing Null to a function with type-hinted parameters will
trigger error.
<?php
Class Sample {
public static function sampleFunc(int $a): string{
return "OK";
}
}
//Fatal Error
Sample::sampleFunc(null);
27
Hack type hinting
• Only “strongly typed” mode
• Permits any type (including null) by using the “mixed”
keyword
<?hh
Class Sample {
public static function sampleFunc(mixed $a): string{
return "OK";
}
}
//OK
Sample::sampleFunc(null);
Sample::sampleFunc(1);
Sample::sampleFunc(”a");
28
Hack Type Hinting
• Accepts Null by adding a “?” before the type hint
<?hh
Class Sample {
public static function sampleFunc(?int $a): string{
return "OK";
}
}
//OK
Sample::sampleFunc(null);
Sample::sampleFunc(1);
29
Hack Type Hinting
The types of keys and values of arrays can be specified.
However, it is only for static analysis, not runtime.
<?hh
Class Sample {
public static function sampleFunc(array<int, string> $a): string{
return "OK";
}
}
//OK
Sample::sampleFunc(array(1 => "a", 2 => "b"));
Sample::sampleFunc(array(1 => 1, 2 => null));
30
Hack Type Hinting
It is possible to specify types in Enum.
<?hh
enum Size: int {
MEDIUM = 1;
LARGE = 2;
}
Class Sample {
public static function sampleFunc(Size $size): string{
return "OK";
}
}
//OK
Sample::sampleFunc(Size::LARGE);
Sample::sampleFunc(2);
Sample::sampleFunc(4); // This works too: it checks the type, not the value.
//Error
Sample::sampleFunc(”a");
31
Type Hinting
• “Strongly typed” only
• Nullable and mixed types
The specifications put emphasis on
type-sensitive, large scale systems.
• “Weakly typed” by default
• No nullable nor mixed types
The specifications put emphasis on
the speed of type-agnostic
development.
32
Point 2
Collections
33
PHP5 arrays:
• Arrays and associative arrays can be used in the same way
• Arrays accept values of any type
• Keys can be integer or string
• Values are retrieved in order of insertion, regardless of keys
<?php
// the code below prints “ab”
$arr = array(1 => ”a", 0 => ”b");
foreach($arr as $value ) {
print($value);
}
34
Hack Collections:
• Has original collections: Vector, Map, Set and Pair
• It is possible to specify the types of keys and values, though
they’re not checked during runtime
<?hh
$a = new Map<string, string>;
//OK
$a->set("key1", "value1");
//OK
$a->set("key2", 2);
//OK
$a->set(3, array());
35
Hack Collection
It’s not necessary to check if the key exists prior to fetching a
value, and it won’t trigger a “Notice” error when the key doesn’t
exist.
<?hh
$a = new Map<string, string>;
$a->set("key1", "value1");
// $val1 becomes “value1”
$val1 = $a->get("key1");
// $val2 becomes null, no “Notice” error fired
$val2 = $a->get("key2");
36
Map
Stores key-value pairs
B
A
D
EC
37
Vector
Pure stack-like ordered array
21 4 53
38
Set
Ordered collection of unique values
BA D EC
39
Pair
Immutable collection of exactly 2 values
40
Collection
• Four original collections
• It is possible to specify the types
of values (keys as well for Maps)
The specifications put emphasis on
type-sensitive, large scale systems.
• Only arrays that accept any type
• No concern over the types of
arrays and their values
The specifications put emphasis on
the speed of “anything-goes”
associative arrays.
41
Point 3
Original specifications
42
Original features:
• Lambdas
• Generics
• Enum
• Tuples
• Shapes
43
Enum (Enumeration of value)
<?hh
enum Size: int {
SMALL = 0;
MEDIUM = 1;
LARGE = 2;
X_LARGE = 3;
}
Enumerate values with a specific type
44
Tuples
<?hh
list($a, $b) = testFunc();
public function testFunc() : (string, int) {
return tuple(“OK”, 1);
}
Return multiple values ​​from a function
45
Original language specification
Hack/HHVM has added many original language specifications.
By using Hack in your service, you can achieve:
• quick development with fewer bugs
• developers actually enjoy coding
46
Point 4
Parallel execution
47
Parallel execution
It is possible to run statements in parallel by using
original functions such as “Async” and “Await.”
Parallel execution is possible out-of-the-box,
reaching even higher performance speeds.
48
Parallel execution
49
Point 5
Static analysis tool
50
Static analysis tool
The static analysis of the code is done by hh_client. It
checks for syntax errors and inconsistencies, allowing
developers to fix them before runtime.
Code with fewer bugs like this is only possible due to the
strict type restrictions in Hack.
51
You can check the program before execution.
• Check for compilation errors
• Type-check the arguments and return values
• Check for discouraged syntax
• Check for inappropriate type casting
Static analysis tool
* configure automatic static analysis with hhvm.hack.lang.auto_typecheck
in config files.
52
Point 6
Gradually adopting features from PHP7
53
Continued support for both PHP5 and 7
• HHVM3.11 implements the new features in PHP7
• The direction is to support both PHP5 and PHP7
• Also possible to break backward compatibility by setting
“hhvm.php7.all = 1” in the settings
• Features from PHP7 can be individually enabled
https://docs.hhvm.com/hhvm/configuration/INI-settings#php-7-settings
54
Point 7
Great adoption record
55
Great adoption record
The adoption continues to grow, especially among large
scale services. Wikipedia and Baidu have many commits into
the source code to Hack/HHVM.
https://github.com/facebook/hhvm/wiki/Users
56
Although Hack/HHVM is very nice,
there are also unfavorable qualities
57
Release cycle
Hack (HHVM)
• Released every 8 weeks
• Every 3rd version is turned into the LTS version, which is
supported for one year
PHP
• Released every 1 year
• Life cycle of 3 years (bug fixes 2 years, security 1 year)
LTS are supported for about 1 year
Hack/HHVM support
59
• HHVM crash: needed to monitor to restart
automatically
• pecl not supported: tried replacing some with
golang, but currently venturing into HNI
• Had to upgrade CentOS6 to CentOS7 due to
sudden end of support
• Most of IDEs don’t support it
Some issues we faced in production
60
Hard to find resources
Problem
61
PHP7 support in HHVM
62
PHP7 support in HHVM
http://hhvm.com/blog/10859/php-7-support
63
TLDR;
• The release of PHP7 is also fortunate to HHVM
• New features in PHP7 will be available from HHVM3.11
• HHVM will continue supporting both PHP5 and PHP7
• Possible to break backward compatibility by setting
“hhvm.php7.all = 1” in the settings
https://docs.hhvm.com/hhvm/configuration/INI-settings#php-7-settings
64
Issues related to PHP7 can be tracked on GitHub
https://github.com/facebook/hhvm/labels/php7%20incompatibility
65
Wrap-up
• PHP7 and Hack are similar, but with different
features
• Hack seems to more suited to large scale systems
• Hack didn’t split from PHP, it synchronizes and
evolves together
66
PHP specifications are community-driven, while Hack
is mainly developed by Facebook.
I think PHP values the “loose PHP-ness,” while Hack
values the “correct practical use.”
Final thoughts
67
It is great to have options in the future of
an excellent language like PHP!
68
PHP7 is out, but it is still worth to
choose Hack/HHVM!
69
thank you
70
This document was created with accuracy in mind, but
the author does not guarantee its veracity nor its
usefulness. In addition, this material was created solely
by the author, and it does not represent the views,
values, etc. of any organization.
Disclaimer

More Related Content

What's hot

Static Analysis of PHP Code – IPC Berlin 2016
Static Analysis of PHP Code – IPC Berlin 2016Static Analysis of PHP Code – IPC Berlin 2016
Static Analysis of PHP Code – IPC Berlin 2016Rouven Weßling
 
Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Sylvain Wallez
 
What is the Joomla Framework and why do we need it?
What is the Joomla Framework and why do we need it?What is the Joomla Framework and why do we need it?
What is the Joomla Framework and why do we need it?Rouven Weßling
 
Go for SysAdmins - LISA 2015
Go for SysAdmins - LISA 2015Go for SysAdmins - LISA 2015
Go for SysAdmins - LISA 2015Chris McEniry
 
OSCON2014 : Quick Introduction to System Tools Programming with Go
OSCON2014 : Quick Introduction to System Tools Programming with GoOSCON2014 : Quick Introduction to System Tools Programming with Go
OSCON2014 : Quick Introduction to System Tools Programming with GoChris McEniry
 
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...Rouven Weßling
 
The promise of asynchronous PHP
The promise of asynchronous PHPThe promise of asynchronous PHP
The promise of asynchronous PHPWim Godden
 
Doing It Wrong with Puppet -
Doing It Wrong with Puppet - Doing It Wrong with Puppet -
Doing It Wrong with Puppet - Puppet
 
Productive Programming in Java 8 - with Lambdas and Streams
Productive Programming in Java 8 - with Lambdas and Streams Productive Programming in Java 8 - with Lambdas and Streams
Productive Programming in Java 8 - with Lambdas and Streams Ganesh Samarthyam
 
On the Edge Systems Administration with Golang
On the Edge Systems Administration with GolangOn the Edge Systems Administration with Golang
On the Edge Systems Administration with GolangChris McEniry
 
SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09Elizabeth Smith
 

What's hot (20)

Php’s guts
Php’s gutsPhp’s guts
Php’s guts
 
50 shades of PHP
50 shades of PHP50 shades of PHP
50 shades of PHP
 
Static Analysis of PHP Code – IPC Berlin 2016
Static Analysis of PHP Code – IPC Berlin 2016Static Analysis of PHP Code – IPC Berlin 2016
Static Analysis of PHP Code – IPC Berlin 2016
 
PHP7 is coming
PHP7 is comingPHP7 is coming
PHP7 is coming
 
Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!
 
Spl in the wild
Spl in the wildSpl in the wild
Spl in the wild
 
What is the Joomla Framework and why do we need it?
What is the Joomla Framework and why do we need it?What is the Joomla Framework and why do we need it?
What is the Joomla Framework and why do we need it?
 
Clojure 7-Languages
Clojure 7-LanguagesClojure 7-Languages
Clojure 7-Languages
 
Go for SysAdmins - LISA 2015
Go for SysAdmins - LISA 2015Go for SysAdmins - LISA 2015
Go for SysAdmins - LISA 2015
 
OSCON2014 : Quick Introduction to System Tools Programming with Go
OSCON2014 : Quick Introduction to System Tools Programming with GoOSCON2014 : Quick Introduction to System Tools Programming with Go
OSCON2014 : Quick Introduction to System Tools Programming with Go
 
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...
 
The promise of asynchronous PHP
The promise of asynchronous PHPThe promise of asynchronous PHP
The promise of asynchronous PHP
 
Doing It Wrong with Puppet -
Doing It Wrong with Puppet - Doing It Wrong with Puppet -
Doing It Wrong with Puppet -
 
Csp scala wixmeetup2016
Csp scala wixmeetup2016Csp scala wixmeetup2016
Csp scala wixmeetup2016
 
Productive Programming in Java 8 - with Lambdas and Streams
Productive Programming in Java 8 - with Lambdas and Streams Productive Programming in Java 8 - with Lambdas and Streams
Productive Programming in Java 8 - with Lambdas and Streams
 
On the Edge Systems Administration with Golang
On the Edge Systems Administration with GolangOn the Edge Systems Administration with Golang
On the Edge Systems Administration with Golang
 
IO Streams, Files and Directories
IO Streams, Files and DirectoriesIO Streams, Files and Directories
IO Streams, Files and Directories
 
Peek at PHP 7
Peek at PHP 7Peek at PHP 7
Peek at PHP 7
 
Introduction to Perl
Introduction to PerlIntroduction to Perl
Introduction to Perl
 
SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09
 

Viewers also liked

「技術のインテリジェンスを創る」をどうやって実現するか
「技術のインテリジェンスを創る」をどうやって実現するか「技術のインテリジェンスを創る」をどうやって実現するか
「技術のインテリジェンスを創る」をどうやって実現するかYuji Otani
 
PHP7ではなくHack/HHVMを選ぶ理由
PHP7ではなくHack/HHVMを選ぶ理由PHP7ではなくHack/HHVMを選ぶ理由
PHP7ではなくHack/HHVMを選ぶ理由Yuji Otani
 
サバフェス! 2015 Spring LT資料
サバフェス! 2015 Spring LT資料サバフェス! 2015 Spring LT資料
サバフェス! 2015 Spring LT資料Takashi Takizawa
 
MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)
MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)
MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)Yuji Otani
 
BIND of Summer (2017-04-13)
BIND of Summer (2017-04-13)BIND of Summer (2017-04-13)
BIND of Summer (2017-04-13)Takashi Takizawa
 
DNS RFCの歩き方(短縮版)
DNS RFCの歩き方(短縮版)DNS RFCの歩き方(短縮版)
DNS RFCの歩き方(短縮版)Takashi Takizawa
 
OSSで楽に作るGo言語クライアントツール
OSSで楽に作るGo言語クライアントツールOSSで楽に作るGo言語クライアントツール
OSSで楽に作るGo言語クライアントツールTano Makoto
 
Php7 傳說中的第七隻大象
Php7 傳說中的第七隻大象Php7 傳說中的第七隻大象
Php7 傳說中的第七隻大象bobo52310
 
JSON-lD
JSON-lDJSON-lD
JSON-lDCQD
 
Fintech研究所『2016年振り返り』
Fintech研究所『2016年振り返り』Fintech研究所『2016年振り返り』
Fintech研究所『2016年振り返り』Toshio Taki
 
PHP7がリリースされたいま、 改めてHackについて考える。
PHP7がリリースされたいま、 改めてHackについて考える。PHP7がリリースされたいま、 改めてHackについて考える。
PHP7がリリースされたいま、 改めてHackについて考える。Yuji Otani
 
HHVM on CentOS6 本番運用のうまみとつらみ
HHVM on CentOS6 本番運用のうまみとつらみHHVM on CentOS6 本番運用のうまみとつらみ
HHVM on CentOS6 本番運用のうまみとつらみKei KORI
 
NoSQL勉強会
NoSQL勉強会NoSQL勉強会
NoSQL勉強会Yuji Otani
 
Json ld 簡介
Json ld 簡介Json ld 簡介
Json ld 簡介bobo52310
 
Introduction openstack-horizon
Introduction openstack-horizonIntroduction openstack-horizon
Introduction openstack-horizonbobo52310
 
[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)
[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)
[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)Naoki (Neo) SATO
 
Neo4j の「データ操作プログラミング」から 「ビジュアライズ」まで
Neo4j の「データ操作プログラミング」から 「ビジュアライズ」までNeo4j の「データ操作プログラミング」から 「ビジュアライズ」まで
Neo4j の「データ操作プログラミング」から 「ビジュアライズ」までKeiichiro Seida
 
RDBとNoSQLの上手な付き合い方(勉強会@LIG 2013/11/11)
RDBとNoSQLの上手な付き合い方(勉強会@LIG 2013/11/11)RDBとNoSQLの上手な付き合い方(勉強会@LIG 2013/11/11)
RDBとNoSQLの上手な付き合い方(勉強会@LIG 2013/11/11)Yuji Otani
 
figo at API Days 2016 in Paris
figo at API Days 2016 in Parisfigo at API Days 2016 in Paris
figo at API Days 2016 in ParisLars Markull
 
Implementing DDD Concepts in PHP
Implementing DDD Concepts in PHPImplementing DDD Concepts in PHP
Implementing DDD Concepts in PHPSteve Rhoades
 

Viewers also liked (20)

「技術のインテリジェンスを創る」をどうやって実現するか
「技術のインテリジェンスを創る」をどうやって実現するか「技術のインテリジェンスを創る」をどうやって実現するか
「技術のインテリジェンスを創る」をどうやって実現するか
 
PHP7ではなくHack/HHVMを選ぶ理由
PHP7ではなくHack/HHVMを選ぶ理由PHP7ではなくHack/HHVMを選ぶ理由
PHP7ではなくHack/HHVMを選ぶ理由
 
サバフェス! 2015 Spring LT資料
サバフェス! 2015 Spring LT資料サバフェス! 2015 Spring LT資料
サバフェス! 2015 Spring LT資料
 
MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)
MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)
MariaDB+GaleraClusterの運用事例(MySQL勉強会2016-01-28)
 
BIND of Summer (2017-04-13)
BIND of Summer (2017-04-13)BIND of Summer (2017-04-13)
BIND of Summer (2017-04-13)
 
DNS RFCの歩き方(短縮版)
DNS RFCの歩き方(短縮版)DNS RFCの歩き方(短縮版)
DNS RFCの歩き方(短縮版)
 
OSSで楽に作るGo言語クライアントツール
OSSで楽に作るGo言語クライアントツールOSSで楽に作るGo言語クライアントツール
OSSで楽に作るGo言語クライアントツール
 
Php7 傳說中的第七隻大象
Php7 傳說中的第七隻大象Php7 傳說中的第七隻大象
Php7 傳說中的第七隻大象
 
JSON-lD
JSON-lDJSON-lD
JSON-lD
 
Fintech研究所『2016年振り返り』
Fintech研究所『2016年振り返り』Fintech研究所『2016年振り返り』
Fintech研究所『2016年振り返り』
 
PHP7がリリースされたいま、 改めてHackについて考える。
PHP7がリリースされたいま、 改めてHackについて考える。PHP7がリリースされたいま、 改めてHackについて考える。
PHP7がリリースされたいま、 改めてHackについて考える。
 
HHVM on CentOS6 本番運用のうまみとつらみ
HHVM on CentOS6 本番運用のうまみとつらみHHVM on CentOS6 本番運用のうまみとつらみ
HHVM on CentOS6 本番運用のうまみとつらみ
 
NoSQL勉強会
NoSQL勉強会NoSQL勉強会
NoSQL勉強会
 
Json ld 簡介
Json ld 簡介Json ld 簡介
Json ld 簡介
 
Introduction openstack-horizon
Introduction openstack-horizonIntroduction openstack-horizon
Introduction openstack-horizon
 
[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)
[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)
[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)
 
Neo4j の「データ操作プログラミング」から 「ビジュアライズ」まで
Neo4j の「データ操作プログラミング」から 「ビジュアライズ」までNeo4j の「データ操作プログラミング」から 「ビジュアライズ」まで
Neo4j の「データ操作プログラミング」から 「ビジュアライズ」まで
 
RDBとNoSQLの上手な付き合い方(勉強会@LIG 2013/11/11)
RDBとNoSQLの上手な付き合い方(勉強会@LIG 2013/11/11)RDBとNoSQLの上手な付き合い方(勉強会@LIG 2013/11/11)
RDBとNoSQLの上手な付き合い方(勉強会@LIG 2013/11/11)
 
figo at API Days 2016 in Paris
figo at API Days 2016 in Parisfigo at API Days 2016 in Paris
figo at API Days 2016 in Paris
 
Implementing DDD Concepts in PHP
Implementing DDD Concepts in PHPImplementing DDD Concepts in PHP
Implementing DDD Concepts in PHP
 

Similar to Why choose Hack/HHVM over PHP7

Hsc IT 5. Server-Side Scripting (PHP).pdf
Hsc IT 5. Server-Side Scripting (PHP).pdfHsc IT 5. Server-Side Scripting (PHP).pdf
Hsc IT 5. Server-Side Scripting (PHP).pdfAAFREEN SHAIKH
 
Php training100%placement-in-mumbai
Php training100%placement-in-mumbaiPhp training100%placement-in-mumbai
Php training100%placement-in-mumbaivibrantuser
 
TAKING PHP SERIOUSLY - Keith Adams
TAKING PHP SERIOUSLY - Keith AdamsTAKING PHP SERIOUSLY - Keith Adams
TAKING PHP SERIOUSLY - Keith AdamsHermes Alves
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckrICh morrow
 
Hack programming language
Hack programming languageHack programming language
Hack programming languageRadu Murzea
 
07 control+structures
07 control+structures07 control+structures
07 control+structuresbaran19901990
 
Tool Up Your LAMP Stack
Tool Up Your LAMP StackTool Up Your LAMP Stack
Tool Up Your LAMP StackLorna Mitchell
 
Code Analysis-run time error prediction
Code Analysis-run time error predictionCode Analysis-run time error prediction
Code Analysis-run time error predictionNIKHIL NAWATHE
 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Muhamad Al Imran
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Muhamad Al Imran
 
What To Expect From PHP7
What To Expect From PHP7What To Expect From PHP7
What To Expect From PHP7Codemotion
 

Similar to Why choose Hack/HHVM over PHP7 (20)

Hsc IT 5. Server-Side Scripting (PHP).pdf
Hsc IT 5. Server-Side Scripting (PHP).pdfHsc IT 5. Server-Side Scripting (PHP).pdf
Hsc IT 5. Server-Side Scripting (PHP).pdf
 
Php training100%placement-in-mumbai
Php training100%placement-in-mumbaiPhp training100%placement-in-mumbai
Php training100%placement-in-mumbai
 
TAKING PHP SERIOUSLY - Keith Adams
TAKING PHP SERIOUSLY - Keith AdamsTAKING PHP SERIOUSLY - Keith Adams
TAKING PHP SERIOUSLY - Keith Adams
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course Deck
 
Hack programming language
Hack programming languageHack programming language
Hack programming language
 
07 control+structures
07 control+structures07 control+structures
07 control+structures
 
Code metrics in PHP
Code metrics in PHPCode metrics in PHP
Code metrics in PHP
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
08 subprograms
08 subprograms08 subprograms
08 subprograms
 
Introduction to php basics
Introduction to php   basicsIntroduction to php   basics
Introduction to php basics
 
Tool up your lamp stack
Tool up your lamp stackTool up your lamp stack
Tool up your lamp stack
 
Tool Up Your LAMP Stack
Tool Up Your LAMP StackTool Up Your LAMP Stack
Tool Up Your LAMP Stack
 
Code Analysis-run time error prediction
Code Analysis-run time error predictionCode Analysis-run time error prediction
Code Analysis-run time error prediction
 
Welcome to hack
Welcome to hackWelcome to hack
Welcome to hack
 
php.pptx
php.pptxphp.pptx
php.pptx
 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
 
Php i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
 
What To Expect From PHP7
What To Expect From PHP7What To Expect From PHP7
What To Expect From PHP7
 
More about PHP
More about PHPMore about PHP
More about PHP
 

More from Yuji Otani

SKYDISCのIoTを支えるテクノロジー
SKYDISCのIoTを支えるテクノロジーSKYDISCのIoTを支えるテクノロジー
SKYDISCのIoTを支えるテクノロジーYuji Otani
 
Hack/HHVMの最新事情とメイン言語に採用した理由
Hack/HHVMの最新事情とメイン言語に採用した理由Hack/HHVMの最新事情とメイン言語に採用した理由
Hack/HHVMの最新事情とメイン言語に採用した理由Yuji Otani
 
Redisの特徴と活用方法について
Redisの特徴と活用方法についてRedisの特徴と活用方法について
Redisの特徴と活用方法についてYuji Otani
 
FuelPHP × HHVM サービス開発事例
FuelPHP × HHVM サービス開発事例FuelPHP × HHVM サービス開発事例
FuelPHP × HHVM サービス開発事例Yuji Otani
 
Hack言語に賭けたチームの話
Hack言語に賭けたチームの話Hack言語に賭けたチームの話
Hack言語に賭けたチームの話Yuji Otani
 
スタートアップにおける技術チームの作り方
スタートアップにおける技術チームの作り方スタートアップにおける技術チームの作り方
スタートアップにおける技術チームの作り方Yuji Otani
 
Go言語のフレームワークRevelの紹介とサービスにおける活用事例
Go言語のフレームワークRevelの紹介とサービスにおける活用事例Go言語のフレームワークRevelの紹介とサービスにおける活用事例
Go言語のフレームワークRevelの紹介とサービスにおける活用事例Yuji Otani
 
Hack+FuelPHPによるWebサービス開発
Hack+FuelPHPによるWebサービス開発Hack+FuelPHPによるWebサービス開発
Hack+FuelPHPによるWebサービス開発Yuji Otani
 
【初心者向け】Go言語勉強会資料
 【初心者向け】Go言語勉強会資料 【初心者向け】Go言語勉強会資料
【初心者向け】Go言語勉強会資料Yuji Otani
 
NoSQL勉強会資料(2015/03/12@ヒカラボ )
NoSQL勉強会資料(2015/03/12@ヒカラボ )NoSQL勉強会資料(2015/03/12@ヒカラボ )
NoSQL勉強会資料(2015/03/12@ヒカラボ )Yuji Otani
 
Phalcon勉強会資料
Phalcon勉強会資料Phalcon勉強会資料
Phalcon勉強会資料Yuji Otani
 
Redis勉強会資料(2015/06 update)
Redis勉強会資料(2015/06 update)Redis勉強会資料(2015/06 update)
Redis勉強会資料(2015/06 update)Yuji Otani
 
【基礎編】社内向けMySQL勉強会
【基礎編】社内向けMySQL勉強会【基礎編】社内向けMySQL勉強会
【基礎編】社内向けMySQL勉強会Yuji Otani
 
Nginx勉強会
Nginx勉強会Nginx勉強会
Nginx勉強会Yuji Otani
 
PHP基礎勉強会
PHP基礎勉強会PHP基礎勉強会
PHP基礎勉強会Yuji Otani
 
負荷分散勉強会
負荷分散勉強会負荷分散勉強会
負荷分散勉強会Yuji Otani
 
Php5 4勉強会
Php5 4勉強会Php5 4勉強会
Php5 4勉強会Yuji Otani
 

More from Yuji Otani (17)

SKYDISCのIoTを支えるテクノロジー
SKYDISCのIoTを支えるテクノロジーSKYDISCのIoTを支えるテクノロジー
SKYDISCのIoTを支えるテクノロジー
 
Hack/HHVMの最新事情とメイン言語に採用した理由
Hack/HHVMの最新事情とメイン言語に採用した理由Hack/HHVMの最新事情とメイン言語に採用した理由
Hack/HHVMの最新事情とメイン言語に採用した理由
 
Redisの特徴と活用方法について
Redisの特徴と活用方法についてRedisの特徴と活用方法について
Redisの特徴と活用方法について
 
FuelPHP × HHVM サービス開発事例
FuelPHP × HHVM サービス開発事例FuelPHP × HHVM サービス開発事例
FuelPHP × HHVM サービス開発事例
 
Hack言語に賭けたチームの話
Hack言語に賭けたチームの話Hack言語に賭けたチームの話
Hack言語に賭けたチームの話
 
スタートアップにおける技術チームの作り方
スタートアップにおける技術チームの作り方スタートアップにおける技術チームの作り方
スタートアップにおける技術チームの作り方
 
Go言語のフレームワークRevelの紹介とサービスにおける活用事例
Go言語のフレームワークRevelの紹介とサービスにおける活用事例Go言語のフレームワークRevelの紹介とサービスにおける活用事例
Go言語のフレームワークRevelの紹介とサービスにおける活用事例
 
Hack+FuelPHPによるWebサービス開発
Hack+FuelPHPによるWebサービス開発Hack+FuelPHPによるWebサービス開発
Hack+FuelPHPによるWebサービス開発
 
【初心者向け】Go言語勉強会資料
 【初心者向け】Go言語勉強会資料 【初心者向け】Go言語勉強会資料
【初心者向け】Go言語勉強会資料
 
NoSQL勉強会資料(2015/03/12@ヒカラボ )
NoSQL勉強会資料(2015/03/12@ヒカラボ )NoSQL勉強会資料(2015/03/12@ヒカラボ )
NoSQL勉強会資料(2015/03/12@ヒカラボ )
 
Phalcon勉強会資料
Phalcon勉強会資料Phalcon勉強会資料
Phalcon勉強会資料
 
Redis勉強会資料(2015/06 update)
Redis勉強会資料(2015/06 update)Redis勉強会資料(2015/06 update)
Redis勉強会資料(2015/06 update)
 
【基礎編】社内向けMySQL勉強会
【基礎編】社内向けMySQL勉強会【基礎編】社内向けMySQL勉強会
【基礎編】社内向けMySQL勉強会
 
Nginx勉強会
Nginx勉強会Nginx勉強会
Nginx勉強会
 
PHP基礎勉強会
PHP基礎勉強会PHP基礎勉強会
PHP基礎勉強会
 
負荷分散勉強会
負荷分散勉強会負荷分散勉強会
負荷分散勉強会
 
Php5 4勉強会
Php5 4勉強会Php5 4勉強会
Php5 4勉強会
 

Recently uploaded

Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 

Recently uploaded (20)

Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 

Why choose Hack/HHVM over PHP7

  • 1. Why choose Hack/HHVM over PHP7 Intelligence, Ltd. Yuji Otani 1 Presented on Feb 24, 2016
  • 2. 2 • Born in Shimonoseki, Yamaguchi Prefecture • Software Engineer at Intelligence, Ltd • I love cars and programming • Be my friend on Facebook! https://www.facebook.com/yuji.otani.16 About me:
  • 3. 3 5years → → My main experiences with programming languages: 7years 1year
  • 4. 4 Question 1 Have you used Hack/HHVM?
  • 5. 5 Question 2 PHP7 has been released. Are you uncertain about what to use next?
  • 6. 6 Goal of this presentation: Convey the qualities of Hack/HHVM and make you consider it
  • 7. 7 We have adopted Hack/HHVM in many projects here at Intelligence since 2015. The Framework of our choice is FuelPHP.
  • 8. 8 Example: MIIDAS (job hunting service) https://miidas.jp
  • 9. 9 Example: MyRefer (employee referral service) https://i-myrefer.jp/
  • 10. 10 • a programming language developed by Facebook • compatible with PHP • runs on HHVM (virtual machine) • based on PHP5.6 What is Hack?
  • 11. • bug-free and fast coding • enjoyable coding experience • fast runtime • fit for large scale systems The goals of Hack: http://growthhackjapan.com/2014-03-23-facebook-hack-released-to-the-public/
  • 12. 12 • we wanted to challenge something new while leveraging the experience with PHP • we wanted to deliver a performant service • we wanted to keep the ease of readability and maintainability even when the system grew bigger • PHP7 was not available yet Why we chose Hack:
  • 13. 13 At the end of last year, the big happening
  • 14. 14 Dec 3, 2015 PHP7 was released!
  • 16. 16 • Null coalesce operator • EngineException (catchable fatal errors) • anonymous classes • scalar type hinting • return type declaration New language specifications
  • 17. 17 • optimized for 64-bit CPUs • efficient use of CPU cache • in-memory arrays became sequences (in PHP5 they were all associative arrays) • the memory usage by arrays has improved dramatically. * PHP5 (72bytes) → PHP7 (32bytes) New data structure
  • 18. 18 PHP7 incorporated many features from Hack/HHVM • scalar type hinting • return value declaration • great performance • lower consumption of memory for arrays • AST (abstract syntax tree) compiling
  • 19. 19 Currently PHP faces a big turning point. That's precisely the reason why I want you to know the qualities of Hack/HHVM.
  • 21. 21 What is type hinting? You can specify the type of arguments and return values of functions. Class Sample { public static function sampleFunc(int $a): string{ return "OK"; } } //OK Sample::sampleFunc (1); //Fatal Error Sample::sampleFunc ("a");
  • 22. 22 Type hinting in PHP Types that could be used in type hinting were gradually added. PHP5.0 :Class PHP5.1 :array PHP5.4 :Closure and function PHP7 :Scalar Type (int, float, string, bool)
  • 23. 23 There are major differences in type hinting between Hack and PHP7
  • 24. 24 PHP7 type hinting There are 2 modes: • Weakly typed = automatic type casting • Strongly typed = strict type checking <?php Class Sample { public static function sampleFunc(int $a): string{ return "OK"; } } // OK in both modes Sample::sampleFunc(1); // OK only in weakly typed mode Sample::sampleFunc("1");
  • 25. 25 PHP7 type hinting • The default mode is “weakly typed” • To switch to “strongly typed” mode, it is necessary to declare it in the beginning of the source files • It’s only possible to declare “strongly typed” mode per file, i.e. it’s not possible to declare “strongly typed” mode in configuration files <?php // "Strongly typed" mode is enabled in this file only declare(strict_types=1);
  • 26. 26 PHP7 type hinting • It is not possible to declare nullable or mixed types. • Passing Null to a function with type-hinted parameters will trigger error. <?php Class Sample { public static function sampleFunc(int $a): string{ return "OK"; } } //Fatal Error Sample::sampleFunc(null);
  • 27. 27 Hack type hinting • Only “strongly typed” mode • Permits any type (including null) by using the “mixed” keyword <?hh Class Sample { public static function sampleFunc(mixed $a): string{ return "OK"; } } //OK Sample::sampleFunc(null); Sample::sampleFunc(1); Sample::sampleFunc(”a");
  • 28. 28 Hack Type Hinting • Accepts Null by adding a “?” before the type hint <?hh Class Sample { public static function sampleFunc(?int $a): string{ return "OK"; } } //OK Sample::sampleFunc(null); Sample::sampleFunc(1);
  • 29. 29 Hack Type Hinting The types of keys and values of arrays can be specified. However, it is only for static analysis, not runtime. <?hh Class Sample { public static function sampleFunc(array<int, string> $a): string{ return "OK"; } } //OK Sample::sampleFunc(array(1 => "a", 2 => "b")); Sample::sampleFunc(array(1 => 1, 2 => null));
  • 30. 30 Hack Type Hinting It is possible to specify types in Enum. <?hh enum Size: int { MEDIUM = 1; LARGE = 2; } Class Sample { public static function sampleFunc(Size $size): string{ return "OK"; } } //OK Sample::sampleFunc(Size::LARGE); Sample::sampleFunc(2); Sample::sampleFunc(4); // This works too: it checks the type, not the value. //Error Sample::sampleFunc(”a");
  • 31. 31 Type Hinting • “Strongly typed” only • Nullable and mixed types The specifications put emphasis on type-sensitive, large scale systems. • “Weakly typed” by default • No nullable nor mixed types The specifications put emphasis on the speed of type-agnostic development.
  • 33. 33 PHP5 arrays: • Arrays and associative arrays can be used in the same way • Arrays accept values of any type • Keys can be integer or string • Values are retrieved in order of insertion, regardless of keys <?php // the code below prints “ab” $arr = array(1 => ”a", 0 => ”b"); foreach($arr as $value ) { print($value); }
  • 34. 34 Hack Collections: • Has original collections: Vector, Map, Set and Pair • It is possible to specify the types of keys and values, though they’re not checked during runtime <?hh $a = new Map<string, string>; //OK $a->set("key1", "value1"); //OK $a->set("key2", 2); //OK $a->set(3, array());
  • 35. 35 Hack Collection It’s not necessary to check if the key exists prior to fetching a value, and it won’t trigger a “Notice” error when the key doesn’t exist. <?hh $a = new Map<string, string>; $a->set("key1", "value1"); // $val1 becomes “value1” $val1 = $a->get("key1"); // $val2 becomes null, no “Notice” error fired $val2 = $a->get("key2");
  • 38. 38 Set Ordered collection of unique values BA D EC
  • 40. 40 Collection • Four original collections • It is possible to specify the types of values (keys as well for Maps) The specifications put emphasis on type-sensitive, large scale systems. • Only arrays that accept any type • No concern over the types of arrays and their values The specifications put emphasis on the speed of “anything-goes” associative arrays.
  • 42. 42 Original features: • Lambdas • Generics • Enum • Tuples • Shapes
  • 43. 43 Enum (Enumeration of value) <?hh enum Size: int { SMALL = 0; MEDIUM = 1; LARGE = 2; X_LARGE = 3; } Enumerate values with a specific type
  • 44. 44 Tuples <?hh list($a, $b) = testFunc(); public function testFunc() : (string, int) { return tuple(“OK”, 1); } Return multiple values ​​from a function
  • 45. 45 Original language specification Hack/HHVM has added many original language specifications. By using Hack in your service, you can achieve: • quick development with fewer bugs • developers actually enjoy coding
  • 47. 47 Parallel execution It is possible to run statements in parallel by using original functions such as “Async” and “Await.” Parallel execution is possible out-of-the-box, reaching even higher performance speeds.
  • 50. 50 Static analysis tool The static analysis of the code is done by hh_client. It checks for syntax errors and inconsistencies, allowing developers to fix them before runtime. Code with fewer bugs like this is only possible due to the strict type restrictions in Hack.
  • 51. 51 You can check the program before execution. • Check for compilation errors • Type-check the arguments and return values • Check for discouraged syntax • Check for inappropriate type casting Static analysis tool * configure automatic static analysis with hhvm.hack.lang.auto_typecheck in config files.
  • 52. 52 Point 6 Gradually adopting features from PHP7
  • 53. 53 Continued support for both PHP5 and 7 • HHVM3.11 implements the new features in PHP7 • The direction is to support both PHP5 and PHP7 • Also possible to break backward compatibility by setting “hhvm.php7.all = 1” in the settings • Features from PHP7 can be individually enabled https://docs.hhvm.com/hhvm/configuration/INI-settings#php-7-settings
  • 55. 55 Great adoption record The adoption continues to grow, especially among large scale services. Wikipedia and Baidu have many commits into the source code to Hack/HHVM. https://github.com/facebook/hhvm/wiki/Users
  • 56. 56 Although Hack/HHVM is very nice, there are also unfavorable qualities
  • 57. 57 Release cycle Hack (HHVM) • Released every 8 weeks • Every 3rd version is turned into the LTS version, which is supported for one year PHP • Released every 1 year • Life cycle of 3 years (bug fixes 2 years, security 1 year)
  • 58. LTS are supported for about 1 year Hack/HHVM support
  • 59. 59 • HHVM crash: needed to monitor to restart automatically • pecl not supported: tried replacing some with golang, but currently venturing into HNI • Had to upgrade CentOS6 to CentOS7 due to sudden end of support • Most of IDEs don’t support it Some issues we faced in production
  • 60. 60 Hard to find resources Problem
  • 62. 62 PHP7 support in HHVM http://hhvm.com/blog/10859/php-7-support
  • 63. 63 TLDR; • The release of PHP7 is also fortunate to HHVM • New features in PHP7 will be available from HHVM3.11 • HHVM will continue supporting both PHP5 and PHP7 • Possible to break backward compatibility by setting “hhvm.php7.all = 1” in the settings https://docs.hhvm.com/hhvm/configuration/INI-settings#php-7-settings
  • 64. 64 Issues related to PHP7 can be tracked on GitHub https://github.com/facebook/hhvm/labels/php7%20incompatibility
  • 65. 65 Wrap-up • PHP7 and Hack are similar, but with different features • Hack seems to more suited to large scale systems • Hack didn’t split from PHP, it synchronizes and evolves together
  • 66. 66 PHP specifications are community-driven, while Hack is mainly developed by Facebook. I think PHP values the “loose PHP-ness,” while Hack values the “correct practical use.” Final thoughts
  • 67. 67 It is great to have options in the future of an excellent language like PHP!
  • 68. 68 PHP7 is out, but it is still worth to choose Hack/HHVM!
  • 70. 70 This document was created with accuracy in mind, but the author does not guarantee its veracity nor its usefulness. In addition, this material was created solely by the author, and it does not represent the views, values, etc. of any organization. Disclaimer