After studying this chapter you will be able to understand: Setting the environment, overview of PHP, constants and variables in PHP, operators in PHP, conditional statements in PHP, looping statements, arrays in PHP. | Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 1 Setting the environment Overview of PHP Constants and Variables in PHP Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 2 2 Department of Computer Science, CIIT Islamabad. Operators in PHP Conditional Statements in PHP Looping Statements Arrays in PHP Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 3 3 Department of Computer Science, CIIT Islamabad. Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 4 Arithmetic Operators: +, - ,*, /, % Assignment Operators: = += ($a +=$b ), *= , /= .= ($a .= $b) Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 5 Adds $b in $a Concatenates $b with $a Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 6 Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 7 String Operators: . , .= $a=“abcd”.”efgh”; $a=abcdefgh $a.=“ijk”; $a=abcdefghijk | Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 1 Setting the environment Overview of PHP Constants and Variables in PHP Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 2 2 Department of Computer Science, CIIT Islamabad. Operators in PHP Conditional Statements in PHP Looping Statements Arrays in PHP Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 3 3 Department of Computer Science, CIIT Islamabad. Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 4 Arithmetic Operators: +, - ,*, /, % Assignment Operators: = += ($a +=$b ), *= , /= .= ($a .= $b) Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 5 Adds $b in $a Concatenates $b with $a Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 6 Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 7 String Operators: . , .= $a=“abcd”.”efgh”; $a=abcdefgh $a.=“ijk”; $a=abcdefghijk Increment/decrement Operators: ++,-- $b=$a++ $b=++$a Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 8 First variable Second variable Concatenation Using .= Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 9 Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 10 Variable declared Incremented before display Incremented after display Displaying incremented value Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 11 Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 12 Logical Operators: AND, OR, NOT, XOR &&, ||, ! Equality Operators: ==, !=, === Comparison Operators: >, = Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 13 Integer value String value Compares only values Strict comparison Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 14 if statement: if(condition) { } if-else statement: if(condition) { } else {