PHP Misc. Constants
Posted by admin | Posted in PHP Tutorial | Posted on 10-08-2010-05-2008
0
| Constant | Description | PHP Version |
| CONNECTION_ABORTED | ||
| CONNECTION_NORMAL | ||
| CONNECTION_TIMEOUT | ||
| __COMPILER_HALT_OFFSET__ | 5 |
| Constant | Description | PHP Version |
| CONNECTION_ABORTED | ||
| CONNECTION_NORMAL | ||
| CONNECTION_TIMEOUT | ||
| __COMPILER_HALT_OFFSET__ | 5 |
| Function | Description | PHP Version |
| connection_aborted() | Checks whether the client has disconnected | 3 |
| connection_status() | Returns the current connection status | 3 |
| connection_timeout() | Deprecated in PHP 4.0.5 | 3 |
| constant() | Returns the value of a constant | 4 |
| define() | Defines a constant | 3 |
| defined() | Checks whether a constant exists | 3 |
| die() | Prints a message and exits the current script | 3 |
| eval() | Evaluates a string as PHP code | 3 |
| exit() | Prints a message and exits the current script | 3 |
| get_browser() | Returns the capabilities of the user’s browser | 3 |
| highlight_file() | Outputs a file with the PHP syntax highlighted | 4 |
| highlirght_string() | Outputs a string with the PHP syntax highlighted | 4 |
| ignore_user_abort() | Sets whether a remote client can abort the running of a script | 3 |
| pack() | Packs data into a binary string | 3 |
| php_check_syntax() | Deprecated in PHP 5.0.5 | 5 |
| php_strip_whitespace() | Returns the source code of a file with PHP comments and whitespace removed | 5 |
| show_source() | Alias of highlight_file() | 4 |
| sleep() | Delays code execution for a number of seconds | 3 |
| time_nanosleep() | Delays code execution for a number of seconds and nanoseconds | 5 |
| time_sleep_until() | Delays code execution until a specified time | 5 |
| uniqid() | Generates a unique ID | 3 |
| unpack() | Unpacks data from a binary string | 3 |
| usleep() | Delays code execution for a number of microseconds | 3 |
The behavior of the misc functions is affected by settings in the php.ini file.
Misc. configuration options:
| Name | Default | Description | Changeable |
| ignore_user_abort | “0″ | FALSE indicates that scripts will be terminated as soon as they try to output something after a client has aborted their connection | PHP_INI_ALL |
| highlight.string | “#DD0000″ | Color for highlighting a string in PHP syntax | PHP_INI_ALL |
| highlight.comment | “#FF8000″ | Color for highlighting PHP comments | PHP_INI_ALL |
| highlight.keyword | “#007700″ | Color for syntax highlighting PHP keywords (e.g. parenthesis and semicolon) | PHP_INI_ALL |
| highlight.bg | “#FFFFFF” | Color for background | PHP_INI_ALL |
| highlight.default | “#0000BB” | Default color for PHP syntax | PHP_INI_ALL |
| highlight.html | “#000000″ | Color for HTML code | PHP_INI_ALL |
| browscap | NULL | Name and location of browser-capabilities file (e.g. browscap.ini) | PHP_INI_SYSTEM |
The misc functions are part of the PHP core. There is no installation needed to use these functions.
The misc. functions were only placed here because none of the other categories seemed to fit.
| Constant | Description | PHP Version |
| M_E | Returns e (approx. 2.718) | 4 |
| M_EULER | Returns Euler’s constant (approx. 0.577) | 4 |
| M_LNPI | Returns the natural logarithm of PI (approx. 1.144) | 4 |
| M_LN2 | Returns the natural logarithm of 2 (approx. 0.693) | 4 |
| M_LN10 | Returns the natural logarithm of 10 (approx. 2.302) | 4 |
| M_LOG2E | Returns the base-2 logarithm of E (approx. 1.442) | 4 |
| M_LOG10E | Returns the base-10 logarithm of E (approx. 0.434) | 4 |
| M_PI | Returns PI (approx. 3.14159) | 3 |
| M_PI_2 | Returns PI/2 (approx. 1.570) | 4 |
| M_PI_4 | Returns PI/4 (approx. 0.785) | 4 |
| M_1_PI | Returns 1/PI (approx. 0.318) | 4 |
| M_2_PI | Returns 2/PI (approx. 0.636) | 4 |
| M_SQRTPI | Returns the square root of PI (approx. 1.772) | 4 |
| M_2_SQRTPI | Returns 2/square root of PI (approx. 1.128) | 4 |
| M_SQRT1_2 | Returns the square root of 1/2 (approx. 0.707) | 4 |
| M_SQRT2 | Returns the square root of 2 (approx. 1.414) | 4 |
| M_SQRT3 | Returns the square root of 3 (approx. 1.732) | 4 |
| Function | Description | PHP Version |
| abs() | Returns the absolute value of a number | 3 |
| acos() | Returns the arccosine of a number | 3 |
| acosh() | Returns the inverse hyperbolic cosine of a number | 4 |
| asin() | Returns the arcsine of a number | 3 |
| asinh() | Returns the inverse hyperbolic sine of a number | 4 |
| atan() | Returns the arctangent of a number as a numeric value between -PI/2 and PI/2 radians | 3 |
| atan2() | Returns the angle theta of an (x,y) point as a numeric value between -PI and PI radians | 3 |
| atanh() | Returns the inverse hyperbolic tangent of a number | 4 |
| base_convert() | Converts a number from one base to another | 3 |
| bindec() | Converts a binary number to a decimal number | 3 |
| ceil() | Returns the value of a number rounded upwards to the nearest integer | 3 |
| cos() | Returns the cosine of a number | 3 |
| cosh() | Returns the hyperbolic cosine of a number | 4 |
| decbin() | Converts a decimal number to a binary number | 3 |
| dechex() | Converts a decimal number to a hexadecimal number | 3 |
| decoct() | Converts a decimal number to an octal number | 3 |
| deg2rad() | Converts a degree to a radian number | 3 |
| exp() | Returns the value of Ex | 3 |
| expm1() | Returns the value of Ex – 1 | 4 |
| floor() | Returns the value of a number rounded downwards to the nearest integer | 3 |
| fmod() | Returns the remainder (modulo) of the division of the arguments | 4 |
| getrandmax() | Returns the maximum random number that can be returned by a call to the rand() function | 3 |
| hexdec() | Converts a hexadecimal number to a decimal number | 3 |
| hypot() | Returns the length of the hypotenuse of a right-angle triangle | 4 |
| is_finite() | Returns true if a value is a finite number | 4 |
| is_infinite() | Returns true if a value is an infinite number | 4 |
| is_nan() | Returns true if a value is not a number | 4 |
| lcg_value() | Returns a pseudo random number in the range of (0,1) | 4 |
| log() | Returns the natural logarithm (base E) of a number | 3 |
| log10() | Returns the base-10 logarithm of a number | 3 |
| log1p() | Returns log(1+number) | 4 |
| max() | Returns the number with the highest value of two specified numbers | 3 |
| min() | Returns the number with the lowest value of two specified numbers | 3 |
| mt_getrandmax() | Returns the largest possible value that can be returned by mt_rand() | 3 |
| mt_rand() | Returns a random integer using Mersenne Twister algorithm | 3 |
| mt_srand() | Seeds the Mersenne Twister random number generator | 3 |
| octdec() | Converts an octal number to a decimal number | 3 |
| pi() | Returns the value of PI | 3 |
| pow() | Returns the value of x to the power of y | 3 |
| rad2deg() | Converts a radian number to a degree | 3 |
| rand() | Returns a random integer | 3 |
| round() | Rounds a number to the nearest integer | 3 |
| sin() | Returns the sine of a number | 3 |
| sinh() | Returns the hyperbolic sine of a number | 4 |
| sqrt() | Returns the square root of a number | 3 |
| srand() | Seeds the random number generator | 3 |
| tan() | Returns the tangent of an angle | 3 |
| tanh() | Returns the hyperbolic tangent of an angle | 4 |
The math functions are part of the PHP core. There is no installation needed to use these functions.
The math functions can handle values within the range of integer and float types.
| Function | Description | PHP version |
| ezmlm_hash() | Calculates the hash value needed by the EZMLM mailing list system | 3 |
| mail() | Allows you to send emails directly from a script | 3 |
The behavior of the mail functions is affected by settings in the php.ini file.
Mail configuration options:
| Name | Default | Description | Changeable |
| SMTP | “localhost” | Windows only: The DNS name or IP address of the SMTP server | PHP_INI_ALL |
| smtp_port | “25″ | Windows only: The SMTP port number. Available since PHP 4.3 | PHP_INI_ALL |
| sendmail_from | NULL | Windows only: Specifies the “from” address to be used in email sent from PHP | PHP_INI_ALL |
| sendmail_path | NULL | Unix systems only: Specifies where the sendmail program can be found (usually /usr/sbin/sendmail or /usr/lib/sendmail) | PHP_INI_SYSTEM |
The mail functions are part of the PHP core. There is no installation needed to use these functions.
For the mail functions to be available, PHP requires an installed and working email system. The program to be used is defined by the configuration settings in the php.ini file.
The mail() function allows you to send emails directly from a script.
| Function | Description | PHP Version |
| LIBXML_COMPACT | Set small nodes allocation optimization. This may improve the application performance | 5 |
| LIBXML_DTDATTR | Set default DTD attributes | 5 |
| LIBXML_DTDLOAD | Load external subset | 5 |
| LIBXML_DTDVALID | Validate with the DTD | 5 |
| LIBXML_NOBLANKS | Remove blank nodes | 5 |
| LIBXML_NOCDATA | Set CDATA as text nodes | 5 |
| LIBXML_NOEMPTYTAG | Change empty tags (e.g. <br/> to <br></br>), only available in the DOMDocument->save() and DOMDocument->saveXML() functions | 5 |
| LIBXML_NOENT | Substitute entities | 5 |
| LIBXML_NOERROR | Do not show error reports | 5 |
| LIBXML_NONET | Stop network access while loading documents | 5 |
| LIBXML_NOWARNING | Do not show warning reports | 5 |
| LIBXML_NOXMLDECL | Drop the XML declaration when saving a document | 5 |
| LIBXML_NSCLEAN | Remove excess namespace declarations | 5 |
| LIBXML_XINCLUDE | Use XInclude substitution | 5 |
| LIBXML_ERR_ERROR | Get recoverable errors | 5 |
| LIBXML_ERR_FATAL | Get fatal errors | 5 |
| LIBXML_ERR_NONE | Get no errors | 5 |
| LIBXML_ERR_WARNING | Get simple warnings | 5 |
| LIBXML_VERSION | Get libxml version (e.g. 20605 or 20617) | 5 |
| LIBXML_DOTTED_VERSION | Get dotted libxml version (e.g. 2.6.5 or 2.6.17) | 5 |
| Function | Description | PHP Version |
| libxml_clear_errors() | Clear libxml error buffer | 5 |
| libxml_get_errors() | Retrieve array of errors | 5 |
| libxml_get_last_error() | Retrieve last error from libxml | 5 |
| libxml_set_streams_context() | Set the streams context for the next libxml document load or write | 5 |
| libxml_use_internal_errors() | Disable libxml errors and allow user to fetch error information as needed | 5 |
The libxml functions and constants are used together with SimpleXML, XSLT and DOM functions.
| Function | Description | PHP Version |
| header() | Sends a raw HTTP header to a client | 3 |
| headers_list() | Returns a list of response headers sent (or ready to send) | 5 |
| headers_sent() | Checks if / where the HTTP headers have been sent | 3 |
| setcookie() | Sends an HTTP cookie to a client | 3 |
| setrawcookie() | Sends an HTTP cookie without URL encoding the cookie value | 5 |
The directory functions are part of the PHP core. There is no installation needed to use these functions.
The HTTP functions let you manipulate information sent to the browser by the Web server, before any other output has been sent.