Parse Error Syntax Error Unexpected T_string Expecting T_function Define
Contents |
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
Syntax Error, Unexpected 'define' (t_string)
the company Business Learn more about hiring developers or posting ads with us Stack Overflow php expecting function (t_function) Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of php parse error: syntax error, unexpected 'define' (t_string) 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up PHP Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION up vote 1 down vote favorite I get this
Parse Error: Syntax Error, Unexpected ';', Expecting Function (t_function)
error in my PHP code: PHP Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in C:\Inetpub\wwwroot\webroot\www.novotempo.org.br\lib\Twitter.php on line 54 The line in question: define('DEBUG',false); Searching the net I found that this usually occurs when you´re using PHP 4.xx, but I´m using 5.2.6 (Just checked it using phpinfo()). I tried locally, and in two other external hosts, but it keeps returning the same message. Why does this happen? How can I fix it? php
Parse Error: Syntax Error, Unexpected 'echo' (t_echo)
parsing share|improve this question edited Jan 28 at 14:01 legoscia 24.4k94982 asked Aug 17 '09 at 16:03 Douglas Santos Pinto The true problem is probably one one of the lines before it –Greg Aug 17 '09 at 16:05 Can you post more of the code (a few lines above and a few beneath)? –Mike Dinescu Aug 17 '09 at 16:06 Inside a class method, I got this error when I commented an if statement but forgot to comment the closing brace. That put my next line outside of the function definition. It was a call to a static class function, which PHP saw as an unexpected string literal, I suppose. –Buttle Butkus Jan 10 '14 at 1:22 add a comment| 2 Answers 2 active oldest votes up vote 11 down vote If you are trying to DEFINE something inside of a class but outside of a function, you are going to get this error. (Normally the only place PHP will be looking for a function and not expecting a string is in a class, outside of a method) IE: Your code should not look like this: class myClass { define("DEBUG", true); function myFunc() { } } share|improve this answer edited Aug 17 '09 at 16:18 answered Aug 17 '09
T_OLD_FUNCTION or T_FUNCTIO If this is your first visit, be sure to check out the parse error syntax error unexpected ' ' in php FAQ by clicking the link above. You may have to
Php Define
register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 5 of 5 Thread: [RESOLVED] Parse error: syntax error, http://stackoverflow.com/questions/1288837/php-parse-error-syntax-error-unexpected-t-string-expecting-t-function unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTIO Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 06-08-2009,03:25 AM #1 aarchaic View Profile View Forum Posts Member Join Date May 2009 Location Pretoria, http://board.phpbuilder.com/showthread.php?10366062-RESOLVED-Parse-error-syntax-error-unexpected-T_STRING-expecting-T_OLD_FUNCTION-or-T_FUNCTIO South Africa Posts 44 [RESOLVED] Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTIO Hello guys. I see there is a few threads on this subject but i have this problem the code looks ok to me but i'm not really up to scratch with functions or classes. this is the error... Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/site/public_html/pfp/magazine/db.php on line 6 here is the code. config.php PHP Code: firstname = $firstname; $this->lastname = $lastname; $this->age = $age; public syntax error, unexpected function $greet() { return "Hello, my name is " . $this->firstname . " " . $this->lastname . '. nice to meet you! :-)"; } } $teacher = new Person ("boring", "12345"' 12345); $student = new Person ("Bob", "Fleming", 77); echo greet($teacher); echo greet($student); echo $student->age; ?>
//ADMINSETTINGS//
define("ADMIN_PASSWORD","PASS");//AdminPassword
define("WEBSITE_NAME","FlashPageFlip");//YourWebsiteName
//MySQLSETTINGS//
define("HOST","localhost");//databasehost
define(https://www.codecademy.com/en/forum_questions/52bb7913548c35e324005ed6 following parsing error: Parse error: syntax error, unexpected TSTRING, expecting TVARIABLE on line 16 This is line 16: public function_construct($firstname, $lastname, $age) { I can't find anything wrong. I know what strings and variables http://coursesweb.net/php-mysql/common-php-errors-solution_t are, but what does the prefix "T" indicate in the error message? Despite the message, the m\code passes to go on to the next exercise, but there is no output. I am using the code syntax error from 1/10 as a guide, along with instructions and hints, and everything in my code looks right! $frustration = "unresolved errors!"; My complete code follows:
not connect to SMTP host, mysql_num_rows() expects parameter 1 to be resource, unexpected T_STRING, unexpected T_ECHO, session had already been started, unexpected T_VARIABLE expecting '.' or ';', Use of undefined constant, Call to undefined function, headers already sent, Undefined variable, Undefined index /Undefined offset, unexpected T_IF, unexpected T_FOR, unexpected ')', Illegal offset type, unexpected '=' expecting ')', unexpected ... T_CONSTANT_ENCAPSED_STRING expecting ..., unexpected T_BOOLEAN_AND, unexpected '$variable' (T_VARIABLE) expecting function (T_FUNCTION), unexpected 'some_string' (T_STRING) expecting function (T_FUNCTION), unexpected '$var_name' (T_VARIABLE), unexpected '->' (T_OBJECT_OPERATOR), Missing argument ... for function_name(), zip_read() expects parameter 1 to be resource, syntax error unexpected 'unset' (T_UNSET) in ..., preg_match(): Compilation failed: nothing to repeat at offset, Cannot redeclare class, Call to undefined function curl_init(), Expects parameter 1 to be string; array given in, Expects parameter 1 to be array; string given in, domdocument.loadhtml Unexpected end tag, simplexml_load_string() / loadXML() Input is not proper UTF-8 indicate encoding, session_start() The session id is too long or contains illegal characters, preg_replace / preg_match Unknown modifier, Invalid argument supplied for foreach(), Call to undefined method stdClass, Call to a member function bind_param() on boolean, Class finfo not found - First, to be sure that PHP displays all errors and warning messages, add this code at the beginning of the PHP script. ini_set('display_errors',1);error_reporting(E_ALL); • Parse error: syntax error, unexpected '/' in ... Cause: - Posible forgot a slash "/" in the comment line.