SlideShare una empresa de Scribd logo
1 de 47
Advanced PHP
 PHP Operators
 Control Structures
 PHP Functions
 Arrays
*Property of STI K0032
Operator
is something that you feed with one or more
values
characters or set of characters that perform a
special operation within the PHP code
*Property of STI K0032
Arithmetic Operators
used to perform simple mathematical
operations such as addition, subtraction,
multiplication, division, etc
Example Name Result
$a + $b Addition (+) Sum of $a and $b
$a - $b Subtraction (-) Difference of $a and $b
$a * $b Multiplication (*) Product of $a and $b
$a / $b Division (/) Quotient of $a and $b
$a % $b Modulus (%) Remainder of $a divided
by $b
$a**$b Exponentiation
(**)
Result of raising $a to
the $b‘th power (PHP 5)
*Property of STI K0032
Assignment Operators
used to transfer values to a variable
Operator Assignment Same as Description
= a=b a = b
The left operand
gets the value of
the expression on
the right
+= a+=b a = a + b Addition
-= a-=b a = a – b Subtraction
*= a*=b a = a * b Multiplication
/= a/=b a = a / b Division
%= a%=b a = a % b Modulus
*Property of STI K0032
Comparison Operators
allow you to compare two values
Example Name Result
$a = = $b Equal TRUE if $a is equal to $b.
$a = = = $b Identical TRUE if $a is equal to $b, and they are of
the same type. (PHP 4 only)
$a != $b Not equal TRUE if $a is not equal to $b.
$a <> $b Not equal TRUE if $a is not equal to $b.
$a != = $b Not identical TRUE if $a is not equal to $b, or they are
not of the same type. (PHP 4 only)
$a < $b Less than TRUE if $a is strictly less than $b.
$a > $b Greater than TRUE if $a is strictly greater than $b.
$a <= $b Less than or equal TRUE if $a is less than or equal to $b.
$a >= $b Greater than or
equal
TRUE if $a is greater than or equal to $b.
*Property of STI K0032
Increment/Decrement Operators
 increment operators are used to increase the value of a
variable by 1
 decrement operators are used to decrease the value of
a variable by 1
Example Name Effect
++$a Pre-increment Increment $a by one.Then
returns $a.
$a++ Post-increment Returns $a, then increments
$a by one.
--$a Pre-decrement Decrements $a by one, then
returns $a.
$a-- Post-decrement Returns $a, then decrements
$a by one.
*Property of STI K0032
Increment/Decrement Operators
Sample script
<?php
echo "<h3>Postincrement</h3>";
$a = 5;
echo "Should be 5: " . $a++ . "<br />n";
echo "Should be 6: " . $a . "<br />n";
echo "<h3>Preincrement</h3>";
$a = 5;
echo "Should be 6: " . ++$a . "<br />n";
echo "Should be 6: " . $a . "<br />n";
?
*Property of STI K0032
Logical Operators
used to combine conditional statements
Example Name Result
$a and $b AND TRUE if both $a and $b areTRUE.
$a or $b OR TRUE if either $a or $b isTRUE.
$a xor $b XOR TRUE if either $a or $b isTRUE, but not
both.
! $a NOT TRUE if $a is notTRUE.
$a && $b AND TRUE if both $a and $b areTRUE.
$a | | $b OR TRUE if either $a or $b isTRUE.
*Property of STI K0032
String Operators
 two string operators
 concatenation operator (.) - returns the concatenation of its
right and left arguments
 concatenation assignment operator (.=) - appends the
argument on the right side to the argument on the left side
<?php
$a = "Hello ";
$b = $a . "World!"; // now $b contains "Hello World!"
$a = "Hello ";
$a .= "World!"; // now $a contains "Hello World!"
?>
*Property of STI K0032
PHP Array Operators
PHP array operators are used to compare arrays
Example Name Result
$a + $b Union (+) Union of $a and $b
$a = = $b Equality (==) Returns true of $a and $b have the
same value
$a === $b Identity (===) Returns true if $a and $b have the
same value, same order, and of the
same type
$a != $b Inequality (!=) Returns true if $a is not equal to $b
$a <> $b Inequality (<>) Returns true if $a is not equal to $b
$a !== $b Not-Identity (!==) Returns true if $a is not identical to $b
*Property of STI K0032
Control Structures: IF Statement
The if statement is one of the most important
features of many languages
It allows conditional execution of code
fragments
Use PHP if statement when you want your
program to execute a block of code only if a
specified condition is true
*Property of STI K0032
IF Statement
Syntax:
Example:
If (condition) {
statement to be executed if condition is true;
}
<?php
$t = date("H");
if ($t < "12") {
echo "Good morning!";
}
?>
*Property of STI K0032
If…Else Statement
 This control structure execute some code if a condition is met
and do something else if the condition is not met
 Else extends an if statement to execute a statement in case the
condition in the if statement evaluates to false
 Syntax:
If (condition) {
statement to be executed if condition is
true;
} else {
Statement to be executed if condition is
false;
}
*Property of STI K0032
If…Else Statement
Example:
 The else statement is only executed if the condition in the if
statement is evaluated to false, and if there were any elseif
expressions – only if they evaluated to false as well
<?php
$t = date("H");
if ($t < "12") {
echo "Good morning!";
} else {
echo “Good afternoon!”;
}
?>
*Property of STI K0032
ElseIf Statement
 a combination of if and else
 it extends an if statement to execute a different
statement in case the original if expression evaluates to
FALSE
 Syntax:
If (condition) {
statement to be executed if condition is true;
} elseif (condition) {
Statement to be executed if condition is true;
} else {
Statement to be executed if condition is false;
}
*Property of STI K0032
ElseIf Statement
 Example:
<?php
$t = date("H");
if ($t < "12") {
echo "Good morning!";
} elseif ($t < "18") {
echo "Good afternoon!";
} else {
echo "Have a good evening!";
}
?>
*Property of STI K0032
Switch Statement
 similar to a series of if statements on the same expression
 Syntax:
switch (n) {
case 1:
Statement to be executed if n=case 1;
Break;
case 2:
Statement to be executed if n=case 2;
Break;
case 3:
Statement to be executed if n=case 3;
Break;
...
Default:
Statement to be executed if n is not equal to all cases;
}
*Property of STI K0032
Switch Statement
 Example:
<?php
$fruit = "mango";
switch ($fruit) {
case "apple":
echo "My favorite fruit is apple!";
break;
case "banana":
echo " My favorite fruit is banana!";
break;
case "mango":
echo " My favorite fruit is mango!";
break;
default:
echo "My favorite fruit is not in the list!";
}
?>
*Property of STI K0032
While Statement
While loops are the simplest type of loop in PHP.
They behave like their C counterparts
The basic form of a while statement is
While (condition is true) {
Statement to be executed here...;
}
*Property of STI K0032
While Statement
Example:
<?php
$a = 1;
While ($a <=10) {
echo “The number is: $a <br>”;
$a++;
}
?>
*Property of STI K0032
Do…while statement
do...while loops are very similar to while loops,
except the truth expression is checked at the
end of each iteration instead of in the beginning
do…while statement will always execute the
blocked of code once, it will then checked the
condition, and repeat the loop while the
condition is true
*Property of STI K0032
Do…while statement
Syntax:
Example:
Do {
Statement to be executed;
} while (condition is true);
<?php
$a = 1;
Do {
echo “The number is: $a <br>”;
$a++;
}
While ($a <=10);
?>
*Property of STI K0032
FOR statement
executes block of codes in a specified number of
times
basically used when you know the number of
times the code loop should run
Syntax:
for (initialization; condition; increment)
{
statement to be executed
}
*Property of STI K0032
FOR statement
Initialization: It is mostly used to set
counter
Condition: It is evaluated for each loop
iteration
Increment: Mostly used to increment a
counter
*Property of STI K0032
FOR statement
Example:
Result:
<?php
for ($a = 1; $a <= 5; $a++) {
echo "The number is: $a <br>";
}
?>
*Property of STI K0032
Function
self-contained blocked of codes that
perform a specified “function” or task
executed by a call to the function
can be called anywhere within a page
often accepts one or more parameters
(“also referred to as arguments”) which
you can pass to it
*Property of STI K0032
Function
 Syntax:
 The declaration of a user defined function starts with
the word “function” followed by a short but descriptive
name for that function
function functionName()
{
Statement to be executed;
}
*Property of STI K0032
Function
 Example:
 Result:
<?php
function callMyName()
{
echo "Francesca Custodio";
}
callMyName();
?>
*Property of STI K0032
Function Arguments
 Function arguments are just like variables
 specified right after the function name inside the
parentheses
 Example:
<?php
function MyFamName($Fname){
echo "$Fname Garcia. <br>”;
}
MyFamName("Allen");
MyFamName("Patrick");
MyFamName("Hannah");
?>
*Property of STI K0032
Function returns a value
Function returns a value using the return
statement
Example:
<?php
function sum($a, $b) {
$ab = $a + $b;
return $ab;
}
echo "5 + 10 = " . sum(5, 10) . "<br>";
echo "7 + 13 = " . sum(7, 13) . "<br>";
echo "2 + 4 = " . sum(2, 4);
?>
*Property of STI K0032
 Having 3 car names (Honda, Mazda, and Mitsubishi), how
will you store these car names in a variable?
Answer:
$car1 = “Honda”;
$car2 = “Mazda”;
$car3 = “Mitsubishi”;
 However, what if you want to loop through the cars and
look for a specific one? And what if you had hundreds or
thousands of cars?What will you do?
Answer:
Create an array and store them to a single variable.
*Property of STI K0032
Arrays
PHP array is a special variable which allows you
to store multiple values in a single variable
$cars = array(“Honda”, “Mazda”, “Mitsubishi”);
*Property of STI K0032
Arrays
The values of an array can be accessed by
referring to its index number
Result:
<?php
$cars = array("Honda", "Mazda", "Mitsubishi");
echo "I have " . $cars[0] . ", " . $cars[1] “,” .
", and " . $cars[2] . ".";
?>
*Property of STI K0032
Types of PHP Arrays
Three (3) different types of PHP arrays
Indexed array
Associative array
Multidimensional array
*Property of STI K0032
Indexed Arrays
Indexed arrays or numeric arrays use
number as key
The key is the unique identifier, or id of
each item within an array
index number starts at zero
*Property of STI K0032
Indexed Arrays
Two ways to create an array:
1. Automatic key assignment
2. Manual key assignment
$Fruits = array(“Mango”, ”Santol”, ”Apple”,
“Banana”);
$fruit[0] = “Mango”;
$fruit[1] = “Santol”;
$fruit[2] = “Apple”;
$fruit[3] = “Banana”;
*Property of STI K0032
Array count() function
The count() function is used to return the length (the
number of elements) of an array
Example:
Result:
$fruit = array(“Mango”, ”Santol”, ”Apple”,
“Banana”);
$arrlength=count($fruit);
echo $arrlength;
*Property of STI K0032
Array: displaying specific content
Example:
Result:
$Fruit = array(“Mango”, ”Santol”, ”Apple”,
“Banana”);
echo $fruit[1];
*Property of STI K0032
Looping through Indexed Array
 Loop construct is used to loop through and print all the values of
a numeric array
 For loop structure is best to use in numeric array
<?php
$fruit = array("Mango", "Santol", "Apple",
"Banana");
$arrlength = count($fruit);
for ($i = 0; $i < $arrlength; $i++)
{
echo $fruit[$i];
echo "<br>";
}
?>
*Property of STI K0032
Associative Arrays
arrays that use named keys as you assigned to
them
Associative arrays are similar to numeric arrays
but instead of using a number for the key
it use a value.Then assign another value to the
key
*Property of STI K0032
Associative Arrays
Two options to create an associative array
1. First:
2. Second:
$fruit = array (“Mango”=>”100”, “Santol”=>”200”,
“Apple”=>”300”);
$fruit [‘Mango’] = “100”;
$fruit [‘Santol’] = “200”;
$fruit [‘Apple’] = “300”;
*Property of STI K0032
Displaying the content of an Associative Array
 Displaying the content of an associative array is compared with
numeric or indexed array, by referring to its key
 Example:
 Output:
<?php
$fruit = array("Mango" => "100 per kilo",
"Santol" => "200 per kilo", "Apple" => "300 per
kilo");
echo "Santol:" . $fruit["Santol"];
?>
*Property of STI K0032
Looping through an Associative Array
 Loop construct is used to loop through and print all the
values of an associative array
 For each loop structure is best to use in associative
array
 Example:
<?php
$fruit = array("Mango", "Santol", "Apple", "Banana");
$arrlength = count($fruit);
foreach($fruit as $x => $x_value) {
echo "Key = " . $x . ", Value = " . $x_value;
echo "<br>";
}
?>
*Property of STI K0032
Multidimensional Arrays
an array that contains another array as a value,
which in turn can hold another array as well
This can be done as many times as can be wish –
could have an array inside another array, which
is inside another array, etc
In such a way, it is possible to create two- or
three-dimensional arrays
*Property of STI K0032
Multidimensional Arrays
Name QTY Sold
Mango 100 96
Apple 60 59
Santol 110 100
<?php
$fruit = array
(
array("Mango",100,96),
array("Apple",60,59),
array("Santol",110,100)
);
?>
*Property of STI K0032
Multidimensional Arrays
 The two-dimensional array name $fruit array which has two
indices: row and column - contains three arrays.To get access to
each specific element of the $fruit array, one must point to the
two indices.
 Example:
 Result:
echo $fruit[0][0].": QTY: ".$fruit[0][1].", sold: ".
$fruit[0][2].".<br>";
echo $fruit[1][0].": QTY: ".$fruit[1][1].", sold: ".
$fruit[1][2].".<br>";
echo $fruit[2][0].": QTY: ".$fruit[2][1].", sold: ".
$fruit[2][2].".<br>";
*Property of STI K0032
Multidimensional Arrays
 Using for loop statement to get the element of the $fruit array
Result:
for ($row = 0; $row < 3; $row++) {
echo "<p><b>Row number $row</b></p>";
echo "<ul>";
for ($col = 0; $col < 3; $col++) {
echo "<li>".$fruit[$row][$col]."</li>";
}
echo "</ul>";
}

Más contenido relacionado

La actualidad más candente

07 Introduction to PHP #burningkeyboards
07 Introduction to PHP #burningkeyboards07 Introduction to PHP #burningkeyboards
07 Introduction to PHP #burningkeyboardsDenis Ristic
 
Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2Mohd Harris Ahmad Jaal
 
Zend Certification Preparation Tutorial
Zend Certification Preparation TutorialZend Certification Preparation Tutorial
Zend Certification Preparation TutorialLorna Mitchell
 
Lecture 2 php basics (1)
Lecture 2  php basics (1)Lecture 2  php basics (1)
Lecture 2 php basics (1)Core Lee
 
Elegant Ways of Handling PHP Errors and Exceptions
Elegant Ways of Handling PHP Errors and ExceptionsElegant Ways of Handling PHP Errors and Exceptions
Elegant Ways of Handling PHP Errors and ExceptionsZendCon
 
PHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and requirePHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and requireTheCreativedev Blog
 
PHP Enums - PHPCon Japan 2021
PHP Enums - PHPCon Japan 2021PHP Enums - PHPCon Japan 2021
PHP Enums - PHPCon Japan 2021Ayesh Karunaratne
 
Linux shell script-1
Linux shell script-1Linux shell script-1
Linux shell script-1兎 伊藤
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPwahidullah mudaser
 

La actualidad más candente (20)

07 Introduction to PHP #burningkeyboards
07 Introduction to PHP #burningkeyboards07 Introduction to PHP #burningkeyboards
07 Introduction to PHP #burningkeyboards
 
PHP variables
PHP  variablesPHP  variables
PHP variables
 
Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2
 
Zend Certification Preparation Tutorial
Zend Certification Preparation TutorialZend Certification Preparation Tutorial
Zend Certification Preparation Tutorial
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Lecture 2 php basics (1)
Lecture 2  php basics (1)Lecture 2  php basics (1)
Lecture 2 php basics (1)
 
Operators in PHP
Operators in PHPOperators in PHP
Operators in PHP
 
Elegant Ways of Handling PHP Errors and Exceptions
Elegant Ways of Handling PHP Errors and ExceptionsElegant Ways of Handling PHP Errors and Exceptions
Elegant Ways of Handling PHP Errors and Exceptions
 
PHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and requirePHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and require
 
Basic PHP
Basic PHPBasic PHP
Basic PHP
 
Intermediate PHP
Intermediate PHPIntermediate PHP
Intermediate PHP
 
Basic of PHP
Basic of PHPBasic of PHP
Basic of PHP
 
Php i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
 
PHP
PHPPHP
PHP
 
PHP Enums - PHPCon Japan 2021
PHP Enums - PHPCon Japan 2021PHP Enums - PHPCon Japan 2021
PHP Enums - PHPCon Japan 2021
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!
 
slidesharenew1
slidesharenew1slidesharenew1
slidesharenew1
 
Data Types In PHP
Data Types In PHPData Types In PHP
Data Types In PHP
 
Linux shell script-1
Linux shell script-1Linux shell script-1
Linux shell script-1
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
 

Destacado

P H P Part I, By Kian
P H P  Part  I,  By  KianP H P  Part  I,  By  Kian
P H P Part I, By Kianphelios
 
Surprise! It's PHP :) (unabridged)
Surprise! It's PHP :) (unabridged)Surprise! It's PHP :) (unabridged)
Surprise! It's PHP :) (unabridged)Sharon Levy
 
Chapter 02 php basic syntax
Chapter 02   php basic syntaxChapter 02   php basic syntax
Chapter 02 php basic syntaxDhani Ahmad
 
10 Webdesign Trends for 2014 by Vanksen
10 Webdesign Trends for 2014 by Vanksen10 Webdesign Trends for 2014 by Vanksen
10 Webdesign Trends for 2014 by VanksenVanksen
 

Destacado (6)

Php mysql
Php mysqlPhp mysql
Php mysql
 
P H P Part I, By Kian
P H P  Part  I,  By  KianP H P  Part  I,  By  Kian
P H P Part I, By Kian
 
Php
PhpPhp
Php
 
Surprise! It's PHP :) (unabridged)
Surprise! It's PHP :) (unabridged)Surprise! It's PHP :) (unabridged)
Surprise! It's PHP :) (unabridged)
 
Chapter 02 php basic syntax
Chapter 02   php basic syntaxChapter 02   php basic syntax
Chapter 02 php basic syntax
 
10 Webdesign Trends for 2014 by Vanksen
10 Webdesign Trends for 2014 by Vanksen10 Webdesign Trends for 2014 by Vanksen
10 Webdesign Trends for 2014 by Vanksen
 

Similar a Advanced php

Expressions and Operators.pptx
Expressions and Operators.pptxExpressions and Operators.pptx
Expressions and Operators.pptxJapneet9
 
Learn PHP Basics
Learn PHP Basics Learn PHP Basics
Learn PHP Basics McSoftsis
 
2014 database - course 2 - php
2014 database - course 2 - php2014 database - course 2 - php
2014 database - course 2 - phpHung-yu Lin
 
Advanced Perl Techniques
Advanced Perl TechniquesAdvanced Perl Techniques
Advanced Perl TechniquesDave Cross
 
Php Reusing Code And Writing Functions
Php Reusing Code And Writing FunctionsPhp Reusing Code And Writing Functions
Php Reusing Code And Writing Functionsmussawir20
 
Php Chapter 1 Training
Php Chapter 1 TrainingPhp Chapter 1 Training
Php Chapter 1 TrainingChris Chubb
 
php programming.pptx
php programming.pptxphp programming.pptx
php programming.pptxrani marri
 
What's new in PHP 8.0?
What's new in PHP 8.0?What's new in PHP 8.0?
What's new in PHP 8.0?Nikita Popov
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developersStoyan Stefanov
 
PHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return TypesPHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return TypesEric Poe
 
Functions in PHP.pptx
Functions in PHP.pptxFunctions in PHP.pptx
Functions in PHP.pptxJapneet9
 

Similar a Advanced php (20)

Expressions and Operators.pptx
Expressions and Operators.pptxExpressions and Operators.pptx
Expressions and Operators.pptx
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Learn PHP Basics
Learn PHP Basics Learn PHP Basics
Learn PHP Basics
 
PHP Basics
PHP BasicsPHP Basics
PHP Basics
 
2014 database - course 2 - php
2014 database - course 2 - php2014 database - course 2 - php
2014 database - course 2 - php
 
Advanced Perl Techniques
Advanced Perl TechniquesAdvanced Perl Techniques
Advanced Perl Techniques
 
Web Technology_10.ppt
Web Technology_10.pptWeb Technology_10.ppt
Web Technology_10.ppt
 
PHP Basics
PHP BasicsPHP Basics
PHP Basics
 
Php Reusing Code And Writing Functions
Php Reusing Code And Writing FunctionsPhp Reusing Code And Writing Functions
Php Reusing Code And Writing Functions
 
Php Basic
Php BasicPhp Basic
Php Basic
 
Php
PhpPhp
Php
 
Php Chapter 1 Training
Php Chapter 1 TrainingPhp Chapter 1 Training
Php Chapter 1 Training
 
php programming.pptx
php programming.pptxphp programming.pptx
php programming.pptx
 
What's new in PHP 8.0?
What's new in PHP 8.0?What's new in PHP 8.0?
What's new in PHP 8.0?
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developers
 
Introduction in php part 2
Introduction in php part 2Introduction in php part 2
Introduction in php part 2
 
php AND MYSQL _ppt.pdf
php AND MYSQL _ppt.pdfphp AND MYSQL _ppt.pdf
php AND MYSQL _ppt.pdf
 
Php Tutorials for Beginners
Php Tutorials for BeginnersPhp Tutorials for Beginners
Php Tutorials for Beginners
 
PHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return TypesPHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return Types
 
Functions in PHP.pptx
Functions in PHP.pptxFunctions in PHP.pptx
Functions in PHP.pptx
 

Más de Anne Lee

Week 17 slides 1 7 multidimensional, parallel, and distributed database
Week 17 slides 1 7 multidimensional, parallel, and distributed databaseWeek 17 slides 1 7 multidimensional, parallel, and distributed database
Week 17 slides 1 7 multidimensional, parallel, and distributed databaseAnne Lee
 
Data mining
Data miningData mining
Data miningAnne Lee
 
Data warehousing
Data warehousingData warehousing
Data warehousingAnne Lee
 
Database backup and recovery
Database backup and recoveryDatabase backup and recovery
Database backup and recoveryAnne Lee
 
Database monitoring and performance management
Database monitoring and performance managementDatabase monitoring and performance management
Database monitoring and performance managementAnne Lee
 
transportation and assignment models
transportation and assignment modelstransportation and assignment models
transportation and assignment modelsAnne Lee
 
Database Security Slide Handout
Database Security Slide HandoutDatabase Security Slide Handout
Database Security Slide HandoutAnne Lee
 
Database Security Handout
Database Security HandoutDatabase Security Handout
Database Security HandoutAnne Lee
 
Database Security - IG
Database Security - IGDatabase Security - IG
Database Security - IGAnne Lee
 
03 laboratory exercise 1 - WORKING WITH CTE
03 laboratory exercise 1 - WORKING WITH CTE03 laboratory exercise 1 - WORKING WITH CTE
03 laboratory exercise 1 - WORKING WITH CTEAnne Lee
 
02 laboratory exercise 1 - RETRIEVING DATA FROM SEVERAL TABLES
02 laboratory exercise 1 - RETRIEVING DATA FROM SEVERAL TABLES02 laboratory exercise 1 - RETRIEVING DATA FROM SEVERAL TABLES
02 laboratory exercise 1 - RETRIEVING DATA FROM SEVERAL TABLESAnne Lee
 
01 laboratory exercise 1 - DESIGN A SIMPLE DATABASE APPLICATION
01 laboratory exercise 1 - DESIGN A SIMPLE DATABASE APPLICATION01 laboratory exercise 1 - DESIGN A SIMPLE DATABASE APPLICATION
01 laboratory exercise 1 - DESIGN A SIMPLE DATABASE APPLICATIONAnne Lee
 
Indexes - INSTRUCTOR'S GUIDE
Indexes - INSTRUCTOR'S GUIDEIndexes - INSTRUCTOR'S GUIDE
Indexes - INSTRUCTOR'S GUIDEAnne Lee
 
07 ohp slides 1 - INDEXES
07 ohp slides 1 - INDEXES07 ohp slides 1 - INDEXES
07 ohp slides 1 - INDEXESAnne Lee
 
07 ohp slide handout 1 - INDEXES
07 ohp slide handout 1 - INDEXES07 ohp slide handout 1 - INDEXES
07 ohp slide handout 1 - INDEXESAnne Lee
 
Wk 16 ses 43 45 makrong kasanayan sa pagsusulat
Wk 16 ses 43 45 makrong kasanayan sa pagsusulatWk 16 ses 43 45 makrong kasanayan sa pagsusulat
Wk 16 ses 43 45 makrong kasanayan sa pagsusulatAnne Lee
 
Wk 15 ses 40 42 makrong kasanayan sa pagbabasa
Wk 15 ses 40 42 makrong kasanayan sa pagbabasaWk 15 ses 40 42 makrong kasanayan sa pagbabasa
Wk 15 ses 40 42 makrong kasanayan sa pagbabasaAnne Lee
 
Wk 13 ses 35 37 makrong kasanayan sa pagsasalita
Wk 13 ses 35 37 makrong kasanayan sa pagsasalitaWk 13 ses 35 37 makrong kasanayan sa pagsasalita
Wk 13 ses 35 37 makrong kasanayan sa pagsasalitaAnne Lee
 
Wk 12 ses 32 34 makrong kasanayan sa pakikinig
Wk 12 ses 32 34 makrong kasanayan sa pakikinigWk 12 ses 32 34 makrong kasanayan sa pakikinig
Wk 12 ses 32 34 makrong kasanayan sa pakikinigAnne Lee
 
Wk 11 ses 29 31 konseptong pangkomunikasyon - FILIPINO 1
Wk 11 ses 29 31 konseptong pangkomunikasyon - FILIPINO 1Wk 11 ses 29 31 konseptong pangkomunikasyon - FILIPINO 1
Wk 11 ses 29 31 konseptong pangkomunikasyon - FILIPINO 1Anne Lee
 

Más de Anne Lee (20)

Week 17 slides 1 7 multidimensional, parallel, and distributed database
Week 17 slides 1 7 multidimensional, parallel, and distributed databaseWeek 17 slides 1 7 multidimensional, parallel, and distributed database
Week 17 slides 1 7 multidimensional, parallel, and distributed database
 
Data mining
Data miningData mining
Data mining
 
Data warehousing
Data warehousingData warehousing
Data warehousing
 
Database backup and recovery
Database backup and recoveryDatabase backup and recovery
Database backup and recovery
 
Database monitoring and performance management
Database monitoring and performance managementDatabase monitoring and performance management
Database monitoring and performance management
 
transportation and assignment models
transportation and assignment modelstransportation and assignment models
transportation and assignment models
 
Database Security Slide Handout
Database Security Slide HandoutDatabase Security Slide Handout
Database Security Slide Handout
 
Database Security Handout
Database Security HandoutDatabase Security Handout
Database Security Handout
 
Database Security - IG
Database Security - IGDatabase Security - IG
Database Security - IG
 
03 laboratory exercise 1 - WORKING WITH CTE
03 laboratory exercise 1 - WORKING WITH CTE03 laboratory exercise 1 - WORKING WITH CTE
03 laboratory exercise 1 - WORKING WITH CTE
 
02 laboratory exercise 1 - RETRIEVING DATA FROM SEVERAL TABLES
02 laboratory exercise 1 - RETRIEVING DATA FROM SEVERAL TABLES02 laboratory exercise 1 - RETRIEVING DATA FROM SEVERAL TABLES
02 laboratory exercise 1 - RETRIEVING DATA FROM SEVERAL TABLES
 
01 laboratory exercise 1 - DESIGN A SIMPLE DATABASE APPLICATION
01 laboratory exercise 1 - DESIGN A SIMPLE DATABASE APPLICATION01 laboratory exercise 1 - DESIGN A SIMPLE DATABASE APPLICATION
01 laboratory exercise 1 - DESIGN A SIMPLE DATABASE APPLICATION
 
Indexes - INSTRUCTOR'S GUIDE
Indexes - INSTRUCTOR'S GUIDEIndexes - INSTRUCTOR'S GUIDE
Indexes - INSTRUCTOR'S GUIDE
 
07 ohp slides 1 - INDEXES
07 ohp slides 1 - INDEXES07 ohp slides 1 - INDEXES
07 ohp slides 1 - INDEXES
 
07 ohp slide handout 1 - INDEXES
07 ohp slide handout 1 - INDEXES07 ohp slide handout 1 - INDEXES
07 ohp slide handout 1 - INDEXES
 
Wk 16 ses 43 45 makrong kasanayan sa pagsusulat
Wk 16 ses 43 45 makrong kasanayan sa pagsusulatWk 16 ses 43 45 makrong kasanayan sa pagsusulat
Wk 16 ses 43 45 makrong kasanayan sa pagsusulat
 
Wk 15 ses 40 42 makrong kasanayan sa pagbabasa
Wk 15 ses 40 42 makrong kasanayan sa pagbabasaWk 15 ses 40 42 makrong kasanayan sa pagbabasa
Wk 15 ses 40 42 makrong kasanayan sa pagbabasa
 
Wk 13 ses 35 37 makrong kasanayan sa pagsasalita
Wk 13 ses 35 37 makrong kasanayan sa pagsasalitaWk 13 ses 35 37 makrong kasanayan sa pagsasalita
Wk 13 ses 35 37 makrong kasanayan sa pagsasalita
 
Wk 12 ses 32 34 makrong kasanayan sa pakikinig
Wk 12 ses 32 34 makrong kasanayan sa pakikinigWk 12 ses 32 34 makrong kasanayan sa pakikinig
Wk 12 ses 32 34 makrong kasanayan sa pakikinig
 
Wk 11 ses 29 31 konseptong pangkomunikasyon - FILIPINO 1
Wk 11 ses 29 31 konseptong pangkomunikasyon - FILIPINO 1Wk 11 ses 29 31 konseptong pangkomunikasyon - FILIPINO 1
Wk 11 ses 29 31 konseptong pangkomunikasyon - FILIPINO 1
 

Último

Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.soniya singh
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.soniya singh
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...Escorts Call Girls
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceDelhi Call girls
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Onlineanilsa9823
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 

Último (20)

Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 

Advanced php

  • 1. Advanced PHP  PHP Operators  Control Structures  PHP Functions  Arrays
  • 2. *Property of STI K0032 Operator is something that you feed with one or more values characters or set of characters that perform a special operation within the PHP code
  • 3. *Property of STI K0032 Arithmetic Operators used to perform simple mathematical operations such as addition, subtraction, multiplication, division, etc Example Name Result $a + $b Addition (+) Sum of $a and $b $a - $b Subtraction (-) Difference of $a and $b $a * $b Multiplication (*) Product of $a and $b $a / $b Division (/) Quotient of $a and $b $a % $b Modulus (%) Remainder of $a divided by $b $a**$b Exponentiation (**) Result of raising $a to the $b‘th power (PHP 5)
  • 4. *Property of STI K0032 Assignment Operators used to transfer values to a variable Operator Assignment Same as Description = a=b a = b The left operand gets the value of the expression on the right += a+=b a = a + b Addition -= a-=b a = a – b Subtraction *= a*=b a = a * b Multiplication /= a/=b a = a / b Division %= a%=b a = a % b Modulus
  • 5. *Property of STI K0032 Comparison Operators allow you to compare two values Example Name Result $a = = $b Equal TRUE if $a is equal to $b. $a = = = $b Identical TRUE if $a is equal to $b, and they are of the same type. (PHP 4 only) $a != $b Not equal TRUE if $a is not equal to $b. $a <> $b Not equal TRUE if $a is not equal to $b. $a != = $b Not identical TRUE if $a is not equal to $b, or they are not of the same type. (PHP 4 only) $a < $b Less than TRUE if $a is strictly less than $b. $a > $b Greater than TRUE if $a is strictly greater than $b. $a <= $b Less than or equal TRUE if $a is less than or equal to $b. $a >= $b Greater than or equal TRUE if $a is greater than or equal to $b.
  • 6. *Property of STI K0032 Increment/Decrement Operators  increment operators are used to increase the value of a variable by 1  decrement operators are used to decrease the value of a variable by 1 Example Name Effect ++$a Pre-increment Increment $a by one.Then returns $a. $a++ Post-increment Returns $a, then increments $a by one. --$a Pre-decrement Decrements $a by one, then returns $a. $a-- Post-decrement Returns $a, then decrements $a by one.
  • 7. *Property of STI K0032 Increment/Decrement Operators Sample script <?php echo "<h3>Postincrement</h3>"; $a = 5; echo "Should be 5: " . $a++ . "<br />n"; echo "Should be 6: " . $a . "<br />n"; echo "<h3>Preincrement</h3>"; $a = 5; echo "Should be 6: " . ++$a . "<br />n"; echo "Should be 6: " . $a . "<br />n"; ?
  • 8. *Property of STI K0032 Logical Operators used to combine conditional statements Example Name Result $a and $b AND TRUE if both $a and $b areTRUE. $a or $b OR TRUE if either $a or $b isTRUE. $a xor $b XOR TRUE if either $a or $b isTRUE, but not both. ! $a NOT TRUE if $a is notTRUE. $a && $b AND TRUE if both $a and $b areTRUE. $a | | $b OR TRUE if either $a or $b isTRUE.
  • 9. *Property of STI K0032 String Operators  two string operators  concatenation operator (.) - returns the concatenation of its right and left arguments  concatenation assignment operator (.=) - appends the argument on the right side to the argument on the left side <?php $a = "Hello "; $b = $a . "World!"; // now $b contains "Hello World!" $a = "Hello "; $a .= "World!"; // now $a contains "Hello World!" ?>
  • 10. *Property of STI K0032 PHP Array Operators PHP array operators are used to compare arrays Example Name Result $a + $b Union (+) Union of $a and $b $a = = $b Equality (==) Returns true of $a and $b have the same value $a === $b Identity (===) Returns true if $a and $b have the same value, same order, and of the same type $a != $b Inequality (!=) Returns true if $a is not equal to $b $a <> $b Inequality (<>) Returns true if $a is not equal to $b $a !== $b Not-Identity (!==) Returns true if $a is not identical to $b
  • 11. *Property of STI K0032 Control Structures: IF Statement The if statement is one of the most important features of many languages It allows conditional execution of code fragments Use PHP if statement when you want your program to execute a block of code only if a specified condition is true
  • 12. *Property of STI K0032 IF Statement Syntax: Example: If (condition) { statement to be executed if condition is true; } <?php $t = date("H"); if ($t < "12") { echo "Good morning!"; } ?>
  • 13. *Property of STI K0032 If…Else Statement  This control structure execute some code if a condition is met and do something else if the condition is not met  Else extends an if statement to execute a statement in case the condition in the if statement evaluates to false  Syntax: If (condition) { statement to be executed if condition is true; } else { Statement to be executed if condition is false; }
  • 14. *Property of STI K0032 If…Else Statement Example:  The else statement is only executed if the condition in the if statement is evaluated to false, and if there were any elseif expressions – only if they evaluated to false as well <?php $t = date("H"); if ($t < "12") { echo "Good morning!"; } else { echo “Good afternoon!”; } ?>
  • 15. *Property of STI K0032 ElseIf Statement  a combination of if and else  it extends an if statement to execute a different statement in case the original if expression evaluates to FALSE  Syntax: If (condition) { statement to be executed if condition is true; } elseif (condition) { Statement to be executed if condition is true; } else { Statement to be executed if condition is false; }
  • 16. *Property of STI K0032 ElseIf Statement  Example: <?php $t = date("H"); if ($t < "12") { echo "Good morning!"; } elseif ($t < "18") { echo "Good afternoon!"; } else { echo "Have a good evening!"; } ?>
  • 17. *Property of STI K0032 Switch Statement  similar to a series of if statements on the same expression  Syntax: switch (n) { case 1: Statement to be executed if n=case 1; Break; case 2: Statement to be executed if n=case 2; Break; case 3: Statement to be executed if n=case 3; Break; ... Default: Statement to be executed if n is not equal to all cases; }
  • 18. *Property of STI K0032 Switch Statement  Example: <?php $fruit = "mango"; switch ($fruit) { case "apple": echo "My favorite fruit is apple!"; break; case "banana": echo " My favorite fruit is banana!"; break; case "mango": echo " My favorite fruit is mango!"; break; default: echo "My favorite fruit is not in the list!"; } ?>
  • 19. *Property of STI K0032 While Statement While loops are the simplest type of loop in PHP. They behave like their C counterparts The basic form of a while statement is While (condition is true) { Statement to be executed here...; }
  • 20. *Property of STI K0032 While Statement Example: <?php $a = 1; While ($a <=10) { echo “The number is: $a <br>”; $a++; } ?>
  • 21. *Property of STI K0032 Do…while statement do...while loops are very similar to while loops, except the truth expression is checked at the end of each iteration instead of in the beginning do…while statement will always execute the blocked of code once, it will then checked the condition, and repeat the loop while the condition is true
  • 22. *Property of STI K0032 Do…while statement Syntax: Example: Do { Statement to be executed; } while (condition is true); <?php $a = 1; Do { echo “The number is: $a <br>”; $a++; } While ($a <=10); ?>
  • 23. *Property of STI K0032 FOR statement executes block of codes in a specified number of times basically used when you know the number of times the code loop should run Syntax: for (initialization; condition; increment) { statement to be executed }
  • 24. *Property of STI K0032 FOR statement Initialization: It is mostly used to set counter Condition: It is evaluated for each loop iteration Increment: Mostly used to increment a counter
  • 25. *Property of STI K0032 FOR statement Example: Result: <?php for ($a = 1; $a <= 5; $a++) { echo "The number is: $a <br>"; } ?>
  • 26. *Property of STI K0032 Function self-contained blocked of codes that perform a specified “function” or task executed by a call to the function can be called anywhere within a page often accepts one or more parameters (“also referred to as arguments”) which you can pass to it
  • 27. *Property of STI K0032 Function  Syntax:  The declaration of a user defined function starts with the word “function” followed by a short but descriptive name for that function function functionName() { Statement to be executed; }
  • 28. *Property of STI K0032 Function  Example:  Result: <?php function callMyName() { echo "Francesca Custodio"; } callMyName(); ?>
  • 29. *Property of STI K0032 Function Arguments  Function arguments are just like variables  specified right after the function name inside the parentheses  Example: <?php function MyFamName($Fname){ echo "$Fname Garcia. <br>”; } MyFamName("Allen"); MyFamName("Patrick"); MyFamName("Hannah"); ?>
  • 30. *Property of STI K0032 Function returns a value Function returns a value using the return statement Example: <?php function sum($a, $b) { $ab = $a + $b; return $ab; } echo "5 + 10 = " . sum(5, 10) . "<br>"; echo "7 + 13 = " . sum(7, 13) . "<br>"; echo "2 + 4 = " . sum(2, 4); ?>
  • 31. *Property of STI K0032  Having 3 car names (Honda, Mazda, and Mitsubishi), how will you store these car names in a variable? Answer: $car1 = “Honda”; $car2 = “Mazda”; $car3 = “Mitsubishi”;  However, what if you want to loop through the cars and look for a specific one? And what if you had hundreds or thousands of cars?What will you do? Answer: Create an array and store them to a single variable.
  • 32. *Property of STI K0032 Arrays PHP array is a special variable which allows you to store multiple values in a single variable $cars = array(“Honda”, “Mazda”, “Mitsubishi”);
  • 33. *Property of STI K0032 Arrays The values of an array can be accessed by referring to its index number Result: <?php $cars = array("Honda", "Mazda", "Mitsubishi"); echo "I have " . $cars[0] . ", " . $cars[1] “,” . ", and " . $cars[2] . "."; ?>
  • 34. *Property of STI K0032 Types of PHP Arrays Three (3) different types of PHP arrays Indexed array Associative array Multidimensional array
  • 35. *Property of STI K0032 Indexed Arrays Indexed arrays or numeric arrays use number as key The key is the unique identifier, or id of each item within an array index number starts at zero
  • 36. *Property of STI K0032 Indexed Arrays Two ways to create an array: 1. Automatic key assignment 2. Manual key assignment $Fruits = array(“Mango”, ”Santol”, ”Apple”, “Banana”); $fruit[0] = “Mango”; $fruit[1] = “Santol”; $fruit[2] = “Apple”; $fruit[3] = “Banana”;
  • 37. *Property of STI K0032 Array count() function The count() function is used to return the length (the number of elements) of an array Example: Result: $fruit = array(“Mango”, ”Santol”, ”Apple”, “Banana”); $arrlength=count($fruit); echo $arrlength;
  • 38. *Property of STI K0032 Array: displaying specific content Example: Result: $Fruit = array(“Mango”, ”Santol”, ”Apple”, “Banana”); echo $fruit[1];
  • 39. *Property of STI K0032 Looping through Indexed Array  Loop construct is used to loop through and print all the values of a numeric array  For loop structure is best to use in numeric array <?php $fruit = array("Mango", "Santol", "Apple", "Banana"); $arrlength = count($fruit); for ($i = 0; $i < $arrlength; $i++) { echo $fruit[$i]; echo "<br>"; } ?>
  • 40. *Property of STI K0032 Associative Arrays arrays that use named keys as you assigned to them Associative arrays are similar to numeric arrays but instead of using a number for the key it use a value.Then assign another value to the key
  • 41. *Property of STI K0032 Associative Arrays Two options to create an associative array 1. First: 2. Second: $fruit = array (“Mango”=>”100”, “Santol”=>”200”, “Apple”=>”300”); $fruit [‘Mango’] = “100”; $fruit [‘Santol’] = “200”; $fruit [‘Apple’] = “300”;
  • 42. *Property of STI K0032 Displaying the content of an Associative Array  Displaying the content of an associative array is compared with numeric or indexed array, by referring to its key  Example:  Output: <?php $fruit = array("Mango" => "100 per kilo", "Santol" => "200 per kilo", "Apple" => "300 per kilo"); echo "Santol:" . $fruit["Santol"]; ?>
  • 43. *Property of STI K0032 Looping through an Associative Array  Loop construct is used to loop through and print all the values of an associative array  For each loop structure is best to use in associative array  Example: <?php $fruit = array("Mango", "Santol", "Apple", "Banana"); $arrlength = count($fruit); foreach($fruit as $x => $x_value) { echo "Key = " . $x . ", Value = " . $x_value; echo "<br>"; } ?>
  • 44. *Property of STI K0032 Multidimensional Arrays an array that contains another array as a value, which in turn can hold another array as well This can be done as many times as can be wish – could have an array inside another array, which is inside another array, etc In such a way, it is possible to create two- or three-dimensional arrays
  • 45. *Property of STI K0032 Multidimensional Arrays Name QTY Sold Mango 100 96 Apple 60 59 Santol 110 100 <?php $fruit = array ( array("Mango",100,96), array("Apple",60,59), array("Santol",110,100) ); ?>
  • 46. *Property of STI K0032 Multidimensional Arrays  The two-dimensional array name $fruit array which has two indices: row and column - contains three arrays.To get access to each specific element of the $fruit array, one must point to the two indices.  Example:  Result: echo $fruit[0][0].": QTY: ".$fruit[0][1].", sold: ". $fruit[0][2].".<br>"; echo $fruit[1][0].": QTY: ".$fruit[1][1].", sold: ". $fruit[1][2].".<br>"; echo $fruit[2][0].": QTY: ".$fruit[2][1].", sold: ". $fruit[2][2].".<br>";
  • 47. *Property of STI K0032 Multidimensional Arrays  Using for loop statement to get the element of the $fruit array Result: for ($row = 0; $row < 3; $row++) { echo "<p><b>Row number $row</b></p>"; echo "<ul>"; for ($col = 0; $col < 3; $col++) { echo "<li>".$fruit[$row][$col]."</li>"; } echo "</ul>"; }