yoursurrogategod Posted January 10, 2013 Share Posted January 10, 2013 Is there any real difference between those two? I'm 80% inclined to say no, but I'm not 100% sure. Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted January 10, 2013 Share Posted January 10, 2013 The difference is that you are in control of the scope of the second decleration and not the first. You should always explicitly define the scope of your methods and variables rather than relying on the PHP systems defaults. If the default behaviour of PHP's scope definition changes in the future then the that will have an effect on anything you have not explicitly defined, and most likely break your classes. As far as I remember PHP only allows for the omision of the scope deffinition (public, private or protected) purely for a legacy compatability. No new code should be writen without the use of one of them. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.