• my name (unregistered)

    It's flak, not flack. If I'm not mistaken this comes from the old WWII times (like "Blitz")

    Remy: https://www.etymonline.com/word/flack#etymonline_v_8824

  • Peter Tramo (unregistered)

    $strSec = (string)intval('Secnod');

  • Ruts (unregistered)

    TRWTF in this post is the grammar used to describe the problem, it's awful!

    Remy: It's better in the original French.

  • Kiwi (unregistered)

    While datyphus might be a sisyphus joke, it sounds more like a platypus. Not sure how to work that into a story, though.

  • Dave (unregistered) in reply to my name

    Remy, that's the wrong type of flack.

  • my name (unregistered) in reply to my name

    https://idioms.thefreedictionary.com/take+flak

  • Gumpy_Gus (unregistered)

    My Sysephean moment was when I spent several weeks refactoring one 3,300-line straight-line PHP program into something quite a bit more modular and intelligible.

    When I checked that new code in, the Big Boss adjudged the code "unmaintainable" and put me on an accelerated journey to unemployment.

  • Raj (unregistered) in reply to Gumpy_Gus

    Legacy PHP code is like those BSL-4 research labs that fire departments are instructed to leave alone when they get on fire. The firefighters simply set a perimeter at a safe distance, make sure the fire doesn't propagate past that perimeter, and prevent people from going in until the ashes are cold.

  • (nodebb)

    Converting from date to string and then back to date a few times ensures that it's a real date, which is important for type safety.

  • (nodebb)

    Both areas output dates in format Y-m-d (ISO?). The solution was nested in the code multiple times. Whoever did this was under the influence, which is fairly normal for those of us that work with PHP. Actual solution, which is very simple -

    $date = date("Y-m-d"); // 2019-04-03

    Or

    $dtObj = new DateTime(); $date = $dtObj->format("Y-m-d"); // 2019-04-03

  • ooOOooGa (unregistered) in reply to Gumpy_Gus

    That is more a problem with the Big Boss rather than the language.

    When I do the same thing - refactor some huge monolithic block of PHP code into something more modular and maintainable - I get praised for it.

    And of course scan through the original code to see if there is anything short enough and generic enough to submit here...

  • Little Bobby Tables (unregistered) in reply to Kiwi

    F*ck-filled datyphus?

    I wonder whether the original code might have had different formattings, e.g. d-m-Y or m-d-Y and they needed to go back and forwards between each other -- then someone came along and standardised on Y-m-d and then was too lazy / did not dare to clean up the resulting cruft.

  • Little Bobby Tables (unregistered) in reply to Gumpy_Gus

    Had a Sysyphean moment where i set up a little subroutine for converting a complex set of flags into a simple go/no-go so as to determine whether a particular user was authorised to use a certain operation (to then be used multiple times throughout the codebase) -- but was told to reverse it out and instead implement a long and complicated if then if then if then blah in each of the multitudinous places the paradigm was used.

  • Little Bobby Tables (unregistered) in reply to Gumpy_Gus

    Had a Sysyphean moment where i set up a little subroutine for converting a complex set of flags into a simple go/no-go so as to determine whether a particular user was authorised to use a certain operation (to then be used multiple times throughout the codebase) -- but was told to reverse it out and instead implement a long and complicated if then if then if then blah in each of the multitudinous places the paradigm was used.

  • Guest (unregistered)

    We don't give strtotime a format string. Does it try to "guess" the format? In that case this code is not a noop. It computes a pseudorandom permutation of year, month, and day.

  • evilclive (unregistered) in reply to my name

    "PHP gets a lot of publicity or press agent"? No, it's flak. Flack is a person.

  • tbo (unregistered)

    I mean, you can do this in any language...

    var ten = parseInt(parseInt('10', 10).toString(), 10);

    For the non-PHP users, this code is really just:

    $migrateStartTime = $startDateTimeIndentifier = date('Y-m-d');

    unless they actually use $startDateTime later on.

  • Just Me (unregistered)

    That first line truncates the date to midnight. I don't know if there's a better way of doing it in PHP.

  • Gerry (unregistered) in reply to Little Bobby Tables

    Somehow the multiple post seems appropriate...

  • Fernando (unregistered)

    DateTime::createFromFormat('Y-m-d', date('Y-m-d'));

    This line is not useless, it gets a DateTime objects at the start of the current day, as opposed to a DateTime object from the actual now time

  • Rhialto (unregistered)

    Just happened to be browsing the Sidebar WTF suggestions for today ...

    https://what.thedailywtf.com/post/166973

    and

    https://what.thedailywtf.com/post/166974

    ... synchronicity or ...

  • medievalist (unregistered)

    If a language makes it fast and easy to write something that provides income, it'll be more likely to be used by programmers with less skill and training.

    If a language dominates academic training, it will be more likely to be used by programmers who aren't able to pick up new techniques without formal training.

    Nonetheless there are good coders working in PHP, and there are innovative programmers working in Java.

  • ShortestStraw() (unregistered) in reply to Just Me

    (new DateTimeImmutable())->setTime(0, 0, 0);

Leave a comment on “The Myth of Datyphus”

Log In or post as a guest

Replying to comment #504488:

« Return to Article