Advertisement
idsystems

PHP_Leccion1.7_06

Jan 19th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. <?
  2.  
  3. function muestra($valor,$fondo='#eeeeee') {
  4.     if ($valor < 0.5)
  5.         $color = 'red';
  6.     else
  7.         $color = 'blue';
  8.     echo "<td bgcolor='$fondo'><font color='$color'>$valor</font></td>\n";
  9. }
  10. ?>
  11.  
  12. <h1>Tabla</h1>
  13. <table border="1">
  14. <?
  15.  
  16.     $nrenglon = 0;
  17.     for ($x=0; $x<=2; $x+=0.01) {
  18.         $nrenglon++;
  19.         echo "<tr>";
  20.         if ($nrenglon % 2) {
  21.             muestra($x);
  22.             muestra(sin($x));
  23.             muestra(cos($x));
  24.         }
  25.         else {
  26.             muestra($x,"#dddddd");
  27.             muestra(sin($x),"#dddddd");
  28.             muestra(cos($x),"#dddddd");
  29.         }
  30.         echo "</tr>";
  31.     }
  32. ?>
  33. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement