summaryrefslogtreecommitdiffstats
path: root/control.php
diff options
context:
space:
mode:
Diffstat (limited to 'control.php')
-rw-r--r--control.php56
1 files changed, 56 insertions, 0 deletions
diff --git a/control.php b/control.php
new file mode 100644
index 0000000..8e608e2
--- /dev/null
+++ b/control.php
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Hacker's Corner</title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+</head>
+<body>
+<h1>Please Don't Fear!</h1>
+<b>Sandbox:</b> Let's Roll!<br />
+<p>
+<?php
+ error_reporting(E_ALL | E_STRICT);
+ ini_set("display_errors", 1);
+
+ $pi = 3.14159;
+ echo "Pi = " . $pi . "<br />";
+
+ switch ($pi)
+ {
+ case 1.618:
+ break;
+ case 3.14159:
+ echo "cought it.<br />";
+ break;
+ default:
+ echo "how could this happen?<br />";
+ break;
+ }
+
+ /* while and for are straightforward, foreach is interesting, it allows us
+ * to loop through assosiative arrays, aka key-value pair */
+ $myarr = array("world" => "evil", "bro" => "ski", "he" => "is good man");
+ foreach ($myarr as $value)
+ echo "the value is \"{$value}\"<br />";
+
+ echo "<br />";
+ foreach ($myarr as $key => $value) /* fucking weird */
+ echo "at {$key} the value is \"{$value}\"<br />";
+
+ echo '<br />$myarr points to "' . current($myarr) . "\".<br />";
+ reset($myarr);
+ next($myarr);
+ echo '$myarr now points to "' . current($myarr) . "\".<br />";
+
+ /* incrementing pointer */
+ while ($str = current($myarr))
+ {
+ echo $str . ", ";
+ next($myarr);
+ }
+?>
+</p>
+</body>
+</html>
+