Have an account? Sign in
Login  Register  Facebook
This Page is Under Construction! - If You Want To Help Please Send your CV - Advanced Web Core (BETA)
Quick Table of Contents
[Edit] Parse Error: syntax error, unexpected $end
When you see the unexpected $end syntax error it is telling you that you left something open that should have closed(usually improper curly bracket or quote nesting).
This error is many times difficult to pinpoint in your script because the error line that is returned is not going to be the line where the nest opens. The error line is usually where the program ends. Functions, loops, condition statements, as well as other mechanisms use curly brackets to open and close those mechanisms ( { } ). Strings will use quote marks for encapsulation and nesting.
This error will also render when you use short opening PHP tags(<?) instead of the normal(<?php). To use short PHP tags you must configure your php.ini file to make them work.

How can i fix it

  • Be sure that all mechanisms that use a set of curly brackets ( { } ) to nest things, are properly nested. When each curly bracket in your script opens, it has to close also.
  • Be sure all of your strings are quoted correctly. For example:
  • $name = "Adam; // will render unexpected $end
    $name = "Adam'; // will render unexpected $end
    $name = "Adam"; // is correct quote mark nesting
  • Use normal full PHP opening tags(<?php) or else set your php.ini configuration file to use the short PHP opening tags(<?) using the following line in your php.ini file:
  • short_open_tag = On
[Edit] Unexpected T_LNUMBER, expecting T_STRING
This notice usually renders when you begin the name of a function with a number.

How can i fix it

Do not use a number as the first character in the name of function, object, or variable. This function name below will render the error.
function 2ndFunction() {
    echo "The number as first character in the name of the function will render this error.";
}
[Edit] Unexpected T_LNUMBER, expecting T_VARIABLE
This notice will render when you begin the name of a variable with a number.

How can i fix it

Do not use a number as the first character in the name of any variable, object, or function.
$2var = "Hello"; // Wrong
$var2 = "Hello"; // Right