FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Parse error: syntax error, unexpected T_VARIABLE
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Parse error: syntax error, unexpected T_VARIABLE [message #177328 is a reply to message #177321] Sat, 10 March 2012 21:21 Go to previous messageGo to previous message
Umberto Salsi is currently offline  Umberto Salsi
Messages: 2
Registered: August 2011
Karma:
Junior Member
Une BĂ©vue <unbewusstsein(at)fai(dot)invalid> wrote:

> at line :
> public static $JAR=$_SERVER['DOCUMENT_ROOT'] .
> '/AB2Html/Builder/saxon9he.jar';
>
> i got the error :
> Parse error: syntax error, unexpected T_VARIABLE

The expression giving the initial value of a proprty must be statically
evaluable and must result to be NULL, FALSE, TRUE, int numbers and simple
operations with int (+ - * / % << >>), float numbers and simple operations with
float (+ - * /), string and string concatenation, other named constants
statically evaluable, or array() with keys and values that are static
expressions as well. Functions and variables like $_SERVER are not allowed
because can be evaluated only at runtime. This same limitation of the PHP
interpreter holds also for: class constants; function default values.

The official manual (http://www.php.net/manual/en/language.oop5.properties.php)
only states:

"This declaration may include an initialization, but this initialization must
be a constant value--that is, it must be able to be evaluated at compile time
and must not depend on run-time information in order to be evaluated."

but now you know the full story.

Regards,
___
/_|_\ Umberto Salsi
\/_\/ www.icosaedro.it
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: combobox
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 01:27:47 GMT 2024

Total time taken to generate the page: 0.05089 seconds