Two unknown PHP operators

醉折花枝作酒筹
Release: 2023-03-09 06:56:01
Original
2203 people have browsed it

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;
Copy after login

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
Copy after login

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;
?>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!