解析错误:PHP中的语法错误[重复]

This question already has an answer here:

I try to store a string to a PHP variable. But it shows an error "Parse error: syntax error, unexpected '='" Here is the code

$page-title = "Home Page";
</div>

Do like this:

$page_title = "Home Page";

Replace $page-title = "Home Page";

with: $page_title = "Home Page";

The variable you used is wrong. PHP variables cant contain - signs.

Your variable name is incorrect.

A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ).

You can use it either $pageTitle or $page_title as your variable name fore more detail refer php manual

you have use - subtraction sign in declaring variable that's why it cause an error you can check here how to declare php variableshow to declare php variables

try this

$page_title = "Home Page";

</div>