Article 4CCQ4 CodeSOD: The Myth of Datyphus

CodeSOD: The Myth of Datyphus

by
Remy Porter
from The Daily WTF on (#4CCQ4)

PHP gets a lot of flack, but perhaps we're taking the wrong perspective on things. Perhaps the gods have condemned PHP to ceaselessly rolling CMSes and wikis up the hill, whence they roll back down under their own weight. The gods had thought, with some reason, that there is no more dreadful punishment than futile and hopeless labor.

I mean, look at this code:

$migrateStartTime = date("Y-m-d", strtotime(date('Y-m-d', time())));// Four other lines of code$startDateTime = DateTime::createFromFormat('Y-m-d', date('Y-m-d'));$startDateTimeIdentifier = $startDateTime->format('Y-m-d');

Is there anything more futile than that first line? Get the current time, format it as a date, convert the formatted string back into a date, and then convert that date into a string with the same format.

I leave PHP at the foot of its codebase. One always finds one's burden again. But PHP teaches the higher fidelity that negates the gods and raises date handling code. It too concludes that all is well. This universe henceforth without a master seems to it neither sterile nor futile. Each date format string, each unnecessary conversion of that night filled codebase, in itself forms a world. The struggle itself toward the heights is enough to fill a man's heart. One must imagine PHP happy.

proget-icon.png [Advertisement] ProGet can centralize your organization's software applications and components to provide uniform access to developers and servers. Check it out! TheDailyWtf?d=yIl2AUoC8zAW--XpJEWwqU
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments