Home > Backend Development > PHP Tutorial > Array array type analysis instructions in PHP_PHP tutorial

Array array type analysis instructions in PHP_PHP tutorial

WBOY
Release: 2016-07-21 15:36:02
Original
1072 people have browsed it

The key of the 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.

Copy code The code is as follows:

$arr = array('a','b ',5=>'c','d','e',6=>'g');
echo '
'; <br>print_r($arr); <br> echo '
';


The result of the above code is

Copy code Code As follows:

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


Like this. The reason there is no value "d" is because it is overwritten by the following 6=>'g'

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322197.htmlTechArticleThe key of the 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,...
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