SlideShare uma empresa Scribd logo
1 de 66
Programming in Hack
Alejandro Marcu
Dutch PHP Conference 2016
2
 Started programming Logo at
8 years old
 Then moved to Basic, Turbo
Pascal, C++, Java
 2001 – 2004 Various
programming jobs in
Argentina
 2004 – 2008: TopCoder
 2009 – 2015: Facebook
Alejandro Marcu
3
1. Introduction
2. Hack Types
3. Collections
4. Async
5. XHP
6. Hack Codegen
What You Will Learn Today
Introduction
5
HHVM history
 2007 - Hackathon project: convert PHP to c++
 2009 – HipHop (HPHPc) in prod in Facebook
 2010 – Open sourced HipHop for PHP
 2010 – Started the HHVM project
 2013 – HHVM in prod in Facebook
 2013 – HHVM open sourced
6
 In 2014 Wikipedia migrated to HHVM:
 CPU load went from 50% to 10%
 Mean page save time went 6s to 3s
 Average page load time went from 1.3s to 0.9s
 PHP 7 performance is close to HHVM
Example of migration to HHVM
7
 Started in 2012 as “strict-mode” project
 Grew to be much more than that
 Open sourced in 2014
 As of now, HHVM is the only execution engine that
runs Hack
 Totally interoperable with PHP, allowing for a gradual
migration
Hack
8
 Analyzes Hack programs statically
 Monitors files changes in the background
 Extremely fast, even in huge code bases
 Can even be used by IDEs to autocomplete code
Typechecker
Typechecker
hacklang.org/tutorial/
10
 Type annotations
 Collections
 Async
 XHP
 Attributes
 Constructor parameter
Promotion
 Enums
 Generics
Hack only features
 Operators
 Lambda
 Null safe
 XHP attribute access
 Pipe operator
 Shapes
 Trait and interfaces
requirements
 Type aliases
11
 References
 Global statements
 Top level code
 Variable variables
 Dynamic properties
 Pseudo-functions
 isset
 empty
 Unset
 goto
 Etc..
Unsupported features in Hack
12
<?hh //strict  Type annotations required
 Can’t call PHP
 No top level code
 No references
<?hh // partial
or
<?hh
 The following is allowed but not checked:
• Calls to PHP
• Top level code
• References
 Type annotations not required but checked
if present
<?hh // decl  Not checked at all
 Functions and classes are indexed
 Use it only as the first step to migrate to
Hack
Typechecker modes
Type annotations
14
Types
 Primitive types
 bool
 int
 float
 string
 array
 resource
 Combined primitive types
 num (int or float)
 arraykey (int or string)
 Object types
 Name of classes or interfaces
Return types
void can be used only as a return type
Parameters
Nullable parameters
Local variables
Class attributes
Class attributes
Class attributes
Constructor argument promotion
Enums
Enums
Enums
Generics
Arrays with generics
Collections
Vector
0-indexed list
Map
Keys: int or str.
Values: anything
Set
Unique elements
Collections overview
Vector
Map
Set
Immutability
Immutability
Immutability
Async
37
 Single thread blocking
 Single thread non-blocking
 Multithread
Threads
Single Thread blocking example
Single Thread blocking example
Single Thread blocking example
Async example
Async example
Async example
44
 Use the keyword async before function
 The return type must be Awaitable<…>
 Call async from async using await
 Call async from non-async using HHAsiojoin
 Make parallel calls using helpers in HHAsio
(such as v,vm,m,mf, etc.)
Async
XHP
46
What is XHP?
 XHP is used to generate HTML in PHP or Hack
 No templating
 No string concatenating
 Represent HTML as a tree of objects
 Familiar XML syntax
 Secure
 Strong validations
 Extensible
Hello World
composer.json
xhp.php
Hello World
Adding children
Custom class definition
Inheriting and transferring attributes
Async components
53
XHP parser transforms it into regular Hack code:
 XHP class names are replaced:
 First char colon is replaced with xhp_
 Other colons are replaced with two underscores
 Hyphens are replaced with an underscore
 E.g. :ui:nav:header is replaced with
xhp_ui__nav__header
XHP internals
54
 XHP tags are replaced with constructors. E.g.
will be replaced with:
XHP internals
Hack Codegen
56
Why code generation?
 Code generation: writing code that writes code
 Higher level of abstraction
 Generate boilerplate code
 Generate code from almost static data in database
 Replace usage of __call
57
 Easy to create files, functions, classes, methods,
arrays, collections, etc
 Support for partially generated files
 Files can be signed
 No string concatenation
 No need to indent or add spaces
 https://github.com/facebook/hack-codegen/
 Composer: require facebook/hack-codegen
Hack Codegen
Hack Codegen example
Hack Codegen example output
ORM code generation
ORM code generation
ORM code generation
ORM code generation
Learning Resources
65
Learning resources
 http://hacklang.org/ : installation, tutorial, docs
 “Hack & HHVM” book
Contact Information
amarcu@gmail.com
/alejandro.marcu
/alejandromarcu
@AlejandroMarcu
/in/alejandromarcu

Mais conteúdo relacionado

Mais procurados

Chap1introppt1php basic
Chap1introppt1php basicChap1introppt1php basic
Chap1introppt1php basicmonikadeshmane
 
Advanced c programming in Linux
Advanced c programming in Linux Advanced c programming in Linux
Advanced c programming in Linux Mohammad Golyani
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScriptDenis Voituron
 
Golang 101
Golang 101Golang 101
Golang 101宇 傅
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8Talha Ocakçı
 
Rest style web services (google protocol buffers) prasad nirantar
Rest style web services (google protocol buffers)   prasad nirantarRest style web services (google protocol buffers)   prasad nirantar
Rest style web services (google protocol buffers) prasad nirantarIndicThreads
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#Sagar Pednekar
 
Compilation and Execution
Compilation and ExecutionCompilation and Execution
Compilation and ExecutionChong-Kuan Chen
 
Experience protocol buffer on android
Experience protocol buffer on androidExperience protocol buffer on android
Experience protocol buffer on androidRichard Chang
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010Satish Verma
 
Using ANTLR on real example - convert "string combined" queries into paramete...
Using ANTLR on real example - convert "string combined" queries into paramete...Using ANTLR on real example - convert "string combined" queries into paramete...
Using ANTLR on real example - convert "string combined" queries into paramete...Alexey Diyan
 
.Net passé, présent et futur
.Net passé, présent et futur.Net passé, présent et futur
.Net passé, présent et futurDenis Voituron
 

Mais procurados (20)

C# and vb
C# and vbC# and vb
C# and vb
 
Lex
LexLex
Lex
 
Chap1introppt1php basic
Chap1introppt1php basicChap1introppt1php basic
Chap1introppt1php basic
 
C-Sharp 6.0 ver2
C-Sharp 6.0 ver2C-Sharp 6.0 ver2
C-Sharp 6.0 ver2
 
Advanced c programming in Linux
Advanced c programming in Linux Advanced c programming in Linux
Advanced c programming in Linux
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScript
 
C#unit4
C#unit4C#unit4
C#unit4
 
Golang 101
Golang 101Golang 101
Golang 101
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8
 
Rest style web services (google protocol buffers) prasad nirantar
Rest style web services (google protocol buffers)   prasad nirantarRest style web services (google protocol buffers)   prasad nirantar
Rest style web services (google protocol buffers) prasad nirantar
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#
 
C# - Part 1
C# - Part 1C# - Part 1
C# - Part 1
 
Python Intro
Python IntroPython Intro
Python Intro
 
Compilation and Execution
Compilation and ExecutionCompilation and Execution
Compilation and Execution
 
Experience protocol buffer on android
Experience protocol buffer on androidExperience protocol buffer on android
Experience protocol buffer on android
 
ANTLR4 in depth
ANTLR4 in depthANTLR4 in depth
ANTLR4 in depth
 
50 shades of PHP
50 shades of PHP50 shades of PHP
50 shades of PHP
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
 
Using ANTLR on real example - convert "string combined" queries into paramete...
Using ANTLR on real example - convert "string combined" queries into paramete...Using ANTLR on real example - convert "string combined" queries into paramete...
Using ANTLR on real example - convert "string combined" queries into paramete...
 
.Net passé, présent et futur
.Net passé, présent et futur.Net passé, présent et futur
.Net passé, présent et futur
 

Destaque

Hacking Your Way To Better Security - Dutch PHP Conference 2016
Hacking Your Way To Better Security - Dutch PHP Conference 2016Hacking Your Way To Better Security - Dutch PHP Conference 2016
Hacking Your Way To Better Security - Dutch PHP Conference 2016Colin O'Dell
 
