Arrays in PHP

Arrays are important to program development. Explore how to work with them in PHP.

provided by: 
Originally published at Internet.com


Arrays fall under the same category that a lot of concepts in PHP do: "Difficult to understand at first, easy to use once you do, and impossible to live without." In this article, we will be taking a look at why they are so important to program development, and explore how to work with them. You will also learn how you can write a random link generator using arrays, and expand it to display banners or buttons associated with the links. So, What Exactly are Arrays? Arrays, common to almost every programming language in one form or another, are a data type which allows groups of related data to be stored in a structured table-like format. Simple arrays look a lot like a database or spreadsheet from your favorite office suite, and can be manipulated in much the same way.

In PHP, an array is assigned to a single variable, but it can hold dozens of individual pieces of information. Each individual bit of information, or row, is referred to as an array element. Within every array element there are two parts: the value, which contains the actual information you want to store, and a unique key which identifies the value. You'll learn later how keys play an important role in the process of accessing and manipulate array elements. Keys can either be non-negative integers, or strings. Arrays with integers as keys are the most common types and known as Scalar Arrays. Those with strings as keys are called Associative Arrays...

Read article at Internet.com site
Related Articles
- Password protection through JavaScript
This is the first in a series of script tips meant to discuss and describe the concept of creating password protection through JavaScript.
- Passing and Reading URL Parameters
Related Articles
- Password protection through JavaScript
This is the first in a series of script tips meant to discuss and describe the concept of creating password protection through JavaScript.
- Passing and Reading URL Parameters

Rss   Delicious   Digg   Add To My Yahoo   Add To My Google   Bookmark   Search Plugin

Topics:
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML