1

static $PATH_TO_USER = $server . '/users';

I'm getting a syntax error. If I remove the static, it accepts it, though.

It's not a big deal to type the whole thing out, but I'm not sure why this isn't working in the first place

2
  • 1
    Is this declaration included inside a class definition ? or is $server a global ? Commented Jun 29, 2011 at 16:52
  • The first answer to this question answers everything what you need to know about the problem. Commented Jun 29, 2011 at 17:16

1 Answer 1

4

Static variable

Static variables may be declared as seen in the examples above. Trying to assign values to these variables which are the result of expressions will cause a parse error.

via the PHP Manual.

Static property

Like any other PHP static variable, static properties may only be initialized using a literal or constant; expressions are not allowed.

via the PHP Manual.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.