Home > Backend Development > PHP Tutorial > PHP study notes_5_Arrays and predefined variables (unfinished)

PHP study notes_5_Arrays and predefined variables (unfinished)

WBOY
Release: 2016-08-08 09:19:20
Original
858 people have browsed it

php has two types of arrays: index array and associative array. Their declaration methods are similar. There are mainly three declaration methods:

Declaration method:
array(); can declare any array, see the example below

<code><?php
    $temp= array(<span>1</span>,<span>2</span>,<span>3</span>);
    print_r($temp);<span>//这是打印数组的方法</span><span>/**
    输出的结果,Array90

    **/</span></code>
Copy after login

Note:
1. When null is used as a data key, it will be converted into an empty string;
2. When adding a value, the array subscript is the current maximum subscript plus 1. If the maximum subscript value is a negative number, when adding an element with an unspecified index, the index is 0;
3.

<code><span>$_POST</span>:接收表单以POST发送的数据
<span>$_GET</span>:接收表单以GET方式发送的数据
<span>$_REQUEST</span>:<span>$_GET</span>+<span>$_POST</span>+<span>$_COOKIE</span><span>$_FILES</span>:HTTP文件上传变量
<span>$_SERVER</span>:服务器与执行环境变量
<span>$_ENV</span>:环境变量
<span>$_SESSION</span>:会话变量
<span>$_COOKIE</span>:http cookie
<span>$_GLOBALE</span>:预定义变量的总集合
<span>$php_errormsg</span>:前一个错误信息(只在错误发生的作用域内可用,需要开启php.ini里track_error配置项)</code>
Copy after login

Copyright statement: This article is an original article. Reprints must indicate the source. The views in the article only represent the views at the time. There must be shortcomings. Please feel free to remind me. Thank you very much!

The above introduces the PHP study notes_5_arrays and predefined variables (not finished), including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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