• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need Help with parse error in PHP

 
Phani Kumar Venkata
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hello Guys,

I am a newbie for PHP. I have just started today. I wrote a small hello world script but I could not execute it. I got a parser error when i try to run the script. Please see the code below:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”>
<head>
<title>Hello</title>
<link rel=”stylesheet” type=”text/css” href=”common.css” />
</head>
<body>
<h1><?php echo “Hello, world! ”; ?></h1>
</body>
</html>

I got an error like "( ! ) Parse error: syntax error, unexpected '!', expecting ',' or ';' in C:\wamp\www\hello_pretty.php on line 12".

Can anyone help me?
 
Nick Charles
Ranch Hand
Posts: 71
Linux PHP Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you paste this code directly from your editor? If you did, notice that your quote marks are slanted; that's because they are not plain quotes (ASCII 0x22) but rather the enhanced quotes used by a word processor. What editor did you use to create this file? (What OS are you running on?)

Try replacing all of the slanted quotes with standard quotes using a plain text editor.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic