This is a discussion on heredoc and $_SERVER vars within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi, Why can't you insert $_SERVER vars with in a heredoc block? Ex: $str = <<<heredoc $_SERVER['...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
Why can't you insert $_SERVER vars with in a heredoc block? Ex: $str = <<<heredoc $_SERVER['PATH_TRANSLATED']; heredoc; Gives me this error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in *** on line 22 - What is the logic behind this error? S -- |
|
|||
|
You can but it would be more like this
$str = <<<HEREDOC {$_SERVER['PATH_TRANSLATED']} HEREDOC; Hope this helps. Stef wrote: > Hi, > > Why can't you insert $_SERVER vars with in a heredoc block? > > Ex: > > $str = <<<heredoc > > $_SERVER['PATH_TRANSLATED']; > > heredoc; > > Gives me this error: > > Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting > T_STRING or T_VARIABLE or T_NUM_STRING in *** on line 22 > > - > > What is the logic behind this error? > > S > |