From 676e090b418a16ff37ec69951a13b748b4d8e725 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Sun, 2 Sep 2018 13:03:36 -0500 Subject: [PATCH] Removed docs folder from repository and moved build to separate branch --- .gitignore | 2 + docs/CNAME | 1 - docs/arithmetic.html | 84 --- docs/arrays.html | 80 --- docs/basics.html | 78 --- docs/boolean-logic.html | 90 ---- docs/classes.html | 94 ---- docs/comparisons.html | 91 ---- docs/conditionals.html | 119 ----- docs/credits.html | 69 --- docs/css/site.css | 418 --------------- docs/favicon-32.png | Bin 1348 -> 0 bytes docs/functions.html | 95 ---- docs/index.html | 109 ---- docs/js/site.js | 1103 --------------------------------------- docs/loops.html | 106 ---- docs/manifest.json | 4 - docs/variables.html | 87 --- 18 files changed, 2 insertions(+), 2628 deletions(-) delete mode 100644 docs/CNAME delete mode 100644 docs/arithmetic.html delete mode 100644 docs/arrays.html delete mode 100644 docs/basics.html delete mode 100644 docs/boolean-logic.html delete mode 100644 docs/classes.html delete mode 100644 docs/comparisons.html delete mode 100644 docs/conditionals.html delete mode 100644 docs/credits.html delete mode 100644 docs/css/site.css delete mode 100644 docs/favicon-32.png delete mode 100644 docs/functions.html delete mode 100644 docs/index.html delete mode 100644 docs/js/site.js delete mode 100644 docs/loops.html delete mode 100644 docs/manifest.json delete mode 100644 docs/variables.html diff --git a/.gitignore b/.gitignore index 9141126..a82ca6b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ /vendor /node_modules + +/docs diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index 7f00477..0000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -phpapprentice.com \ No newline at end of file diff --git a/docs/arithmetic.html b/docs/arithmetic.html deleted file mode 100644 index cc01003..0000000 --- a/docs/arithmetic.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - Arithmetic - - - - - - - - - - - -
-

Arithmetic

-

Doing math like a pro

-
<?php
-
-
Now that we know how to create variables, let's look at doing some math.
$a = 1;
-$b = 2;
-
-
To add two values, use the plus symbol.
$c = $a + $b;
-
-
To subtract, use the minus symbol.
$c = $b - $a;
-
-
To multiply two values, use an asterisk.
echo $a * $b;
-
-
To divide values, use a forward slash.
echo $b / $a;
-
-
PHP uses the percent symbol for calculating the modulus of two numbers. The modulus is calculated by dividing two numbers and returning the remainder of the result. So, in this example, the value of $modulo will be 0.
$modulo = 10 % 5;
-
-
You can also use double asterisks to calculate a number to the power of another number. The following statement will print 25.
echo 5 ** 2;
-
-
- -
- - - - - - diff --git a/docs/arrays.html b/docs/arrays.html deleted file mode 100644 index 7559764..0000000 --- a/docs/arrays.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - Arrays - - - - - - - - - - - -
-

Arrays

-

Time to make a list

-
<?php
-
-
There are two ways to create an array. First, you can use the array construct to pass in values separated by commas and it will return an array.
$taskList = array('grocery store', 'change car oil');
-
-
Second, you can surround the list in square brackets. This style is the most common and recommended form of creating an array.
$groceryList = ['bread', 'milk', 'eggs'];
-
-
PHP will automatically assign index keys for each value in an array starting with 0. So, to access a value in an array you will pass the key number into brackets after the variable name.
echo $groceryList[0] . "\n";
-echo $groceryList[1] . "\n";
-
-
You can also assign keys in an array using numbers or strings. It is very common to create an array with string keys. The pattern is called an associative array or a map.
$car = ['make' => 'Toyota', 'model' => 'Camry'];
-
-
To access the value in an associative array, just use the string key in brackets after the variable name.
echo $car['model'] . "\n";
-
-
- -
- - - - - - diff --git a/docs/basics.html b/docs/basics.html deleted file mode 100644 index 5ef2172..0000000 --- a/docs/basics.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - Basics - - - - - - - - - - - -
-

Basics

-

Getting started

-
<?php
-
-
In the tradition of our ancestors, let's start with a hello world program. All PHP files must start with a <?php tag unless it is for a html template. (We will learn about html templates later.)
echo "Hello World!\n";
-
-
There is a lot going on in this statement so let's work through it.

-
First, the echo keyword tells PHP to output some text.
echo 'I am some text';
-
-
Second, PHP stores text in strings.

-
To write a string, you surround letters with single or double quotes. The difference between single quoted strings and double quoted strings is that double quoted strings can hold special characters like \n which tells PHP to start a new line.
'I am a string';
-"\nI am a string on a new line";
-
-
Third, all lines of code in PHP must end in a semi-colon.
echo "No semi-colon is a no-no\n";
-
-
Using semi-colons means we can write multiple statements on one line.
echo 'Hello'; echo " World\n";
-
-
- -
- - - - - - diff --git a/docs/boolean-logic.html b/docs/boolean-logic.html deleted file mode 100644 index a192503..0000000 --- a/docs/boolean-logic.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - Boolean Logic - - - - - - - - - - - -
-

Boolean Logic

-

Is it a yes or a no?

-
<?php
-
-
Boolean logic is used to combine booleans to return another boolean.

