Home > Backend Development > PHP Tutorial > PHP execution operator

PHP execution operator

WBOY
Release: 2023-09-18 10:18:01
forward
968 people have browsed it

PHP execution operator

Introduction

defines an execution operator in PHP. Strings enclosed in backticks (``) are treated as DOS commands (shell commands in UNIX/Linux) and their output is returned. The operation of this operator is similar to the shell_exec() function in PHP.

The following code executes the DIR command and returns the result as a string.

Example

<?php
$list=`dir *.php`;
echo "$list";
?>
Copy after login

Output

The following results will be displayed

Volume in drive C is Windows 10
Volume Serial Number is 540D-CE99
Directory of C:\xampp\php
01/27/2016 05:32 PM 18,869 CompatInfo.php
07/08/2020 06:40 PM 64 test.php
07/11/2020 02:13 PM 48 testscript.php
03/30/2013 05:59 PM 1,447 webdriver-test-example.php
4 File(s) 20,428 bytes
0 Dir(s) 178,002,157,568 bytes free
Copy after login

This is another example of the backtick operator. It executes the type command

Example

<?php
$list=&#39;type testscript.php&#39;;
echo "$list";
?>
Copy after login

Output

will show the following results

type testscript.php
Copy after login

The above is the detailed content of PHP execution operator. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:tutorialspoint.com
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