Parse Error Syntax Error Unexpected T_var Expecting T_variable In
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss unexpected var php the workings and policies of this site About Us Learn more php unexpected t_variable about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack
Php Syntax Error Unexpected
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
Syntax Error, Unexpected T_variable
each other. Join them; it only takes a minute: Sign up PHP Unexpected 'var' (T_VARIABLE) up vote 0 down vote favorite For whatever reason, I have a small bit of PHP code that no matter where I put var $blah;, it always gives this error in the logs: PHP Parse error: syntax error, unexpected 'var' (T_VAR) in /path/to/file.php on line xx I have no idea why it parse error: syntax error, unexpected '=' in wouldn't accept this. A class that is included (which creates the $proverbSite variable in another php section) uses plenty of 'var $blah', with no problems. I also realise this is probably just an embarassingly simple mistake. dbConnect(); $result = $proverbSite->dbQuery("randProverb"); if($result != null) { $row = $result->fetch_assoc(); echo $row['proverb']; echo "
"; } ?> php share|improve this question asked Jul 30 '13 at 0:44 ZephireNZ 4815 3 What's on line xx? –Barmar Jul 30 '13 at 0:46 3 And which is line xx ? –mario Jul 30 '13 at 0:46 1 Usually errors like this are due to unbalanced quotes, or a missing ; somewhere. –Barmar Jul 30 '13 at 0:47 1 Or it's due to using var $x=1; outside of a class declaration. –mario Jul 30 '13 at 0:47 1 possible duplicate of T_VAR Error with PHP –Barmar Jul 30 '13 at 0:50 | show 4 more comments 3 Answers 3 active oldest votes up vote 2 down vote accepted Keyword var is only use
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
Parse Error: Syntax Error, Unexpected (t_variable)
Overflow the company Business Learn more about hiring developers or posting ads with us php variable 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 up vote 1 down vote favorite what is this error ? Parse http://stackoverflow.com/questions/17936577/php-unexpected-var-t-variable error: syntax error, unexpected T_VAR in D:\xampp\htdocs\mehdi\application\libraries\phpass-0.1\PasswordHash.php on line 32 code: $iteration_count_log2 = $params['phpass_hash_strength']; $portable_hashes = $params['phpass_hash_portable']; var $itoa64; //line 32 var $iteration_count_log2; var $portable_hashes; var $random_state; php codeigniter error-handling share|improve this question asked Aug 2 '11 at 20:08 Kimberly Mullins 28227 Why, it's a syntax error, of course. –Jon Martin Aug 2 '11 at 20:10 add a comment| 2 Answers 2 active oldest votes up vote 4 down http://stackoverflow.com/questions/6917959/parse-error-syntax-error vote You must not use var to declare a variable : just assign a value to it, when you need it : $your_variable = 5647; And if you really want your variables listed beforehand, just assign something that would mean no-value to them, like, for instance, null : $your_variable = null; Just so you know : var was used, in PHP 4 (and, as such, is still valid in PHP 5, for that same usage) to declare classes properties. share|improve this answer answered Aug 2 '11 at 20:11 Pascal MARTIN 271k42502565 Help me understand PHP: Why is var used in some examples that I see? Is it for global variables? –jp2code Nov 15 '13 at 19:01 add a comment| up vote 1 down vote Remove 'var' from each of your variables. share|improve this answer answered Aug 2 '11 at 20:11 Jaime 872410 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged php codeignite
Detected You currently have javascript disabled. Several functions may not work. Please re-enable javascript to access full functionality. unexpected (T_VAR), expecting variable (T_VARIABLE) Started by cybernet, Mar 11 2014 08:08 AM https://forums.phpfreaks.com/topic/286872-unexpected-t-var-expecting-variable-t-variable/ php class var variable Please log in to reply 2 replies to this topic #1 cybernet cybernet Advanced Member Members 88 posts Location/usr/sbin/mysqld Age:69 Posted 11 March 2014 - 08:08 AM so i found a pdo class to connect to mysql with pdo and looks easy to customize however i have an error that i can't figure it out class 'mysql:dbname=vax', 'username' => 'vax', 'password' => 'veryrandpasswd', ); public static getDbHandle(){ if(self::$_dbHandle == null){ self::$_dbHandle = new PDO( self::$_dbConfig['dsn'] , self::$_dbConfig['username'], self::$_dbConfig['password'] ); } return self::$_dbHandle; } } class StockMapper { protected $_dbh; public __construct($dbh = null) { if($dbh == null){ $this->_dbh = ApplicationResourcePool::getDbHandle(); } else { $this->_dbh = $dbh; } } public getStockById($stockId){ $sth=$this->_dbh->prepare("SELECT * from stock WHERE id = :stockId"); $sth->bindParam(":stockId", syntax error, unexpected $stockId); $sth->execute(); $result = $sth->fetch(PDO::FETCH_ASSOC); return $result[0]; } } $stockMapper = new StockMapper(); $stockData = $stockMapper->getStockById('302'); ?> Parse error: syntax error, unexpected 'var' (T_VAR), expecting variable (T_VARIABLE) in /path/index.php on line 5 i really don't know what to do /usr/sbin/mysqld Back to top #2 jairathnem jairathnem Advanced Member Members 96 posts Posted 11 March 2014 - 08:58 AM static variable. doesn't make sense, does it? cybernet likes this Back to top #3 cybernet cybernet Advanced Member Members 88 posts Location/usr/sbin/mysqld Age:69 Posted 11 March 2014 - 08:59 AM please stop mocking me i presume it should be "private" instead of "static" ... right ? Edited by cybernet, 11 March 2014 - 09:07 AM. /usr/sbin/mysqld Back to top Back to PHP Coding Help · Next Unread Topic → 0 user(s) are reading this topic 0 members, 0 guests, 0 anonymous users Reply to quoted postsClear PHP Freaks → PHP Coding → PHP Coding Help Privacy Policy Forum Rules & Terms of Service · Change Theme IP.Board Mobile PHP Freaks PHP Freaks - English (USA) English (USA) PHP Freaks - English (USA) Mark Community Read Forums Members Pages Mark all as read Help Community Forum Software by IP.BoardLicensed to: PHP Freaks Sign In Use Facebook Use Twitter Need an a