Magento done right - PHP UK 2016
Magento done right  - PHP UK 2016Magento done right  - PHP UK 2016
Magento done right - PHP UK 2016Ciaran Rooney
 
Security Theatre - PHP UK Conference
Security Theatre - PHP UK ConferenceSecurity Theatre - PHP UK Conference
Security Theatre - PHP UK Conferencexsist10
 
Debugging Effectively
Debugging EffectivelyDebugging Effectively
Debugging EffectivelyColin O'Dell
 
From Doctor to Coder: A Whole New World?
From Doctor to Coder: A Whole New World?From Doctor to Coder: A Whole New World?
From Doctor to Coder: A Whole New World?Aisha Sie
 
Deploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutesDeploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutesMichelangelo van Dam
 
Crafting beautiful software
Crafting beautiful softwareCrafting beautiful software
Crafting beautiful softwareJorn Oomen
 
DPC 2016 - 53 Minutes or Less - Architecting For Failure
DPC 2016 - 53 Minutes or Less - Architecting For FailureDPC 2016 - 53 Minutes or Less - Architecting For Failure
DPC 2016 - 53 Minutes or Less - Architecting For Failurebenwaine
 
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016 Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016 Alexander Lisachenko
 
Feature Flags Are Flawed: Let's Make Them Better - DPC
Feature Flags Are Flawed: Let's Make Them Better - DPCFeature Flags Are Flawed: Let's Make Them Better - DPC
Feature Flags Are Flawed: Let's Make Them Better - DPCStephen Young
 
The treacherous road to microservices
The treacherous road to microservicesThe treacherous road to microservices
The treacherous road to microservicesgoatcode
 
Driving Design through Examples
Driving Design through ExamplesDriving Design through Examples
Driving Design through ExamplesCiaranMcNulty
 
Introducing Eager Design
Introducing Eager DesignIntroducing Eager Design
Introducing Eager DesignMarcello Duarte
 
Elasticsearch, the story so far
Elasticsearch, the story so farElasticsearch, the story so far
Elasticsearch, the story so farJordy Moos
 
Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)David de Boer
 
Integrating Bounded Contexts Tips - Dutch PHP 2016
Integrating Bounded Contexts Tips - Dutch PHP 2016Integrating Bounded Contexts Tips - Dutch PHP 2016
Integrating Bounded Contexts Tips - Dutch PHP 2016Carlos Buenosvinos
 
The Road To Technical Team Lead
The Road To Technical Team LeadThe Road To Technical Team Lead
The Road To Technical Team Leadbenwaine
 

Destaque (20)

Hacking Your Way To Better Security - Dutch PHP Conference 2016
Hacking Your Way To Better Security - Dutch PHP Conference 2016Hacking Your Way To Better Security - Dutch PHP Conference 2016
Hacking Your Way To Better Security - Dutch PHP Conference 2016
 
Magento done right - PHP UK 2016
Magento done right  - PHP UK 2016Magento done right  - PHP UK 2016
Magento done right - PHP UK 2016
 
Security Theatre - PHP UK Conference
Security Theatre - PHP UK ConferenceSecurity Theatre - PHP UK Conference
Security Theatre - PHP UK Conference
 
Debugging Effectively
Debugging EffectivelyDebugging Effectively
Debugging Effectively
 
From Doctor to Coder: A Whole New World?
From Doctor to Coder: A Whole New World?From Doctor to Coder: A Whole New World?
From Doctor to Coder: A Whole New World?
 
Deploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutesDeploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutes
 
Crafting beautiful software
Crafting beautiful softwareCrafting beautiful software
Crafting beautiful software
 
Scaling your website
Scaling your websiteScaling your website
Scaling your website
 
DPC 2016 - 53 Minutes or Less - Architecting For Failure
DPC 2016 - 53 Minutes or Less - Architecting For FailureDPC 2016 - 53 Minutes or Less - Architecting For Failure
DPC 2016 - 53 Minutes or Less - Architecting For Failure
 
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016 Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
 
Feature Flags Are Flawed: Let's Make Them Better - DPC
Feature Flags Are Flawed: Let's Make Them Better - DPCFeature Flags Are Flawed: Let's Make Them Better - DPC
Feature Flags Are Flawed: Let's Make Them Better - DPC
 
The treacherous road to microservices
The treacherous road to microservicesThe treacherous road to microservices
The treacherous road to microservices
 
