Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHP 101: flow control

PHP 101: flow control

Fundamental PHP & Web Development

LucienLee

June 27, 2013
Tweet

More Decks by LucienLee

Other Decks in Programming

Transcript

  1. ESLEIF •If my dog is gone, I call its name;

    else if my dog is eating, I go to eat. 13
  2. ELSEIF if($dog == ‘gone’){ echo “Where are you, Lucy!”; }elseif($dog

    == ‘eating’){ $myState = “go to eat”; } 14
  3. ARRAY •a collection of data items. •key map to value.

    •Like many box put together. 27 Apple 100 Orange 150 Banana 200
  4. 28 0 1 2 0 A B C 1 D

    E F 2 G H I Multi-Case
  5. two array plus $item1 = array(‘rose’,‘lily’); $item2 = array(‘apple’,‘banana’,‘grape’); $items

    = $item1 + $item2; //$items = array(‘rose’,‘lily’, ‘grape’); 33
  6. HomeWork 37 • make key-value array to save student grade.

    • All grade * 1.4, if modified grade over 100, modify in another way:original value + (100 - original value)*0.1 • change array as name map to array save grade and pass or not. a b c d e f 30 40 90 60 55 80