This is a php example of arrays, a brief description of the basic use of the array, the example added a note
Copy Code code as follows:
<?php
Defines a string array
$fruit = Array (\ "apple\", \ "orange\");
Value of reference array
$fruit [0];//represents the value of apple
The value of the $fruit [1];//represents orange
It's worth noting that the index of the array is starting at 0, and people who have studied C and Java know it.
Defines an array of numeric types
$number = Array (1,2,3,4,5);//reference array value ditto
Defines an array of conforming types
$mix = Array (1,\ "example\", \ "hello\", 2.5);//reference array value ditto
You can also define an array in the form of a key value
$ex = Array (\ "a\" =>\ "fruit", "b\" =>\ "car \");
You can quote this.
$ex [\ "A\"];//the corresponding value is the fruit
$ex [\ "B\"];//the corresponding value is the car
You can also create an array of such key-value conformance types
?>