In my previous question I found two solutions for accessing static members. I would like to know which one is the better way, and why.
In my previous question I found two solutions for accessing static members. I would
Share
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.
In my opinion, if your statis members are public, you should access it directly. Otherwise if it’s private or protected, you can access via a method. If you use Reflection to access a static member, the PHP interpreter need some unncessary steps to reflect all member of your object and the process is slower. Another reason to avoid using reflection is you can use code completiong of IDE for improving productivity.