Learning HTML/CSS? Read Design and Build Websites:
https://amzn.to/2FcOy1Y
Learning JavaScript? Read Eloquent JavaScript:
https://amzn.to/2RL5Qoh
In this video:
(Part 1):
Single/Double Quotes
Escape Characters
PHP Comments
Using heredoc
PHP operators:
-- Arithmetic operators
(Part 2):
-- Comparison operators
-- Shorthand notation operators
-- Increment and Decrement operators (prefix and postfix notation)
Things to Remember:
In PHP, using double quotes will usually substitute values. That is, if you reference values within double quotes, their value will be substituted. In addition, escape characters only work within double quotes.
In PHP, using single quotes will display the values as they are, without any kind of substitution. For instance, variable names will NOT get substituted nor will escape characters be escaped. Moreover, you can freely apply double quotes within a single-quote block whereas when using strings within double-quotes, you have to escape the double quote character in order to use it.
Comments in PHP are C-style: single line comments start with a double-slash: // This is a comment;
multi-line comments are contained within a /* blablabla */ block. Anything within these two comment-delimiting characters will be taken as comments by PHP.
You can have multi-line strings in PHP using heredoc. Place the block of text after the triple less-than-sign followed by an IDENTIFIER name. After typing all the lines you want, type the name of the IDENTIFIER again in a newline, followed by semicolon to end the heredoc statement.
PHP has arithmetic operators for basic math: plus, minus, star (multiplication), division, modulo (represented by the percent sign)
Modulo operator will give you the remainder of the division between two operands
PHP has comparison operators to test two operands for equality or inequality: equal, not equal, less than, greater than, less-than-or-equal-to, greater-than-or-equal-to
PHP also has the triple comparison operators === and !==
The identical operator, ===, checks for BOTH value and type
The not-identical operator, !==, checks for unequal value OR unequal type
You can use shorthand notation operators to type less: += -= *= /= %= .=
Increment/decrement operators increase/decrease the value of variables by one
There are prefix and postfix notations for the increment operator.
In prefix notation, FIRST the variable is increment, THEN its value is used in the expression/statement.
In postfix notation, FIRST the variable VALUE is used, THEN the variable is incremented after the expression/statement has been executed.