Home > Backend Development > PHP Problem > What are the built-in constants in php?

What are the built-in constants in php?

DDD
Release: 2023-08-16 15:09:12
Original
1317 people have browsed it

php's built-in constants include PHP_VERSION, PHP_OS, PHP_EOL, PHP_INT_MAX, PHP_INT_MIN, PHP_INT_SIZE, PHP_ROUND_HALF_UP, PHP_ROUND_HALF_EVEN, PHP_ROUND_HALF, PHP_FLOAT_MAX, PHP_FLOAT_DIG, PHP_BINARY, PHP_SAPI, PHP_SELF, etc.

What are the built-in constants in php?

The operating environment of this article: Windows 10 system, PHP8.1.3 version, Dell G3 computer.

PHP's built-in constants are some predefined constants that can be used directly in PHP scripts. There are many these constants. Here are some common built-in constants:

PHP_VERSION: The version number of the current PHP parser.

PHP_OS: The name of the operating system running the PHP parser.

PHP_EOL: The newline character of the current operating system.

PHP_INT_MAX: The maximum integer value that the current PHP parser can represent.

PHP_INT_MIN: The smallest integer value that the current PHP parser can represent.

PHP_INT_SIZE: The size (number of bytes) of the integer type that the current PHP parser can handle.

PHP_ROUND_HALF_UP: Constant for rounding 8. PHP_ROUND_HALF_DOWN: Constant for rounding.

PHP_ROUND_HALF_EVEN: Constant used for rounding.

PHP_ROUND_HALF: Constant used for rounding.

PHP_FLOAT_MAX: The maximum floating point value that the current PHP parser can represent.

PHP_FLOAT_MIN: The smallest floating point value that the current PHP parser can represent.

PHP_FLOAT_DIG: The number of significant digits of floating point numbers that the current PHP parser can represent.

PHP_BINARY: The binary path of the PHP parser.

PHP_SAPI`: The interface type of the current PHP parser (such as "cli" or "cgi-fcgi").

PHP_SELF: The file name of the currently executing script.

PHP_MAXPATHLEN: The maximum path length allowed for the current operation.

PHP_MAX_EXECUTION_TIME: The maximum execution time (seconds) allowed by the current PHP parser.

PHP_OUTPUT_HANDLER_START: The start identification constant of the PHP output handler.

PHP_OUTPUT_HANDLER_CONT: PHP output processing continuation identification constant.

PHP_OUTPUT_HANDLER_END: ​​The end identification constant of the PHP output handler.

These are some common PHP built-in constants, which can be used directly in PHP scripts without prior definition. By using these constants, you can easily obtain some information related to the PHP parser and the current environment.

The above is the detailed content of What are the built-in constants in php?. For more information, please follow other related articles on the PHP Chinese website!

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