-
Using double ampersands tells PHP to check if both values are true. If so, it will return true. If not, it will return false.
$a = true;
-$b = true;
-$c = false;
-
-
Returns true.
$a && $b;
-
Returns false.
$a && $c;
-
-
Using two pipe characters checks if either value is true. Then, it will return true. If both values are false, the PHP returns false.
$a = true;
-$b = false;
-$c = false;
-$d = true;
-
-
Returns true.
$a || $b;
-
Returns false.
$b || $c;
-
Returns true.
$a || $d;
-
-
Using an exclamation point returns the value flipped.
$d = true;
-
-
Outputs false.
echo !$d;
-
-
- -
- - - - - - diff --git a/docs/classes.html b/docs/classes.html deleted file mode 100644 index db79f7b..0000000 --- a/docs/classes.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - Classes - - - - - - - - - - - -
-

Classes

-

Object-oriented programming

-
<?php
-
-
Classes allow you to define your own data types. All classes start with the class keyword followed by the name of the class and opening and closing curly braces.
class Car
-{
-}
-
-
To create an instance of a class, you use the "new" keyword in front of the class name with parentheses.
$car = new Car();
-
-
A class can define attributes and methods. An attribute is a piece of data stored on the class instance. You can define an attribute by adding the word "public" and a variable name inside the class definition.
class Bicycle
-{
-    public $color;
-}
-
-
Then, when you create an instance of the class, you can set and use the color attribute on the bicycle using "->".
$bike = new Bicycle();
-$bike->color = 'Blue';
-echo $bike->color . "\n";
-
-
A method is a function attached to the class. You can add a method to a class by using the "public" keyword followed by the function. A method can access the attributes and methods of the instance using the "$this" variable.
class Tricycle
-{
-    public $color;
-
-    public function echoColor()
-    {
-        echo $this->color . "\n";
-    }
-}
-
-$bike = new Tricycle();
-$bike->color = 'Red';
-$bike->echoColor();
-
-
- -
- - - - - - diff --git a/docs/comparisons.html b/docs/comparisons.html deleted file mode 100644 index 3e8c40b..0000000 --- a/docs/comparisons.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - Comparisons - - - - - - - - - - - -
-

Comparisons

-

Equality checking

-
<?php
-
-
A boolean is a value that is always 0 or 1, yes or no, on or off. In PHP, a boolean is represented by the words true and false. While programming, you will often want to know if something is true or false.
$a = true;
-$b = false;
-
-
There are many constructs and functions that will return a boolean. To start, let's look at comparisons.
$one = 1;
-$two = 2;
-
-
Double equals checks if two values are equal. This statement will return false.
$one == $two;
-
-
An exclamation point and equal sign check if two values are not equal. This statement will return true.
$one != $two;
-
-
You can use greater than and less than symbols to check for comparisons too. This statement will return false.
$one > $two;
-
-
This statement will return true.
$one < $two;
-
-
If you combine a greater than or less than symbol with an equal, it will check if the value is greater or less than or equal to another value.
$one <= $two;
-$one >= $two;
-
-
You can also check that two values are equal and of the same type by using three equal signs.

-
This returns true.
1 == '1';
-
-
This returns false.
1 === '1';
-
-
- -
- - - - - - diff --git a/docs/conditionals.html b/docs/conditionals.html deleted file mode 100644 index 9410670..0000000 --- a/docs/conditionals.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - Conditionals - - - - - - - - - - - -
-

Conditionals

-

Checking the if before the what

-
<?php
-
-
When writing code, there will be times when you need to perform actions only under certain circumstances. There are several ways to control execution in PHP. We will start with an if statement.
$animal = 'cow';
-if ($animal == 'cow') {
-    echo "Moooooo.....\n";
-}
-
-
All conditionals check to see if a statement evaluates to true or false. In the case above, since $animal equals 'cow', the statement returns true and the contents of the if statement are executed.

-
-
An if statement can have multiple conditions chained together. If the first if statement returns false, then PHP will check each elseif. If none of the checks return true, then the else block will be executed.
$animal = 'bird';
-if ($animal == 'dog') {
-    echo "Woof! 🐢\n";
-} elseif ($animal == 'cat') {
-    echo "Meow!? 🐱\n";
-} elseif ($animal == 'bird') {
-    echo "Chirp! 🐦\n";
-} else {
-    echo "I am not a dog, cat or bird\n";
-}
-
-
An alternative to the if statement is the switch. A switch statement has multiple cases to check if the value in parentheses equals something. In this statement, since $food equals 'apples', the switch will echo "Eating an apple". The default case will be run if no other case evaluates to true, like an else statement.
$food = 'apples';
-switch ($food) {
-    case 'apples':
-        echo "Eating an apple\n";
-        break;
-    case 'oranges':
-        echo "Eating an orange\n";
-        break;
-    case 'peaches':
-        echo "Eating a peach\n";
-        break;
-    default:
-        echo "No food, I am hungry\n";
-}
-
-
Breaks are a special keyword that tell PHP to stop execution once a case passes. If you do not use a break, PHP will continue to execute all following cases. In this switch, both "Drinking water" and "Drinking tea" will be executed since there is no break in the 'water' case.
$drink = 'water';
-switch ($drink) {
-    case 'water':
-        echo "Drinking water\n";
-    case 'tea':
-        echo "Drinking tea\n";
-        break;
-}
-
-
PHP also supports single line conditionals called a ternary. In a ternary, the condition is followed by a question mark before the value that should be returned if the condition is true and then another colon and a value to return if the condition is false.
$language = 'english';
-echo $language == 'spanish' ? "hola\n" : "hello\n";
-
-
Lastly, there is another form of a ternary that checks if a value is set and then returns the value to the right of two question marks if value is null.
echo $IDoNotExist ?? "Variable not set\n";
-
-
You can also chain multiple checks in a row.
$IExist = "Variable exists\n";
-echo $IDoNotExist ?? $IExist ?? "Neither variable is set\n";
-
-
- -
- - - - - - diff --git a/docs/credits.html b/docs/credits.html deleted file mode 100644 index 3bc0de2..0000000 --- a/docs/credits.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - PHP Apprentice - Credits - - - - - - - - - -
-
-
-

