Home  >  Article  >  Backend Development  >  What does predefinition mean in php

What does predefinition mean in php

尊渡假赌尊渡假赌尊渡假赌
尊渡假赌尊渡假赌尊渡假赌Original
2023-06-05 10:00:441893browse

Predefinition in PHP refers to the built-in constants, variables and functions that are considered globally available. These contents do not need to be specially introduced or declared and exist in the PHP language itself.

What does predefinition mean in php

Operating system for this tutorial: Windows 10 system, php8.1.3 version, Dell G3 computer.

Predefined in PHP refers to the built-in constants, variables and functions that are considered globally available

1. Predefined constants

Predefined constants are constants defined by PHP itself. Developers can use them directly without declaring or defining them themselves:

PHP_VERSION:当前 PHP 版本号
PHP_OS:运行 PHP 的操作系统
PHP_EOL:当前操作系统的行尾标识符TRUE、FALSE、NULL:分别表示真、假和空值

2. Predefined variables

Predefined variables are also usually called super global variables. They have global scope and developers can access them from any function or class method. The following are some common predefined variables:

$_SERVER:包含一系列服务器环境变量和请求信息
$_GET:包含通过 GET 方法提交过来的参数
$_POST:包含通过 POST 方法提交过来的参数
$_COOKIE:包含存储在客户端的 Cookie 数据
$_SESSION:包含跨页面会话期间存储的数据
$_FILES:包含上传文件的相关信息
$_REQUEST:包含所有 HTTP 请求数据,包括 GET、POST 和 COOKIE 数据

3. Predefined functions

Predefined functions are built-in functions provided by the PHP language and can be used directly in scripts , without prior declaration or import. The following are some common booking functions:

print()、echo():分别用于输出字符串到浏览器
count():用于获取数组元素的个数
isset()、empty():分别用于判断变量是否

The above is the detailed content of What does predefinition mean in php. For more information, please follow other related articles on the PHP Chinese website!

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