PHP Arrays By Justin Nelsen.

Slides:



Advertisements
Similar presentations
SWU, Computer systems and technologies. The Objective of This Lecture To give you a very high-level overview of some of the tools for Web Programming.
Advertisements

XAMPP: Cross – Apache, MySQL, Php, Perl + FileZilla, Tomcat NetBeans: IDE PHP Installation.
The Griffin Family. Hi! I am Stewie Griffin. This is my family.
Outline o What is an array ? o Indexed array o Associative array o Multidimensional array.
04/09/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
INTERNET APPLICATION DEVELOPMENT For More visit:
PHP Arrays. Outline o What is array in PHP ? o Numeric array o Associative array o Multidimensional array.
Arrays By Shyam Gurram. What is an Array? An array can store one or more values in a single variable name. Each element in the array is assigned its own.
Introduction to MySQL Lab no. 10 Advance Database Management System.
PHP - Introduction Week 5 Dr. Ken Cosh Introducing PHP 1.
Open Source Software Unit – 3 Presented By Mr. R.Aravindhan.
Web Programming Language Week 5 Dr. Ken Cosh Introducing PHP 1.
PHP. What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server.
Julian Springer Room 42 Joe Slovo.  W3 schools recommend that you have a basic understanding of HTML and of JavaScript before attempting to grasp PHP.
Family Guy This slide show will take you through the life and times of the Griffin family of Quahog, Road Island. By Arya&Dillon.
PHP Arrays By Justin Nelsen. What is an Array? - An array can store one or more values in a single variable name. -Each element in the array is assigned.
PHP Variables.  Variables are "containers" for storing information. How to Declare PHP Variables  In PHP, a variable starts with the $ sign, followed.
 An array stores multiple values in one single variable.  Example: Output: I like Honda Civic, BMW and Toyota.
PHP. What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server.
From Word Embeddings To Document Distances
D. Phát triển thương hiệu
BÖnh Parkinson PGS.TS.BS NGUYỄN TRỌNG HƯNG BỆNH VIỆN LÃO KHOA TRUNG ƯƠNG TRƯỜNG ĐẠI HỌC Y HÀ NỘI Bác Ninh 2013.
HF NOISE FILTERS PERFORMANCE
Bayesian Confidence Limits and Intervals
انتقال حرارت 2 خانم خسرویار.
Summer Student Program First results
Theoretical Results on Neutrinos
HERMESでのHard Exclusive生成過程による 核子内クォーク全角運動量についての研究
yaSpMV: Yet Another SpMV Framework on GPUs
Creating Synthetic Microdata for Higher Educational Use in Japan: Reproduction of Distribution Type based on the Descriptive Statistics Kiyomi Shirakawa.
Overview of TST-2 Experiment
10. predavanje Novac i financijski sustav
FLUORECENCE MICROSCOPY SUPERRESOLUTION BLINK MICROSCOPY ON THE BASIS OF ENGINEERED DARK STATES* *Christian Steinhauer, Carsten Forthmann, Jan Vogelsang,
Particle acceleration during the gamma-ray flares of the Crab Nebular
Interpretations of the Derivative Gottfried Wilhelm Leibniz
Advisor: Chiuyuan Chen Student: Shao-Chun Lin
A pache M ySQL P hp Robert Mudge Reference:
PHP Condtions and Loops Prepared by Dr. Maher Abuhamdeh.
Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this.
Limits on Anomalous WWγ and WWZ Couplings from DØ
Oleh: Ahmad Ramadhani, S.Kom
© 2015 Pearson Education, Inc.
What we have covered What is IR Evaluation
JoAnn Logue-O’Malley, Beaumont Health Roseann Ferrara, SCC
Infectious and Communicable Diseases
Variables Variables are used to store data or information.
DBW - PHP DBW2017.
>> PHP: Arrays.
PHP Arrays Functions.
CHAPTER 5 SERVER SIDE SCRIPTING
Forward Markets and Contracts
Web Programming Tutorial
8th Semester, Batch 2008 Department of Computer Science SSUET.
Maximum Satisfiability in Software Analysis: Applications & Techniques
TRIANGULATION.
Geometry & Measurement
Introduction to Web programming
UE/BiTS Hamburg Summer term 2018
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
Multidimensional array
Basics (Cont...).
Unit 7 – Area and Volume Mathematics (9-1) - iGCSE Year 09
PHP PROF. S. LAKSHMANAN, DEPT. OF B. VOC. (SD & SA),
PHP-II.
Pascal Prof. Steven A. Demurjian
PHP Array.
Property Case Law Update NQLA 25 May 2013
IEEE 802 JTC1 Standing Committee July 2019 agenda in Vienna
2nd Grade High-Frequency Words
CSRC Summer School on Quantum Non-equilibrium Phenomena: Methods and Applications Nonequilibrium Green’s Function Method in Quantum Transport – Electrons,
Presentation transcript:

PHP Arrays By Justin Nelsen

What is an Array? -An array can store one or more values in a single variable name. -Each element in the array is assigned its own ID so that it can be easily accessed. -$array[key] = value;

3 Kinds of Arrays Numeric Array Associative Array Multidimensional Array

Numeric Array A numeric array stores each element with a numeric ID key. 3 ways to write a numeric array.

Automatically Example: $names = array("Peter","Quagmire","Joe");

Munually Example: $names[0] = "Peter"; $names[1] = "Quagmire"; $names[2] = "Joe";

The ID can be used in a script Example: <?php $names[0] = "Peter"; $names[1] = "Quagmire"; $names[2] = "Joe"; echo $names[1] . " and " . $names[2] . " are ". $names[0] . "'s neighbors"; ?>

Output Quagmire and Joe are Peter's neighbors

Associative Arrays -An associative array, each ID key is associated with a value. -When storing data about specific named values, a numerical array is not always the best way to do it. -With associative arrays we can use the values as keys and assign values to them.

Example Using an array to assign an age to a person. $ages = array(”Brent"=>42, ”Andrew"=>25, "Joshua”16=>); $ages[’Brent'] = ”42"; $ages[’Andrew'] = ”25"; $ages['Joshua'] = ”16";

The Id can be used in a script <?php $ages[‘Brent’] = ”42"; $ages[‘Andrew’] = ”25"; $ages[‘Joshua’] = ”16"; echo Brent is " . $ages[‘Brent’] . " years old."; ?>

Output -“Brent is 42 years old.”

Multidimensional Arrays In a multidimensional array, each element in the main array can also be an array. - And each element in the sub-array can be an array, and so on.

Example $families = array ( "Griffin"=>array "Peter", "Lois", "Megan" ), "Quagmire"=>array ( "Glenn" ), "Brown"=>array "Cleveland", "Loretta", "Junior" ) );

Ouput Is Megan a part of the Griffin family? Array ( [Griffin] => Array [0] => Peter [1] => Lois [2] => Megan ) [Quagmire] => Array [0] => Glenn [Brown] => Array [0] => Cleveland [1] => Loretta [2] => Junior echo "Is " . $families['Griffin'][2] . " a part of the Griffin family?"; Is Megan a part of the Griffin family?

References http:www.w3schools.com/php/php_arrays.asp http://www.softwareprojects.org/php-arrays-08.htm