php-7.2
Docker-php-ext-install mcrypt missing folder
mcrypt extension is not provided with the PHP source since 7.2 , but are instead available through PECL. To install a PECL extension in docker, use pecl install to download and compile it, then use docker-php-ext-enable to enable it: pecl install mcrypt-1.0.5 docker-php-ext-enable mcrypt Before the pecl install you may need to install/update the package … Read more
What does question mark (?) before type declaration means in php (?int) [duplicate]
It’s called Nullable types. Which defines ?int as either int or null. Type declarations for parameters and return values can now be marked as nullable by prefixing the type name with a question mark. This signifies that as well as the specified type, NULL can be passed as an argument, or returned as a value, … Read more
Silence “Declaration … should be compatible” warnings in PHP 7
1. Workaround Since it is not always possible to correct all the code you did not write, especially the legacy one… if (PHP_MAJOR_VERSION >= 7) { set_error_handler(function ($errno, $errstr) { return strpos($errstr, ‘Declaration of’) === 0; }, E_WARNING); } This error handler returns true for warnings beginning with Declaration of which basically tells PHP that … Read more
What do strict types do in PHP?
From the Treehouse blog: With PHP 7 we now have added Scalar types. Specifically: int, float, string, and bool. By adding scalar type hints and enabling strict requirements, it is hoped that more correct and self-documenting PHP programs can be written. It also gives you more control over your code and can make the code … Read more