Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Does the array of php only support numeric subscripts?

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces whether the array of php only supports digital subscript, which can be used for reference by interested friends. I hope you can learn a lot after reading this article.

No, the subscript (index value) of the php array can be a string or a number. An array with a subscript of a string is an associative array, which is an array with a special index; an array with a subscript of a number is an indexed array, whose subscript value must be an integer, starting with 0, and so on.

Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

In PHP, the subscript (index value) of an array can be a string or a number.

An array subscribed to a string is an associative array

An array with a subscript of numbers is an indexed array

Indexed array

The indexed array stores a series of organized single or multiple values, each of which can be accessed by using an unsigned integer value. The key of the indexed array is an integer, starting at 0, and so on.

Associative array

An associative array is an array with a special index. Use a string or other type of value (except NULL) to index it.

In fact, the difference between an associative array and an indexed array is only in the key value, the key value of the associative array is a string and is artificially specified.

Thank you for reading this article carefully. I hope the article "does the array of php only support digital subscript" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report