PHP FAQs about official documentation

Source: Internet
Author: User
Tags php 7 features unsupported
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 twointTypesum(1,2)Cannot Input Function =


  

2. In this instance,functionFollowing:floatWhat does it mean?
Is it the input number?returnIs 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 twointTypesum(1,2)Cannot Input Function =


  

2. In this instance,functionFollowing:floatWhat does it mean?
Is it the input number?returnIs 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.