FUNCTION NAME |
FUNCTION DESCRIPTION |
FUNCTION SYNTAX |
FUNCTION RETURN VALUE |
connection_aborted()
[connection_aborted – Check whether client disconnected] |
This function checks whether the client disconnected [‘aborted the connection’]. |
connection_aborted(); |
connection_aborted() : returns 1 if the client disconnected; 0 otherwise. |
connection_status()
[connection_status – Returns connection status bitfield] |
This function returns the connection status bitfield. |
connection_status(); |
connection_status() : returns the connection status bitfield – one of four possible values: 0 [CONNECTION_NORMAL ]; 1 [CONNECTION_ABORTED ]; 2 [CONNECTION_TIMEOUT ]; or 3 [CONNECTION_ABORTED & CONNECTION_TIMEOUT ]. |
constant()
[constant – Returns the value of a constant] |
This function returns the value of the constant represented by name. |
constant(name); |
constant() : returns the value of the constant on success; FALSE and an E_WARNING-level error on failure. |
define()
[define – Defines a named constant at runtime] |
This function defines a named constant at runtime. |
define(name, value, case_insensitive [optional parameter with a default value of FALSE]);
[name: it is not recommended – although it is possible – to define() constants with reserved or invalid names (whose values can only be retrieved through the use of the constant() function). value: in PHP 7 array values are accepted, in addition to the types accepted by PHP 5 (integer, float, string, boolean, and NULL). Resource constants can be defined, but this is not recommended since it can lead to unpredictable behaviour. case_insensitive: if set to TRUE the constant will be defined case-insensitively and stored in lowercase. Case-insensitive definitions are deprecated as of PHP 7.3.0.] |
define() : returns TRUE on success; FALSE on failure. |
defined()
[defined – Checks whether a given named constant exists] |
This function checks whether the constant represented by name exists and is defined.
Since defined() only applies to constants, use isset() to check whether a variable exists, and function_exists() to ascertain the existence of a function. |
defined(name); |
defined() : returns TRUE if the named constant represented by name has been defined; FALSE otherwise. |
eval()
[eval – Evaluate a string as PHP code] |
This language construct evaluates the passed code as PHP code. As it facilitates the execution of arbitrary PHP code, its use is discouraged. Do not pass any user-provided data to it without correct prior validation. |
eval(code);
[code represents valid PHP code to be evaluated. Opening and closing PHP tags must not be included. A return statement will immediately terminate evaluation of the code. code is executed in the scope of the code calling eval() ; thus, any variables that are defined/altered during execution of the eval() call will persist after its termination.] |
eval() : returns NULL unless return is called in the code — in which case, the value passed to return is returned. A ParseError exception is thrown if a parse error is encountered in the evaluated code in PHP 7; beforehand, FALSE would be returned and the ensuing code execution continued normally. Parse errors cannot be caught in eval() using set_error_handler() . A fatal error causes the whole script to exit. |
exit()
[exit – Output a message and terminate the current script] |
This language construct – equivalent to the die() language construct – terminates execution [thus, ‘exits’] the script. Even when exit() is called, shutdown functions and object destructors will always be executed. Since it is a language construct, exit can be called without parentheses if no status is passed. |
exit(status [optional parameter]);
[If present, status can be either a string or an integer. If a string, exit() will print it just before exiting. If an integer it should be in the range 0 – 254; 255 is reserved by PHP, while 0 is used to terminate the script successfully.] |
exit() : no value is returned. |
get_browser()
[get_browser – Tells what the user’s browser is capable of] |
This function attempts to determine the capabilities of the user’s browser, by referencing [‘getting’] the browser’s information in the browscap.ini file (this file is not bundled with PHP but can be downloaded separately). |
get_browser(user_agent [optional parameter], return_array [optional parameter, with a default value of FALSE]);
[By default, the value of the HTTP User-Agent header is used for the user_agent parameter; this can be altered, or bypassed entirely by passing in NULL. If return_array is set to TRUE, this function will return an array instead of an object.] |
get_browser() : returns an object or an array containing various data elements pertaining to the browser – major and minor version numbers, ID string, TRUE/FALSE values for browser capabilities such as frames, JavaScript, cookies. |
__halt_compiler()
[__halt_compiler – Halts the compiler execution] |
This function halts the execution of the compiler, and can only be used from the outermost scope. It is useful for embedding data in PHP scripts, like the installation files. If halt_compiler() is present in a file, byte position of the data start can be determined by the __COMPILER_HALT_OFFSET__ constant. |
__halt_compiler(); |
__halt_compiler() : no value is returned [‘VOID’]. |
highlight_file()
[highlight_file – Syntax highlighting of a file] |
This function – an alias of show_source() – prints out or returns a syntax-highlighted version of the code contained in filename, using the colours defined in the built-in syntax-highlighter for PHP. Many servers are configured to highlight files with a phps extension automatically. |
highlight_file(filename, return [optional boolean parameter, with a default value of FALSE]);
[filename represents the path to the PHP file to be highlighted. return: when set to TRUE, this parameter makes the function return the highlighted code rather than printing it out; internal output buffering is then used, so this function cannot be used inside an ob_start() callback function.] |
highlight_file() : if return is set to TRUE, this function returns the highlighted code as a string rather than printing it out. Otherwise, TRUE is returned on success; FALSE on failure. |
highlight_string()
[highlight_string – Syntax highlighting of a string] |
This function outputs or returns html markup for a syntax-highlighted version of the given PHP code string , using the colours defined in the built-in syntax highlighter for PHP. |
highlight_string(string, return [optional boolean parameter, with a default value of FALSE]);
[string specifies the PHP code to be highlighted; the opening tag should be included. return: if set to TRUE, the function returns the highlighted code rather than printing it out.] |
highlight_string() : if return is set to TRUE, the highlighted code is returned as a string rather than being printed out. Otherwise, TRUE is returned on success; FALSE on failure. |
hrtime()
[hrtime – Get the system’s high resolution time] |
This function returns the system’s high resolution time, counted from an arbitrary point in time. The timestamp returned by this function cannot be either increased or decreased. |
hrtime(get_as_number [optional boolean parameter, with a default value of FALSE]);
[get_as_number specifies whether the high resolution time should be returned in array or number format.] |
hrtime() : if get_as_number is FALSE then an array of integers in the form [seconds, nanoseconds] is returned. Otherwise, the nanoseconds are returned as integer [64-bit systems] or float [32-bit systems]. |
ignore_user_abort()
[ignore_user_abort – Set whether a client disconnect should abort script execution] |
This function sets whether a client [‘user’] disconnect should abort script execution. If value is set to TRUE then script execution continues regardless of a client disconnect; thus, the script ignores the disconnection. Similarly, if a script’s tty [‘teletype’/terminal] goes away without the script being terminated, a TRUE value stops the script from dying the next time it tries to write anything. |
ignore_user_abort(value [optional boolean parameter, with no default value]);
[If given, value sets the ignore_user_abort PHP ini setting to the given value. If value is not set, this function simply returns the previous setting without changing it.] |
ignore_user_abort() : returns the previous setting, as an integer. |
pack()
[pack – Pack data into binary string] |
This function packs the given arguments into a binary string according to format. Perl provided the inspiration for this function; all formatting codes work the same as in Perl, although some – like “u” – are missing. Only unpack() – pack() ‘s functional antagonist – is affected by the distinction between signed and unsigned values; pack() gives the same result for signed and unsigned format codes. PHP internally stores integers as signed values of a machine-dependent size; operations and literals that yield numbers outside the boundaries of the integer type will be stored as float. When these floats are packed as integers, they are first cast to the integer type — this may or may not result in the desired byte sequence. |
pack(format, arguments [optional parameter]);
[There are currently thirty implemented format codes: a (NUL-padded string); A (SPACE-padded string); h (hex string, low nibble first); H (hex string, high nibble first); c (signed char); C (unsigned char); s (signed short, 16-bit, machine byte order); S (unsigned short, 16-bit, machine byte order); n (unsigned short, 16-bit, big endian byte order); v (unsigned short, 16-bit, little endian byte order); i (signed integer); I (unsigned integer); l (signed long, 32-bit, machine byte order); L (unsigned long, 32-bit, machine byte order); N (unsigned long, 32-bit, big endian byte order); V (unsigned long, 32-bit, little endian byte order); q (signed long long, 64-bit, machine byte order); Q (unsigned long long, 64-bit, machine byte order); J (unsigned long long, 64-bit, big endian byte order); P (unsigned long long, 64-bit, little endian byte order); f (float); g (float, little endian byte order); G (float, big endian byte order); d (double); e (double, little endian byte order); E (double, big endian byte order); x (NUL byte); X (Back up one byte); Z (NUL-padded string); and @ (NUL-fill to absolute position).] |
pack() : returns a binary string containing data. |
php_check_syntax()
[php_check_syntax – Check the PHP syntax of (and execute) the specified file] |
This function tests filename for scripting errors, performing a syntax (lint) check. It is similar to using php -l from the command line, except that this function executes – but doesn’t output – the checked filename. If a function is defined in filename it will be available to the file that called php_check_syntax() , but output from filename will be suppressed. This function has been deprecated and removed from PHP for technical reasons — to obtain the functionality provided by this function, use php -l somefile.php from the commandline instead. |
php_check_syntax(filename, error_message [optional parameter]);
[If error_message is used, it will contain the error message produced by the syntax check. error_message is passed by reference.] |
php_check_syntax() : returns TRUE if the lint check passes; FALSE if the lint check fails or if filename cannot be opened. |
php_strip_whitespace()
[php_strip_whitespace – Return source with stripped comments and whitespace] |
This function returns the PHP source code in filename with PHP comments and whitespace removed [‘stripped’]. This is similar to using php -w from the commandline. This function respects the value of the short_open_tag ini directive. |
php_strip_whitespace(filename);
[The string filename represents the path to the PHP file.] |
php_strip_whitespace() : returns the stripped source code as a string on success; an empty string on failure. Before PHP 5.0.1, this function would only return an empty string. |
sapi_windows_cp_conv()
[sapi_windows_cp_conv – Convert string from one codepage to another] |
This function converts subject string from one codepage to another. |
sapi_windows_cp_conv(in_codepage, out_codepage, subject);
[in_codepage: the codepage of the subject string — either the codepage name or identifier. out_codepage: the codepage to convert the subject string to — either the codepage name or identifier. subject represents the string to convert.] |
sapi_windows_cp_conv() : returns subject string converted to out_codepage, or NULL on failure. If invalid codepages are given OR if the subject is not valid for in_codepage, this function issues E_WARNING-level errors. |
sapi_windows_cp_get()
[sapi_windows_cp_get – Get process codepage] |
This function returns [‘gets’] the identifier of the codepage of the current process. |
sapi_windows_cp_get(kind);
[kind denotes the type of codepage and can be either ‘ansi’ or ‘oem’.] |
sapi_windows_cp_get() : returns the codepage identifier. |
sapi_windows_cp_is_utf8()
[sapi_windows_cp_is_utf8 – Indicates whether the codepage is UTF-8 compatible] |
This function indicates whether the codepage of the current process is UTF-8 compatible. |
sapi_windows_cp_is_utf8(); |
sapi_windows_cp_is_utf8() : returns whether the codepage of the current process is UTF-8 compatible, as a boolean. |
sapi_windows_cp_set()
[sapi_windows_cp_set – Set process codepage] |
This function sets the codepage of the current process. |
sapi_windows_cp_set(codepage);
[codepage represents a codepage identifier; integer format.] |
sapi_windows_cp_set() : returns TRUE on success; FALSE on failure. |
sapi_windows_vt100_support()
[sapi_windows_vt100_support – Get or set VT100 support for the specified stream associated to an output buffer of a Windows console] |
PHP tries to enable the VT100 feature of the STDOUT/STDERR streams upon startup. If these streams are redirected to a file, VT100 features may not be enabled. If VT100 support is enabled, one can use control sequences from the VT100 terminal. They allow the modification of the terminal’s output, and – on Windows – are known as Console Virtual Terminal Sequences. This function uses the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag implemented in the Windows 10 API, so the VT100 feature may not be available on older versions of Windows. |
sapi_windows_vt100_support(stream, enable [optional boolean parameter, with no default value]);
[stream specifies the stream upon which the function will operate. enable specifies whether the VT100 feature will be enabled [TRUE] or not [FALSE].] |
sapi_windows_vt100_support() : if enable is omitted, the function returns TRUE if stream has VT100 control codes enabled, FALSE if not. If enable has been specified, the function will try to enable or disable the VT100 features of stream — if the enabling/disabling of VT100 features has been successful then the function returns TRUE; otherwise, FALSE is returned. |
sleep()
[sleep – Delay execution] |
This function delays the program execution [makes the program ‘sleep’] for the given number of seconds. |
sleep(seconds);
[seconds specifies the halt time in seconds.] |
sleep() : returns zero on success; FALSE on error. If a signal interrupts the call, sleep() returns a non-zero value — on Windows, this value will be equal to the WAIT_IO_COMPLETION constant within the Windows API; on other platforms, the return value will be the number of seconds left to sleep. An E_WARNING is generated if the specified number of seconds is negative. Before PHP 5.3.4 on Windows, this function always returns NULL when sleep has occurred. |
sys_getloadavg()
[sys_getloadavg – Gets system load average] |
This function returns [‘gets’] three samples representing the average system load (the number of processes in the system run queue) over the last 1, 5, and 15 minutes. |
sys_getloadavg(); |
sys_getloadavg() : returns an array of three samples [last 1, 5, and 15 minutes]. |
time_nanosleep()
[time_nanosleep – Delay for a number of seconds and nanoseconds] |
This function delays program execution (makes the program execution ‘sleep’) for the period of time specified by seconds and nanoseconds. |
time_nanosleep(seconds, nanoseconds);
[seconds must be a non-negative integer. nanoseconds must be a non-negative integer less than one billion.] |
time_nanosleep() : returns TRUE on success; FALSE on failure. If the delay was interrupted by a signal, an associative array will be returned comprising seconds [number of seconds remaining in the delay] and nanoseconds [the number of nanoseconds remaining in the delay]. This function has been available on Windows systems since PHP 5.3.0. |
time_sleep_until()
[time_sleep_until – Make the script sleep until the specified time] |
This function makes the script sleep until the specified timestamp. |
time_sleep_until(timestamp);
[timestamp specifies the timestamp at which the script should wake.] |
time_sleep_until() : returns TRUE on success; FALSE on failure. This function has been available on Windows system since PHP 5.3.0. An E_WARNING is generated if timestamp is in the past. |
uniqid()
[uniqid – Generate a unique ID] |
This function returns an [optionally-prefixed] unique identifier based on the current time in microseconds. This function is not considered cryptographically-secure; for cryptographically-secure values it is advisable to use random_int() , random_bytes() , or openssl_random_pseudo_bytes() . Most systems adjust system clock by NTP; it is possible that this function does not return unique ID for the process/thread. The more_entropy parameter should be used to increase the likelihood of uniqueness. |
uniqid(prefix [optional string parameter], more_entropy [optional boolean parameter]);
[prefix is useful in cases where several identifiers might be generated simultaneously (at the same microsecond). If more_entropy is set to true, additional entropy – using the combined linear congruential generator – will be added at the end of the return value, increasing the likelihood of the result’s uniqueness.] |
uniqid() : returns a timestamp-based unique identifier as a string. With an empty prefix, the returned string will be 13 characters long; if more_entropy is TRUE it will be 23 characters long. |
unpack()
[unpack – Unpack data from binary string] |
This function unpacks from a binary_string into an associative array, according to the specified format. To facilitate data storage in an associative array, the different format codes must be named and separated by a forward slash (/). If a repeater argument is present, each of the array keys will have a sequence number behind the given name. |
unpack(format, binary_string, offset [optional parameter, with a default value of 0]);
[binary_string represents the packed data. offset represents the offset to start unpacking from.] |
unpack() : returns an associative array containing unpacked elements of binary_string. |
usleep()
[usleep – Delay execution in microseconds] |
This function delays program execution [makes the program ‘sleep’] for the specified number of micro_[μ]seconds. |
usleep(micro_seconds);
[micro_seconds specifies a halt time in microseconds (millionths of a second).] |
usleep() : no value is returned. |