Example of new operator usage in PHP7

Source: Internet
Author: User
This article mainly introduces the usage of new operators in PHP 7, and analyzes the functions and usage skills of merging operators and combining comparison operators in combination with examples, for more information, see the example in this article. We will share this with you for your reference. The details are as follows:

NULL merge operator

It is actually a transformation of the ternary operators, reducing the amount of code

// Original practice // $ lig = isset ($ _ GET ['lig'])? $ _ GET ['lig']: 'Bee '; $ lig = $ _ GET ['lig']? 'Bee '; echo $ lig;

Run the following command:

Spacecraft operator (composite operator)

The essence is the size comparison character, but the return value of '<', '>' is greater than-1, which is similar to the compareto () function of Java strings.

 1.1; print (PHP_EOL); // line feed echo"
"; Print (1.1 <=> 1); echo"
"; Echo 1 <=> '1 ';

Run the following command:

I hope this article will help you with PHP programming.

For more information about how to add an operator usage instance in PHP7, see PHP Chinese network!

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.