2016-09-21

Sep 21 Class Thread.

Hi Everyone!
Post your solutions to the Sep 21 Let's Build Something here.
Best,
Chris
Hi Everyone! Post your solutions to the Sep 21 Let's Build Something here. Best, Chris

-- Sep 21 Class Thread
<!DOCTYPE html> <html> <head> <title>PHP Time</title> </head> <body> <?php $t = time(); if($t%2==1){
	echo("<h1>I'm feeling a bit odd</h1>");
} else{
 echo("<h1>_SERVER superglobal</h1>");
 echo("<table>
      <tr>
       <th>key</th>
       <th>value</th>
      </tr>");
      foreach ($_SERVER as $key => $value) {
            echo("<tr>
                  <td>$key</td>
                  <td>$value</td>
            	 </tr>");
      }
            echo("</table>");
} ?> </body> </html>
<!DOCTYPE html> <html> <head> <title>PHP Time</title> </head> <body> <?php $t = time(); if($t%2==1){ echo("<h1>I'm feeling a bit odd</h1>"); } else{ echo("<h1>_SERVER superglobal</h1>"); echo("<table> <tr> <th>key</th> <th>value</th> </tr>"); foreach ($_SERVER as $key => $value) { echo("<tr> <td>$key</td> <td>$value</td> </tr>"); } echo("</table>"); } ?> </body> </html>

-- Sep 21 Class Thread
<!DOCTYPE html> <html lang="en">
    <head>
        <title>Odd Even Server</title>
        <meta charset="utf-8" />
    </head>
    <body>
      <?php
        $current_time = time();
        if($current_time % 2 == 1) {
            echo "<h1>I'm feeling a bit odd</h1>";
        }
        else {
            echo "<h1>_SERVER superglobal</h1>";
            echo "<table>";
            echo "<tr><th>key</th><th>value</th></tr>";
            foreach($_SERVER as $key => $value) {
                echo "<tr><td>$key</td><td>$value</td></tr>";
            }
            echo "</table>";
        }
      ?>
    </body>
</html>
<!DOCTYPE html> <html lang="en"> <head> <title>Odd Even Server</title> <meta charset="utf-8" /> </head> <body> <?php $current_time = time(); if($current_time % 2 == 1) { echo "<h1>I'm feeling a bit odd</h1>"; } else { echo "<h1>_SERVER superglobal</h1>"; echo "<table>"; echo "<tr><th>key</th><th>value</th></tr>"; foreach($_SERVER as $key => $value) { echo "<tr><td>$key</td><td>$value</td></tr>"; } echo "</table>"; } ?> </body> </html>

-- Sep 21 Class Thread
<!DOCTYPE html> <html>
    <head>
        <title>Odd Even Server</title>
    </head>
    <body>
      <?php
        if(time() % 2 == 1) {
            echo "<h1>I'm feeling a bit odd</h1>";
        }
        else {
            echo "<h1>_SERVER superglobal</h1>";
            echo "<table>";
            echo "<tr><th>key</th><th>value</th></tr>";
            foreach($_SERVER as $key => $value) {
                echo "<tr><td>$key</td><td>$value</td></tr>";
            }
            echo "</table>";
        }
      ?>
    </body>
</html>
<!DOCTYPE html> <html> <head> <title>Odd Even Server</title> </head> <body> <?php if(time() % 2 == 1) { echo "<h1>I'm feeling a bit odd</h1>"; } else { echo "<h1>_SERVER superglobal</h1>"; echo "<table>"; echo "<tr><th>key</th><th>value</th></tr>"; foreach($_SERVER as $key => $value) { echo "<tr><td>$key</td><td>$value</td></tr>"; } echo "</table>"; } ?> </body> </html>

User Icon
-- Sep 21 Class Thread
<!DOCTYPE html> <html lang="en">
    <head>
        <title>Michael Yu's OddEvenServer.php</title>
        <meta charset="utf-8" />
    </head>
    <body>
      <?php
        $ clock = time();
        if (clock % 2 == 1)
        {
            echo "<h1>I'm feeling a bit odd</h1>";
        }
        else
        {
            echo "<h1>_SERVER superglobal</h1>";
            echo "<table>";
            echo "<tr><th>key</th><th>value</th></tr>";
            foreach($_SERVER as $key => $value)
            {
                echo "<tr><td>$key</td><td>$value</td></tr>";
            }
            echo "</table>";
        }
      ?>
    </body>
</html>
(Edited: 2016-09-21)
<!DOCTYPE html> <html lang="en"> <head> <title>Michael Yu's OddEvenServer.php</title> <meta charset="utf-8" /> </head> <body> <?php $ clock = time(); if (clock % 2 == 1) { echo "<h1>I'm feeling a bit odd</h1>"; } else { echo "<h1>_SERVER superglobal</h1>"; echo "<table>"; echo "<tr><th>key</th><th>value</th></tr>"; foreach($_SERVER as $key => $value) { echo "<tr><td>$key</td><td>$value</td></tr>"; } echo "</table>"; } ?> </body> </html>

-- Sep 21 Class Thread
<?
  $time = time();
  $odd = "<h1>I'm feeling a bit Odd</h1>";
  $even = "<h1>_SERVER superglobals</h1>";
?>
 <!DOCTYPE html>
<html>
    <head>
        <title>Odd or Even . . . That's the question.</title>
        <meta charset="utf-8" />
        <style type="text/css">
        	table{
        		border: 1px solid;
        	}
					tr, td {
						border: solid;
						border-width: 1px 0 0 0;
					}
					tr, th{
						text-align: left;
					}
        </style>
    </head>
    <body>
    	<? 
    		if (($time % 2) != 0) {
    			print($odd);
    		} else{
    			print($even)
    			?>
    			<table>
			    	<tr>
			    		<th>Key</th>
			    		<th>Value</th>
			    	</tr>
			    	<?
			    	foreach ( $_SERVER as $key => $value) {
			    	?>
						<tr>
							<td><?= $key ?></td>
							<td><?= $value ?></td>
						</tr>
    				<?
    			}?>
    </table>
    <?
    		}
    	?>
    </body>
</html>
(Edited: 2016-09-21)
<? $time = time(); $odd = "<h1>I'm feeling a bit Odd</h1>"; $even = "<h1>_SERVER superglobals</h1>"; ?> <!DOCTYPE html> <html> <head> <title>Odd or Even . . . That's the question.</title> <meta charset="utf-8" /> <style type="text/css"> table{ border: 1px solid; } tr, td { border: solid; border-width: 1px 0 0 0; } tr, th{ text-align: left; } </style> </head> <body> <? if (($time % 2) != 0) { print($odd); } else{ print($even) ?> <table> <tr> <th>Key</th> <th>Value</th> </tr> <? foreach ( $_SERVER as $key => $value) { ?> <tr> <td><?= $key ?></td> <td><?= $value ?></td> </tr> <? }?> </table> <? } ?> </body> </html>

-- Sep 21 Class Thread
<!DOCTYPE html> <html>
    <head>
        <title></title>
    </head>
    <body>
        <?php
            $t=time();
        
        echo "
"; if(($t % 2) == 0){ echo "
"; echo "<h1>_SERVER superglobal</h1>"; echo("<table> <tr> <th>KEY</th> <th>VALUE</th> </tr>"); foreach ($_SERVER as $key => $value) { echo("<tr> <td>$key</td> <td>$value</td> </tr>"); } echo("</table>"); } else{ echo "
"; echo "<h1>I'm feeling a bit odd"; } ?> </body>
</html>
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <?php $t=time(); echo "<br>"; if(($t % 2) == 0){ echo "<br>"; echo "<h1>_SERVER superglobal</h1>"; echo("<table> <tr> <th>KEY</th> <th>VALUE</th> </tr>"); foreach ($_SERVER as $key => $value) { echo("<tr> <td>$key</td> <td>$value</td> </tr>"); } echo("</table>"); } else{ echo "<br>"; echo "<h1>I'm feeling a bit odd"; } ?> </body> </html>

-- Sep 21 Class Thread
<!DOCTYPE html> <html> <head>
  <title>Odd Even Server</title>
</head>
<body> <?php $time = time();
  if($time % 2 == 1){
      echo "<h1>I'm feeling a bit odd</h1>";
  }else{
      echo "<h1>_SERVER superglobal</h1>";
      echo "<table>";
      echo "<tr><th>key</th><th>value</th></tr>";
  }
  foreach($_SERVER as $key => $value){
    echo "<tr><td>$key</td><td>$value</td></tr>";
  }
echo "</table>"; ?> </body> </html>
(Edited: 2016-09-21)
<!DOCTYPE html> <html> <head> <title>Odd Even Server</title> </head> <body> <?php $time = time(); if($time % 2 == 1){ echo "<h1>I'm feeling a bit odd</h1>"; }else{ echo "<h1>_SERVER superglobal</h1>"; echo "<table>"; echo "<tr><th>key</th><th>value</th></tr>"; } foreach($_SERVER as $key => $value){ echo "<tr><td>$key</td><td>$value</td></tr>"; } echo "</table>"; ?> </body> </html>

-- Sep 21 Class Thread
<!DOCTYPE html>
<html> <head>
	<title>PHP server time</title>
	<meta charset="utf-8">
</head> <body> <?php function serverTime(){
	$number = time();
	if($number % 2 == 0)
	{
		echo "<h1>_SERVER superglobal</h1>";
	}
	else {
		echo "<h1>I'm feeling a bit odd</h1>";
	}
	echo "<table>
		<th>key</th>
		<th<value</th>");
	foreach ($_SERVER as $key => $value) {
	 
		echo "<tr>
			<td>$key</td>
			<td>$value</td>
		</tr>
		</table>";
	}
} serverTime();
?> </body> </html>
<!DOCTYPE html> <html> <head> <title>PHP server time</title> <meta charset="utf-8"> </head> <body> <?php function serverTime(){ $number = time(); if($number % 2 == 0) { echo "<h1>_SERVER superglobal</h1>"; } else { echo "<h1>I'm feeling a bit odd</h1>"; } echo "<table> <th>key</th> <th<value</th>"); foreach ($_SERVER as $key => $value) { echo "<tr> <td>$key</td> <td>$value</td> </tr> </table>"; } } serverTime(); ?> </body> </html>

-- Sep 21 Class Thread
    <!DOCTYPE html> <html>
        <head>
            <title>Even odd server blinks</title>
        </head>
        <body>
            <?php
                $t=time();
            echo "
    ";
            if(($t % 2) == 0){
                echo "
    ";
                echo "<h1>_SERVER superglobal</h1>";
                echo("<table>
                      <tr>
                       <th>KEY</th>
                       <th>VALUE</th>
                      </tr>");
                      foreach ($_SERVER as $key => $value) {
                            echo("<tr>
                                  <td>$key</td>
                                  <td>$value</td>
                                 </tr>");
                      }
                echo("</table>");
            }
            else{
                echo "
    ";
                echo "<h1>I'm feeling a bit odd";
                }
            ?>
        </body>
    </html>
<!DOCTYPE html> <html> <head> <title>Even odd server blinks</title> </head> <body> <?php $t=time(); echo " "; if(($t % 2) == 0){ echo " "; echo "<h1>_SERVER superglobal</h1>"; echo("<table> <tr> <th>KEY</th> <th>VALUE</th> </tr>"); foreach ($_SERVER as $key => $value) { echo("<tr> <td>$key</td> <td>$value</td> </tr>"); } echo("</table>"); } else{ echo " "; echo "<h1>I'm feeling a bit odd"; } ?> </body> </html>
[ Next ]
X