Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Pertemuan 14 PHP: Conditions-loops-functions-Array Last Updated: 23 rd May 2011 By M. Arief

Similar presentations


Presentation on theme: "1 Pertemuan 14 PHP: Conditions-loops-functions-Array Last Updated: 23 rd May 2011 By M. Arief"— Presentation transcript:

1 1 Pertemuan 14 PHP: Conditions-loops-functions-Array Last Updated: 23 rd May 2011 By M. Arief

2 2 Objectives ► To learn to use logical test operators to create compound conditional test statements ► To learn to use conditional test statements to compare numerical and string data values ► To learn to use looping statements to repeat other statements ► To learn to use several PHP functions useful for Web application development ► To learn to write and use your own functions

3 3 IF-Statements if (some test) { // code here } else if (some other test) { // code here } else { // if neither test met, do this }

4 4 Comparison Operator == Equals > Greater than < Less than >= Greater or equal to <= Less or equal to !=, <> Not equal

5 5 Logical Operator ! NOT !$b Returns true if $b is false && AND $a && $b Returns true if both $a and $b are true || OR $a || $b Returns true if either $a or $b or both are true and AND $a and $b Same as && or OR $a or $b Same as ||

6 6 SWITCH-Conditionals

7 7 SWITCH-Conditionals

8 8 PHP Loops ► Loops provide a mechanism for executing a section of code repeatedly. ► PHP supports four kinds of loops: for, while, do-while and foreach for, while, do-while and foreach

9 9 FOR-loop

10 10 WHILE-loop

11 11 DO-WHILE-loop

12 12 FOREACH-Loop ► Used extensively to grab and manipulate values from arrays. ► We'll cover this control structure in depth next session with Arrays.

13 13 PHP Function

14 14 PHP Function date(), time(), empty

15 15 PHP Function

16 16 PHP Function: Return Value

17 17 PHP Function: Return Value

18 18 Creating an Array

19 19 Creating an Array

20 20 Creating an Array

21 21 Creating an Array

22 22 View Array Structure

23 23 View More Array Details

24 24 Add Items to an Array

25 25 Be Careful

26 26 Delete an Array Element

27 27 Merge and Count

28 28 FOREACH and Array

29 29 FOREACH and Array

30 30 Implode: from Array to String

31 31 Explode: from String to Array

32 32 Array Search

33 33 Multidimensional Array

34 34 Multidimensional Array

35 35 Pertemuan 14 Session Last Updated: 23 rd May 2010 By M. Arief

36 36 Objectives ► To understand sessions and basic session functionality ► To learn how to use sessions to build multiple page sites with state preservation ► To learn how to use browser cookies to track data about the user ► To learn how to use PHP session handling functions to track various data ► To learn how to declare and use classes

37 37 HTTP Limitations

38 38 Chaining Variables in URL’s

39 39 The Session Solution

40 40 Sessions

41 41 How PHP Sessions Work

42 42 session_start()

43 43 Common Error

44 44 Setting and Accessing Session Value

45 45 Deleting Session Value

46 46 Contoh Session1.php Sessio2.php


Download ppt "1 Pertemuan 14 PHP: Conditions-loops-functions-Array Last Updated: 23 rd May 2011 By M. Arief"

Similar presentations


Ads by Google