diff --git a/challenges/THE BOX/thebox.html b/challenges/THE BOX/thebox.html new file mode 100644 index 0000000..90f43a3 --- /dev/null +++ b/challenges/THE BOX/thebox.html @@ -0,0 +1,114 @@ + + + + The Box + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/challenges/comprehension/explanation.txt b/challenges/comprehension/explanation.txt index e69de29..4d8e99e 100755 --- a/challenges/comprehension/explanation.txt +++ b/challenges/comprehension/explanation.txt @@ -0,0 +1,17 @@ +The program starts off by defining the hash/dict/map @storage, initializing it to null. + +It then enters a loop which gets a line of text from "input.txt" each iteration, storing it in the scalar variable %temp. + +Within each iteration it splits the string up into words and stores them into the array $temp. + +A foreach loop then iterates over each word, storing them temporarily in the scalar variable %t. + +Inside this loop it checks to see if the word is composed of one or more alphanumeric characters. + +If so, it checks to see if the word is a key in @storage. If so, it increments the integer that the key %t maps to. If not, it initializes an integer in @storage to 1, with %t being its key. + +After the program has reached an EOF (I'm assuming at least), it iterates over all the key-value pairs in @storage, and prints them ("key value"). + +In summary, the program reads a text file, calculates the frequency of every word, and then prints out each word and its corresponding frequency. + +Note: The @ sigil refers to a hash/dict/map. The $ sigil refers to an array. The % sigil refers to a scalar (in this case, strings). diff --git a/challenges/strpos/strpos.php b/challenges/strpos/strpos.php index ee1c4b1..d16ef95 100755 --- a/challenges/strpos/strpos.php +++ b/challenges/strpos/strpos.php @@ -1,8 +1,25 @@