PHP: Back tick `

by Yang Yang on April 22, 2009

Share This Article:
Subscribe to Kavoir: blog feed

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’.

Share This Article:
Subscribe to Kavoir: blog feed

You should also read:

{ 1 comment… read it below or add one }

Yang Yang February 26, 2010 at 5:43 pm

PHP back tick is the operator to execute system commands.

Reply

Leave a Comment

Previous post:

Next post: