From 1bad4fc00814e2c03ecadaa7faf93c6372f5bd30 Mon Sep 17 00:00:00 2001 From: Kyle Kaminski Date: Sun, 16 Jun 2013 03:25:26 -0500 Subject: initial commit --- datatypes.php | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 datatypes.php (limited to 'datatypes.php') diff --git a/datatypes.php b/datatypes.php new file mode 100644 index 0000000..53e8678 --- /dev/null +++ b/datatypes.php @@ -0,0 +1,70 @@ + + + +Hacker's Corner + + + +

Please Don't Fear!

+Sandbox: Let's Roll!
+

+"; + + $hellomsg = "Hello Kyle, world is good.
"; + /* note: single quotes would not do in place variable substitution */ + echo "{$hellomsg}"; /* weird, opposite of bash */ + + $myarray = array(12, 21, 33, 99, 33, "fox" /* hmm this is nice */, array("bro", "brotato")); + echo "2nd item in our array is " . $myarray[1] . " " . $myarray[6][1] . ".

"; + + /* key-value pairs, i like them, dejavu Lua! */ + $keyval = array("name" => "bro", "status" => "amused", "location" => "/dev/null"); + echo "$keyval[name] is $keyval[status]"; + + echo "

";
+    print_r($keyval);
+    echo "

"; + + /* array into a string? seems heck useful */ + $str_from_arr = implode(" ~ ", $keyval); /* 1st param = glue */ + echo "the imploded array is: {$str_from_arr}"; +?> + + +
+Is Pi set? + "; + else + echo "No" . "
"; + + /* how to escape? */ + $var1 = "\"brotato escaped\""; + echo "escaped: " . $var1 . ", ha it is just like C!". "
"; + + unset($pi); /* why not just set it to null? we can set it to 0, "0"! and null */ + if (empty($pi)) + echo "Pi has been unset.
"; + ?> +
+Typecasting, php is very clever!
+ "; + settype($piphi, "string"); /* or just typecast, (string) in front ? */ + + /* constants */ + define("PI_VAL", 3.14159); + ?> +

+ + + -- cgit v1.2.3