1
0
mirror of https://github.com/restoreddev/phpapprentice.git synced 2025-07-30 19:40:43 +02:00

Merge pull request #17 from restoreddev/develop

Proofreading and home page edits
This commit is contained in:
Andrew
2018-12-26 19:18:38 -06:00
committed by GitHub
8 changed files with 18 additions and 13 deletions

View File

@@ -6,7 +6,6 @@
<title><?= $title ?? 'PHP Apprentice' ?></title>
<meta name="description" content="<?= $subtitle ?? 'A site for learning how to use PHP' ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="<?php echo asset('css/site.css') ?>">
<link rel="icon" href="/favicon-32.png">

View File

@@ -5,7 +5,7 @@
<div>
<div class="home-title-wrapper">
<div class="home-logo"><?= icon('elephant') ?></div>
<h1 class="home-title">PHP Apprentice <em>(beta)</em></h1>
<h1 class="home-title">PHP Apprentice</h1>
<h3 class="home-subtitle">A site for learning how to use PHP</h3>
</div>
<p>
@@ -15,10 +15,10 @@
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.
</p>
<p>
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 <a href="https://github.com/restoreddev/phpapprentice" target="_blank">GitHub repository</a>.
PHP Apprentice is currently a work in progress. If you would like to contribute or request a certain discussion topic, checkout the <a href="https://github.com/restoreddev/phpapprentice" target="_blank">GitHub repository</a>.
</p>
<p>
To get started, you will need to <a href="<?php echo page_path('installing-php') ?>">install</a> PHP 7.1, have a text editor and open your terminal.
To get started, you will need to <a href="<?php echo page_path('installing-php') ?>">install</a> PHP, 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! 😃
</p>

View File

@@ -5,10 +5,10 @@ $a = 1;
$b = 2;
// To add two values, use the plus symbol.
$c = $a + $b;
echo $a + $b;
// To subtract, use the minus symbol.
$c = $b - $a;
echo $b - $a;
// To multiply two values, use an asterisk.
echo $a * $b;
@@ -18,8 +18,8 @@ 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;
// In this example, the value of $mod will be 0.
$mod = 10 % 5;
// You can also use double asterisks to calculate a number to the power of another number.
// The following statement will print 25.

View File

@@ -14,7 +14,7 @@ $a && $b;
$a && $c;
// Using two pipe characters checks if either value is true.
// Then, it will return true. If both values are false, the PHP
// Then, it will return true. If both values are false, then PHP
// returns false.
$a = true;
$b = false;

View File

@@ -2,7 +2,7 @@
// 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.
// While programming, you will often want to know if something is positive or negative.
$a = true;
$b = false;
@@ -35,7 +35,13 @@ $one >= $two;
// by using three equal signs.
// This returns true.
1 == 1;
1 == '1';
1 == true;
1 == 1.0;
1 === 1;
// This returns false.
1 === '1';
1 === true;
1 === 1.0;

View File

@@ -62,7 +62,7 @@ switch ($drink) {
$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.
// Lastly, there is another form of a ternary that checks if a value is set and then returns the value to the right of the two question marks if the value is null.
echo $IDoNotExist ?? "Variable not set\n";
// You can also chain multiple checks in a row.

View File

@@ -19,7 +19,7 @@ $var = 'I am a new variable';
// 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.
// Last, there is a string: a collection of characters.
$int = 1;
$float = 100.10;
$bool = true;

View File

@@ -146,7 +146,7 @@ return [
Page::create('abstract', null, 'abstract.php', [
'title' => 'Abstract Classes',
'subtitle' => 'Inheriting an interface',
'previous' => 'interface',
'previous' => 'interfaces',
'next' => 'exceptions',
]),
Page::create('exceptions', null, 'exceptions.php', [