Home > Backend Development > PHP Tutorial > Summary of PHP array key name techniques_PHP tutorial

Summary of PHP array key name techniques_PHP tutorial

WBOY
Release: 2016-07-13 10:04:00
Original
776 people have browsed it

Summary of PHP array key name techniques

This article mainly introduces the summary of PHP array key name techniques, analyzes the common usage techniques of PHP array key names, and has certain reference value. , friends in need can refer to it

This article summarizes the techniques of PHP array key names in more detail. Share it with everyone for your reference. The specific analysis is as follows:

1. $arr[true] is equivalent to $arr[1]; $arr[false] is equivalent to $arr[0].

2. Using null as the key name is equivalent to creating or overwriting an $arr[null], which can be accessed using $arr[null] or $arr[""].

3. When using a number with a decimal point as the key name, the key name will automatically intercept the integer part as the key name. For example, $arr[123.45]=5, you can use $arr[123.45] or $arr[123] to obtain the key value; when traversing with foreach, $arr[123] is used.

4. $arr[]=5, the element will be added after the array $arr.

Note: The data type of the key name in the array is integer or string

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/966914.htmlTechArticleSummary of php array key name techniques This article mainly introduces a summary of php array key name techniques and analyzes php array keys This is a common usage technique, which has certain reference value. Friends who need it can refer to...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template