This is a PHP example about arrays. It briefly explains the basic use of arrays. Comments are added to the example
Copy code The code is as follows:
//Define a string array
$fruit = array("apple", "orange");
//Reference array The value
$fruit[0];//The value represented is apple
$fruit[1];//The value represented is orange
//It is worth noting that the index of the array is from 0 At the beginning, everyone who has studied C and Java knows it.
//Define a numerical array
$number = array(1,2,3,4,5);//The value of the reference array is the same as above
//Define a Conforming array
$mix = array(1,"example","hello",2.5);//The value of the reference array is the same as above
//You can also define the array in key-value mode
$ex = array("a"=>"Fruit","b"=>"Car");
//You can reference it like this
$ex["a"];//Corresponding The value is fruit
$ex["b"];//The corresponding value is car
//You can also create such a key-value matching array
?>
http://www.bkjia.com/PHPjc/746864.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/746864.htmlTechArticleThis is a PHP example about arrays. It briefly explains the basic use of arrays. Comments are added to the example. Copy the code as follows: ?php //Define a string array $fruit =...