in PHP4 there is no public,private,etc. So I am wondering if there is some sort of work-around so that I can make a class’s property private and only accessible via getter/setter
Thanks!!
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.
You could approach this with a distinct syntax that clearly discourages the usage of such properties. You could borrow the python syntax of starting the method name with an underscore to define it as private.
This doesn’t block anyone from using it, of course, but its usage will be discouraged.