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 ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.