Coding Critique is the place to post source code for peer review by other members of DevNetwork. Any kind of code can be posted. Code posted does not have to be limited to PHP. All members are invited to contribute constructive criticism with the goal of improving the code. Posted code should include some background information about it and what areas you specifically would like help with.
Popular code excerpts may be moved to "Code Snippets" by the moderators.
Wow - I wrote this exact thing as a (bizarre) function just the other day... except yours is much cleaner. I don't know what I was on. Oh right, Tylenol 3's. Thank god for subversion
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
pickle wrote:If the call to $this->end() is removed, then $this->end isn't set. While I don't currently use that variable, it might be useful for someone.
A simple start/stop class could certainly be simpler - but this is more versatile.
It seems a little backwards including $this->end() inside of the method.
They would not get a valid elapsed time. I believe that the elapsed should do exactly that. Return the time elapsed between construct (start) or resetStart(), and end() method calls.
Why magically include end() in the elapsed method?
Coule be a matter of preference, and I am certainly in no position to question your preference
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.