lecture3.arrays - Media Software Design DIG 3134 - Lecture...

Info iconThis preview shows pages 1–22. Sign up to view the full content.

View Full Document Right Arrow Icon
1 DIG 3134 - Lecture 3: Arrays Michael Moshell University of Central Florida Media Software Design
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 First: Review the HTML Tables while (answers are not yet enough) { foreach ($class as $student) if ($student is here and awake) call on $student; }
Background image of page 2
3 Array: A filing cabinet, or a LIST of variables. $price[1] $price[2] $price[3] $price[4] Variable Name Index Value 1 2 3 (whoops)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 A For-Loop for ($m=1; $m<=4; $m++) { print “now m is “.$m. “!<br />”; } HAND SIMULATION: value of m: printed output.
Background image of page 4
5 A For-Loop For ($m=1; $m<=4; $m++) { print “now m is “.$m. “ !<br />”; } HAND SIMULATION: value of m: printed output.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 A For-Loop For ($m=1; $m<=4; $m++) { print “now m is “.$m. “ !<br />”; } HAND SIMULATION: value of m: printed output. 1
Background image of page 6
7 A For-Loop For ($m=1; $m<=4; $m++) { print “now m is “.$m. “ !<br />”; } HAND SIMULATION: value of m: printed output. 1 now m is 1!
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 A For-Loop For ($m=1; $m<=4; $m++) { print “now m is “.$m. “ !<br />”; } HAND SIMULATION: value of m: printed output. 1 now m is 1! 2
Background image of page 8
9 A For-Loop For ($m=1; $m<=4; $m++) { print “now m is “.$m. “ !<br />”; } HAND SIMULATION: value of m: printed output. 1 now m is 1! 2 now m is 2!
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 A For-Loop and an array For ($m=1; $m<=4; $m++) { $list[$m]= 3; } // that will put 3 in each location of $m print $list[2]; //HAND SIMULATE NOW! value of m printed output $m $list[$m] 1 2 3 4
Background image of page 10
11 A For-Loop and an array: Result after loop finishes For ($m=1; $m<=4; $m++) { $list[$m]= 3; } // that will put 3 in each location of $m print $list[2]; //HAND SIMULATE NOW! value of m printed output 1 2 3 4 3 $m $list[$m] 1 3 2 3 3 3 4 3
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A For-Loop and an array For ($m=1; $m<=4; $m++) { $list[$m] = $m; } // that will put $m in each location of $m print $list[2]; // what will this print? value of m printed output $m $list[$m] 1 1 2 2 3 3 4 4
Background image of page 12
13 A For-Loop and an array For ($m=1; $m<=4; $m++) { $list[$m]= $m; } // that will put $m in each location of $m print $list[2]; // what will this print? value of m printed output 1 2 3 4 2 $m $list[$m] 1 1 2 2 3 3 4 4
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
14 A For-Loop and an array For ($m=1; $m<=4; $m++) { $list[$m]= $m; } // that will put $m in each location of $m print $list[2]; // what will this print? value of m printed output 1 2 3 4 2 $m $list[$m] 1 1 2 2 3 3 4 4
Background image of page 14
15 A For-Loop and an array For ($m=1; $m<=4; $m++) { $list[$m]= 2*$m; } Print $list[3]; // what will this print?
Background image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
16 A while-Loop and an array (we can go faster now) $m=1; while ($m<=7) { $list[$m]= 2*$m; $m=$m+2; } Print $list[5]; // what will this print?
Background image of page 16
17 A while-Loop and an array $m=1; While ($m<=7) { $list[$m]= 2*$m; $m=$m+2; } Print $list[4]; // what will this print?
Background image of page 17

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
18 And now … We move to the subject of STRINGS.
Background image of page 18
19 The Objective: Learn how to do all kinds of things with text in PHP Why? Numbers are pretty dumb; Almost all good stuff is words.
Background image of page 19

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
20 String Constants & Variables $n=3; $test= "A bear came over $n mountains."; print $test; // what is printed?
Background image of page 20
21 String Constants & Variables $n=3; $test= "A bear came over $n mountains."; print $test; // what is printed?
Background image of page 21

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 22
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/25/2011 for the course DIG 3134 taught by Professor Moshell during the Fall '11 term at University of Central Florida.

Page1 / 67

lecture3.arrays - Media Software Design DIG 3134 - Lecture...

This preview shows document pages 1 - 22. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online