请向我解释设置静态变量时出现此错误的性质

What I wanted to do is to set static $variable to 'new value'. This is my code:

class myobj {

    static protected $variable = null;

    static function test() {
        static::variable = 'new value'
    }
}

$obj = new myobj();
$obj->test();

But an error shows up:

Parse error: syntax error, unexpected '=' in D:\!TC\www\error.php on line 8

Use:

self::$variable = 'new value';

instead of:

static::variable = 'new value'

BTW I strongly encourage you to use an IDE able to directly tell you basic syntax errors, like Aptana Studio or PHPStorm.

You're missing the dollar sign and a colon, and should use self to reference the data member $variable:

self::$variable = 'new value';

you need to use self:

class myobj {
  static protected $variable = null;
  static function test() {
    self::$variable = 'new value';
  }
}