What is a PHP array? What are the types of PHP arrays?

Source: Internet
Author: User
Tags php programming
What is a PHP array?

An array is a set of data that organizes a series of data to form an operational whole.

Arrays in PHP are more complex, but more flexible than arrays in many other high-level languages. An array of arrays is an ordered set of variables in which each variable is called an element. Each element is distinguished by a special identifier, which is called a key (also known as subscript).

Each element in the array contains two items: A key and a value. The corresponding array elements can be obtained by key values, which can be numeric keys or association keys.

If a variable is a container that stores a single value, the array is a container for storing multiple values. Data structures such as:

For example, a team usually has dozens of people, but when they know them, they are considered to be members of a certain team, and then use their numbers to differentiate each player, at this time, the team is an array, and the number is the index of the array, and when the player is assigned, it can be found!

<?php$arr = Array (0=> "Tom",1=> "Andy",2=> "Jack");? >

Arrays provide a quick and easy way to manage a set of related data, which is an important part of PHP programming. How is PHP specifically used? Please refer to PHP How to declare arrays: declaring arrays in two ways this article.

What are the types of PHP arrays?

PHP arrays are divided into three categories

Numeric index array:

An indexed array stores a series of individual or multiple values that are organized, each of which can be accessed by using an unsigned integer value.

Associative arrays:

An associative array is an array that has a special indexed way. You can index it not only by integer, but also by using a string or other type of value (except null).

Multidimensional Arrays:

In the concept of data structures, arrays of more than two-dimensional arrays, both nonlinear and non-planar arrays, become multidimensional arrays.

We'll cover the types of PHP arrays in detail later!

"Related tutorials Recommended"

1. Related topics: "PHP array"

2. Related Video Course recommendations: Definition and classification of PHP arrays: Array elements are made up of key names and values

Related Article

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.