Re: PHP code will not work
| From: | PJ | Date: | Fri, 13 Jun 2008 17:51:51 +0000 |
| Subject: | Re: PHP code will not work | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-275350@lists.php.net to get a copy of this message | ||
Joseph Subida wrote:
Daniel Brown wrote:I had a similar problem and this was suggested and it worked for me: Try to put the global $_SERVER['HTTP_USER_AGENT'] into {}brackets: echo '{$_SERVER['HTTP_USER_AGENT']}'; I'm not sure about the single quotes in your situation... I'm new at this too :)On Wed, Jun 11, 2008 at 11:51 PM, Joseph Subida <jcspam0017@gmail.com> wrote:105: <?php 106: echo $_SERVER['HTTP_USER_AGENT']; 107: ?> All the code before line 105 is code that I've been messing around with. I tried testing those three lines in its own file. But I still get the same error: Parse error: syntax error, unexpected T_VARIABLE in /Library/WebServer/Documents/error.php on line 2Hi. I am new to PHP. I found a tutorial that said to copy and paste the code into a .php document and open it in my browser: <?php echo $_SERVER['HTTP_USER_AGENT']; ?> I'm pretty sure PHP is enabled on my computer. I've tested code such as:PHP is definitely on your system.[snip!]The error I get when I try <?php echo $_SERVER['HTTP_USER_AGENT']; ?> is Parse error: syntax error, unexpected T_VARIABLE in /Library/WebServer/Documents/test.php on line 106What is the code on lines 105 and 106 of test.php? If there'snothing on line 105, please send us the immediately-preceding code.By the way, a T_VARIABLE is just a variable --- anything beginningwith a $dollar_sign.