Skip to content

Commit

Permalink
Add note on Exclamation mark ! logical operator (#220)
Browse files Browse the repository at this point in the history
Reference #113
  • Loading branch information
photodude authored and wilsonge committed Mar 24, 2019
1 parent 148bb42 commit 8a70e4d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion manual/php.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ For all control structures there is a space between the keyword and an opening p

For all all control structures, such as `if`, `else`, `do`, `for`, `foreach`, `try`, `catch`, `switch` and `while`, both the keyword starts a newline and the opening and closing braces are each put on a new line.

Exclamation mark `!`, the logical operator `not` used in a condition, should not have spaces before or after the exclamation mark as shown in the examples.

#### An _if-else_ Example

```php
Expand All @@ -55,11 +57,14 @@ if ($test)

// Comments can go here.
// Note that "elseif" as one word is used.

elseif ($test === false)
{
echo 'Really false';
}
elseif (!$condition)
{
echo 'Not Condition';
}
else
{
echo 'A white lie';
Expand Down

0 comments on commit 8a70e4d

Please sign in to comment.