Re: PHP code will not work
| From: | Nathan Nobbe | Date: | Thu, 12 Jun 2008 23:19:35 +0000 |
| Subject: | Re: PHP code will not work | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-275296@lists.php.net to get a copy of this message | ||
On Wed, Jun 11, 2008 at 9:51 PM, Joseph Subida <jcspam0017@gmail.com> wrote:
> Hi.
>
> 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
> //Function arguments
> function writeMyName2($fname)
> {
> echo $fname . " Refsnes.<br />";
> }
> echo "My name is ";
> writeMyName2("Kai Jim");
> echo "My name is ";
> writeMyName2("Hege");
> echo "My name is ";
> writeMyName2("Stale");
> ?>
>
> which works fine.
>
> 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 106
>
> I tried Googling "T_VARIABLE" and haven't found any useful solutions. Any
> ideas? Thanks!
im guessing
<?php
echo $_SERVER['HTTP_USER_AGENT'];
?>
isnt the complete file thats giving you troubles, because theres only one
line in it. whichever file is giving you troubles has a syntax error on
line 106.
-nathan