SlideShare uma empresa Scribd logo
Globalcode – Open4education
PHP 7
Incompatibilidades e mudanças de
comportamento.
Globalcode – Open4education
Sobre mim
• Primeiro contato com php em 2006.
• Técnico em processamento de dados, 2007.
• Backend PHP e nodejs.
• Integração de api’s e soluções para ecommerce.
• Chaordic/Linx
Globalcode – Open4education
20 anos do PHP
1995 - Personal Home Page Tools v1.0
1997 - PHP/fi 2
1998 - PHP 3 PHP & Zend
2000 - PHP 4 Zend engine
2004 - PHP 5 Zend Engine II
2009 - PHP 5.3 / PHP6 Unicode
2012 - PHP 5.4
2014 - PHP 5.6
2015 - PHP 7.0 Zend engine III
2016 - PHP 7.01
http://php.net/releases/
Globalcode – Open4education
Suporte
Versão Release Suporte Segurança
5.4 03/2012 09/2014 09/2015
5.5 06/2013 07/2015 07/2016
5.6 08/2014 12/2016* 12/2018*
7.0 12/2015 12/2017 12/2018
http://php.net/supported-versions.php
Globalcode – Open4education
• Mais rápido
• Menos memória
PHP7
Globalcode – Open4education
Novidades
https://wiki.php.net/rfc/abstract_syntax_tree
• Abstract Sintax Tree
Globalcode – Open4education
Novidades
https://wiki.php.net/rfc/context_sensitive_lexer
• Contexto léxico sensitivo
Globalcode – Open4education
Novidades
https://wiki.php.net/rfc/context_sensitive_lexer
• Contexto léxico sensitivo
$finder->for( ‘project’ )
->where( ‘name’ )
->or( ‘code’ )->in( [ ‘4’, ‘5’ ] );
Globalcode – Open4education
• Opcache
• Cache secundário persistente em arquivo
Novidades
http://php.net/manual/pt_BR/opcache.configuration.php
zend_extension = opcache.so
opcache.enable_cli = 1
opcache.file_cache = /tmp
opcache.file_cache_only = 1
Globalcode – Open4education
• Novos operadores
• Null coalesce
Novidades
https://wiki.php.net/rfc/isset_ternary
$x = null ?? “a” ; // “a”
$x = null ?? false ?? 1; // false
$x = null ?? “” ?? 1; // “”
$x = null ?? 0 ?? 1; // 0
Globalcode – Open4education
• Novos operadores
• Spaceship
Novidades
https://wiki.php.net/rfc/combined-comparison-operator#usefulness
[ ] <=> [ ]; // 0
[1, 2] <=> [1,1]; // 1
$a = (object) [“a” => “b”];
$b = (object) [“b” => “b”];
$a <=> $b // 0
1 <=> 1; // 0
1 <=> 2; // -1
2 <=> 1; // 1
“b” <=> “a”; // 1
“a” <=> “b”; // -1
“a” <=> “aa”; // -1
Globalcode – Open4education
• Throwable Interface
• Error
• ArithmeticError
• DivisionByZeroError
• AssertionError
• ParseError
• TypeError
• Exception
• ErrorException
Novidades
http://php.net/manual/pt_BR/language.errors.php7.php
Globalcode – Open4education
• Funções matemáticas
• Intdiv
Novidades
intdiv( 3, 2 ); // 1
intdiv( 1, 0 ); // DivisionByZeroError
intdiv( PHP_INT_MIN, -1 ); // ArithmeticError
http://php.net/manual/pt_BR/function.intdiv.php
Globalcode – Open4education
• Tipos escalares
Novidades
http://php.net/manual/en/language.types.intro.php
Globalcode – Open4education
• Tipos escalares
• Modo coercivo x estrito
Novidades
function set(string $input) : int // “1”
{
return $input; // 1
}
$output = set(1.1);
http://php.net/...migration70.new-features.scalar-type-declarations
Globalcode – Open4education
• Tipos escalares
• Modo coercivo x estrito
Novidades
declare( strict_types=1 );
function set(string $input) : int
{
return $input; //throw TypeError
}
$output = set(1.1); //throw TypeError
https://wiki.php.net/rfc/scalar_type_hints_v5#strict_types_declare_directive
Globalcode – Open4education
• Classes anônimas
• extends / implements / traits
Novidades
http://php.net/manual/pt_BR/language.oop5.anonymous.php
use packageILogger;
…
$this->setLogger(new class implements ILogger {
public function log($args){ … }
});
Globalcode – Open4education
• Constantes do tipo array
• define
Novidades
http://php.net/manual/pt_BR/migration70.new-features.php
define (“ANIMALS”, [
“dog”, “cat”, “bird”
]);
echo ANIMALS[1]; // “cat”
Globalcode – Open4education
• Unicode
• escape de strings
Novidades
// PHP 5.x
html_entity_decode(‘&#x2603’, 0, ‘UTF-8’);
mb_convert_encoding(‘&#x2603’, ‘UTF-8’, ‘HTML-ENTITIES’);
json_decode(‘“u2603”’);
// PHP 7
echo “u{2603}”; // ☃
http://php.net/manual/pt_BR/...unicode-codepoint-escape-syntax
Globalcode – Open4education
• Closure::call
Novidades
class A { private $number = 1; } // Sample class
$getCb = function( ) { return $this->number; }; // Closure
// PHP 5.6
$getNumber = $getCb->bindTo(new A, ‘A’);
echo $getNumber( ); // 1
// PHP 7
echo $getCb->call(new A); // 1
http://php.net/manual/pt_BR/closure.call.php
Globalcode – Open4education
• Agrupamento de namespaces
Novidades
use somenamespaceClassA;
use somenamespaceClassB;
use somenamespaceClassC;
use somenamespace { ClassA, ClassB, ClassC };
use function somenamespace{ fnA, fnB, fnC };
use const somenamespace { ConstA, ConstB, ConstC };
http://php.net/manual/pt_BR...group-use-declarations
Globalcode – Open4education
Globalcode – Open4education
Incompatibilidades
Globalcode – Open4education
• Variáveis variáveis
Novidades
https://wiki.php.net/rfc/isset_ternary
$foo = “bar”;
$bar = “baz”;
echo $$foo; // “baz”
Globalcode – Open4education
• Variáveis variáveis
• Sintaxe uniforme
Novidades
https://wiki.php.net/rfc/isset_ternary
$$foo[ “bar” ][ “baz” ]
$ ( $foo[ “bar” ][ “baz” ] ) // php5
$ ( $foo ) [ “bar” ][ “baz” ] // php7
Globalcode – Open4education
• Errors, handler e try/catch.
Mudanças de
comportamento
try { … }
catch(Exception $e) { … }
catch(Error $er) { … }
function errorHandler( $errno, $errstr) { ... }
set_exception_handler(‘errorHandler’);
http://php.net/manual/pt_BR/language.errors.php7.php
Globalcode – Open4education
• Parenteses redundantes.
Mudanças de
comportamento
function getArray( ) {
return [ 1, 2, 3 ];
};
function squareArray( &$a ) {
foreach( $a as &$v ) {
$v **=2;
}
}
squareArray( ( getArray( ) ) );
Notice: Only variables should be
passed by reference in /tmp/test.php
on line 13
http://php.net/manual/pt_BR/...variable-handling.parentheses
Globalcode – Open4education
• list
• Direção de leitura
Mudanças de
comportamento
list( $a[ ], $a[ ], $a[ ] ) = [ 1, 2, 3 ];
// php5
var_dump( $a ); // [ 3, 2, 1 ]
// php7
var_dump( $a ); // [ 1, 2, 3 ]
http://php.net/manual/pt_BR/...incompatible.variable-handling.list
Globalcode – Open4education
• list
• Desempacotar strings
• Chamadas vazias
Mudanças de
comportamento
$string = “abc”;
// php5
list( $a, $b, $c ) = $string; // [ ‘a’, ‘b’, ‘c’ ];
// php7
str_split( $string ); // [ ‘a’, ‘b’, ‘c’ ];
http://php.net/manual/pt_BR/...incompatible.variable-handling.list
Globalcode – Open4education
• Iterador foreach
Mudanças de
comportamento
$array = [ 0 ];
foreach( $array as &$val ) {
var_dump( &$val );
$array[ 1 ] = 1;
}
// int( 0 )
// int( 1 )
http://php.net/manual/pt_BR/...incompatible.foreach
Globalcode – Open4education
• Inteiros
• Divisão por zero
• Módulo
Mudanças de
comportamento
( 1 / 0 ); // Warning: Division by zero %s on line %d
(1 % 0); // PHP Fatal error: Uncaught DivisionByZeroError:
Module by zero in %s line %d.
http://php.net/manual/pt_BR/...incompatible.integers.div-by-zero
Globalcode – Open4education
• Palavras reservadas
• int, float, bool, string
• resource, object, mixed, numeric
Mudanças de
comportamento
class string { // ParseError
...
}
http://php.net/manual/pt_BR/reserved.other-reserved-words.php
Globalcode – Open4education
• Construtores do php 4
Depreciados
class Example
{
// php 4 style
public function Example ( ) { ... }
// php 5 style
public function __construct ( ) { ... }
}
http://php.net/manual/pt_BR/...deprecated.php4-constructors
Globalcode – Open4education
• Chamadas estáticas a não estáticos de outro
contexto
Depreciados
class A {
public function test( ) { var_dump( $this ); };
}
class B {
public function callNonStaticOfA( ) { A::test( ); }
}
(new B)->callNonStaticOfA( ); // Undefined variable
http://php.net/manual/pt_BR/...deprecated.static-calls
Globalcode – Open4education
• mysql
• mysqli ou pdo
• ereg
• preg
• call_user_method( )
• call_user_func( )
• call_user_method_array()
• call_user_func_array( )
Removidos:
http://php.net/manual/pt_BR/migration70.removed-exts-sapis.php
Globalcode – Open4education
• Instalar Virtualbox e Vagrant
• Clonar repositório
Testando o php 7
$ git clone https://github.com/rlerdorf/php7dev.git
$ cd php7dev
$ vagrant up
$ vagrant ssh
Globalcode – Open4education
Importância de testes
Globalcode – Open4education
• Slides palestra Rasmus
• http://talks.php.net/tokyo15#/
• Guia de migração(Manual PHP)
• http://php.net/manual/pt_BR/migration70.php
• Zend infográficos e novidades
• http://www.zend.com/en/resources/php7_infographic
• http://www.zend.com/en/resources/php7-5-things-to-know-infographic
Referências
Globalcode – Open4education
• Email: mbaymone@gmail.com
• twitter: @mbaymone
• Facebook: facebook.com/mbertholdt
• LinkedIn: linkedin.com/in/marceloaymone
• Github: github.com/aymone
Contato
Globalcode – Open4education
Obrigado!!!

Mais conteúdo relacionado

PDF
PHP-CLI in 7 steps - 7Masters PHP
PDF
PHP-CLI em 7 passos
PDF
PHP e a (in)segurança de aplicações
PPTX
Logs, pra que te quero! @ Meetup PHP Vale
ODP
Php7 esta chgando! O que você precisa saber
PPTX
PDF
PHP na Tela Escura: Aplicações Poderosas em Linha de Comando
PPTX
Doctrine for Dummies
PHP-CLI in 7 steps - 7Masters PHP
PHP-CLI em 7 passos
PHP e a (in)segurança de aplicações
Logs, pra que te quero! @ Meetup PHP Vale
Php7 esta chgando! O que você precisa saber
PHP na Tela Escura: Aplicações Poderosas em Linha de Comando
Doctrine for Dummies

Destaque (20)

PPTX
DOC
My Cv Cristina Galo
PDF
Abdominal auscultation [2015]
DOCX
Doa damai
PPTX
PPP Jeffrey Kaney
PPTX
4th evaluation question
PPTX
Haploid induction of allelic diversity populations in maize
DOC
My Cv Cristina Galo
PPTX
Dhcp server &amp; dns server
PDF
Scout - How Create Successful Brand Protection Program
PDF
2015 bocoor power bank pricelist
PDF
Abdominal percussion [2015]
PPTX
An Intra-oral Cement Control System. A Great Solution to a Big Problem
PDF
[2015] the treatment of diabetes mellitus of patients with chronic liver disease
PPTX
Screw versus Cement for Implant Prosthesis Installation. Part 2: The Game Cha...
PPTX
Screw versus cement for implant prosthesis installation part 2
PDF
Cytomegalovirus (cmv), the hidden enemy in liver transplantation 2015
PPTX
Cabbage (Brassica oleracea var.capitata)
PDF
[2016] pathogenesis of liver fibrosis
PDF
[2015] hcv direct acting antivirals [da as] stumbling
My Cv Cristina Galo
Abdominal auscultation [2015]
Doa damai
PPP Jeffrey Kaney
4th evaluation question
Haploid induction of allelic diversity populations in maize
My Cv Cristina Galo
Dhcp server &amp; dns server
Scout - How Create Successful Brand Protection Program
2015 bocoor power bank pricelist
Abdominal percussion [2015]
An Intra-oral Cement Control System. A Great Solution to a Big Problem
[2015] the treatment of diabetes mellitus of patients with chronic liver disease
Screw versus Cement for Implant Prosthesis Installation. Part 2: The Game Cha...
Screw versus cement for implant prosthesis installation part 2
Cytomegalovirus (cmv), the hidden enemy in liver transplantation 2015
Cabbage (Brassica oleracea var.capitata)
[2016] pathogenesis of liver fibrosis
[2015] hcv direct acting antivirals [da as] stumbling
Anúncio

Semelhante a TDC 2016 - PHP7 (20)

PPTX
PHP 7 - A Maioridade do PHP
PDF
Pense no futuro: PHP com Zend Framework
PDF
Linguagem PHP
PDF
PHP Experience 2016 - [Palestra] Keynote: PHP-7
PPSX
5 Maneiras de melhorar seu código PHP
PDF
Palestra Desenvolvimento Ágil para Web com ROR UVA
PPTX
ODP
Sapo Sessions PHP
PDF
PHP para aplicações Web de grande porte
PPT
Cakephp - framework de desenvolvimento de aplicações Web em PHP
PPTX
PHP Tools for Fast coding
PDF
Novidades do PHP 5.3 e 6
PDF
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
PDF
Xdebug seus problemas acabaram - tdc floripa 2017
PPTX
O Aduino ama a Internet - TDC 2012
PDF
Dev Ext PHP
PPTX
Logs, pra que te quero! @ PHP Community Summit by locaweb 2017
PDF
Security & PHP
PHP 7 - A Maioridade do PHP
Pense no futuro: PHP com Zend Framework
Linguagem PHP
PHP Experience 2016 - [Palestra] Keynote: PHP-7
5 Maneiras de melhorar seu código PHP
Palestra Desenvolvimento Ágil para Web com ROR UVA
Sapo Sessions PHP
PHP para aplicações Web de grande porte
Cakephp - framework de desenvolvimento de aplicações Web em PHP
PHP Tools for Fast coding
Novidades do PHP 5.3 e 6
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
Xdebug seus problemas acabaram - tdc floripa 2017
O Aduino ama a Internet - TDC 2012
Dev Ext PHP
Logs, pra que te quero! @ PHP Community Summit by locaweb 2017
Security & PHP
Anúncio

TDC 2016 - PHP7

  • 1. Globalcode – Open4education PHP 7 Incompatibilidades e mudanças de comportamento.
  • 2. Globalcode – Open4education Sobre mim • Primeiro contato com php em 2006. • Técnico em processamento de dados, 2007. • Backend PHP e nodejs. • Integração de api’s e soluções para ecommerce. • Chaordic/Linx
  • 3. Globalcode – Open4education 20 anos do PHP 1995 - Personal Home Page Tools v1.0 1997 - PHP/fi 2 1998 - PHP 3 PHP & Zend 2000 - PHP 4 Zend engine 2004 - PHP 5 Zend Engine II 2009 - PHP 5.3 / PHP6 Unicode 2012 - PHP 5.4 2014 - PHP 5.6 2015 - PHP 7.0 Zend engine III 2016 - PHP 7.01 http://php.net/releases/
  • 4. Globalcode – Open4education Suporte Versão Release Suporte Segurança 5.4 03/2012 09/2014 09/2015 5.5 06/2013 07/2015 07/2016 5.6 08/2014 12/2016* 12/2018* 7.0 12/2015 12/2017 12/2018 http://php.net/supported-versions.php
  • 5. Globalcode – Open4education • Mais rápido • Menos memória PHP7
  • 8. Globalcode – Open4education Novidades https://wiki.php.net/rfc/context_sensitive_lexer • Contexto léxico sensitivo $finder->for( ‘project’ ) ->where( ‘name’ ) ->or( ‘code’ )->in( [ ‘4’, ‘5’ ] );
  • 9. Globalcode – Open4education • Opcache • Cache secundário persistente em arquivo Novidades http://php.net/manual/pt_BR/opcache.configuration.php zend_extension = opcache.so opcache.enable_cli = 1 opcache.file_cache = /tmp opcache.file_cache_only = 1
  • 10. Globalcode – Open4education • Novos operadores • Null coalesce Novidades https://wiki.php.net/rfc/isset_ternary $x = null ?? “a” ; // “a” $x = null ?? false ?? 1; // false $x = null ?? “” ?? 1; // “” $x = null ?? 0 ?? 1; // 0
  • 11. Globalcode – Open4education • Novos operadores • Spaceship Novidades https://wiki.php.net/rfc/combined-comparison-operator#usefulness [ ] <=> [ ]; // 0 [1, 2] <=> [1,1]; // 1 $a = (object) [“a” => “b”]; $b = (object) [“b” => “b”]; $a <=> $b // 0 1 <=> 1; // 0 1 <=> 2; // -1 2 <=> 1; // 1 “b” <=> “a”; // 1 “a” <=> “b”; // -1 “a” <=> “aa”; // -1
  • 12. Globalcode – Open4education • Throwable Interface • Error • ArithmeticError • DivisionByZeroError • AssertionError • ParseError • TypeError • Exception • ErrorException Novidades http://php.net/manual/pt_BR/language.errors.php7.php
  • 13. Globalcode – Open4education • Funções matemáticas • Intdiv Novidades intdiv( 3, 2 ); // 1 intdiv( 1, 0 ); // DivisionByZeroError intdiv( PHP_INT_MIN, -1 ); // ArithmeticError http://php.net/manual/pt_BR/function.intdiv.php
  • 14. Globalcode – Open4education • Tipos escalares Novidades http://php.net/manual/en/language.types.intro.php
  • 15. Globalcode – Open4education • Tipos escalares • Modo coercivo x estrito Novidades function set(string $input) : int // “1” { return $input; // 1 } $output = set(1.1); http://php.net/...migration70.new-features.scalar-type-declarations
  • 16. Globalcode – Open4education • Tipos escalares • Modo coercivo x estrito Novidades declare( strict_types=1 ); function set(string $input) : int { return $input; //throw TypeError } $output = set(1.1); //throw TypeError https://wiki.php.net/rfc/scalar_type_hints_v5#strict_types_declare_directive
  • 17. Globalcode – Open4education • Classes anônimas • extends / implements / traits Novidades http://php.net/manual/pt_BR/language.oop5.anonymous.php use packageILogger; … $this->setLogger(new class implements ILogger { public function log($args){ … } });
  • 18. Globalcode – Open4education • Constantes do tipo array • define Novidades http://php.net/manual/pt_BR/migration70.new-features.php define (“ANIMALS”, [ “dog”, “cat”, “bird” ]); echo ANIMALS[1]; // “cat”
  • 19. Globalcode – Open4education • Unicode • escape de strings Novidades // PHP 5.x html_entity_decode(‘&#x2603’, 0, ‘UTF-8’); mb_convert_encoding(‘&#x2603’, ‘UTF-8’, ‘HTML-ENTITIES’); json_decode(‘“u2603”’); // PHP 7 echo “u{2603}”; // ☃ http://php.net/manual/pt_BR/...unicode-codepoint-escape-syntax
  • 20. Globalcode – Open4education • Closure::call Novidades class A { private $number = 1; } // Sample class $getCb = function( ) { return $this->number; }; // Closure // PHP 5.6 $getNumber = $getCb->bindTo(new A, ‘A’); echo $getNumber( ); // 1 // PHP 7 echo $getCb->call(new A); // 1 http://php.net/manual/pt_BR/closure.call.php
  • 21. Globalcode – Open4education • Agrupamento de namespaces Novidades use somenamespaceClassA; use somenamespaceClassB; use somenamespaceClassC; use somenamespace { ClassA, ClassB, ClassC }; use function somenamespace{ fnA, fnB, fnC }; use const somenamespace { ConstA, ConstB, ConstC }; http://php.net/manual/pt_BR...group-use-declarations
  • 24. Globalcode – Open4education • Variáveis variáveis Novidades https://wiki.php.net/rfc/isset_ternary $foo = “bar”; $bar = “baz”; echo $$foo; // “baz”
  • 25. Globalcode – Open4education • Variáveis variáveis • Sintaxe uniforme Novidades https://wiki.php.net/rfc/isset_ternary $$foo[ “bar” ][ “baz” ] $ ( $foo[ “bar” ][ “baz” ] ) // php5 $ ( $foo ) [ “bar” ][ “baz” ] // php7
  • 26. Globalcode – Open4education • Errors, handler e try/catch. Mudanças de comportamento try { … } catch(Exception $e) { … } catch(Error $er) { … } function errorHandler( $errno, $errstr) { ... } set_exception_handler(‘errorHandler’); http://php.net/manual/pt_BR/language.errors.php7.php
  • 27. Globalcode – Open4education • Parenteses redundantes. Mudanças de comportamento function getArray( ) { return [ 1, 2, 3 ]; }; function squareArray( &$a ) { foreach( $a as &$v ) { $v **=2; } } squareArray( ( getArray( ) ) ); Notice: Only variables should be passed by reference in /tmp/test.php on line 13 http://php.net/manual/pt_BR/...variable-handling.parentheses
  • 28. Globalcode – Open4education • list • Direção de leitura Mudanças de comportamento list( $a[ ], $a[ ], $a[ ] ) = [ 1, 2, 3 ]; // php5 var_dump( $a ); // [ 3, 2, 1 ] // php7 var_dump( $a ); // [ 1, 2, 3 ] http://php.net/manual/pt_BR/...incompatible.variable-handling.list
  • 29. Globalcode – Open4education • list • Desempacotar strings • Chamadas vazias Mudanças de comportamento $string = “abc”; // php5 list( $a, $b, $c ) = $string; // [ ‘a’, ‘b’, ‘c’ ]; // php7 str_split( $string ); // [ ‘a’, ‘b’, ‘c’ ]; http://php.net/manual/pt_BR/...incompatible.variable-handling.list
  • 30. Globalcode – Open4education • Iterador foreach Mudanças de comportamento $array = [ 0 ]; foreach( $array as &$val ) { var_dump( &$val ); $array[ 1 ] = 1; } // int( 0 ) // int( 1 ) http://php.net/manual/pt_BR/...incompatible.foreach
  • 31. Globalcode – Open4education • Inteiros • Divisão por zero • Módulo Mudanças de comportamento ( 1 / 0 ); // Warning: Division by zero %s on line %d (1 % 0); // PHP Fatal error: Uncaught DivisionByZeroError: Module by zero in %s line %d. http://php.net/manual/pt_BR/...incompatible.integers.div-by-zero
  • 32. Globalcode – Open4education • Palavras reservadas • int, float, bool, string • resource, object, mixed, numeric Mudanças de comportamento class string { // ParseError ... } http://php.net/manual/pt_BR/reserved.other-reserved-words.php
  • 33. Globalcode – Open4education • Construtores do php 4 Depreciados class Example { // php 4 style public function Example ( ) { ... } // php 5 style public function __construct ( ) { ... } } http://php.net/manual/pt_BR/...deprecated.php4-constructors
  • 34. Globalcode – Open4education • Chamadas estáticas a não estáticos de outro contexto Depreciados class A { public function test( ) { var_dump( $this ); }; } class B { public function callNonStaticOfA( ) { A::test( ); } } (new B)->callNonStaticOfA( ); // Undefined variable http://php.net/manual/pt_BR/...deprecated.static-calls
  • 35. Globalcode – Open4education • mysql • mysqli ou pdo • ereg • preg • call_user_method( ) • call_user_func( ) • call_user_method_array() • call_user_func_array( ) Removidos: http://php.net/manual/pt_BR/migration70.removed-exts-sapis.php
  • 36. Globalcode – Open4education • Instalar Virtualbox e Vagrant • Clonar repositório Testando o php 7 $ git clone https://github.com/rlerdorf/php7dev.git $ cd php7dev $ vagrant up $ vagrant ssh
  • 38. Globalcode – Open4education • Slides palestra Rasmus • http://talks.php.net/tokyo15#/ • Guia de migração(Manual PHP) • http://php.net/manual/pt_BR/migration70.php • Zend infográficos e novidades • http://www.zend.com/en/resources/php7_infographic • http://www.zend.com/en/resources/php7-5-things-to-know-infographic Referências
  • 39. Globalcode – Open4education • Email: mbaymone@gmail.com • twitter: @mbaymone • Facebook: facebook.com/mbertholdt • LinkedIn: linkedin.com/in/marceloaymone • Github: github.com/aymone Contato