Entry
Parse error: parse error, unexpected $ (why?)
Aug 7th, 2006 08:26
Ted Kac, Josef Polách, Greg M., Brant Messenger,
Check that your braces " { " are all closed " } " properly.
This code (below) generates this error, and indicates a line number at
the end of the PHP source (line 2673 for me) the source is only about
2669 lines long.
<?php
if (strlen($HTTP_GET_VARS['color']) <= '') {
echo "Option A";
}else{
echo "Option B";
?>
The problem is that the else statement's bracket " { " isn't closed.
<?php
if (strlen($HTTP_GET_VARS['color']) <= '') {
echo "Option A";
}else{
echo "Option B";
} ?> <--------THIS LINE added " { "
So check that your braces are closed, and happy coding.
Greg.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I had the same problem. There was unclosed if():
Missing endif; caused this error message.
Josef
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Or..
#####################
# Nother solution #
#####################
If you don't find any braces open look for a block echo..
ie..
echo <<<HERE
HERE;
if you have blank space around the 'HERE' values you could get the
same error.
For example:
echo <<<HERE
HERE;
will probably give you the same error.
Kudos!
Tedkac
## end 'Nother solution' ##