SHARE
TWEET

Modulo colorido

a guest Nov 16th, 2015 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $a = array_fill(1,10,'operand');
  4.  
  5. foreach($a as $key=>$valor){
  6.         if($key%2 == 1):
  7.                 print "<span style=\"color:red;\">$valor</span><br/>";
  8.         else:
  9.                 print "<span style=\"color:black;\">$valor</span><br/>";
  10.         endif; 
  11. }
  12.  
  13. print "<hr>";
  14.  
  15. foreach($a as $key=>$valor){
  16.         if($key%2 == 1):
  17.                 $class = "colorido";
  18.         else:
  19.                 $class = "";
  20.         endif;
  21.                
  22.         print "<span class=\"{$class}\">$valor</span><br/>";
  23. }
  24.  
  25. ?>
  26. <style type="text/css">
  27. .colorido {color:violet;}
  28. </style>
  29.  
  30. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top