Constants | |
---|---|
Magic Constants | |
These magic constants change their values depending on where they are used. | |
Name | Description |
__CLASS__ | The name of the class that the method belongs to, along with and the containing namespace. If it is used in a trait method, gives the value of the class in which the trait is used. |
__DIR__ | The directory of the current file. If this is used inside an included file, it refers to the included file. This is equivalent to dirname(__FILE__). This directory name does not have a trailing slash unless it is the root directory. |
__FILE__ | The full path and filename of the current file. If this is used inside an included file, it refers to the included file. |
__FUNCTION__ | The name of the function containing function. Otherwise, it returns "{closure}" if it is an anonymous function. |
__LINE__ | The current line number in this file. |
__METHOD__ | The name of the method that contains the constant. |
__NAMESPACE__ | The name of the namespace that contains the constant. |
__TRAIT__ | The name of the trait that the method belongs to, along with and the containing namespace. |
<< Class Name >>::class | The name of the class, along with and the containing namespace. |
Predefined Constants | |
These are the constants that are defined as the PHP core, including Zend and SAPI. | |
Name | Description |
PHP_VERSION | This is a string that defines the current version. For example, this is the string "7.4.1-extra" for the PHP version 7.4.1-extra. |
PHP_MAJOR_VERSION | This is an integer that defines the current major version. For example, this is the integer 7 for the PHP version 7.4.1-extra. |
PHP_MINOR_VERSION | This is an integer that defines the current minor version. For example, this is the integer 4 for the PHP version 7.4.1-extra. |
PHP_RELEASE_VERSION | This is an integer that defines the current release version. For example, this is the integer 1 for the PHP version 7.4.1-extra. |
PHP_VERSION_ID | This is an integer that defines the current PHP version as an integer. This can be used to compare versions. For example, this is the integer 70401 for the PHP version 7.4.1-extra. |
PHP_EXTRA_VERSION | This is a string that defines the current extra version. For example, this is the string "-extra" for the PHP version 7.4.1-extra. |
PHP_ZTS | This is an integer value that indicates whether or not the Zend Thread Safety is enabled. The value 0 is equivalent to false and indicates that the current PHP version is not thread safe. |
PHP_DEBUG | This is an integer that indicates whether or not PHP debugging is enabled. The value 0 is equivalent to false. |
PHP_MAXPATHLEN | This is an integer that indicates the maximum number of characters that are supported for a filename and path. |
PHP_OS | This is a string that specifies the operating system for which this version of PHP was built. The string "WINNT" is an example. |
PHP_OS_FAMILY | This is a string that specifies the operating system family for which this version of PHP was built. The string "Windows" is an example. |
PHP_SAPI | This is a string that specifies the server API for this version of PHP. The string "cgi-fcgi" is an example. |
PHP_EOL | This is a string that specifies the end of line character for the currrent platform. The strings "\n" and "\r\n" are examples for Unix and Windows, respectively. |
PHP_INT_MAX | An integer that is the largest integer value: 2147483647 or 9223372036854775807 for 32 bit or 64 bit systems, respectively. |
PHP_INT_MIN | An integer that is the smallest integer value: -2147483648 or -9223372036854775808 for 32 bit or 64 bit systems, respectively. |
PHP_INT_SIZE | The number of bytes used to represent an integer: 4 or 8 bytes for 32 bit or 64 bit systems, respectively. |
PHP_FLOAT_DIG | An integer that indicates the number of decimal digits that can be represented via the mantissa of a float value. Typically, this might be 15. |
PHP_FLOAT_EPSILON | The smallest float value that can be added to 1 such that the result is a value greater than 1. An example value for this is 2.2204460492503E-16. |
PHP_FLOAT_MIN | The smallest positive float value that can be represented. An example value for this is 2.2250738585072E-308. |
PHP_FLOAT_MAX | The largest float value that can be represented. An example value for this is 1.7976931348623E+308. |
DEFAULT_INCLUDE_PATH | A string that tells the default include path. The string ".;C:\php\pear" is an example. |
PEAR_INSTALL_DIR | A string that tells where pear is installed. The string "C:\php\pear" is an example. |
PEAR_EXTENSION_DIR | A string that tells where the pear extension is installed. The string "C:\php\ext" is an example. |
PHP_EXTENSION_DIR | A string that tells where the PHP extensions are. The string "C:\php\ext" is an example. |
PHP_PREFIX | A string that tells the prefix value for PHP paths. The string "C:\php\" is an example. |
PHP_BINDIR | A string that tells the bindir value for PHP paths. The string "C:\php\" is an example. |
PHP_BINARY | A string that tells where the binary file for PHP is. The string "C:\Program Files\PHP\v7.4\php-cgi.exe" is an example. |
PHP_MANDIR | A string that tells the directory where the man pages (instruction pages) were installed. |
PHP_LIBDIR | A string that tells the directory where the libraries were installed. The string "C:\php\" is an example. |
PHP_DATADIR | A string that tells the directory where the data files were installed. The string "C:\php\" is an example. |
PHP_SYSCONFDIR | A string that tells the directory where the system configuration files were installed. The string "C:\php\" is an example. |
PHP_LOCALSTATEDIR | A string that tells the directory where the local state files were installed. The string "C:\php\" is an example. |
PHP_CONFIG_FILE_PATH | A string that tells the path where the configuation files are to be installed. The string "C:\WINDOWS" is an example. |
PHP_CONFIG_FILE_SCAN_DIR | A string that tells the directory where the file scan files were installed. |
PHP_SHLIB_SUFFIX | A string that indicates the file extension for libraries. The strings "so" and "dll" are examples for Unix and Windows, respectively. |
PHP_FD_SETSIZE | An integer that indicate the maximum number of file descriptors for select system calls. The number 256 is an example. |
E_ERROR | The integer value that is reported for a fatal run-time error. The value 1 is an example. |
E_WARNING | The integer value that is reported for a run-time warning. The value 2 is an example. |
E_PARSE | The integer value that is reported for a compile-time parsing error. The value 4 is an example. |
E_NOTICE | The integer value that is reported for a run-time notice. This could be an error or a normal occurance. The value 8 is an example. |
E_CORE_ERROR | The integer value that is reported for an initial PHP start-up error that is generated by the core of PHP. The value 16 is an example. |
E_CORE_WARNING | The integer value that is reported for an initial PHP start-up warning that is generated by the core of PHP. The value 32 is an example. |
E_COMPILE_ERROR | The integer value that is reported for a fatal compile-time error. The value 64 is an example. |
E_COMPILE_WARNING | The integer value that is reported for a fatal compile-time warning. The value 128 is an example. |
E_USER_ERROR | The integer value that is reported for a user-generated error. It is generated by the trigger_error() function. The value 256 is an example. |
E_USER_WARNING | The integer value that is reported for a user-generated warning. It is generated by the trigger_error() function. The value 512 is an example. |
E_USER_NOTICE | The integer value that is reported for a user-generated notice. It is generated by the trigger_error() function. The value 1024 is an example. |
E_STRICT | The integer value is used to set PHP to strict mode. The value 2048 is an example. |
E_RECOVERABLE_ERROR | The integer value is used to indicate a recoverable error. The value 4096 is an example. |
E_DEPRECATED | The integer value is used to indicate deprecated PHP features. The value 8192 is an example. |
E_USER_DEPRECATED | The integer value is used to indicate user-generated deprecated PHP features. The value 16384 is an example. |
E_ALL | The integer value is used to indicate all errors, warnings, and notices. The value 32767 is an example. |
__COMPILER_HALT_OFFSET__ | An integer used to indicate a compiler halt offset. |
true | A boolean value that indicates a true value. |
false | A boolean value that indicates a false value. |
null | The null value is used to indicate a nonexistent object. |
PHP_WINDOWS_EVENT_CTRL_C | An integer that is used to indicate a control + c (copy) event. |
PHP_WINDOWS_EVENT_CTRL_BREAK | An integer that is used to indicate a control + break event. |
© 20072024 XoaX.net LLC. All rights reserved.