Home  >  Article  >  Backend Development  >  Detailed explanation of array type analysis in PHP_PHP tutorial

Detailed explanation of array type analysis in PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:41:09766browse

This article will explain the detailed analysis of array types in PHP
PHP’s array is an ordered map. Map is a type that associates keys and values.
The key of PHP array can be of string type or integer type. If the key is a float type, it will be automatically converted to an integer type.

If a key is not specified for a value and the maximum value of the integer type index has been given, the new key is the maximum value plus 1. If the new key has been assigned, then the value will be Cover it.
$arr = array(a,b,5=>c,d,e,6=>g);
echo

;<br>print_r( $arr);<br>echo 
;

Code running result
Array(
[0] => a
[1] => b
[5] => c
[6] => g
[7] => e)

Like this. The only reason why there is no value "d" is because it is covered by the following 6=>g
I hope this article can be useful to you.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486155.htmlTechArticleThis article will explain in detail the array type analysis in PHP. The array of PHP is an ordered map. Map is a type that associates keys and values. The key of the php array can be of string type or int...
Statement:
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