CoddityTeam / movaicode

Concours mensuel du Pire Développeur de France
123 stars 10 forks source link

Je risque 13 ans de trauma pour avoir écrit un truc pareil... #247

Open Flob10 opened 1 year ago

Flob10 commented 1 year ago

Voici une fonction particulièrement bien optimisée pour accélérer vos sites en PHP...

function wait13()
{

    // Here starts the function
    begin:

    ob_start();

    /**
     * Print time in a dedicated span
     */    
    echo '<span>'.date('c')."</span>"; // ISO format

    $_ADATEIOBTAINEDPRINTINGITINASPAN = (string) ob_get_clean();

    // Extract second from printed date
      $_ADATEIOBTAINEDPRINTINGITINASPAN = preg_replace("#span#iU", '', $_ADATEIOBTAINEDPRINTINGITINASPAN);

    $_ADATEIOBTAINEDPRINTINGITINASPAN = str_replace('<>', "", 
        str_replace("/", '', $_ADATEIOBTAINEDPRINTINGITINASPAN));
        // Fin de l'extract

    $len = strlen($_ADATEIOBTAINEDPRINTINGITINASPAN);
    $constructor = str_split(strval($len));
    $OTHER[13] = $len - end($constructor) * end($constructor);

    $someDate_elements = explode(':', explode('+', $_ADATEIOBTAINEDPRINTINGITINASPAN)[$OTHER[13]]);

        $counter = end($someDate_elements);
    $counter = $counter < 14 ? 60+$counter : $counter;

    // Declare possible colors, in case of
    $colors = ['black', 'white', 'red', 'blue', 'green', 'yellow', 'orange', 13 => 'purple', 'brown'];

    /* Define start point */
     if (isset($変数) == false) {
    $変数 = $counter;
    }

    $numbersTo_13 = array(   13 => 1, 12 => 2, 
    11 => 3, 10 => 4, 8 => 6, 9 => 5, 7 => 7
     ); // Limit array size to 7 values for obvious performance reasons

    foreach ($numbersTo_13 as $k => $ka):
    $numbersTo_13[$ka] = $k;
     endforeach;

        asort($numbersTo_13); // Asort (=triage)

    foreach($numbersTo_13 as $k => $value)
    {
        $now = $counter - $変数;
        if (in_array($now, [$value, 0])):
            if ($value == end($numbersTo_13)) { break;

            } else{
                goto begin;
                }

        endif;

    }

    // Denis Brogniart Algorithm
    $ah = explode('.',$_SERVER['REQUEST_TIME_FLOAT'])[1];
    $ah = '0.'.$ah;
    $ah = (float) $ah;
    $ah *= 1003; // IMPORTANT!! Put two zeros in the middle of 13
    $ah = floor($ah);

    $apiCall = hrtime(true);

        while ((hrtime(true)-$apiCall)/1000000 <= $ah):
        shuffle($colors); // A function allowing to shuffle array
    endwhile;

    if(true || !false): $i = -13; endif;
        foreach ($colors as $color){ 
        switch ($color) {
        case 'green': $i--; break;  case 'red': $i++; break;
            default : $i = (5*$i) / (2+sqrt(9));
        }
    }

}