Example analysis of PHP array key value usage
This article mainly introduces the PHP array key value usage, the example analyzes the PHP array key value system automatic allocation principle and the use skill, has the certain reference value, needs the friend to refer to the next
This example describes the PHP array key-value usage. Share to everyone for your reference. The specific analysis is as follows:
Look at an array first:
?
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 |
$switching = Array (
Ten,//key = 0
5 = 6,
3 = 7,
' A ' = 4,
One,//key = 6 (the maximum value for an integer key index in the entire array is 5)
' 8 ' = + 2,//Key = 8 (string Kin ' 8 ' converted to 8)
' 02 ' (Note that it is not 2)
0 = 12
/* The key with a front face value of 10 is given 0, and the value of the 0 key is later redefined as 12,
This overrides the previous default 0 key value */
);
Empty array
$empty = Array ();
?>
|
If printed with Print_r ($switching), the result is:
Array ([0] = [5] = 6 [3] = 7 [A] = 4 [6] = [8] = 2 [Geneva] = 77)
Note that 02 of the two-digit number is in the back row.
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/961775.html www.bkjia.com true http://www.bkjia.com/PHPjc/961775.html techarticle example Analysis of PHP array key value usage This article mainly introduces the PHP array key value usage, the example analyzes the PHP array key value system automatic assignment principle and the use technique, has the certain reference ...