What is a PHP array? Which types of PHP arrays are available?

Source: Internet
Author: User
An array is a collection of data. it organizes a series of data to form an operational whole. What is a PHP array?

An array is a collection of data. it organizes a series of data to form an operational whole.

Arrays in PHP are complex, but more flexible than arrays in many other advanced languages. Array is a group of ordered variables, each of which is called an element. Each element is distinguished by a special identifier, which is called a key (or subscript ).

Each element in the array contains two items: Key and value. You can obtain the corresponding array elements through key values. these key values can be numerical keys or associated keys.

If a variable is a container that stores a single value, an array is a container that stores multiple values. The data structure is as follows:

For example, a team usually has dozens of people, but when they get to know them, they will first regard them as members of a team, and then use their numbers to differentiate each team member. at this time, the team is an array, and the number is the subscript of the array. when you specify the number of players, you can find this player!

 "tom",1=>"andy",2=>"jack");?>

Array provides a fast and convenient way to manage a set of related data, which is an important part of php programming. How to use php? Please refer to the article on how to declare an array in php: two methods to declare an array.

What types of PHP arrays are available?

PHP arrays are divided into three types:

Number index array:

The index array stores a series of individual or multiple organizational values. each value can be accessed by an unsigned integer.

Join array:

"Join array" is an array with a special index method. It can be indexed not only by integers, but also by strings or other types of values (except NULL.

Multi-dimensional array:

The concept in the data structure, two-dimensional arrays and above, both non-linear and non-plane arrays become multi-dimensional arrays.

We will introduce the PHP array type in detail later!

[Recommended tutorials]

1. related topic recommendations: php Array (Array)

2. related video course recommendations: php array definition and classification: array elements are composed of key names and values

What is the PHP array above? Which types of PHP array details are available? for more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.