Enter your Sign-on user name and password.

Forgot password?
  • Follow us on:
Loading video...

Start Learning Now

Our free lessons will get you started (Flash® 10 required).
Get immediate access to our entire library.

Sign up for Educator.com

Features Overview

  • Get on-demand access to our complete library
  • Search and jump to exactly what you need to learn
  • Track your progress
  • Download practice and lesson files
  • *Ask questions and get answers from our community & instructors

Arrays

  • An array is a composite data type meaning it can hold more than one piece of data simultaneously, unlike scalar data types.
  • Arrays in PHP are treated as maps where values are associated, or mapped, to keys .
  • Keys can only be either integers or strings. However, values can be any PHP data type, including other arrays.
  • Array values can be repeated, but keys must be unique.
  • Arrays with integers as keys are known as numerically-indexed, or simply, indexed arrays .
  • Arrays with strings as keys are known as associative arrays .
  • Arrays are typically declared using the array() construct.
  • Associative arrays use the => operator to assign keys with values.
  • Data in arrays is accessed using square bracket syntax .
  • For indexed arrays, the integer key of the desired value is listed between the brackets. Indexed array keys always start with the index 0.
  • For associative arrays, the string key of the desired value is listed in quotes between the brackets.
  • print_r() is a function used to output the value of variables in a formatted fashion.
  • Additional Resources:

Arrays

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

Computer Science: Introduction to PHP