search
HomeBackend DevelopmentPHP ProblemWhat does predefinition mean in php

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.