- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Frist, frist, frist, etc.
Admin
Yep, I was waiting for that
Admin
What happens if we need $lastlastlastlastlastlastlastlastyear or $lastlastlastlastlastlastlastlastlastyear or even $lastlastlastlastlastlastlastlastlastlastyear
luckily we will never need $lastlastlastlastlastlastlastlastlastlastlastyear ...
Admin
What's so bad with this? Next thing you know people will be complaining about my use of $TheDayBeforeTheFirstMondayOfThisMonthLastYear.
Admin
Whenever I see such a lot of code simply copied, I wonder, have these people ever heard of loops?
Whenever I see such a lot of code simply copied, I wonder, have these people ever heard of loops?
Whenever I see such a lot of code simply copied, I wonder, have these people ever heard of loops?
Whenever I see such a lot of code simply copied, I wonder, have these people ever heard of loops?
Admin
what are the odds that the probeility of the month being frebruary?
Admin
Bessy says "Content Blocked"
Admin
Totally not a wtf. This is just an optimization so that you can access the previous years by numerical value, like this:
I've used this a lot in my programming career and I know some might disagree but tbh it's just a different approach.
Admin
Having seen websites with PHP code where three groups of modules were 99.9% identical, except for the WHERE clause of what to serach the database for, nothing on websites amazes me.
Don't even get me on the inability of some hosting companies, to understand the differences between even Windows and Linux.
Anyway "that was so lastlastlastlastlastyear".
Admin
ah, a good old fashioned 100% bad code indefensible WTF (and using PHP into the bargain)
this is what we like to see
Admin
Imagine the code for the date-of-birth field...
Admin
Optimize!
Admin
Geez, don't they realize the numberline goes in two directions?
Admin
Shoemaker, stick to your $last.
Admin
I wonder what would happen if they set error_reporting to report E_NOTICE as well...
Admin
I decided to improve the code to a degree:
You see, you grab a random equation, and apply it randomly across the board, and you get the same results, while having crazy code. Job Security.
Admin
captcha: enim -> Eminems little brother
Admin
Could have been worse:
$year2008 = 2008; $year2007 = 2007; $year2006 = 2006; etc.
I mean, this is php after all.
Admin
PHP isn't a bad scripting language. It's just that 99% of the PHP coders give the rest of us a bad name. I use it for server-side coding (both windows/linux) when I need a script to do something, and I don't have the time to build a real app. Handy little system in a pinch.
Admin
Admin
Or
$year = 2010; $yearlast = 2009; $yearlastlast = 2008; etc
with an optional comment saying "TO DO: Changes years on Jan 1st"
Admin
LastYearToInfinity...
Admin
That'll fail on a leap year. ;-)
Admin
I've used cannibalism a lot in my food-procuring career and I know some might disagree but tbh it's just a different approach.
Sometimes "bad" really is bad, not just different.
Admin
Pah; this story is just so date("Y")-1
Admin
Well, on embedded systems like Bessy, it's much more efficient to unroll the loop. Paula Bean taught me that.
Admin
TRWTF is the lack of underscores. It should be "$last_last_last_last_year" which is much more readable and maintainable.
Admin
What REALLY surprises me is that PHP doesn't have a built-in method for this year minus seven.
I suppose it'll be in the next release...
Admin
Applause!
Admin
Last week I wrote code to display a drop-down-field for birthday, with the last 120 years (1890-2010). That was done with a few (~5 or so) lines of code.
Would be interesting to see this in your notation. Great code example!
Admin
I want to hear more about the OP's previous job, where business analysts wrote requirements to implement bugs.
Admin
strtotime("-7 years") is pretty close.
Admin
Last post.
Admin
Last last post.
Admin
OK I'll stop now.
Admin
You were writing that as a reply to a post made by Richard T.Roll... Sarcasm detector offline? ;) Or am I the one missing that sarcasm tag in your reply?
Admin
$TheDayBeforeTheFirstMondayOfThisMonthLastYear = "Sunday";
sooo simple :D
Admin
Whenever i look at stats like "99% of php code is crap" i wonder - is it that 99% of the PHP programmers are crap, or that all php programmer are crappy 99% of the time?
Admin
ThisYear - 7 is not allowed as 7 is a magic number.
LastLastLastLastLastLastLastYear is much better.
Admin
Admin
Yes it is. PHP is poorly designed and inconsistent. The most popular implementation is also a mess and unlikely to get better - one of the leading guys working on improving the stability and security of the code quit in disgust at the unwillingness of Zend to accept changes.
Admin
Thank you.
Admin
And did you have any 120 years old visitors on that site? I'm curious.
Admin
Admin
Admin
That's a comment that's so rational yet so wrong that my stomach contracted. I can imagine that actually being brought forward by somebody.
That somebody wouldn't be my colleague for long, one way or another.
Admin
Admin
http://qdb.us/301603
To Akismet: Who spams by posting links to QDB?
Admin
"Wouldn't be a little more 'casual'? But then....how is the code casual if it wouldn't be more casual? </pedantic-bastard>
Admin
Those names are going to get totally unwieldy after a while, because of their length. The programmer should have gone with: