[go: up one dir, main page]

0% found this document useful (0 votes)
292 views5 pages

Lesson Plan PHP 8

This one-week lesson plan introduces basic programming concepts to students. It will cover what a computer and computer program are, conditional flow statements like if/else statements and logical operators, loops, functions, Booleans, and bitmasks. Topics will be presented through lecture, whiteboarding, and hands-on lab work. The objective is to provide foundational knowledge of computer fundamentals and programming.

Uploaded by

Naima Ibrahim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
292 views5 pages

Lesson Plan PHP 8

This one-week lesson plan introduces basic programming concepts to students. It will cover what a computer and computer program are, conditional flow statements like if/else statements and logical operators, loops, functions, Booleans, and bitmasks. Topics will be presented through lecture, whiteboarding, and hands-on lab work. The objective is to provide foundational knowledge of computer fundamentals and programming.

Uploaded by

Naima Ibrahim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

LESSON PLAN 1

Subject : Web Development (PHP)

Topic : Introduction to Basic Programming

Time : 1 week

Place : Class Room Lab

Method : Lecture

Training Aids : White Board / Marker / Multimedia / PC

Instructor : Naima Ibrahim Joo

HOD Signature : _______________


Objective:
The objective of this lesson will be to provide basic concepts of computer fundamentals and
computer programming.

Following topics will be covered in this lesson.

 What is computer and a computer program?


 Introducing conditional flow statements
 The mechanisms for control flow statements
 Implementing a simple if statement in PHP
 More about if statements and logical operators
 Introducing Logical OR
 Introducing Loops in PHP
 Introducing the While Loop in PHP
 Introducing Custom Functions in PHP
 Introducing Booleans
 Introducing Bitmasks
 Changing data using Bitmasks

What is computer and a computer program?

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

 < less than


 > greater than
 <= less than or equal to
 >= greater than or equal to
 == is equal to
 != is not equal to

Relational expressions evaluate to true or false. All of these operators are called binary operators
because they take two expressions as operands.

Selection: the if statement

if( condition ){

statement(s) // body of if statement

Selection: the if-else statement

if( condition ){

statement(s) /* the if clause */

} else {

statement(s) /* the else clause */

}
Nesting of if-else Statements

if(condition1) {

statement(s)

} else if(condition2) {

statement(s)

} . . . /* more else if clauses may be here

*/ else {

statement(s) /* the default case */

The switch Multiple-Selection Structure

switch ( expression ) {

case value1 : statement(s) break ;

case value2 : statement(s) break ;

...

default: statement(s) break ;

Logical Operators

So far we have seen only simple conditions.

If (count > 10) . . .

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.

 && is AND if (x > 5 && y < 6)


 || is OR if (z == 0 || x > 10)
 ! is NOT if (!(bob > 42))

A boolean expresses a truth value. It can be either TRUE or FALSE.


What is a bitmask?

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")

You might also like