Backtick Operator

I just learned something new today in PHP.  It’s the Backtick Operator.  What it does is executes a shell command and captures its output.  You can then store that in a variable for use.  I am pretty sure this is a UNIX command only.  Not sure if this will work in windows or not.  Here is how you use it.

< ?php
$a = `ls -l`;
echo $a;
?>

One thought on “Backtick Operator

  1. Yes it does work on windows. The only problem is when trying to use cmd.exe on server, there are permissions issues, which I have not figured out how to get around yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>