Home > Backend Development > PHP Problem > what are php array keys

what are php array keys

silencement
Release: 2023-02-25 07:26:01
Original
5228 people have browsed it

what are php array keys

Arrays in PHP are divided into index arrays and associative arrays. A key in the array corresponds to a value.

For example, the following associative array

$navs = [
    'gc'=>'国产电影',
    'om'=>'欧美电影',
];
Copy after login

The name of the array is $navs, gc is the key, that is, key, and its corresponding value is 'domestic movie'; similarly, om is also a key, Its value is 'European and American movies'.

PHP's array does not mean the meaning of arrays in other languages, because arrays in other strongly typed languages ​​are generally of fixed length, and subscripts are fixed numerical arrangements. The subscript (key) of PHP's array (the internal implementation is using classes) can be a number or any other scalar (number, string, etc.), and when the key of the array is a number It can also be discontinued when

. Such as 4,6,7,9, such subscripts.

$_POST $_GET are all system-default arrays

, and the value passed is a variable in it.

$_POST['Here is the value of the attribute name in the form'] // The value of this expression is the value of the attribute value in the form

The above is the detailed content of what are php array keys. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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