Lesson Plan PHP 8
Lesson Plan PHP 8
Time : 1 week
Method : Lecture
A computer program is a collection of instructions that performs a specific task when executed
by a computer. A computer requires programs to function, and typically executes the program's
instructions in a central processing unit
A computer program is usually written by a computer programmer in a programming language.
From the program in its human-readable form of source code, a compiler can derive machine
code—a form consisting of instructions that the computer can directly execute. Alternatively, a
computer program may be executed with the aid of an interpreter.
Introducing conditional flow statements and their mechanism
In computer science, conditional statements, conditional expressions and conditional
constructs are features of a programming language, which perform different computations or
actions depending on whether a programmer-specified Boolean condition evaluates to true or
false.
Relational & Logical Operators, if and switch Statements:
Relational Operators
Relational expressions evaluate to true or false. All of these operators are called binary operators
because they take two expressions as operands.
if( condition ){
if( condition ){
} else {
}
Nesting of if-else Statements
if(condition1) {
statement(s)
} else if(condition2) {
statement(s)
*/ else {
switch ( expression ) {
...
Logical Operators
Sometimes we need to test multiple conditions in order to make a decision. Logical operators
are used for combining simple conditions to make complex conditions.
A bitmask is a pattern of binary values. Bitwise operators allow evaluation and manipulation of
specific bits within an integer.
Bitwise Operators
Example Name Result
$a & $b And Bits that are set in both $a and $b are set.
$a | $b Or (inclusive or) Bits that are set in either $a or $b are set.
$a ^ $b Xor (exclusive Bits that are set in $a or $b but not both are set.
or)
~ $a Not Bits that are set in $a are not set, and vice versa.
$a << $b Shift left Shift the bits of $a $b steps to the left (each step means
"multiply by two")
$a >> $b Shift right Shift the bits of $a $b steps to the right (each step means
"divide by two")