Driving Design through Examples
Driving Design through ExamplesDriving Design through Examples
Driving Design through Examples
 
Introducing Eager Design
Introducing Eager DesignIntroducing Eager Design
Introducing Eager Design
 
Elasticsearch, the story so far
Elasticsearch, the story so farElasticsearch, the story so far
Elasticsearch, the story so far
 
Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)
 
Integrating Bounded Contexts Tips - Dutch PHP 2016
Integrating Bounded Contexts Tips - Dutch PHP 2016Integrating Bounded Contexts Tips - Dutch PHP 2016
Integrating Bounded Contexts Tips - Dutch PHP 2016
 
OOP: Princípios e Padroes
OOP: Princípios e PadroesOOP: Princípios e Padroes
OOP: Princípios e Padroes
 
Como programar melhor jogando game boy
Como programar melhor jogando game boyComo programar melhor jogando game boy
Como programar melhor jogando game boy
 
The Road To Technical Team Lead
The Road To Technical Team LeadThe Road To Technical Team Lead
The Road To Technical Team Lead
 

Semelhante a Programming in hack (20)

Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
 
Basic of PHP
Basic of PHPBasic of PHP
Basic of PHP
 
Hack and HHVM
Hack and HHVMHack and HHVM
Hack and HHVM
 
PHP
 PHP PHP
PHP
 
PHP Comprehensive Overview
PHP Comprehensive OverviewPHP Comprehensive Overview
PHP Comprehensive Overview
 
chapter 5 Server-Side Scripting (PHP).pdf
chapter 5 Server-Side Scripting (PHP).pdfchapter 5 Server-Side Scripting (PHP).pdf
chapter 5 Server-Side Scripting (PHP).pdf
 
Php introduction
Php introductionPhp introduction
Php introduction
 
Chap 4 PHP.pdf
Chap 4 PHP.pdfChap 4 PHP.pdf
Chap 4 PHP.pdf
 
Materi Dasar PHP
Materi Dasar PHPMateri Dasar PHP
Materi Dasar PHP
 
Day1
Day1Day1
Day1
 
Introduction to PHP.ppt
Introduction to PHP.pptIntroduction to PHP.ppt
Introduction to PHP.ppt
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
PHP - Introduction to PHP Fundamentals
PHP -  Introduction to PHP FundamentalsPHP -  Introduction to PHP Fundamentals
PHP - Introduction to PHP Fundamentals
 
Basic php
Basic phpBasic php
Basic php
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 
1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master
 
PHP
PHPPHP
PHP
 
Hack language
Hack languageHack language
Hack language
 
Php Unit 1
Php Unit 1Php Unit 1
Php Unit 1
 
Php manish
Php manishPhp manish
Php manish
 

Último

How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 

Último (20)

How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 

Programming in hack

Notas do Editor

  1. class Demo { public function bar(array $a): int { return $a[0]; } }
  2. echo <div>Hello World!!</div>;
  3. function render(string $name): XHPRoot { return <div>Hello World, {$name}!!</div>; } echo render('PHP Conference');
  4. $select = <select />; $options = Vector {'yes', 'no'}; foreach ($options as $value) { $select->appendChild(<option value={$value}>{$value}</option>); }
  5. class :year-picker extends :x:element { attribute int from @required; attribute int to @required; public function render(): XHPRoot { $select = <select />; for ($i = $this->:from; $i <= $this->:to; $i++) { $select->appendChild( <option value={(string) $i}>{$i}</option> ); } return $select; } } echo <year-picker from={1960} to={1990} />;
  6. class :year-picker extends :x:element { attribute :select; use XHPHelpers; attribute int from @required; attribute int to @required; public function render(): XHPRoot { $select = <select />; for ($i = $this->:from; $i <= $this->:to; $i++) { $select->appendChild( <option value={(string) $i}>{$i}</option> ); } return $select; } } echo <year-picker from={1960} to={1990} name="selector" class="mystyle" />;
  7. class :user:link extends :x:element { attribute int userid @required; use XHPAsync; protected async function asyncRender(): Awaitable<XHPRoot> { $user = await get_user_data($this->:userid); return <a href={$user['link']} class="myclass"> {$user['name']} </a>; } } echo <user:link userid={26}/>;
  8. echo <div class="myclass">Hello World!!</div>; Will be replaced with echo new xhp_div( array('class' => 'myclass'), array('Hello World!!') );