Click to See Complete Forum and Search --> : PHP Parse Error


pmusu
03-08-2008, 11:11 AM
Hi,

I am new to PHP.
I am getting the following error but I cannot understand what is wrong with the syntax.

Here is extract of code.

$priceRange = ($priceRangeMax - $priceRangeMin) / 3; // find price ranges for three tables
$priceRangeMin = sprintf("%01.2f", 0.00);
$priceRangeMax = $priceRangeMin; // needed for initial setup

The error I am getting is in this line
$priceRangeMin = sprintf("%01.2f", 0.00);

The error is:
parse error: (unexpected token 'id') -- (id . f)

Thanks in advance

NogDog
03-08-2008, 01:36 PM
I get no parse error with the code you posted. Perhaps the real error is earlier, but the parser does not know there is a problem until it gets to that line.

TecBrat
03-08-2008, 10:21 PM
I have found that most of the time when I get an error, PHP reports it on the next line. Probably because I missed a semicolon or whatever. Or even worse, if you forget a curly brace and it gives you the last line of the script and it's your best guess where to start debugging.

I did a quick google search for that particular error message and didn't find anything helpful.