PHP code will not work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!

-J.C.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux