Skip to Main Content
PHP & MySQL®: Your visual blueprint™ for creating dynamic, database-driven Web sites
book

PHP & MySQL®: Your visual blueprint™ for creating dynamic, database-driven Web sites

by Janet Valade
September 2006
Intermediate to advanced content levelIntermediate to advanced
319 pages
9h 24m
English
Visual
Content preview from PHP & MySQL®: Your visual blueprint™ for creating dynamic, database-driven Web sites

Chapter 3. Using Arrays

Create an Array

Arrays are complex variables that store a group of values under a single variable name. You can use an array to store related values that you want to process as a group. Each value in an array is called an element. An array can have as many elements as needed. You do not need to specify the size of an array. PHP will store the array with as many elements as you assign to it.

Each element in an array has a key so that you can access the individual elements. You assign values to an array as follows:

$arrayname['key1'] = value1;
$arrayname['key2'] = value2;

You can use numbers or strings as keys. String keys should be enclosed in single quotes, such as $arrayname['cost']. If you do not include a key in the square ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide

PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide

Larry Ullman

Publisher Resources

ISBN: 9780470048399Purchase book