Possible Duplicate:
declare property as object?
Why is this invalid in php
public $var1 = 'hello ' . 'world';
I know you have to assign the string to the property within a method but I was just wondering why this is the case ?
Possible Duplicate:
declare property as object?
Why is this invalid in php
public $var1 = 'hello ' . 'world';
I know you have to assign the string to the property within a method but I was just wondering why this is the case ?
Due to PHP Docs:
Properties are defined by using one of the keywords public, protected, or private, followed by a normal variable declaration. 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.