Type Declarations • Scalar type declarations int string float bool <?php function setAge(int $age) { } setAge('this is string.'); setAge('30'); // integer PHP7
Type Declarations • Return type declarations <?php function getUser() : User { return []; } interface SomeInterface { public function getUser() : User; } PHP7
Type Declarations • Strict mode <?php declare(strict_types=1); // PHP function setAge(int $age) { } setAge('this is string.'); PHP7
use App{Person, Animal}; use App{Person as P, Animal as A}; Group use declarations use AppPerson; use AppAnimal; // use PHP5 PHP7
7 1. Octal Literals 2. String Parsing 3. Division by Zero 4. Uniform Variable Syntax 5. list() Behavior 6. Error Handling // Many fatal errors converted to Exceptions 7. PHP4 style Constructors are not allowed http://php.net/manual/en/migration70.incompatible.php and more…
Division by Zero var_dump(5/0); // bool(false) var_dump(0/0); // bool(false) var_dump(5%0); // bool(false) PHP5 var_dump(5/0); // float(INF) var_dump(0/0); // float(NAN) // JavaScript JS NaN var_dump(5%0); // DivisionByZeroError PHP7
PHP7 1. Never Use PHP Close Tags At the End of A File 2. Never Pass By Reference If Not Required 3. mysql_functions Should Not Be Used ( mysqli_*) 4. ereg PCRE extension: preg_* ( PCRE extension: preg_*) 5. PHP4 Constructors Are Now Deprecated 6. Removed Extensions 7. Removed old and unsupported SAPIs
Loading Comments...