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!