Jump to content

Newbie: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'


Cristian

Recommended Posts

Hello everyone. I am new here and I just started learning PHP; I apologize in advance for how stupid this question will seem to most of you I'm sure. I'm following a video guide and typing what the instructor says (I've checked it like 10 times) but for some reason he isn't getting an error and I am.

 

I am just trying to do simple arithmetic.

<html>
<head>
	<title>Numbers - Christopher</title>
</head>
<body>
	<?php
		$var1 = 3;
		$var2 = 4;
	?>

	Basic Math: <?php echo ((1 + 2 + $var1) * $var2) / 2 – 5; ?><br />

</body>
</html>

 

The answer that comes up on his screen is 7. On mine, it says this:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\wamp\www\christopher\numbers.php on line 11. I'm sure there is something stupid that I am missing. Anyone care to help out the newbie :)?

Maybe that would be better

 


<html>
<head>
	<title>Numbers - Christopher</title>
</head>
<body>
	<?php
		$var1 = 3;
		$var2 = 4;
		$var3 = ((1 + 2 + $var1) * $var2) / 2 - 5;
	?>

	Basic Math: <?php echo $var3; ?><br />

</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.