Php Array Rule Analysis _ PHP Tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.