Archzilon Eshun-Davies - 2014-03-03 23:47:42 - In reply to message 1 from Michael Richey
Well nice to know but these are components from a large project am just
sharing the pieces whenever i get time. interfaces are important on large
projects and are *much* better than any documentation because at a glance
I can tell every function in the class no need to search for example
code and what not. OOP is designed for one purpose if everyone hates C so
much why is it that you are all resisting the so called OOP methodology
that you used in killing C. I do cgi in C and php if *new* school developers
would be taking over from me. I find that if projects like
joomla and wordpress used proper OOP methodologies then they've had less trouble managing bugs. with proper OOP design adding features is no longer
original dev time x 2
Am writing a book on this I'll share when am done.
PS: all the environment variables are set whether empty or not so your approach might not work all the time.
Michael Richey - 2014-03-04 08:24:18 - In reply to message 2 from Archzilon Eshun-Davies
All of the environment variables in this test are NOT set if they aren't part of the original request. The only one that is guaranteed to be set is REMOTE_ADDR, because it's set by the server hosting the PHP script.
By the way - why do you claim that they're always set, and still use isset() in your script? If that's the case, you could skip directly to your empty() test and cut your number of tests in half.
getenv() returns false if a value isn't set, allowing for the kind of ternary expression I posted.