PHP: Back tick `

Back tick ` in PHP is used to read the output from another program, usually external commands in Linux shell, much like the way a pipe does the job with bash.

In PHP, Backtick “ embraced string is treated a command and executed externally in shell, returning the execution results from the standard output. For example,

$files = `ls -l`

And $files now contain the files and directory listing by the bash command ‘ls -l’.

1 thought on “PHP: Back tick `”

Comments are closed.

Scroll to Top