mirror of
https://github.com/restoreddev/phpapprentice.git
synced 2025-07-13 19:46:18 +02:00
More proofreading
This commit is contained in:
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
|
Reference in New Issue
Block a user