note 96894 deleted from language.types.string by danbrown

From: Date: Tue, 17 May 2011 14:14:00 +0000
Subject: note 96894 deleted from language.types.string by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-179797@lists.php.net to get a copy of this message
Note Submitter: gt3 ---- If you try to embed backticks (AKA backquotes) inside of a heredoc, it won't treat the backticks as a shell command execution operator: <?php echo <<<_HTML_ <pre>ls -l</pre> _HTML_; ?> the above example will simply output the literal string 'ls -l' rather than running the command and outputting the results. To interpolate shell command data you first have to store the returned backtick'd info in variables, then place the variables inside the heredoc: <?php $cmd1 = ls -l; $cmd2 = shell_exec("netstat"); // same thing as backticks echo <<<_HTML_ <pre>$cmd1 <hr> $cmd2</pre> _HTML_; ?>

« previous php.notes (#179797) next »