we all knew when you want to execute shell commands in php we have a list of functions like shell_exec, exec, popen, etc to execute the code
<?php echo shell_exec('ls'); ?>
but today i came to knew about the backtick operator which does the same
<?php echo `ls`; ?>
The backtick operator (``) in PHP is used to execute shell commands. It is similar to the shell_exec() function, but it allows you to use command substitution, which means that you can include the output of a command inside another command by enclosing the command that you want to execute in backticks.
In general, the backtick operator is most useful when you want to execute a shell command and capture the output of the command for further processing in your PHP script.
Reblogged this on Naveen Muthusamy.
ReplyDelete