Credits

-

- PHP Apprentice was inspired by - Go By Example and by Elixir School. Both sites offer excellent, quality documentation in Go and Elixir and I want PHP Apprentice to provide the same - experience for the PHP programming language. -

-

- Source Links: -

-

-

- PHP Apprentice was built using several open source projects. - Thank you to each of these maintainers for providing great libraries! -

-

-
-
- -
-
-
- - - - diff --git a/docs/css/site.css b/docs/css/site.css deleted file mode 100644 index 88209b6..0000000 --- a/docs/css/site.css +++ /dev/null @@ -1,418 +0,0 @@ -/* - Solarized Color Schemes originally by Ethan Schoonover - http://ethanschoonover.com/solarized - - Ported for PrismJS by Hector Matos - Website: https://krakendev.io - Twitter Handle: https://twitter.com/allonsykraken) -*/ - -/* -SOLARIZED HEX ---------- ------- -base03 #002b36 -base02 #073642 -base01 #586e75 -base00 #657b83 -base0 #839496 -base1 #93a1a1 -base2 #eee8d5 -base3 #fdf6e3 -yellow #b58900 -orange #cb4b16 -red #dc322f -magenta #d33682 -violet #6c71c4 -blue #268bd2 -cyan #2aa198 -green #859900 -*/ - -code[class*="language-"], -pre[class*="language-"] { - color: #657b83; /* base00 */ - font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - - line-height: 1.5; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, -code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { - background: #073642; /* base02 */ -} - -pre[class*="language-"]::selection, pre[class*="language-"] ::selection, -code[class*="language-"]::selection, code[class*="language-"] ::selection { - background: #073642; /* base02 */ -} - -/* Code blocks */ - -pre[class*="language-"] { - padding: 1em; - margin: .5em 0; - overflow: auto; - border-radius: 0.3em; -} - -:not(pre) > code[class*="language-"], -pre[class*="language-"] { - background-color: #fdf6e3; /* base3 */ -} - -/* Inline code */ - -:not(pre) > code[class*="language-"] { - padding: .1em; - border-radius: .3em; -} - -.token.comment, -.token.prolog, -.token.doctype, -.token.cdata { - color: #93a1a1; /* base1 */ -} - -.token.punctuation { - color: #586e75; /* base01 */ -} - -.namespace { - opacity: .7; -} - -.token.property, -.token.tag, -.token.boolean, -.token.number, -.token.constant, -.token.symbol, -.token.deleted { - color: #268bd2; /* blue */ -} - -.token.selector, -.token.attr-name, -.token.string, -.token.char, -.token.builtin, -.token.url, -.token.inserted { - color: #2aa198; /* cyan */ -} - -.token.entity { - color: #657b83; /* base00 */ - background: #eee8d5; /* base2 */ -} - -.token.atrule, -.token.attr-value, -.token.keyword { - color: #859900; /* green */ -} - -.token.function, -.token.class-name { - color: #b58900; /* yellow */ -} - -.token.regex, -.token.important, -.token.variable { - color: #cb4b16; /* orange */ -} - -.token.important, -.token.bold { - font-weight: bold; -} - -.token.italic { - font-style: italic; -} - -.token.entity { - cursor: help; -} - -body { - font-family: Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif; - font-size: 16px; - padding-top: 1em; - padding-bottom: 1em; -} - -pre, code { - font-family: Consolas, monaco, monospace; - font-size: 16px; - margin: 0 !important; - border-radius: 0 !important; - padding-top: 0.5em !important; - padding-bottom: 0.5em !important; -} - -a { - color: #2AA198; /* #4078f2 */ - text-decoration: none; -} - -a:hover { - text-decoration: underline; - color: #1D6E68; -} - -p { - max-width: 40em; - line-height: 1.5; -} - -h1, h2, h3, h4 { - margin: 1.414em 0 0.5em; - font-weight: inherit; - line-height: 1.2; -} - -h1 { - margin-top: 0; - font-size: 2.441em; -} - -h2 {font-size: 1.953em;} - -h3 {font-size: 1.563em;} - -h4 {font-size: 1.25em;} - -small, .font_small {font-size: 0.8em;} - -button { - font-size: 1em; - background-color: transparent; - border: 0; - cursor: pointer; - padding: 0; - color: #2AA198; -} - -button:hover { - color: #1D6E68; -} - -button .icon { - vertical-align: middle; -} - -button .icon svg { - fill: #2AA198; -} - -button:hover .icon svg { - fill: #1D6E68; -} - -.button { - background-color: #2AA198; - color: #FFF; - padding: 0.5em 1em; - border-radius: 1em; -} - -.button:hover { - color: #FFF; - background-color: #1D6E68; - text-decoration: none; -} - -.button .icon { - vertical-align: middle; -} - -.button .icon svg { - fill: #FFF; -} - -.clearfix:after { - content: ""; - display: table; - clear: both; -} - -.container { - width: 90%; - margin-left: auto; - margin-right: auto; -} - -@media only screen and (min-width: 33.75em) { /* 540px */ - .container { - width: 80%; - } -} - -.center { - margin-left: auto; - margin-right: auto; -} - -.right { - float: right; -} - -.doc { - padding: 0.5em 0; -} - -.subtitle { - margin-top: 0; -} - -.description { - max-width: 25em; -} - -.grid-code { - display: grid; - grid-template-columns: 400px 1fr; - grid-column-gap: 3em; -} - -.grid-code .code { - background-color: #FDF6E3; -} - -.grid-toc { - display: grid; - grid-template-columns: 2fr 1fr; - grid-column-gap: 3em; -} - -.navigate-links { - margin: 1em 0; - float: right; -} - -.navigate-links .icon { - vertical-align: middle; -} - -.navigate-links .icon svg { - fill: #2AA198; -} - -.navigate-links:hover .icon svg { - fill: #1D6E68; -} - -.navigate-links a { - margin-left: 1em; -} - -.navigate-links a:hover { - text-decoration: none; -} - -.table-of-contents { - padding: 2em; -} - -.table-of-contents ol { - margin: 1em 0; - padding-left: 1em; -} - -.table-of-contents .section-title { - font-weight: bold; - font-size: 0.8em; - margin-top: 1em; -} - -.icon { - width: 1em; - display: inline-block; -} - -.home-title-wrapper { - display: grid; - grid-template-columns: 175px 1fr; - grid-template-rows: 1fr 1fr; -} - -.home-title { - -} - -.home-subtitle { - margin-top: 0; - grid-column-start: 2; - grid-column-end: 3; -} - -.home-logo { - grid-row-start: 1; - grid-row-end: 3; -} - -.home-logo svg { - width: 150px; - height: 100px; -} - -.menu { - margin-left: 2em; - margin-bottom: 1em; -} - -.modal { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: 50; - overflow: auto; - background-color: rgba(0, 0, 0, .4); -} - -.modal-content { - display: block; - position: relative; - padding: 1em; - background-color: #FFF; - max-width: 15em; - height: 100%; - -webkit-animation-name: animateleft; - animation-name: animateleft; - -webkit-animation-duration: .4s; - animation-duration: .4s; - overflow: scroll; - box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.4); -} - -.closed { - display: none; -} - -@-webkit-keyframes animateleft { - from {left: -300px; opacity: 0} - to {left: 0; opacity: 1} -} - -@keyframes animateleft { - from {left: -300px; opacity: 0} - to {left: 0; opacity: 1} -} diff --git a/docs/favicon-32.png b/docs/favicon-32.png deleted file mode 100644 index 9bf983c4a2ff1afb96e73cb1cbc54f5cd2611d3f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1348 zcmV-K1-tr*P)FVmLabaP>2Ph)2RKU<4zP-Kuc5Q9#2j%7E z9~BoD*W~Bt=VfPSN8a)JODGiL0D@-d@bJ)aaB#5ga5%og{Ca$R+?^~Kk&S_Yfd>^8 z72nj<)Z8j4C{V#H*Pou?DSpXv4bioCo$ zIeg+}8Rj+Z1)FlEQdtTUK9@7^glYQw`|sD+*H2VeSJ%kp$!xv(lwdIEhfh6AhF@7x zQBiwkW#t>`1VS*uiW`x)%L;~Ad9AFh?0uMqb#;pAgpR>FJ5n>3j^q5EB?gjtU-s z7fCFk@?-^&W6a1me=>tXV$&e2-ki~rMFDwaXAaD)O-@d_X*&}$B!`^v3N45L(vk8& z6a~S|0u)d=UsWNT~7w6?bP@z~gy89<_}5GW=Grf9nAGbs7o`ue&R{caFZRe+u( zpBx(I6zA2qrF$xds6iosa9XX_hr`3ezu<8U5Rzj8L;WnexoFa(;syu&(q^-LjxwP` z%XtrVt3D?u=N>>6AzSC+UWMGGK#Lim-WMI+&qkwhdSYV2O88O*!-EM04p9(#8bmiL z?cbxLqed*r370V`+W5MY?%Wv49Z}F^zCaQ3rhGVrOUPdo0q*3Mo$nM(FJ9tki0?dJ0_{ zySuw4_{^`kjq8Y_UcFy;Wlj#T~$vgZ@*%NQ6Q5u(L+b2-37vn(Mcv!L(rAZa~8wjJ&3 z>-!OpV~QKerE3r~VPw?jaLfbL5Do5q0C0rq#(awB--4B&W@l&5Ae#|Jq?eHzCISCv zc^yuA2L;gw^Egp^95XXB5&&}6v^%T>BHmR37w`9sKK~bjZ7B3?5#q7{0000 - - - - - - Functions - - - - - - - - - - - -
-

Functions

-

Reusable code

-
<?php
-
-
A function allows you to store code under a name and then execute that code later.

-
A function always starts with the function keyword followed by the name with parentheses and then opening and closing curly braces around the code.
function hello_world() {
-    echo "hello world\n";
-}
-
-
To call the function, use the function name with parentheses.
hello_world();
-
-
You can set up values to be passed into a function. To do so, write variables in between the function parentheses. Each one should be separated by a comma.
function greet($firstname, $lastname) {
-    echo "hello $firstname $lastname\n";
-}
-
-
Then, you can pass in values when calling a function. In the greet function, 'John' is assigned to $firstname and 'Smith' is assigned to $lastname.
greet('John', 'Smith');
-
-
You can also return a value from a function. You can only return a single value from a function.
function capitalize($value) {
-    return strtoupper($value);
-}
-
-
When calling a function, it will output the return value which you can load into a variable.
$animal = capitalize('dog');
-echo "$animal\n";
-
-
You can also create nameless functions called closures. Closures can be stored in variables or passed into other functions.
$sum = function ($a, $b) {
-    return $a + $b;
-};
-
-
You can execute a closure by putting parentheses after the variable.
echo $sum(1, 2) . "\n";
-
-
- -
- - - - - - diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index c447757..0000000 --- a/docs/index.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - PHP Apprentice - - - - - - - - - -
-
-
-
- -

PHP Apprentice (beta)

-

A site for learning how to use PHP

-
-

- The goal of PHP Apprentice is to be an easy to understand resource for learning how to write good code in the PHP programming language. There are a lot of PHP tutorials on the internet that use outdated libraries, insecure programming practices or inefficient code. I want this site to show how to write PHP code with quality. -

-

- The site currently has content for learning the basics of PHP. In the future, more pages will be added for more advanced topics like building websites, database integration and security. -

-

- PHP Apprentice is currently a work in progress (hence "beta" is included in the title). If you would like to contribute or request a certain discussion topic, checkout the GitHub repository. -

-

- To get started, you will need to install PHP 7.1, have a text editor and open your terminal. - Each example in PHP Apprentice can by typed into a PHP file and executed in the terminal. - Let's get started! πŸ˜ƒ -

- -
- Open First Chapter -
-
- -
-
- - - - diff --git a/docs/js/site.js b/docs/js/site.js deleted file mode 100644 index 427eada..0000000 --- a/docs/js/site.js +++ /dev/null @@ -1,1103 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = "/"; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./assets/js/site.js"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./assets/js/site.js": -/*!***************************!*\ - !*** ./assets/js/site.js ***! - \***************************/ -/*! no exports provided */ -/*! all exports used */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_prismjs_components_prism_core__ = __webpack_require__(/*! prismjs/components/prism-core */ "./node_modules/prismjs/components/prism-core.js"); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_prismjs_components_prism_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_prismjs_components_prism_core__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prismjs_components_prism_clike__ = __webpack_require__(/*! prismjs/components/prism-clike */ "./node_modules/prismjs/components/prism-clike.js"); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prismjs_components_prism_clike___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_prismjs_components_prism_clike__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_prismjs_components_prism_markup__ = __webpack_require__(/*! prismjs/components/prism-markup */ "./node_modules/prismjs/components/prism-markup.js"); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_prismjs_components_prism_markup___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_prismjs_components_prism_markup__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_prismjs_components_prism_markup_templating__ = __webpack_require__(/*! prismjs/components/prism-markup-templating */ "./node_modules/prismjs/components/prism-markup-templating.js"); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_prismjs_components_prism_markup_templating___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_prismjs_components_prism_markup_templating__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_prismjs_components_prism_php__ = __webpack_require__(/*! prismjs/components/prism-php */ "./node_modules/prismjs/components/prism-php.js"); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_prismjs_components_prism_php___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_prismjs_components_prism_php__); - - - - - - - -var onLoad = function onLoad() { - __WEBPACK_IMPORTED_MODULE_0_prismjs_components_prism_core___default.a.highlightAll(); - - var menuButton = document.querySelector('.menu-button'); - - // stop execution if menu button does not exist on page - if (!menuButton) { - return; - } - - var modalButton = document.querySelector('.modal-button'); - var modal = document.querySelector('.modal'); - var modalContent = document.querySelector('.modal-content'); - var clickEvent = function clickEvent(e) { - var modal = document.querySelector('.modal'); - - if (modal.classList.contains('closed')) { - modal.classList.remove('closed'); - } else { - modal.classList.add('closed'); - } - }; - - menuButton.addEventListener('click', clickEvent); - modalButton.addEventListener('click', clickEvent); - modal.addEventListener('click', function (e) { - var target = e.target; - do { - if (target == modalContent) { - return; - } - target = target.parentNode; - } while (target); - - modal.classList.add('closed'); - }); -}; - -document.onkeydown = function (e) { - e = e || window.event; - - var isEscape = false; - if ("key" in e) { - isEscape = e.key == "Escape" || e.key == "Esc"; - } else { - isEscape = e.keyCode == 27; - } - - if (isEscape) { - var modal = document.querySelector('.modal'); - if (modal && !modal.classList.contains('closed')) { - modal.classList.add('closed'); - } - } -}; - -if (document.readyState !== 'loading') { - onLoad(); -} else { - document.addEventListener('DOMContentLoaded', onLoad); -} - -/***/ }), - -/***/ "./node_modules/prismjs/components/prism-clike.js": -/*!********************************************************!*\ - !*** ./node_modules/prismjs/components/prism-clike.js ***! - \********************************************************/ -/*! dynamic exports provided */ -/***/ (function(module, exports) { - -Prism.languages.clike = { - 'comment': [ - { - pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, - lookbehind: true - }, - { - pattern: /(^|[^\\:])\/\/.*/, - lookbehind: true, - greedy: true - } - ], - 'string': { - pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, - greedy: true - }, - 'class-name': { - pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i, - lookbehind: true, - inside: { - punctuation: /[.\\]/ - } - }, - 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/, - 'boolean': /\b(?:true|false)\b/, - 'function': /[a-z0-9_]+(?=\()/i, - 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i, - 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/, - 'punctuation': /[{}[\];(),.:]/ -}; - - -/***/ }), - -/***/ "./node_modules/prismjs/components/prism-core.js": -/*!*******************************************************!*\ - !*** ./node_modules/prismjs/components/prism-core.js ***! - \*******************************************************/ -/*! dynamic exports provided */ -/*! exports used: default */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(global) {var _self = (typeof window !== 'undefined') - ? window // if in browser - : ( - (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) - ? self // if in worker - : {} // if in node js - ); - -/** - * Prism: Lightweight, robust, elegant syntax highlighting - * MIT license http://www.opensource.org/licenses/mit-license.php/ - * @author Lea Verou http://lea.verou.me - */ - -var Prism = (function(){ - -// Private helper vars -var lang = /\blang(?:uage)?-([\w-]+)\b/i; -var uniqueId = 0; - -var _ = _self.Prism = { - manual: _self.Prism && _self.Prism.manual, - disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler, - util: { - encode: function (tokens) { - if (tokens instanceof Token) { - return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias); - } else if (_.util.type(tokens) === 'Array') { - return tokens.map(_.util.encode); - } else { - return tokens.replace(/&/g, '&').replace(/ text.length) { - // Something went terribly wrong, ABORT, ABORT! - return; - } - - if (str instanceof Token) { - continue; - } - - if (greedy && i != strarr.length - 1) { - pattern.lastIndex = pos; - var match = pattern.exec(text); - if (!match) { - break; - } - - var from = match.index + (lookbehind ? match[1].length : 0), - to = match.index + match[0].length, - k = i, - p = pos; - - for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) { - p += strarr[k].length; - // Move the index i to the element in strarr that is closest to from - if (from >= p) { - ++i; - pos = p; - } - } - - // If strarr[i] is a Token, then the match starts inside another Token, which is invalid - if (strarr[i] instanceof Token) { - continue; - } - - // Number of tokens to delete and replace with the new match - delNum = k - i; - str = text.slice(pos, p); - match.index -= pos; - } else { - pattern.lastIndex = 0; - - var match = pattern.exec(str), - delNum = 1; - } - - if (!match) { - if (oneshot) { - break; - } - - continue; - } - - if(lookbehind) { - lookbehindLength = match[1] ? match[1].length : 0; - } - - var from = match.index + lookbehindLength, - match = match[0].slice(lookbehindLength), - to = from + match.length, - before = str.slice(0, from), - after = str.slice(to); - - var args = [i, delNum]; - - if (before) { - ++i; - pos += before.length; - args.push(before); - } - - var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy); - - args.push(wrapped); - - if (after) { - args.push(after); - } - - Array.prototype.splice.apply(strarr, args); - - if (delNum != 1) - _.matchGrammar(text, strarr, grammar, i, pos, true, token); - - if (oneshot) - break; - } - } - } - }, - - tokenize: function(text, grammar, language) { - var strarr = [text]; - - var rest = grammar.rest; - - if (rest) { - for (var token in rest) { - grammar[token] = rest[token]; - } - - delete grammar.rest; - } - - _.matchGrammar(text, strarr, grammar, 0, 0, false); - - return strarr; - }, - - hooks: { - all: {}, - - add: function (name, callback) { - var hooks = _.hooks.all; - - hooks[name] = hooks[name] || []; - - hooks[name].push(callback); - }, - - run: function (name, env) { - var callbacks = _.hooks.all[name]; - - if (!callbacks || !callbacks.length) { - return; - } - - for (var i=0, callback; callback = callbacks[i++];) { - callback(env); - } - } - } -}; - -var Token = _.Token = function(type, content, alias, matchedStr, greedy) { - this.type = type; - this.content = content; - this.alias = alias; - // Copy of the full string this token was created from - this.length = (matchedStr || "").length|0; - this.greedy = !!greedy; -}; - -Token.stringify = function(o, language, parent) { - if (typeof o == 'string') { - return o; - } - - if (_.util.type(o) === 'Array') { - return o.map(function(element) { - return Token.stringify(element, language, o); - }).join(''); - } - - var env = { - type: o.type, - content: Token.stringify(o.content, language, parent), - tag: 'span', - classes: ['token', o.type], - attributes: {}, - language: language, - parent: parent - }; - - if (o.alias) { - var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias]; - Array.prototype.push.apply(env.classes, aliases); - } - - _.hooks.run('wrap', env); - - var attributes = Object.keys(env.attributes).map(function(name) { - return name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"'; - }).join(' '); - - return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + ''; - -}; - -if (!_self.document) { - if (!_self.addEventListener) { - // in Node.js - return _self.Prism; - } - - if (!_.disableWorkerMessageHandler) { - // In worker - _self.addEventListener('message', function (evt) { - var message = JSON.parse(evt.data), - lang = message.language, - code = message.code, - immediateClose = message.immediateClose; - - _self.postMessage(_.highlight(code, _.languages[lang], lang)); - if (immediateClose) { - _self.close(); - } - }, false); - } - - return _self.Prism; -} - -//Get current script and highlight -var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop(); - -if (script) { - _.filename = script.src; - - if (!_.manual && !script.hasAttribute('data-manual')) { - if(document.readyState !== "loading") { - if (window.requestAnimationFrame) { - window.requestAnimationFrame(_.highlightAll); - } else { - window.setTimeout(_.highlightAll, 16); - } - } - else { - document.addEventListener('DOMContentLoaded', _.highlightAll); - } - } -} - -return _self.Prism; - -})(); - -if (typeof module !== 'undefined' && module.exports) { - module.exports = Prism; -} - -// hack for components to work correctly in node.js -if (typeof global !== 'undefined') { - global.Prism = Prism; -} - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) - -/***/ }), - -/***/ "./node_modules/prismjs/components/prism-markup-templating.js": -/*!********************************************************************!*\ - !*** ./node_modules/prismjs/components/prism-markup-templating.js ***! - \********************************************************************/ -/*! dynamic exports provided */ -/***/ (function(module, exports) { - -Prism.languages['markup-templating'] = {}; - -Object.defineProperties(Prism.languages['markup-templating'], { - buildPlaceholders: { - // Tokenize all inline templating expressions matching placeholderPattern - // If the replaceFilter function is provided, it will be called with every match. - // If it returns false, the match will not be replaced. - value: function (env, language, placeholderPattern, replaceFilter) { - if (env.language !== language) { - return; - } - - env.tokenStack = []; - - env.code = env.code.replace(placeholderPattern, function(match) { - if (typeof replaceFilter === 'function' && !replaceFilter(match)) { - return match; - } - var i = env.tokenStack.length; - // Check for existing strings - while (env.code.indexOf('___' + language.toUpperCase() + i + '___') !== -1) - ++i; - - // Create a sparse array - env.tokenStack[i] = match; - - return '___' + language.toUpperCase() + i + '___'; - }); - - // Switch the grammar to markup - env.grammar = Prism.languages.markup; - } - }, - tokenizePlaceholders: { - // Replace placeholders with proper tokens after tokenizing - value: function (env, language) { - if (env.language !== language || !env.tokenStack) { - return; - } - - // Switch the grammar back - env.grammar = Prism.languages[language]; - - var j = 0; - var keys = Object.keys(env.tokenStack); - var walkTokens = function (tokens) { - if (j >= keys.length) { - return; - } - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - if (typeof token === 'string' || (token.content && typeof token.content === 'string')) { - var k = keys[j]; - var t = env.tokenStack[k]; - var s = typeof token === 'string' ? token : token.content; - - var index = s.indexOf('___' + language.toUpperCase() + k + '___'); - if (index > -1) { - ++j; - var before = s.substring(0, index); - var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar, language), 'language-' + language, t); - var after = s.substring(index + ('___' + language.toUpperCase() + k + '___').length); - var replacement; - if (before || after) { - replacement = [before, middle, after].filter(function (v) { return !!v; }); - walkTokens(replacement); - } else { - replacement = middle; - } - if (typeof token === 'string') { - Array.prototype.splice.apply(tokens, [i, 1].concat(replacement)); - } else { - token.content = replacement; - } - - if (j >= keys.length) { - break; - } - } - } else if (token.content && typeof token.content !== 'string') { - walkTokens(token.content); - } - } - }; - - walkTokens(env.tokens); - } - } -}); - -/***/ }), - -/***/ "./node_modules/prismjs/components/prism-markup.js": -/*!*********************************************************!*\ - !*** ./node_modules/prismjs/components/prism-markup.js ***! - \*********************************************************/ -/*! dynamic exports provided */ -/***/ (function(module, exports) { - -Prism.languages.markup = { - 'comment': //, - 'prolog': /<\?[\s\S]+?\?>/, - 'doctype': //i, - 'cdata': //i, - 'tag': { - pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i, - greedy: true, - inside: { - 'tag': { - pattern: /^<\/?[^\s>\/]+/i, - inside: { - 'punctuation': /^<\/?/, - 'namespace': /^[^\s>\/:]+:/ - } - }, - 'attr-value': { - pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i, - inside: { - 'punctuation': [ - /^=/, - { - pattern: /(^|[^\\])["']/, - lookbehind: true - } - ] - } - }, - 'punctuation': /\/?>/, - 'attr-name': { - pattern: /[^\s>\/]+/, - inside: { - 'namespace': /^[^\s>\/:]+:/ - } - } - - } - }, - 'entity': /&#?[\da-z]{1,8};/i -}; - -Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = - Prism.languages.markup['entity']; - -// Plugin to make entity title show the real entity, idea by Roman Komarov -Prism.hooks.add('wrap', function(env) { - - if (env.type === 'entity') { - env.attributes['title'] = env.content.replace(/&/, '&'); - } -}); - -Prism.languages.xml = Prism.languages.markup; -Prism.languages.html = Prism.languages.markup; -Prism.languages.mathml = Prism.languages.markup; -Prism.languages.svg = Prism.languages.markup; - - -/***/ }), - -/***/ "./node_modules/prismjs/components/prism-php.js": -/*!******************************************************!*\ - !*** ./node_modules/prismjs/components/prism-php.js ***! - \******************************************************/ -/*! dynamic exports provided */ -/***/ (function(module, exports) { - -/** - * Original by Aaron Harun: http://aahacreative.com/2012/07/31/php-syntax-highlighting-prism/ - * Modified by Miles Johnson: http://milesj.me - * - * Supports the following: - * - Extends clike syntax - * - Support for PHP 5.3+ (namespaces, traits, generators, etc) - * - Smarter constant and function matching - * - * Adds the following new token classes: - * constant, delimiter, variable, function, package - */ -(function (Prism) { - Prism.languages.php = Prism.languages.extend('clike', { - 'keyword': /\b(?:and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i, - 'constant': /\b[A-Z0-9_]{2,}\b/, - 'comment': { - pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, - lookbehind: true - } - }); - - Prism.languages.insertBefore('php', 'string', { - 'shell-comment': { - pattern: /(^|[^\\])#.*/, - lookbehind: true, - alias: 'comment' - } - }); - - Prism.languages.insertBefore('php', 'keyword', { - 'delimiter': { - pattern: /\?>|<\?(?:php|=)?/i, - alias: 'important' - }, - 'variable': /\$+(?:\w+\b|(?={))/i, - 'package': { - pattern: /(\\|namespace\s+|use\s+)[\w\\]+/, - lookbehind: true, - inside: { - punctuation: /\\/ - } - } - }); - - // Must be defined after the function pattern - Prism.languages.insertBefore('php', 'operator', { - 'property': { - pattern: /(->)[\w]+/, - lookbehind: true - } - }); - - Prism.languages.insertBefore('php', 'string', { - 'nowdoc-string': { - pattern: /<<<'([^']+)'(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;/, - greedy: true, - alias: 'string', - inside: { - 'delimiter': { - pattern: /^<<<'[^']+'|[a-z_]\w*;$/i, - alias: 'symbol', - inside: { - 'punctuation': /^<<<'?|[';]$/ - } - } - } - }, - 'heredoc-string': { - pattern: /<<<(?:"([^"]+)"(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;|([a-z_]\w*)(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\2;)/i, - greedy: true, - alias: 'string', - inside: { - 'delimiter': { - pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i, - alias: 'symbol', - inside: { - 'punctuation': /^<<<"?|[";]$/ - } - }, - 'interpolation': null // See below - } - }, - 'single-quoted-string': { - pattern: /'(?:\\[\s\S]|[^\\'])*'/, - greedy: true, - alias: 'string' - }, - 'double-quoted-string': { - pattern: /"(?:\\[\s\S]|[^\\"])*"/, - greedy: true, - alias: 'string', - inside: { - 'interpolation': null // See below - } - } - }); - // The different types of PHP strings "replace" the C-like standard string - delete Prism.languages.php['string']; - - var string_interpolation = { - pattern: /{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[.+?]|->\w+)*)/, - lookbehind: true, - inside: { - rest: Prism.languages.php - } - }; - Prism.languages.php['heredoc-string'].inside['interpolation'] = string_interpolation; - Prism.languages.php['double-quoted-string'].inside['interpolation'] = string_interpolation; - - Prism.hooks.add('before-tokenize', function(env) { - if (!/(?:<\?php|<\?)/ig.test(env.code)) { - return; - } - - var phpPattern = /(?:<\?php|<\?)[\s\S]*?(?:\?>|$)/ig; - Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern); - }); - - Prism.hooks.add('after-tokenize', function(env) { - Prism.languages['markup-templating'].tokenizePlaceholders(env, 'php'); - }); - -}(Prism)); - -/***/ }), - -/***/ "./node_modules/webpack/buildin/global.js": -/*!***********************************!*\ - !*** (webpack)/buildin/global.js ***! - \***********************************/ -/*! dynamic exports provided */ -/*! all exports used */ -/***/ (function(module, exports) { - -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || Function("return this")() || (1,eval)("this"); -} catch(e) { - // This works if the window reference is available - if(typeof window === "object") - g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/docs/loops.html b/docs/loops.html deleted file mode 100644 index 1c99a07..0000000 --- a/docs/loops.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - Loops - - - - - - - - - - - -
-

Loops

-

Increase your repetitions

-
<?php
-
-
A loop tells PHP to run a block of code more than once. A classic loop is a while loop. A "while" loop will continue to run the block of code as long as the value in parentheses is true.
$num = 5;
-while ($num > 0) {
-    echo "While loop $num\n";
-    --$num;
-}
-
-
A "do while" loop is similar to a "while" loop except it always runs at least one iteration. In a classic "while" loop, no iterations may be executed if the value in parentheses is false. In a "do while", the boolean check is not done until after the execution of an iteration.
$num = 0;
-do {
-    echo "Do while $num\n";
-    ++$num;
-} while ($num < 5);
-
-
"for" loops allow you to create a more concise while loop. Inside the parentheses, the left section creates a variable before the loop starts, the middle section is the check that is done at the beginning of each loop and the third section is executed after each loop.
for ($i = 0; $i < 10; $i++) {
-    echo "For loop $i\n";
-}
-
-
A "foreach" loop allows you to easily loop over an array. An array is a list of data stored together. The "as" keyword lets you assign a variable to the value in the array for the current iteration of the loop.
$set = [1, 2, 3, 4, 5];
-foreach ($set as $num) {
-    echo "Array value $num\n";
-}
-
-
In loops, you can use the keyword "break" to stop the loop execution no matter how many more iterations should run.
$values = ['one', 'two', 'three'];
-foreach ($values as $value) {
-    if ($value === 'two') {
-        break;
-    }
-    echo "Break $value\n";
-}
-
-
The "continue" keyword stops executing the current loop iteration, but then allows the loop to continue with other iterations.
$values = ['one', 'skip', 'three'];
-foreach ($values as $value) {
-    if ($value === 'skip') {
-        continue;
-    }
-    echo "Continue $value\n";
-}
-
-
- -
- - - - - - diff --git a/docs/manifest.json b/docs/manifest.json deleted file mode 100644 index 22b0fbd..0000000 --- a/docs/manifest.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "js/site.js": "/js/site.js", - "css/site.css": "/css/site.css" -} \ No newline at end of file diff --git a/docs/variables.html b/docs/variables.html deleted file mode 100644 index 66a105d..0000000 --- a/docs/variables.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - Variables - - - - - - - - - - - -
-

Variables

-

The building blocks of PHP

-
<?php
-
-
The variable is the basic building block of any programming language. In PHP, all variables start with a dollar sign.
$greeting;
-
-
To set data in a variable, you put an equals sign after it and some data.
$greeting = 'Hello World!';
-
-
Once you create a variable, you can use it again in other commands and functions.
echo $greeting;
-
-
After the dollar sign, a PHP variable must have an alphabetic character or underscore. Also, variables are case sensitive.
$_var = 'I am a variable with an underscore!';
-$Var = 'I am a variable with a capital letter!';
-$var = 'I am a new variable';
-
-
Variables can hold many different types of data, but there are four simple ones you can try now. An int is a number without a decimal place. A float is a number with a decimal place. A boolean can be two values: true or false. Last, there is a string, a collection of characters.
$int = 1;
-$float = 100.10;
-$bool = true;
-$string = 'I am a string';
-
-
In other programming languages, you have to write what type of data the variable will contain. PHP keeps it simple by allowing you to put any type of data in a variable, including already used variables.
$number = 1;
-$number = 'one';
-
-
- -
- - - - - -