The following problems run in php5.5 I just learned PHP. in this instance, declare (strict_type1) is provided in the official documentation; why does this strict statement appear as an unsupported statement... after the strict declaration is removed, sum () of the following two int types cannot be passed into the function... the following problems run in php5.5:
I just learned PHP for a few days.
Please advise
1. This instance is provided in the official documentation.
declare(strict_type=1);
Why does this strict statement appear as an unsupported statement...
After removing the strict statement, the following twoint
Typesum(1,2)
Cannot Input Function =
2. In this instance,function
Following:float
What does it mean?
Is it the input number?return
Is it all float?
Then the execution still fails.
Reply content:
The following problems run in php5.5:
I just learned PHP for a few days.
Please advise
1. This instance is provided in the official documentation.
declare(strict_type=1);
Why does this strict statement appear as an unsupported statement...
After removing the strict statement, the following twoint
Typesum(1,2)
Cannot Input Function =
2. In this instance,function
Following:float
What does it mean?
Is it the input number?return
Is it all float?
Then the execution still fails.
After a function: float refers to the type of the return value of the function.
Strict_type is introduced from PhP 7. It is not enabled by default and will not be enabled by default. It is a controversial feature. Rasmus, father of PHP, andi, founder of Zend, and dmitry and laruence, core developers of PHP7 performance, both voted against:
Https://wiki.php.net/rfc/scalar_type_hints_v5
You are writing PHP 7 code, declare or type designation, all of which are PHP 7 features.
Php7 is a new version with major changes, so these features are not supported by php5.5
It may take some time for the current environment to transition to php7. You can first read the php5.5 or php5.6 documents and then see the new features of php7.
This is the new feature of the Migration Guide from PHP 5.6 to PHP 7.