Use the php array for rule analysis. Php array rule analysis this article mainly introduces the rules for using php arrays. The example analyzes the usage of arrays in php and has some reference value, for more information about how to use php array rules, see the following section.
This article mainly introduces the php array usage rules. The example analyzes the array usage in php and has some reference value. For more information, see
This article analyzes the use rules of arrays in php. Share it with you for your reference. The specific analysis is as follows:
Arrays are very important in php. Strings, images, numbers, and video equivalents all exist in arrays. Therefore, it is necessary to understand the rules of arrays.
1. Key and value.
Basic array format:
?
|
1
2
3
4 |
Array ([key =>]
Value
,...
)
|
Key => value, where the key can only be two types: integer and string. Value can be in various forms. except for numbers, other values must be enclosed by ''or. The following example shows the rules:
?
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14 |
$ A = array (-1 => 2,
-2 => 3,
'01 '=> '99.jpg ',
8,
'A ',
'B' => TRUE,
NULL,
"",
1.2 => 0.5,
);
Print_r ($ );
?>
|
Output result: array ([-1] => 2 [-2] => 3 [01] => 99.jpg [0] => 8 [1] => 0.5 => 1 [2] => [3] =>)
I hope this article will help you with php programming.
This article mainly introduces the php array usage rules. The example analyzes the array usage in php and has some reference value. if you need it, you can refer to this article...