Jump to content

Error with variables


Hellusius

Recommended Posts

I am trying to sum two variables, but it gives me the following error

[code]Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/www/warnicro.awardspace.com/stats.php on line 3[/code]

The php code is

[code]<?
echo "<font color=\"#EFDFA0\">Statistics<br />;
$count = file_get_contents("count.txt");
$count2 = file_get_contents("count2.txt");
echo "<font color=\"#EFDFA0\">Homepage views: ".trim($count);
echo "<font color=\"#EFDFA0\">Total page view: ".trim($count) + ($count2);
?>  [/code]

Anyone see what I am doing wrong?
Link to comment
https://forums.phpfreaks.com/topic/19458-error-with-variables/
Share on other sites

Use this:
[code=php:0]echo "<font color=\"#EFDFA0\">Statistics<br />";
$count = file_get_contents("count.txt");
$count2 = file_get_contents("count2.txt");

echo "<font color=\"#EFDFA0\">Homepage views: " . trim($count) . "</font><br />";
echo "<font color=\"#EFDFA0\">Total page view: " . (trim($count) + $count2);[/code]
Link to comment
https://forums.phpfreaks.com/topic/19458-error-with-variables/#findComment-84510
Share on other sites

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.