Home >Backend Development >PHP Problem >Two unknown PHP operators
Today I will teach you two special operators, one is the ternary operator, and the other is an operator that can execute system commands. Let’s take a look below.
Ternary operator ? :
Format:
表达式1 ? 表达式2 : 表达式3;
If the value of expression 1 is true, then execute expression 2, if the value of expression 1 is false, then Execute expression 3;
$a=true ? 14 : 43; echo $a;//14
In the above case, we know that the value of expression 1 is true, so we execute expression 2 and the result of the operation is 14.
Special operators` `<br>
This operator involves cross-platform operations and can put system commands into the PHP program in execution.
<?php $a=`magnify`; $b=`magnify`; var_dump($b); echo '<br />'; echo $a; ?>
magnify
There is a function to turn on the magnifying glass in the system command. When we execute this php file, we turn on the magnifying glass in the computer.
[Recommended learning: PHP video tutorial]
The above is the detailed content of Two unknown PHP operators. For more information, please follow other related articles on the PHP Chinese website!