What is a PHP one-dimensional array?
A one-dimensional array is a single array of structures arranged in a simple sort structure, consisting of numbers. Is the basis of a two-dimensional array and a multidimensional array.
An array is a collection of several variables of the same type, and the same name can be used when referencing them. Arrays are composed of contiguous storage units, the lowest address corresponds to the first element of the array, the highest address corresponds to the last element, and the array can be one-dimensional or multidimensional.
PHP One-dimensional array instance detailed
One-dimensional arrays in computer languages
(1) An array is a set of ordered data. The arrangement of the data in the array is a regular one, and the subscript represents the ordinal number of the data in the array.
(2) using an array name (such as s) and subscripts (such as 14) to uniquely determine the elements in the array, such as S, represents the 15th student's grade.
(3) Each element in the array belongs to the same data type. It is not possible to put different types of data (such as students ' grades and students ' gender) in the same set of numbers.
When an element of an array is a variable, the array is called a one-dimensional array. A one-dimensional array is the most common array that saves only one column of content.
The general form of declaring a one-dimensional array is:
Examples of PHP one-dimensional arrays:
<?phpheader ("content-type:text/html; Charset=utf-8 "), $array = Array (1=>" PHP ",2=>" Chinese ",3=>" net ");p Rint_r ($array); >
The output is:
Next we will introduce "what is a PHP two-dimensional array?" PHP two-dimensional array instance detailed
"Related tutorials Recommended"
1. Related topics: "PHP array"