You are on page 1of 2

Web Systems and Technologies 101 - division [/]

(WS 101) - modulus (division remainder) [%]


- exponentiation [**]
Chapter 1: Introduction to PHP b. Relational
+ PHP - is equal to [==]
- is equal and of the same type [===]
- also known as “PHP: Hypertext
- is not equal [!=]
Preprocessor” is an open-source, cross-
- is not equal to or not of the same type [!==]
platform, interpreted and server-side
- is greater than [>]
scripting language that is used to create web
- is less than [<]
applications/sites. It was initially known as
- is greater than or equal to [>=]
Personal Home Page.
- is less than or equal to [<=]
c. Logical
+ Overview of PHP
- and [&&], true if both $x and $y are true
What do I need to run my PHP script? - or [||], true if $x or $y are true
a. Linux or Windows (Operating - not [!], true if $x is not true
System) - xor [xor]
- Linux provides the base operating system d. Other Operators
(OS) and server environment. - concatenation [.]
b. Apache or IIS (HTTP Server) - concatenation assignment [.=]
- the Apache web server intercepts HTTP - increment [++]
request and either serves them directly or - decrement [--]
passes them on to the PHP interpreter for
execution.
c. MySQL (Database) + Conditional Statements
- the MySQL RDBMS serves as the data
storage engine, accepting connections from a. if statement
the PHP layer and inserting, modifying, or syntax:
retrieving data. if (condition) {
d. PHP Package (Authoring tool) // Code to be executed }
- the PHP interpreter parses and executes
PHP code and returns the results to the web b. if-else statement
server. syntax:
if (condition) {
+ Four rules in PHP coding // Code to be executed if
- PHP script starts with <?php and ends with condition is true
?> } else {
- PHP statement must end in a // Code to be executed if
semicolon (;) condition is false }
- Text that is not a command must be put in
quotes c. if-else-if statement
- Any time you have a curly bracket or syntax:
parenthesis, you should have a matching if (condition1) {
end bracket or parenthesis. // Code to be executed if
- The echo is a PHP predefined functions condition1 is true
used to output text, numeric or variable } elseif (czndition2) {
values in the screen display. // Code to be executed if the
- ' ' (single quotes) - content inside single condition1 is false and
quotes is evaluated literally. condition2 is true
- " " (double quotes) - Variables inside double } else {
quotes are evaluated for their values. // Code to be executed if both
condition1 and condition2 are
false }
d. switch statement
+ PHP Operators syntax:
a. Arithmetic switch (n) {
- addition [+] case label1:
- subtraction [-] // Code to be executed if
- multiplication [*] n=label1
break; - are complex variables that allow us to
case label2: store more than one value or a group of
// Code to be executed if values under a single variable name.
n=label2 - syntax:
break; ... $color = array (‘Red’, ‘Green’,
default: ‘Blue’);//the first value index
// Code to be executed if n is number is 0
different from all labels }

+ Repetition Control Structure + Types of Arrays


a. while a. Indexed array
- loops through a block of code as long as - an array with a numeric key.
the condition specified evaluates to true. b. Associative array
syntax: - an array where each key has its own
while (condition) { specific value.
// Code to be executed } c. Multidimensional array
- an array containing one or more arrays
b. do-while within itself.
-the block of code executed once and then
condition is evaluated. If the condition is true + Manipulating Arrays
the statement is repeated as long as the a. array_pop() - pop the element off the end
specified condition is true. of array.
syntax: b. array_push() - push one or more elements
do { onto the end of array.
// Code to be executed c. array_search() - searches the array for a
} while (condition); given value and returns the corresponding
key if successful.
c. for d. sort() - sort an array.
- loops through a block of code until the
counter reaches a specified number.
syntax: Chapter 3:PHP Form Handling and
for(initialization; condition; Validation
increment) {
// Code to be executed } Button

d. foreach Checkbox
- loops through a block of code for each
Hidden
element in an array
Image

Radio

Reset
Chapter 2: Functions and Arrays
Select
+ Functions
- a set of program statements that perform a Submit
specific task, and that can be called, or
executed, from anywhere in your program. Text
You can create a function by using keyword
Textarea
function() and inserting the code in the
function block. File
- syntax:
function myFunc(){
// Code to be executed }

+ Arrays

You might also like