63
dhux
8y

The person who wrote this deserves an award.

Comments
  • 1
    Auto-generated code??
  • 11
    @mk3d No, someone took the time to write it.
  • 9
    @dhux mmm, productive guy..
  • 8
    What is the default!?
  • 10
    At the very least it isn't an if elseif
  • 3
    @C-Info Ha, i have a script that does exactly that. I'm not even sorry about it either.
  • 3
    If you think about it you just have to write 1 or 2 cases, copy them a bunch of times and just change the numbers.

    I am guessing you need less than 30 seconds to copy paste and change the numbers.

    Probably this is faster than writing some code to do the same.
  • 1
    Desperately need some variables
  • 6
    @nickpapoutsis as I see it:

    String result = "";
    if (field starts witg '-') { result += "nein"; trim "-"; }

    result += {{number}} + ".png"

    As long as the assumption holds this is more extensible.

    On the other side the shown solution is safer as someone has validated if the file exists... But, if you enter a new file or want to change a name you have a maintenance problem.
  • 0
    I would directly work with CSS3 and HTML for display. With Images for every degree I would go nuts...
  • 1
    XDD ;D my eyes are bleeding. Umm you can't even defend this kind of fuckery.
  • 0
    @NelsonBighetti @C-info did just that: it's not an if else chain!
  • 2
    Dutchies! :')
  • 2
    $temp_morgen=$weer['temperature'] . '.png';
    if ($weer['temperature'][0]=='-')
    $temp_morgen='min' . substr($weer['temperature'],1) . '.png';

    Replaced it with 3 short lines why the fu** do that.
  • 2
    @matanl Made it a one liner for you:
    $temp_morgen = ( $weer ["temperature"][0] === "-" ) ? ( "min" . substr( $weer["temperature"], 1 ) . ".png" ) : ( $weer["temperature"] . ".png" );
Add Comment