Home  >  Article  >  Backend Development  >  Two unknown PHP operators

Two unknown PHP operators

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-03-26 11:06:252174browse

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.

Two unknown PHP operators

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 &#39;<br />&#39;;
echo $a;
?>

magnifyThere 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to close tag in phpNext article:How to close tag in php