PHP Array tutorial

Home - Tutorials - Basics

In this tutorial I will show you how to work with arrays in PHP. You will learn how to create, sort or print an array. Besides this we will touch on multidimensional arrays as well.

Tutorial info:

Name:PHP Array tutorial
Total steps:7

Bookmark PHP Array tutorial

Step 1 - Introduction to arrays

PHP Array tutorial

Arrays are special data types. Despite of other normal variables an array can store more than one value. Let's suppose you want to store basic colors in your PHP script. You can construct a small list from them like this:

Color list:

It is quite hard, boring, and bad idea to store each color in a separate variable. It would be very nice to have the above representation almost as it is in PHP. And here comes array into play.

The array type exists exactly for such purposes. So let's see how to create an array to store our color list.

Next Step of PHP Array tutorial

Tags: array, php array, sort array, create array, print array, array length

Follow phpf1 on Twitter

F1 Site Family
Java F1
JavaScript F1

Total time: 0.1418