Php Parse Error Syntax Error Unexpected T_public Expecting T_paamayim_nekudotayim
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 parse error: syntax error, unexpected 'protected' (t_protected) About Us Learn more about Stack Overflow the company Business Learn more about
Parse Error Syntax Error Unexpected T_paamayim_nekudotayim Wordpress
hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join syntax error unexpected 'public' (t_public) laravel 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 What does this mean? parse error syntax error unexpected t_public in codeigniter “Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM” up vote 48 down vote favorite 8 T_PAAMAYIM_NEKUDOTAYIM sounds really exotic, but most certainly absolutely nonsense to me. I traced it all down to this lines of code: config; return $cnf::getConfig($key); } function __construct() { $this->config = new Config(); } } ?> In
Message: Syntax Error, Unexpected 'public' (t_public)
the constructor I create a Config object. Here's the class: final class Config { private static $instance = NULL; private static $config; public static function getConfig($key) { return self::$config[$key]; } public static function getInstance() { if (!self::$instance) { self::$instance = new Config(); } return self::$instance; } private function __construct() { // include configuration file include __ROOT_INCLUDE_PATH . '/sys/config/config.php'; // defines a $config array $this->config = $config; } } No idea why this doesnt work / what the error means... php share|improve this question asked Dec 27 '09 at 14:02 openfrog 14.4k38169305 possible duplicate of PHP expects T_PAAMAYIM_NEKUDOTAYIM? –John Slegers Jul 4 '15 at 14:32 add a comment| 7 Answers 7 active oldest votes up vote 57 down vote accepted T_PAAMAYIM_NEKUDOTAYIM is the double colon scope resolution thingy PHP uses - :: Quick glance at your code, I think this line: return $cnf::getConfig($key); should be return $cnf->getConfig($key); The first is the way to call a method statically - this code would be valid if $cnf contained a string that was also a valid class. The -> syntax is for calling a method on an instance of a class/object. share|improve this answer edited Dec
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 parse error: syntax error, unexpected 'public' (t_public) About Us Learn more about Stack Overflow the company Business Learn more about what is t_paamayim_nekudotayim hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss
[symfony\component\debug\exception\fatalerrorexception] Syntax Error, Unexpected 'public' (t_public)
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 Troubleshooting unexpected T_PUBLIC error http://stackoverflow.com/questions/1966010/what-does-this-mean-parse-error-syntax-error-unexpected-t-paamayim-nekudotay [closed] up vote 3 down vote favorite I get this error... Parse error:syntax error, unexpected T_PUBLIC in C:\filename here on line 12 On this line.... public static function getInstance(){ The code...
'; } public static function getInstance(){ if (!self::$instance) { self::$instance = new Session(); } return self::$instance; } } php share|improve http://stackoverflow.com/questions/2114439/troubleshooting-unexpected-t-public-error this question edited Jan 26 '12 at 22:11 user212218 asked Jan 22 '10 at 1:49 JasonDavis 17.4k67216396 closed as too localized by cryptic ツ, NullPoiиteя, Lusitanian, rdlowrey, Rikesh Mar 21 '13 at 5:05 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question. When you have a syntax error, double check all control characters like {, }, ; etc. –alex Jan 22 '10 at 2:08 I had this error and it was because I tried declaring a public function outside of a class. When I saw the code snippets in this question, it helped me realize this. The question was closed, but the ultimate answer to this question is that a member cannot be declared public unless it is directly in a class. In the case of this question, th
here for a quick overview of the site Help Center Detailed answers to any questions you might http://stackoverflow.com/questions/20275629/parse-error-syntax-error-unexpected-t-paamayim-nekudotayim-expecting-t-variab have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business 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, syntax error just like you, helping each other. Join them; it only takes a minute: Sign up Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting T_VARIABLE [duplicate] up vote 0 down vote favorite This question already has an answer here: PHP expects T_PAAMAYIM_NEKUDOTAYIM? 7 answers Why is my website generating this error: Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, syntax error unexpected expecting T_VARIABLE This is the code being executed: public function __construct($name, $path = false, $options = false) { if ($path !== false) { static::configure('cache_directory'); } if ($options == true) { $name .= '-'.$_SERVER['REMOTE_ADDR']; } $this->file_path = static::configure('cache_directory') .'/'. $name . '.idx.php'; } php syntax-error share|improve this question edited Apr 9 '15 at 13:28 Kev 83k36227317 asked Nov 28 '13 at 22:29 user3047472 11 marked as duplicate by andrewsi, Shaiful Islam, karthik, greg-449, EdChum Jul 5 '15 at 8:18 This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. add a comment| 1 Answer 1 active oldest votes up vote 4 down vote That's hebrew for "double colon". static::configure is likely what's causing problems. static is a PHP keyword - I doubt you can use it as a class name. If you're trying to use late static bindings, make sure you've got PHP 5.3 or higher... share|improve this answer answered Nov