Meetup del PHP User Group Milano con presentazione delle attività del gruppo e dell'associazione GrUSP per la diffusione delle buone pratiche nel mondo dello sviluppo web. Durante il meetup ci sarà anche un intervento di Enrico Zimuel sulle novità del PHP 7.1 (e 7.2), con la presentazione del suo nuovo libro "Sviluppare in PHP 7. Realizzare applicazioni web e API professionali" edito da Tecniche Nuove.
2. MIPRESENTO
Sviluppatore web dal 1996
Senior Software Engineer presso ,
una società
Coautore di , e
Speaker e relatore internazionale
Research Programmer presso
Co-fondatore del
www.zimuel.it
Zend
Rogue Wave
Apigility Expressive Zend
Framework
TEDx
Università di Amsterdam
PUG Torino
7. TIPINULLABLE
Per parametri e valori di ritorno di funzioni
Sintassi: aggiunta del ? prima del tipo
null può essere passato come argomento,
o restituito come valore
15. CATCHMULTIPLI
try {
// Some code...
} catch (ExceptionA | ExceptionB $e) {
// Handle exceptions A or B
} catch (Exception $e) {
// ...
}
16. INDICINEGATIVI
var_dump("abcdef"[-2]); // string(1) "e"
var_dump("abcdef"[-7]); // string(0) "", PHP Notice
// strpos
var_dump(strpos("aabbcc", "b", -3)); // int(3)
// get the last character of a string
$last = substr($foo, -1); // before PHP 7.1
$last = $foo[-1];
17. OPENSSLAEAD
Cifratura e autenticazione (Authenticated
Encryption)
Supporto modalità GCM e CCM
GCM è 3 volte più veloce di CCM.
Più informazioni su
Dettagli
benchmark
Authenticated Encryption in PHP 7.1
26. TIPOOBJECT
Utilizzabile come parametro e ritorno di tipo
function foo(object $obj): string {
return $obj->var;
}
function bar(MyClass $arg): object {
return $arg;
}
27. OMISSIONEDELTIPO
E' possibile omettere il tipo di un parametro per
interfacce o classi ereditate
class Foo {
public function myFunction(array $myarray)
{ /* ... */ }
}
class Bar extends Foo {
public function myFunction($myarray)
{ /* ... */ }
}
28. ULTIMAVIRGOLA
Lasciare la virgola nell'ultimo elemento di un lista
// Arrays (already possible)
$array = [1, 2, 3,];
use FooBar{ Foo, Bar, Baz, };
fooCall($arg1, $arg2, $arg3,);
protected
$a = 'foo',
$b = 'bar',
;