1. PHP / Говнокод #557

    +145.5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if ($ajax_teamID == $value['team2ID']){
                  $visitors_team = $Bet->CBetType[$Bet->betTypeIndex]->CTeam->getOne($value['team2ID'])->title;
                  $home_team     = $Bet->CBetType[$Bet->betTypeIndex]->CTeam->getOne($value['team1ID'])->title;
            } else {      
                  $home_team     = $Bet->CBetType[$Bet->betTypeIndex]->CTeam->getOne($value['team1ID'])->title;              
                  $visitors_team = $Bet->CBetType[$Bet->betTypeIndex]->CTeam->getOne($value['team2ID'])->title;
            }

    Не делайте так.

    Запостил: guest, 16 Февраля 2009

    Комментарии (6) RSS

    • Бомж Без Колес:
      Это ужоснах ваще!
      Ответить
    • Индивидуум:
      Тогда приведите пример, как правильней…
      Ответить
    • 27:
      <?php
      $i = ($ajax_teamID==$value['team2ID']) ? 1 : 0;
      $visitors_team = $Bet->CBetType[$Bet->betTypeIndex]->CTeam->getOne($value['team'+1+$i+'ID'])->title;
      	$home_team = $Bet->CBetType[$Bet->betTypeIndex]->CTeam->getOne($value['team'+1+1-$i+'ID'])->title;
      ?>
      Ответить
    • 27:
      <?php
      $i = ($ajax_teamID==$value['team2ID']) ? 1 : 0;
      $visitors_team = $Bet->CBetType[$Bet->betTypeIndex]->CTeam->getOne($value['team'+1+$i+'ID'])->title;
          $home_team = $Bet->CBetType[$Bet->betTypeIndex]->CTeam->getOne($value['team'+2-$i+'ID'])->title;
      ?>
      Ответить
    • 27:
      вотак
      <?php
      $i = ($ajax_teamID==$value['team2ID']) ? 2 : 1;
      $visitors_team = $Bet->CBetType[$Bet->betTypeIndex]->CTeam->getOne($value['team'+$i+'ID'])->title;
          $home_team = $Bet->CBetType[$Bet->betTypeIndex]->CTeam->getOne($value['team'+3-$i+'ID'])->title;
      ?>
      Ответить
    • Иван:
      27, правильное решение такое
      <?
      $home_team     = $Bet->CBetType[$Bet->betTypeIndex]->CTeam->getOne($value['team1ID'])->title;              
      $visitors_team = $Bet->CBetType[$Bet->betTypeIndex]->CTeam->getOne($value['team2ID'])->title;
      ?>
      Ответить

    Добавить комментарий