PHP: Hypertext Preprocessor (original) (raw)

Predefined Constants

Core Predefined Constants

These constants are defined by the PHP core. This includes PHP, the Zend engine, and SAPI modules.

[PHP_VERSION](reserved.constants.php#constant.php-version) (string)

The current PHP version as a string in "major.minor.release[extra]" notation.

[PHP_MAJOR_VERSION](reserved.constants.php#constant.php-major-version) (int)

The current PHP "major" version as an integer (e.g., int(5) from version "5.2.7-extra").

[PHP_MINOR_VERSION](reserved.constants.php#constant.php-minor-version) (int)

The current PHP "minor" version as an integer (e.g., int(2) from version "5.2.7-extra").

[PHP_RELEASE_VERSION](reserved.constants.php#constant.php-release-version) (int)

The current PHP "release" version as an integer (e.g., int(7) from version "5.2.7-extra").

[PHP_VERSION_ID](reserved.constants.php#constant.php-version-id) (int)

The current PHP version as an integer, useful for version comparisons (e.g., int(50207) from version "5.2.7-extra").

The current PHP "extra" version as a string (e.g., '-extra' from version "5.2.7-extra"). Often used by distribution vendors to indicate a package version.

[ZEND_THREAD_SAFE](reserved.constants.php#constant.zend-thread-safe) (bool)

Indicates whether the current build of PHP is thread safe.

[ZEND_DEBUG_BUILD](reserved.constants.php#constant.zend-debug-build) (bool)

Indicates whether the current build of PHP is a debug build.

[PHP_ZTS](reserved.constants.php#constant.php-zts) (bool) Alias of [ZEND_THREAD_SAFE](reserved.constants.php#constant.zend-thread-safe)

Indicates whether the current build of PHP is thread safe.

[PHP_DEBUG](reserved.constants.php#constant.php-debug) (bool) Alias of [ZEND_DEBUG_BUILD](reserved.constants.php#constant.zend-debug-build)

Indicates whether the current build of PHP is a debug build.

[DEBUG_BACKTRACE_PROVIDE_OBJECT](reserved.constants.php#constant.debug-backtrace-provide-object) (int)

Populate the "object" index.

[DEBUG_BACKTRACE_IGNORE_ARGS](reserved.constants.php#constant.debug-backtrace-ignore-args) (int)

Don't include the argument information for functions in the stack trace.

[PHP_MAXPATHLEN](reserved.constants.php#constant.php-maxpathlen) (int)

The maximum length of filenames (including path) supported by this build of PHP.

[PHP_OS](reserved.constants.php#constant.php-os) (string)

The operating system PHP was built for.

[PHP_OS_FAMILY](reserved.constants.php#constant.php-os-family) (string)

The operating system family PHP was built for. One of'Windows', 'BSD','Darwin', 'Solaris','Linux' or 'Unknown'. Available as of PHP 7.2.0.

[PHP_SAPI](reserved.constants.php#constant.php-sapi) (string)

The Server API for this build of PHP. See also php_sapi_name().

[PHP_EOL](reserved.constants.php#constant.php-eol) (string)

The correct 'End Of Line' symbol for this platform.

[PHP_INT_MAX](reserved.constants.php#constant.php-int-max) (int)

The largest integer supported in this build of PHP. Usually int(2147483647) in 32 bit systems and int(9223372036854775807) in 64 bit systems.

[PHP_INT_MIN](reserved.constants.php#constant.php-int-min) (int)

The smallest integer supported in this build of PHP. Usually int(-2147483648) in 32 bit systems and int(-9223372036854775808) in 64 bit systems. Usually, PHP_INT_MIN === ~PHP_INT_MAX.

[PHP_INT_SIZE](reserved.constants.php#constant.php-int-size) (int)

The size of an integer in bytes in this build of PHP.

[PHP_FLOAT_DIG](reserved.constants.php#constant.php-float-dig) (int)

Number of decimal digits that can be rounded into a float and back without precision loss. Available as of PHP 7.2.0.

[PHP_FLOAT_EPSILON](reserved.constants.php#constant.php-float-epsilon) (float)

Smallest representable positive number x, so that x + 1.0 != 1.0. Available as of PHP 7.2.0.

[PHP_FLOAT_MIN](reserved.constants.php#constant.php-float-min) (float)

Smallest representable positive floating point number. If you need the smallest representable negative floating point number, use - PHP_FLOAT_MAX. Available as of PHP 7.2.0.

[PHP_FLOAT_MAX](reserved.constants.php#constant.php-float-max) (float)

Largest representable floating point number. Available as of PHP 7.2.0.

[DEFAULT_INCLUDE_PATH](reserved.constants.php#constant.default-include-path) (string)

[PEAR_INSTALL_DIR](reserved.constants.php#constant.pear-install-dir) (string)

[PEAR_EXTENSION_DIR](reserved.constants.php#constant.pear-extension-dir) (string)

[PHP_EXTENSION_DIR](reserved.constants.php#constant.php-extension-dir) (string)

The default directory where to look for dynamically loadable extensions (unless overridden by extension_dir). Defaults to [PHP_PREFIX](reserved.constants.php#constant.php-prefix) (or PHP_PREFIX . "\\ext" on Windows).

[PHP_PREFIX](reserved.constants.php#constant.php-prefix) (string)

The value --prefix was set to at configure. On Windows, it is the value --with-prefix was set to at configure.

[PHP_BINDIR](reserved.constants.php#constant.php-bindir) (string)

The value --bindir was set to at configure. On Windows, it is the value --with-prefix was set to at configure.

[PHP_SBINDIR](reserved.constants.php#constant.php-sbindir) (string)

The value --sbindir was set to at configure. On Windows, it is the value --with-prefix was set to at configure. Available as of PHP 8.4.0.

[PHP_BINARY](reserved.constants.php#constant.php-binary) (string)

Specifies the PHP binary path during script execution.

[PHP_MANDIR](reserved.constants.php#constant.php-mandir) (string)

Specifies where the manpages were installed into.

[PHP_LIBDIR](reserved.constants.php#constant.php-libdir) (string)

[PHP_DATADIR](reserved.constants.php#constant.php-datadir) (string)

[PHP_SYSCONFDIR](reserved.constants.php#constant.php-sysconfdir) (string)

[PHP_LOCALSTATEDIR](reserved.constants.php#constant.php-localstatedir) (string)

[PHP_CONFIG_FILE_PATH](reserved.constants.php#constant.php-config-file-path) (string)

[PHP_CONFIG_FILE_SCAN_DIR](reserved.constants.php#constant.php-config-file-scan-dir) (string)

[PHP_SHLIB_SUFFIX](reserved.constants.php#constant.php-shlib-suffix) (string)

The build-platform's shared library suffix, such as "so" (most Unixes) or "dll" (Windows).

[PHP_FD_SETSIZE](reserved.constants.php#constant.php-fd-setsize) (int)

The maximum number of file descriptors for select system calls. Available as of PHP 7.1.0.

[E_ERROR](errorfunc.constants.php#constant.e-error) (int)

[E_WARNING](errorfunc.constants.php#constant.e-warning) (int)

[E_PARSE](errorfunc.constants.php#constant.e-parse) (int)

[E_NOTICE](errorfunc.constants.php#constant.e-notice) (int)

[E_CORE_ERROR](errorfunc.constants.php#constant.e-core-error) (int)

[E_CORE_WARNING](errorfunc.constants.php#constant.e-core-warning) (int)

[E_COMPILE_ERROR](errorfunc.constants.php#constant.e-compile-error) (int)

[E_COMPILE_WARNING](errorfunc.constants.php#constant.e-compile-warning) (int)

[E_USER_ERROR](errorfunc.constants.php#constant.e-user-error) (int)

[E_USER_WARNING](errorfunc.constants.php#constant.e-user-warning) (int)

[E_USER_NOTICE](errorfunc.constants.php#constant.e-user-notice) (int)

[E_RECOVERABLE_ERROR](errorfunc.constants.php#constant.e-recoverable-error) (int)

[E_DEPRECATED](errorfunc.constants.php#constant.e-deprecated) (int)

[E_USER_DEPRECATED](errorfunc.constants.php#constant.e-user-deprecated) (int)

[E_ALL](errorfunc.constants.php#constant.e-all) (int)

[E_STRICT](errorfunc.constants.php#constant.e-strict) (int)

Error reporting constants

[__COMPILER_HALT_OFFSET__](misc.constants.php#constant.compiler-halt-offset) (int)

[true](reserved.constants.php#constant.true) (bool)

See Booleans.

[false](reserved.constants.php#constant.false) (bool)

See Booleans.

[null](reserved.constants.php#constant.null) (null)

See Null.

[PHP_WINDOWS_EVENT_CTRL_C](reserved.constants.php#constant.php-windows-event-ctrl-c) (int)

A Windows CTRL +C event. Available as of PHP 7.4.0 (Windows only).

[PHP_WINDOWS_EVENT_CTRL_BREAK](reserved.constants.php#constant.php-windows-event-ctrl-break) (int)

A Windows CTRL +BREAK event. Available as of PHP 7.4.0 (Windows only).

[PHP_CLI_PROCESS_TITLE](reserved.constants.php#constant.php-cli-process-title) (bool)

Indicates whether the setting and getting of the process title is available. Available only under the CLI SAPI.

[STDERR](reserved.constants.php#constant.stderr) (resource)

An already opened stream to stderr. Available only under the CLI SAPI.

[STDIN](reserved.constants.php#constant.stdin) (resource)

An already opened stream to stdin. Available only under the CLI SAPI.

[STDOUT](reserved.constants.php#constant.stdout) (resource)

An already opened stream to stdout. Available only under the CLI SAPI.

See also: Magic constants.

Standard Predefined Constants

All constants from core extensions are defined in PHP by default.

Found A Problem?

There are no user contributed notes for this page.