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.
<?php $list=`dir *.php`; echo "$list"; ?>
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
This is another example of the backtick operator. It executes the type command
<?php $list='type testscript.php'; echo "$list"; ?>
will show the following results
type testscript.php
The above is the detailed content of PHP execution operator. For more information, please follow other related articles on the PHP Chinese website!