Download presentation
Presentation is loading. Please wait.
Published byKory Bradford Modified over 9 years ago
1
Class02 More Arrays MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 1/14/2016
2
Our progress… New tools Weeks 1-6 Using a web framework Weeks 7-9 Using a mobile device IDE Weeks 10-12 The class project (It’s a bake off!) Weeks 13-15 1.Arrays 2.PDO 3.MVC 4.JavaScript / JSON 5.RWD / CSS We’re here…
3
Objectives Last time … 1.Know what an array is. 2.Be able to create an array in PHP 3.Add, change, and delete data from an array. Today … 1.Associative Arrays 2.How to loop through arrays 3.Queues and Stacks 4.Sorting Arrays 5.Multidimensional Arrays
4
Associative Arrays You can see that the differences in syntax between working with associative arrays, and a numerically indexed arrays are pretty minor. Instead of: array(value1,valule2,value3, …)
6
Using a “for” loop The PHP function count() will return the number of elements in an array. That can be handy for controlling a “for” loop like this one.
7
Using a “foreach” loop.
9
Queues and Stacks
10
What’s a queue? A queue is a “First in, First Out” collection of values
11
What’s a stack? A stack is a “Last in, First Out” collection of values With stacks, we sometimes talk about “push” and “pop” operations.
13
Sorting an array These three functions are the most useful.
14
Multidimensional Arrays
18
The “times table” we just built…
19
One more handy function…
20
Let’s try an exercise P ERMANENT LINK TO THIS COMIC : HTTP :// XKCD. COM /1623/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.