php class static variables ,concat -


is have 2 class

first

<?php    require_once( 'error/disconnectedhandler.php' );   require_once( 'error/nosuchrequesthandler.php' );     class networkmanager {    public static final $response_jump = 1000;   .... 

second

<?php     require_once( '../networkmanager.php' );      class disconnectedhandler implements handler{         public static $type          = 2000;         public static $response_type = self::$type + networkmanager::$response_jump;         public static $ver           = 0; 

i error in line

public static $response_type = self::$type + networkmanager::$response_jump; 

eclipse ide paint $type in red , says

multiple annotations found @ line: - syntax error, unexpected '$type', expecting   'identifier' - syntax error, unexpected '$type', expecting   'identifier' 

what correct syntax ?

thank in advanced

static variable declarations (as class constants) must literally defined , cannot contain expression evaluated prior runtime.

you have initialize disconnectedhandler::$respone_type in constructor or more in static initializer method.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -