Suffering for hours Trying to fix it by no Hope

syntax error, unexpected $end in C:\???????\index.php on line 547

the lines form 511 to 547 are

<?
ContentBlockFoot();
?>
            </td>
        </tr>
    </table>

<?
BottomCode();

function error_handler($errno, $errstr, $errfile, $errline)
{

    switch ($errno)
    {
	case FATAL:
            echo "<b>FATAL</b> [$errno] $errstr<br>\n";
	    echo "  Fatal error in line ".$errline." of file ".$errfile;
	    echo ", PHP ".PHP_VERSION." (".PHP_OS.")<br>\n";
	    echo "Aborting...<br>\n";
	    exit(1);
	break;
	case ERROR:
	     echo "<b>ERROR</b> [$errno] $errstr<br>\n";
	break;
	case WARNING:
	//    echo "<b></b> [$errno] $errstr<br>\n";
	break;
	default:
	break;
    }

}


?>

Please help !!!

Recommended Answers

All 8 Replies

You are probably missing an ending quote (") somewhere in your code. A missed end brace "}", bracket "]", or parenthesis ")" can also cause
the unexpected $end in a script as well.

Wherever the bug is it isn't in that piece of code. But as the previous post states it usually means a missing curly bracket { or }.

Just another comment, which might not be a problem:

Have you tried using the full <?php tag instead of just the <? tag? Depending on your configuration, using short tags can cause funny stuff to happen.

If you copied your code and pasted it, this also causes this problem, what you can do is delete the <?php from your copied code and retype it manually. Hope this helps.

Member Avatar for rajarajan2017

The error showing that you are missing brace in your code. Post your full code to identify where it is missing or find by yourself in a editor.

line numbers in executing php scripts are not the same as line numbers in the source.
executing scripts that contain any include(); statements, the included file's line count is counted in the executing file
check line counts in includes and the missing brace will likely be that many lines before the indicated line

It works for me.

It works for me.

that was the point, untangling error messages, the OP couldnt find a fault in that region of code and wanted some input on where and how to find the fault

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.