PHP troubleshooting unexpected T_PUBLIC error

Posted by jasondavis on Stack Overflow See other posts from Stack Overflow or by jasondavis
Published on 2010-01-22T01:49:11Z Indexed on 2011/01/11 7:53 UTC
Read the original article Hit count: 167

Filed under:
|

PHP is driving me insane right now, please help me, I must be missing something. In this VERY BASIC example below 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...

<?PHP
class Session{

 private static $instance;

 function __construct() {
 {
  session_start();
  echo 'Session object created<BR><BR>';
 }

 public static function getInstance(){
  if (!self::$instance) {
   self::$instance = new Session();
  }
  return self::$instance;
 }
}

© Stack Overflow or respective owner

Related posts about php

Related posts about error