Home  >  Article  >  Backend Development  >  What are the commonly used predefined constant functions in php?

What are the commonly used predefined constant functions in php?

下次还敢
下次还敢Original
2024-04-27 11:45:31423browse

PHP provides many predefined constant functions: PHP_VERSION returns the PHP version. PHP_OS returns the current operating system name. PHP_SAPI returns the server API that PHP runs under. PHP_EOL returns the system newline character. E_ALL returns an integer containing all error levels.

What are the commonly used predefined constant functions in php?

Commonly used predefined constant functions in PHP

PHP provides a large number of predefined constant functions. Help us get information about the current PHP environment and scripts. The following are some of the commonly used functions:

1. PHP_VERSION

Returns the version number of PHP, such as "7.4.25" or "8.1.6".

2. PHP_OS

Returns the name of the current operating system, such as "Linux", "Windows" or "macOS".

3. PHP_SAPI

Returns the server API used by the current PHP run, such as "cli" (command line interface), "apache2handler" (Apache module) or " cgi-fcgi" (CGI/FastCGI).

4. PHP_EOL

Returns the string containing the newline character in the current system, such as "\n" (Unix) or "\r\n" (Windows).

5. E_ALL

Returns an integer containing all error levels, such as 2047.

6. E_ERROR

Returns an integer indicating the error level E_ERROR, for example 1.

7. E_WARNING

Returns an integer indicating the error level E_WARNING, for example 2.

8. E_NOTICE

Returns an integer indicating the error level E_NOTICE, for example 8.

9. E_USER_ERROR

Returns an integer indicating the error level E_USER_ERROR, for example 256.

10. E_USER_WARNING

Returns an integer indicating the error level E_USER_WARNING, for example 512.

11. E_USER_NOTICE

Returns an integer representing the error level E_USER_NOTICE, such as 1024.

The above is the detailed content of What are the commonly used predefined constant functions 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
Previous article:What does res mean in phpNext article:What does res mean in php