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 http://arief.ismy.web.id

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 http://arief.ismy.web.id

3 3 IF-Statements if (some test) { // code here } else if (some other test) { // code here } else { // if neither test met, do this } http://arief.ismy.web.id

4 4 Comparison Operator == Equals > Greater than < Less than >= Greater or equal to <= Less or equal to !=, <> Not equal http://arief.ismy.web.id

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 || http://arief.ismy.web.id

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 http://arief.ismy.web.id

9 9 FOR-loop

10 10 WHILE-loop http://arief.ismy.web.id

11 11 DO-WHILE-loop http://arief.ismy.web.id

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. http://arief.ismy.web.id

13 13 PHP Function http://arief.ismy.web.id

14 14 PHP Function http://arief.ismy.web.id date(), time(), empty

15 15 PHP Function http://arief.ismy.web.id

16 16 PHP Function: Return Value http://arief.ismy.web.id

17 17 PHP Function: Return Value http://arief.ismy.web.id

18 18 Creating an Array http://arief.ismy.web.id

19 19 Creating an Array http://arief.ismy.web.id

20 20 Creating an Array http://arief.ismy.web.id

21 21 Creating an Array http://arief.ismy.web.id

22 22 View Array Structure http://arief.ismy.web.id

23 23 View More Array Details http://arief.ismy.web.id

24 24 Add Items to an Array http://arief.ismy.web.id

25 25 Be Careful http://arief.ismy.web.id

26 26 Delete an Array Element http://arief.ismy.web.id

27 27 Merge and Count http://arief.ismy.web.id

28 28 FOREACH and Array http://arief.ismy.web.id

29 29 FOREACH and Array http://arief.ismy.web.id

30 30 Implode: from Array to String http://arief.ismy.web.id

31 31 Explode: from String to Array http://arief.ismy.web.id

32 32 Array Search http://arief.ismy.web.id

33 33 Multidimensional Array http://arief.ismy.web.id

34 34 Multidimensional Array http://arief.ismy.web.id

35 35 Pertemuan 14 Session Last Updated: 23 rd May 2010 By M. Arief http://arief.ismy.web.id

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 http://arief.ismy.web.id

37 37 HTTP Limitations http://arief.ismy.web.id

38 38 Chaining Variables in URL’s http://arief.ismy.web.id

39 39 The Session Solution http://arief.ismy.web.id

40 40 Sessions http://arief.ismy.web.id

41 41 How PHP Sessions Work http://arief.ismy.web.id

42 42 session_start() http://arief.ismy.web.id

43 43 Common Error http://arief.ismy.web.id

44 44 Setting and Accessing Session Value http://arief.ismy.web.id

45 45 Deleting Session Value http://arief.ismy.web.id

46 46 Contoh Session1.php Sessio2.php http://arief.ismy.web.id


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

Similar presentations


Ads by Google