389

And the most useless function of the year award goes to...

Comments
  • 42
    But how else would you get an id with only the id?
  • 5
    Thanks! This gave me a good laugh 😂
  • 0
    @Enocra the input parameter? :)
  • 5
    @viking8 but you NEED to do something with the input parameter before you return it. Otherwise why bother making the function? 😃
  • 4
    Darcula yeah.
  • 3
    @orijin I know, it's a horrible function :) could uppercase the id - for giggles
  • 3
    maybe there will be some modifications to this function? It serves as a temporary placeholder now? but so far it's a fair award :)
  • 17
    get_id_user(get_id_user(get_id_user(............
  • 2
    Just return $user_id, it's not that hard.
  • 1
    Haha even rookies dont make mistakes like this unless they are absolutely plastered
  • 1
    Well. I guess it would be a feature to check if the id is in the database if you remove the "fix" somebody did.

    But yeah... kinda useless :)
  • 2
    @hoggchan but why would you ever create a function called "get_id_user" that requires the id of the user you want to get the id for as the only parameter? Even as a placeholder? :P
  • 2
    What IDE is this?
    The real question being: can I have those sexy arrows with PHPStorm?
  • 0
    Before looking at the uselessness of the method I'd probably say it's not the model's responsibility to retrieve data or to execute queries or to store a reference to the database connection :)
  • 0
    Can't it be used to check id exists ?
  • 0
    @NathanDoesDev No for your first question. Actually this function does not do what its name means, therefore, it's just a joke as far as I can tell from this edition of code. No more judgements I can make until former or later code is shown.
    (´ー`)
  • 0
    @DLMousey will check ASAP
  • 1
    @hoggchan that's what I was thinking. There is a commented out return below it. Meaning it was used to return something else before and they chose to move the resolution somewhere else. And since this fn was called at many places, easier option is to just make it return the passed value. I have done something like this everywhere in a personal project of mine. Yes that thing is a mess and I have to do a almost full rewrite before I can make major changes. but it works.
  • 1
    @willol this article explains what those arrows are (https://medium.com/larsenwork-andre...) and this is a list of some of the best ligature-enabled programming fonts (https://slant.co/topics/5611/...)
  • 0
    @garetmckinley thanks! I installed fira code, I'll read that
  • 0
    - "quickly! The code runs too fast, we must slow It down!!"
    - "Lets put random db queries everywhere encapsulated in functions!"
    - "yess perfectttttt durdur hur dur"
  • 1
    ﴾͡๏̯͡๏﴿ O'RLY? Even my two level comments are more meaningful than this piece of code. [•_•]
  • 1
    I guess it is missing a //TODO
    LOL

    Pointless in two ways... 1. Because you already know the user is and number 2 is obvious.

    I love this shit!
  • 1
    When you copy useless shit from stackoverflow :D used to happen to me a lot tbh

    Relevant keyword: cargo cult programming
  • 3
    Maybe they're just paid per line of code
  • 0
    @the-alias I hope they are not, as that would be a terrible way to program.
  • 0
    @the-alias - good thinking outside the box - seems like the only reasonable explanation
  • 0
    @NathanDoesDev could be a legacy function that is used extensively throughout. Granted, the code hitting the db should have been removed. However, if some form of ongoing refactor is happening that function may, at s push, make sense.
  • 1
    I agree with you!
Add Comment