Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Gdzie lepiej zastosować if
kszymon0
post
Post #1





Grupa: Zarejestrowani
Postów: 38
Pomógł: 0
Dołączył: 29.12.2008

Ostrzeżenie: (0%)
-----


Witam, Chciałbym się zapytać, który z tych kodów jest lepszy i dla czego (chodzi mi tutaj o instrukcję if gdzie lepiej ją stosować)?

  1. foreach ($data["platforms"] as $platform)
  2.   {
  3.   if (count($data["platforms"]) > 1 ) {
  4.   $tplatforms .= "<span style=\'font-size: 10px; color: {$cplatforms[$platform -1]}\'> {$platforms[$platform -1]} </span>";
  5.   $splatforms = "<td style='width: 25px; height: 14px; text-align: center; font: normal normal 10px Verdana; color: #b72120; cursor: pointer;' onmouseover=\"showhint(this, '{$tplatforms}')\">+</td>";
  6.   } else {
  7.   $splatforms = "<td style='width: 25px; height: 14px; text-align: center; font: normal normal 10px Verdana; color: #{$cplatforms[$platform -1]};'>{$platforms[$platform -1]}</td>";
  8.   }
  9.   }
  1. if (Count($data["platforms"]) > 1)
  2.   foreach ($data["platforms"] as $platform)
  3.   {
  4.   $tplatforms .= "<span style=\' margin-left: 2px; font-size: 10px; color: {$cplatforms[$platform -1]}\'>{$platforms[$platform -1]}</span>";
  5.   $platformstxt = "<td style='width: 25px; height: 14px; text-align: center; font: normal normal 10px Verdana; color: #b72120; cursor: pointer;' onmouseover=\"showhint(this, '{$tplatforms}')\">+</td>";
  6.   }
  7.   else $platformstxt = "<td style=\"width: 25px; height: 14px; text-align: center; font: normal normal 10px Verdana; color: #{$cplatforms[$data["platforms"][0] -1]};\">{$platforms[$data["platforms"][0] -1]}</td>";


Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 6.10.2025 - 07:46