Monday, December 12, 2011

Err: unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in

Error:
              Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /var/www/captcha/captcha.php on line 80

Common Reasons & Solutions
:

              This error will occur for many reasons in PHP. Some of them are,

PHP5 Syntax incompatible with older versions of PHP like 4.x
              Some of the declaration methods used in latest versions of PHP doesn't works with older versions. This will occurs in the environment where the running version of PHP is older than the  development one. In that case, any on of the listed solution may work.

  • Remove the access specifiers like public, private and protected from in-front of the variable or function declarations. 
  • Put 'var' in-front of variable declaration instead of normal declarations
    • var $x = 10;  instead of $x = 10;

No comments:

Post a Comment