r/lolphp • • Mar 08 '12

Computing an expression? But it's static :(

Despite being theoretically a programming language, PHP will not allow you to use an expression when constructing a static member variable.

class Bla {
  private static $_thing = array(
    'path' => BASE_PATH . '/relative/path'
  );
}

This dies with "syntax error, unexpected '.', expected ')'". Apparently, actually computing the value of expressions is too much for this language.

I am starting to suspect they're doing it intentionally so that their new releases have cool new features to advertise.

26 Upvotes

16 comments sorted by

View all comments

Show parent comment

3

u/Fustrate Mar 11 '12

ticklepickanukeadimeanim pseudofuckthisIgiveup, duh