#An array in PHP is actually an ordered map. A mapping is a type that associates values to keys.
This type has been optimized in many aspects, so it can be treated as a real array, or list (vector), hash table (an implementation of mapping), dictionary, set , stacks, queues and many more possibilities.
Since the value of an array element can also be another array, tree structures and multidimensional arrays are also allowed.
Define array array() (Recommended learning: PHP programming from entry to proficiency)
You can use the array() language structure to create a new one array. It accepts any number of comma-separated key => value pairs.
array( key => value<br/> , ...<br/> )<br/>// 键(key)可是是一个整数 integer 或字符串 string<br/>// 值(value)可以是任意类型的值<br/>
The comma after the last array element can be omitted. Usually used in single-line array definitions, such as array(1, 2) instead of array(1, 2,). It is common to leave the last comma in multi-line array definitions to make it easier to add a new cell.
Since 5.4, you can use the short array definition syntax, using [] instead of array().
<?php<br/>$array = array(<br/> "foo" => "bar",<br/> "bar" => "foo",<br/>);<br/><br/>// 自 PHP 5.4 起<br/>$array = [<br/> "foo" => "bar",<br/> "bar" => "foo",<br/>];<br/>?><br/>
The above is the detailed content of What is an array in PHP. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Chinese version
Chinese version, very easy to use

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
