In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Php associative array and index array what is the difference, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, hope you can gain something.
The difference between an associative array and an indexed array in php: the subscript (key name) of an indexed array consists of numbers, each number corresponding to the position of an array element in the array, while the subscript (key name) of an associative array consists of a string wrapped in quotation marks, which can be a mixture of numeric and character values, or any integer value or string.
In PHP, an array is a collection of data that forms an operable whole. Each data is an element, which contains a key name and a key value.
The difference between an indexed array and an associative array is distinguished by key names
I. indexed array
The subscript (key name) of an indexed array consists of numbers. By default, starting from 0, each number corresponds to the position of an array element in the array, which does not need to be specified. PHP automatically assigns an integer value to the key name of the indexed array, and then increments automatically from this value.
The results show that:
You can also write:
The results show that:
2. Associative array
The subscript (key name) of an associative array consists of a mixture of numeric values and strings, and if an array has a key name that is not a number, then the array is an associative array.
The key name of an associative array can be any integer or string. If the key name is a string, add a delimiter to the key name-single quotation mark''or double quotation mark "". For indexed arrays, to avoid confusion, it is best to add delimiters as well.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.