19. Type Declarations
• Scalar type declarations int string float bool
<?php
function setAge(int $age)
{
}
setAge('this is string.');
setAge('30'); // integer
PHP7
20. Type Declarations
• Return type declarations
<?php
function getUser() : User
{
return [];
}
interface SomeInterface {
public function getUser() : User;
}
PHP7
21. Type Declarations
• Strict mode
<?php
declare(strict_types=1); // PHP
function setAge(int $age)
{
}
setAge('this is string.');
PHP7
22. use App{Person, Animal};
use App{Person as P, Animal as A};
Group use declarations
use AppPerson;
use AppAnimal; // use
PHP5
PHP7
29. 7 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