![]() |
What do you find more comfortable?
Well I use my own framework for coding (it's time for a complete rewrite) and some of my friends use as well and I'd like the opinion of some fellow coder and what you find more comfortable using (it's also for programmers who work on my script after I deliver it to client)
methods like this PHP Code:
PHP Code:
|
I find the latter example more easier. :-)
|
in my experience, using a static method like in your first example is a lot easier and faster to type.
Usually I use static methods for carrying around instances of objects I will want. For example: PHP Code:
I also use them for a quick authentication check: PHP Code:
|
This is noobish but what does the :: do?
|
Quote:
PS a property is also a variable. thus either way Update: Gah, maybe I need to stay off the computer for 20 years. |
By the way, I got the OP confused, -_-.
Update: Well, my new opinion -_- Is that you should do If the class is in the php file PHP Code:
PHP Code:
Something is wrong with me today -_- |
Quote:
Quote:
Code:
class TestTlc: it's pretty simple. Do you need an instance of a class to authenticate a user, for example? Then don't use static methods. Static methods are made for defining behavior, not functionality. |
Quote:
|
I would suggest a bit different approach. What login should do? I suppose create a session/cookies, etc
So that's what I would prefer: PHP Code:
|
| All times are GMT. The time now is 09:29 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0