hellorobot.org

Parse Error: syntax error, unexpected $end

“Parse Error: syntax error, unexpected $end” is one of those less-than-transparent error messages. What exactly does it mean?

Usually this error is trying to tell you that a curly brace was opened but never closed: an opening if (condition) { with no closing }; or, as another example, an foreach($var as $subVar): with no endforeach;.

It shouldn’t be too difficult to fix – and a good IDE would catch it before you even try to run the script – but it can be annoying to try to resolve when you’re learning PHP.

No Responses

Add your response

Respond to “Parse Error: syntax error, unexpected $end”