SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
PHP
The Rise of
Steeven Andrian
Founder of O2System Framework
CEO of PT. Lingkar Kreasi (Circle Creative)
hidup?
mati?
Steeven Andrian
The Rise Of PHP
NodeJS
Ryan Dahl
May 27, 2009
Go
Robert Griesemer
November 10, 2009
NPM
Isaac Z. Schlueter
January 12, 2010
The Major
HITS!
PWA
Alex Russel
November 17, 2015
2009 2010 2015
Steeven Andrian
The Rise Of PHP
Mitos PHP
Steeven Andrian
The Rise Of PHP
Not
Secure
Not
Scale
Slow
Steeven Andrian
The Rise Of PHP
Salah
Kaprah ?!
Steeven Andrian
The Rise Of PHP
Not
Async
Not
Serverless
No Packages
Management
Supported
Since PHP
v5.4
March 1, 2012
Spearhead
Since PHP
v4.0
May 22, 2000
Composer
Since PHP
v5.4
May 1, 2012
No Socket
Support
Supported
Since PHP
v4.10
December 10, 2001
No PWA
Support
Supported
Since
O2System
Framework
Soft Launch
April 23, 2018
Steeven Andrian
The Rise Of PHP
Lahirnya Kembali
Sang
Legenda
Steeven Andrian
The Rise Of PHP
Fitur-fitur
Juara!
Steeven Andrian
The Rise Of PHP
AST
Abstract Syntax Tree
<?php
require ‘path/to/utility.php’;
$code = <<<’EOC’
<?php
$var = 42;
EOC;
echo ast_dump(astparse_code($code, $version = 50)), “n”;
// Output:
AST_STMT_LIST
0: AST_ASSIGN
var: AST_VAR
name: “var”
expr: 42
Steeven Andrian
The Rise Of PHP
RTD
Return Type Declaration
<?php
function foo($bar):string
{
return $bar;
}
foo(50);
Fatal error:
Uncaught TypeError: Return value of foo() must be of the type string
Steeven Andrian
The Rise Of PHP
CST
Coercive Scalar Type
<?php
function foo(string $num):string
{
return ‘this is: ’ . $bar;
}
foo(50);
Notice:
A non well formed numeric value encountered in file on line 2
Steeven Andrian
The Rise Of PHP
SST
Strict Scalar Type
<?php
declare(strict_types = 1);
function foo(string $num):string
{
return ‘this is: ’ . $num;
}
foo(50);
Fatal Error:
Uncaught TypeError: Argument 1 passed to foo() must be of the type string, integer given, called
in line 9 and defined in file: 3
Steeven Andrian
The Rise Of PHP
Typed
Class Property
<?php
class Example
{
public string $foo = ‘foo’;
}
$example = new Example();
$example->foo = 1;
Fatal Error:
Uncaught TypeError: $foo must be of the type string, integer given, called in line 9 and defined in
file: 3
Steeven Andrian
The Rise Of PHP
Union Types
Returns and Declaration
<?php
function foo(string|int $num):string|int
{
return $num;
}
foo(50);
foo(‘fifty’);
Steeven Andrian
The Rise Of PHP
Anonymous Class
<?php
use O2SystemFrameworkModelsSqlModel;
$model = new class extends Model
{
public $table = ‘test_table’;
}
$model->all();
Steeven Andrian
The Rise Of PHP
Null Coalesce Operator
<?php
$a = null;
$b = 1;
$c = 2;
echo $a ?? $b; // output: 1
echo $c ?? $b; // output: 2
echo $a ?? $b ?? $c; // output: 1
echo $a ?? $x ?? $c; // output: 2
Steeven Andrian
The Rise Of PHP
Spaceship Operator
<?php
function cmp_php5($a, $b) {
return ($a < $b) ? -1 : (($a > $b) ? 1 : 0);
}
function cmp_php7($a, $b) {
return $a <=> $b
}
|=| // tie fighter
k=k // tie interceptor
<==> // tie bomber
<=> // tie advanced X1
Steeven Andrian
The Rise Of PHP
Zero-cost Assertions
<?php
function test($args) {
assert ($arg > 20) && $arg < 110, “$arg is invalid”);
}
ini_set(‘zend.assertions’, 0); test(16);
ini_set(‘zend.assertions’, 1); test(17);
ini_set(‘assert.exception’, 1); test(18);
Warning: assert(): 17 is invalid failed in file on line 2
Fatal error: uncaught AssertionError: 18 is invalid in file: 2
Steeven Andrian
The Rise Of PHP
Added Closure::call()
<?php
$foo = function() {
return $this->num;
}
class MyClass
{
private $num = 42;
}
// PHP v5.x
$class = $foo->bindTo($myClass, “MyClass”);
$class();
// PHP v7.x
$foo->call($myClass);
Steeven Andrian
The Rise Of PHP
Arrow Function
<?php
$x = 10;
// PHP v5.x
$nums = array_map(function($n) use $x {
return $n * $x;
}, [1,2,3,4]);
// PHP v7.x
$nums = array_map(fn($n) => $n * $x, [1,2,3,4]);
print_r($nums);
// Output: Array(10,20,30,40);
Steeven Andrian
The Rise Of PHP
Parse Error
on Invalid numeric literals
<?php
$mask = 0855;
Parse error: Invalid numeric literal
Steeven Andrian
The Rise Of PHP
Uniform Variable Syntax
<?php
// v7.x Left to Right
$this->$foo[‘bar’];
// v5.x
$this->{$foo[‘bar’]};
// Support missing combinations of operations
$foo()[‘bar’]();
[$obj1, $obj2[0]->prop;
getStr(){0}
// Support operations on arbitrary (...) expressions
(...)[‘foo’];
(...)->foo;
// Support nested ::
$foo[‘bar’]::$baz;
$foo::$bar::$baz;
$foo->bar()::baz();
// Support nested ()
$foo()();
$foo->bar()();
Foo::bar()();
$foo()();
Steeven Andrian
The Rise Of PHP
Immutable Arrays
Optimization
<?php
$arrays = [];
for($i = 0; $i < 100000; ++$i) {
$arrays[] = [1,2,3,4,5,6]
}
PHP5 PHP7 PHP7 with OpCache
Memory Usage 1366 MB 391 MB 32 MB
Creation Execution Time 0.77s 0.29s 0.03s
Destroying Execution Time 1.45s 0.05s 0.002s
6x faster 10x faster
Steeven Andrian
The Rise Of PHP
New Reserved Words
bool
int
float
string
null
false
true
resource
object
mixed
numeric
Steeven Andrian
The Rise Of PHP
Fitur-fitur
Killer!
Steeven Andrian
The Rise Of PHP
FFI
Foreign Function
Interfaces
Steeven Andrian
The Rise Of PHP
JIT Compiler
Just In Time Compiler
Compiled
to OpCodes
Run on
Virtual Machine
Run on
CPU
Steeven Andrian
The Rise Of PHP
JIT Compiler
Just In Time Compiler
Compiled to Machine Code Run on CPU
Steeven Andrian
The Rise Of PHP
Memorized
Preload Codes
Compiled
to Machine Code
Run on CPU
Steeven Andrian
The Rise Of PHP
Attributes
For Metaprogramming
<?php
use AppAttributesAttributeExample;
<<AttributeExample>>
class Foo
{
<<AttributeExample>>
public const BAR = ‘bar’;
<<AttributeExample>>
public $prop;
<<AttributeExample>>
public function hello(<<AttributeExample>> $world)
{
// write your code here...
}
}
Steeven Andrian
The Rise Of PHP
Fitur-fitur yang
memperkuat!
Steeven Andrian
The Rise Of PHP
Fitur-fitur yang memperkuat
✔ Removal of many deprecated features
✔ 64-bit integer support on Windows
✔ Cleanup edge-case integer overflow/underflow
✔ Support for strings with length >= 2^31 bytes in 64bit builds
✔ Unicode Codepoint Escape Syntax
✔ ICU IntlChar class added to intl extension
Steeven Andrian
The Rise Of PHP
✔ Much more cpu cache friendly
✔ New memory allocator similar to jemalloc
✔ Faster hastable iteration API
✔ Array duplication optimization
✔ PCRE JIT enabled by default
✔ Fast ZPP (ZendParseParameters) implementation
✔ Faster stack-alocated zvals (instead of heap)
✔ Optimized VM calling
✔ Global register variables with gcc 4.8+
✔ Hundreds of micro-optimizations
Steeven Andrian
The Rise Of PHP
Fitur-fitur yang memperkuat
Apakah
PHP akan mati?
Steeven Andrian
The Rise Of PHP
78.9% www
is built using PHP
*according to W3Techs Data
Steeven Andrian
The Rise Of PHP
Apakah
untung
belajar PHP!
Steeven Andrian
The Rise Of PHP
✔ Ada dimana saja (Sekolah, Kursus, YouTube, Forum, Stackoverflow)
✔ Mudah dipelajari (Belajar SSI, OOP, Design Pattern, FasS, Microservice, dll)
✔ Dapat banyak digunakan untuk belajar mengasah skill programming
khususnya logika.
✔ Good for getting a job and perfect entry level job.
✔ More applicable (HTML, CSS, JS, PHP & MySQL) sudah bisa membangun
website / aplikasi / command line interface
✔ Mudah diintegrasikan
✔ Mudah mencari support atau dukungan
Steeven Andrian
The Rise Of PHP
Tips
Steeven Andrian
The Rise Of PHP
Questions
Steeven Andrian
The Rise Of PHP
Find Me on Google
Steeven Andrian
Follow me on
Instagram, Facebook and Twitter
@steevenz_
Github
@steevenz

Contenu connexe

Tendances

Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Tatsuhiko Miyagawa
 
Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13
Stephan Hochdörfer
 
Ruby 入門 第一次就上手
Ruby 入門 第一次就上手Ruby 入門 第一次就上手
Ruby 入門 第一次就上手
Wen-Tien Chang
 

Tendances (20)

Dynamic code generation in Perl
Dynamic code generation in PerlDynamic code generation in Perl
Dynamic code generation in Perl
 
Tatsumaki
TatsumakiTatsumaki
Tatsumaki
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
 
Bootstrap |> Elixir - Easy fun for busy developers
Bootstrap |> Elixir - Easy fun for busy developersBootstrap |> Elixir - Easy fun for busy developers
Bootstrap |> Elixir - Easy fun for busy developers
 
A Lifecycle Of Code Under Test by Robert Fornal
A Lifecycle Of Code Under Test by Robert FornalA Lifecycle Of Code Under Test by Robert Fornal
A Lifecycle Of Code Under Test by Robert Fornal
 
Get your teeth into Plack
Get your teeth into PlackGet your teeth into Plack
Get your teeth into Plack
 
Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13Your Business. Your Language. Your Code - dpc13
Your Business. Your Language. Your Code - dpc13
 
Crafting Quality PHP Applications (ConFoo YVR 2017)
Crafting Quality PHP Applications (ConFoo YVR 2017)Crafting Quality PHP Applications (ConFoo YVR 2017)
Crafting Quality PHP Applications (ConFoo YVR 2017)
 
Karma - JS Test Runner
Karma - JS Test RunnerKarma - JS Test Runner
Karma - JS Test Runner
 
AngularJS Unit Testing
AngularJS Unit TestingAngularJS Unit Testing
AngularJS Unit Testing
 
Getting big without getting fat, in perl
Getting big without getting fat, in perlGetting big without getting fat, in perl
Getting big without getting fat, in perl
 
Symfony 4 Workshop - Limenius
Symfony 4 Workshop - LimeniusSymfony 4 Workshop - Limenius
Symfony 4 Workshop - Limenius
 
Modern PHP
Modern PHPModern PHP
Modern PHP
 
Ruby 入門 第一次就上手
Ruby 入門 第一次就上手Ruby 入門 第一次就上手
Ruby 入門 第一次就上手
 
Last train to php 7
Last train to php 7Last train to php 7
Last train to php 7
 
Morpheus configuration engine (slides from Saint Perl-2 conference)
Morpheus configuration engine (slides from Saint Perl-2 conference)Morpheus configuration engine (slides from Saint Perl-2 conference)
Morpheus configuration engine (slides from Saint Perl-2 conference)
 
The secret of PHP7's Performance
The secret of PHP7's Performance The secret of PHP7's Performance
The secret of PHP7's Performance
 
Testing JS with Jasmine
Testing JS with JasmineTesting JS with Jasmine
Testing JS with Jasmine
 
Conscious Decoupling - Lone Star PHP
Conscious Decoupling - Lone Star PHPConscious Decoupling - Lone Star PHP
Conscious Decoupling - Lone Star PHP
 
BUILDING APPS WITH ASYNCIO
BUILDING APPS WITH ASYNCIOBUILDING APPS WITH ASYNCIO
BUILDING APPS WITH ASYNCIO
 

Similaire à CodePolitan Webinar: The Rise of PHP

Similaire à CodePolitan Webinar: The Rise of PHP (20)

The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
 
The new features of PHP 7
The new features of PHP 7The new features of PHP 7
The new features of PHP 7
 
Php7 HHVM and co
Php7 HHVM and coPhp7 HHVM and co
Php7 HHVM and co
 
Php7 hhvm and co
Php7 hhvm and coPhp7 hhvm and co
Php7 hhvm and co
 
第26回PHP勉強会
第26回PHP勉強会第26回PHP勉強会
第26回PHP勉強会
 
CakePHP 2.0 - It'll rock your world
CakePHP 2.0 - It'll rock your worldCakePHP 2.0 - It'll rock your world
CakePHP 2.0 - It'll rock your world
 
Api Design
Api DesignApi Design
Api Design
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
Developing web APIs using middleware in PHP 7
Developing web APIs using middleware in PHP 7Developing web APIs using middleware in PHP 7
Developing web APIs using middleware in PHP 7
 
The why and how of moving to php 5.4
The why and how of moving to php 5.4The why and how of moving to php 5.4
The why and how of moving to php 5.4
 
Plack - LPW 2009
Plack - LPW 2009Plack - LPW 2009
Plack - LPW 2009
 
What To Expect From PHP7
What To Expect From PHP7What To Expect From PHP7
What To Expect From PHP7
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6
 
What's new with PHP7
What's new with PHP7What's new with PHP7
What's new with PHP7
 
Clear php reference
Clear php referenceClear php reference
Clear php reference
 
CakePHP - The Path to 2.0
CakePHP - The Path to 2.0CakePHP - The Path to 2.0
CakePHP - The Path to 2.0
 
Intro to PSGI and Plack
Intro to PSGI and PlackIntro to PSGI and Plack
Intro to PSGI and Plack
 
ElePHPant7 - Introduction to PHP7
ElePHPant7 - Introduction to PHP7ElePHPant7 - Introduction to PHP7
ElePHPant7 - Introduction to PHP7
 
Build a bot workshop async primer - php[tek]
Build a bot workshop  async primer - php[tek]Build a bot workshop  async primer - php[tek]
Build a bot workshop async primer - php[tek]
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

CodePolitan Webinar: The Rise of PHP