Here is my php script:
<?php
$id = "";
$name = "";
$original = 0;
$new = 0;
$difference = 0;
$message = "";
$fin = fopen("inv.txt", "r");
printf(" SALES REPORT");
printf("\nITEM ID ITEM NAME SALES DIFF MESSAGE\n");
while(! feof($fin))
{
$info = explode(" ", $info);
$id = $info[0];
$name = $info[1];
$difference = strval((int)$new - (int)$original);
if ((int)$difference < 0)
{
$message = "You're Fired!";
elseif ((int)$difference > 0)
{
$message = "Bonus!";
else
{
$message = "Pick it up!";
}
printf($id + " " + $name + " " + $difference + " " + $message + "\n");
}
?>
Here is the content of inv.txt:
W111 widget 20 25
B222 Bob 34 30
T333 Thingy 10 10
S444 Something 45 44
The output I am trying to get from my php script is
SALES REPORT
ITEM ID ITEM NAME SALES DIFF MESSAGE
W111 widget -5 You're Fired!
B222 Bob 4 Bonus!
T333 Thingy 0 Pick it up!
S444 Something 1 Bonus!
But instead I get
Parse error: syntax error, unexpected token ")" in C:\Users\user\Documents\file.php on line 10
What did I do wrong and how do I fix it?