Parse Error Syntax Error Unexpected T_constant_encapsed_string Expecting T_function
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and syntax error, unexpected (t_string), expecting function (t_function) policies of this site About Us Learn more about Stack Overflow the php expecting function (t_function) company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags
Php Parse Error: Syntax Error, Unexpected 'define' (t_string)
Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only
Parse Error: Syntax Error, Unexpected ';', Expecting Function (t_function)
takes a minute: Sign up php Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION on construct up vote 1 down vote favorite hey guys was hoping you could help me out.. just to let u know in advance, im a relatively new php coder, doing a practice project, and came across this problem and ive spent like an hour of rechecking parse error: syntax error, unexpected 'echo' (t_echo) and googling but just cant figure out whats causing it error: Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in C:\wamp\www\forum\classes\ClassUser.php on line 7 the segment of the code causing the problem: include $_SERVER["DOCUMENT_ROOT"]."forum/classes/general.inc"; Class User{ __construct($u,$p){ //this is line 7 $user=$u; if(strlen($p)>30|| empty($p) || !preg_match('/[^a-zA-Z0-9]/i',$p)){ $password=0; } else{ $password=hash_hmac('md5',$p,KEY); } } oh and since im new to php, incase im doing something which i should not be, please to recommend.. thanks in advance. note:ive removed the php tags since they seemed to be messing with the formatting of this post :/ note2: im also getting another notice Notice: Use of undefined constant KEY - assumed 'KEY' in C:\wamp\www\forum\classes\general.inc on line 20 but im assuming thats more of a warning than an error... but just adding incase it has something to do with the error general.inc: //error definations define("ERROR_FIELD_EMPTY","Error! All required fields not filled"); define("ERROR_INVALID_SIGNIN","Error! Username/password do not match!"); define("ERROR_GENERAL_INPUT", "Error! Invalid input given"); define("ERROR_SQL_CONNECT","Error! Could not connect to sql database"); //field sizes define("PASSWORD_LENGTH",12); define("USERNAME_LENGTH",30); //sql server details define("SQL_SERVER_NAME","localhost"); define("SQL_SERVER_USERNAME","root"); define("SQL_SERVER_PASSWORD",""); define("SQL_SERVER_DATABASE","forums"); define(KEY,"key"); function __autoload($className){ require_once($_SERVER["DOCUMENT_ROOT"]."forum/classes/Class$className.php"); } ClassUser.php include $_SERVER["DOCUMENT_ROOT"]."forum/classes/general.inc"
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business
Php Define
Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Parse error: syntax error, unexpected 'numberToTest' (T_STRING), expecting function (T_FUNCTION) [closed] up vote -1 down vote favorite I am trying to make a http://stackoverflow.com/questions/10872097/php-parse-error-syntax-error-unexpected-t-string-expecting-t-function-on-cons for loop that will give me the integers 1 to 1000. i have gotten this error message and cant find out what i did wrong. i looked threw people who got the same message but could not find a helpful answer that fit my need. the full error message was Parse error: syntax error, unexpected 'numberToTest' (T_STRING), expecting function (T_FUNCTION) in C:\xampp\htdocs\prime2\primeNumberFinder.php on line 15 here is the code: http://stackoverflow.com/questions/29042129/parse-error-syntax-error-unexpected-numbertotest-t-string-expecting-funct $i<1000; ++$i){ echo "$i
"; } } numberToTest(); } ?> thanks! php share|improve this question asked Mar 13 '15 at 21:19 sam tam 61 closed as off-topic by Bulk, Paul Crovella, axiac, andrewsi, Shankar Damodaran Mar 14 '15 at 1:14 This question appears to be off-topic. The users who voted to close gave this specific reason:"This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Bulk, Paul Crovella, axiac, andrewsi, Shankar DamodaranIf this question can be reworded to fit the rules in the help center, please edit the question. 3 Missing } to close the class definition; spurious } after the function call; and treating a class method as a normal global function –Mark Baker Mar 13 '15 at 21:20 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote accepted You need to close the class with a } before trying to call its methods You also need to call the class method correctly, as a method of an instantiated class
Templates » How can I fix that syntax error, unexpected T_STRING, expecting T_FUNCTION? How can I fix that syntax error, unexpected T_STRING, expecting https://wordpress.org/support/topic/how-can-i-fix-that-syntax-error-unexpected-t_string-expecting-t_function/ T_FUNCTION? icemanblabla00 @icemanblabla00 6 months ago I use wordpress theme and I added some codes in functions.php . Here there: https://gist.github.com/tomhemsley/4d19646f57a0a1f20709 Then, I saw that: Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /home/elmacocu/public_html/wp-content/themes/hueman/functions.php on line 58 FULL CODE HERE: transient_name ) ) { $datas = get_transient( $this->transient_name ); if ( $datas[‘tried'] >= $this->failed_login_lim