Table 3.347. Exceptions Thrown by backquote()
err | desc |
|---|---|
| An error occurred with the |
Calls a builtin function and returns the return value, passing the remaining arguments after the function name to the builtin function. This function can be used to override a builtin function's functionality with a custom implementation.
any call_builtin_function(string $name, ...)
$result = call_builtin_function("func_name", $arg1, $arg2);
Table 3.349. Exceptions Thrown by call_builtin_function()
err | desc |
|---|---|
| Parse options do not allow access to the function. |
| The builtin function does not exist. |
Calls a builtin function and returns the return value, using the optional second argument as a list of arguments for the function.
any call_builtin_function_args(string $name, list $args)
any call_builtin_function_args(string $name, any $arg)
call_builtin_function_args("func_name", $arg_list);
Table 3.351. Exceptions Thrown by call_builtin_function_args()
err | desc |
|---|---|
| Parse options do not allow access to the function. |
| The builtin function does not exist. |
Calls a function, closure, or call reference and returns the return value, passing the remaining arguments after the function name to the function, closure, or call reference.
any call_function(string $name, ...)
any call_function(code $code, ...)
$result = call_function("func_name", $arg1, $arg2);
$result = call_function($call_ref, $arg1, $arg2);
Table 3.352. Arguments and Return Values for call_function()
Argument Type | Return Type | Description |
|---|---|---|
Executes the given function, closure, or call reference with the remainder of the arguments as the arguments to the function, closure, or call reference to be called. |
Table 3.353. Exceptions Thrown by call_function()
err | desc |
|---|---|
| Parse options do not allow access to the function. |
| The function does not exist. |
Calls a function, closure, or call reference and returns the return value, using the optional second argument as a list of arguments for the function, closure, or call reference to be called.
any call_function_args(string $name, list $args)
any call_function_args(string $name, any $arg)
any call_function_args(code $code, list $args)
any call_function_args(code $code, any $arg)
call_function_args("func_name", $arg_list);
call_function_args($call_ref, $arg_list);
Table 3.355. Exceptions Thrown by call_function_args()
err | desc |
|---|---|
| Parse options do not allow access to the function. |
| The function does not exist. |
Calls a method of an object, passing the remainder of the arguments to the function as arguments to the method.
any callObjectMethod(object $obj, string $method, ...)
$result = callObjectMethod($obj, "method", $arg1, $arg2);
Table 3.357. Exceptions Thrown by callObjectMethod()
err | desc |
|---|---|
| The named method does not exist in this class. |
| The named method may not be called explicitly. |
| The named method is private and therefore can only be called within the class. |
| The named method is a member of a privately inherited base class. |
Calls a method of an object, using the optional third argument as the argument list to the method.
any callObjectMethodArgs(object $obj, string $method, list $args)
any callObjectMethodArgs(object $obj, string $method, any $arg)
$result = callObjectMethodArgs($obj, "method", $arg_list);
Table 3.359. Exceptions Thrown by callObjectMethodArgs()
err | desc |
|---|---|
| The named method does not exist in this class. |
| The named method may not be called explicitly. |
| The named method is private and therefore can only be called within the class. |
| The named method is a member of a privately inherited base class. |
Returns True if the function exists in the current program's function name space.
bool existsFunction(string $name) (CONST)
bool existsFunction(code $code) (NOOP)
$bool = existsFunction("func_name");
This function does not throw any exceptions.
Returns "builtin", "user", or NOTHING according to the function name passed.
my *string $type = functionType("print");
This function does not throw any exceptions.
Returns the byte value of the offset (starting with 0) in the object passed. Of no offset is passed, then the value of the first byte (offset 0) is returned. Note that the [] operator provides a more efficient way to retrieve a byte from a binary object.
Note that this function is identical to getByte() except that this version has no RT_NOOP variant.
*int get_byte(data $data, softint $offset $offset = 0) (CONST)
my *int $byte = get_byte($bin, 2); # returns the third byte of the binary object
Returns the 16-bit integer value at the 2-byte offset (starting with 0) in the data passed. Of no offset is passed, then the value of the first 16-bit position at offset 0 is returned. Note that the [] operator provides a more efficient way to retrieve a byte from a binary object.
This function assumes MSB byte order when retrieving the value from the data.
See also get_word_16_lsb().
*int get_word_16(data $data, softint $offset = 0) (CONST)
my *int $val = get_word_16($bin, 2); # returns the third 16-bit value in MSB format of the binary object
Table 3.363. Arguments and Return Values for get_word_16()
Arguments | Return Type | Description |
|---|---|---|
The MSB integer value of the data at the 2-byte offset given in the string or binary object. If no offset is passed, then the first 16-bit value is returned. If the object is empty or the offset is larger than the object's size, then no value is returned. |
Returns the 16-bit integer value at the 2-byte offset (starting with 0) in the data passed. Of no offset is passed, then the value of the first 16-bit position at offset 0 is returned. Note that the [] operator provides a more efficient way to retrieve a byte from a binary object.
This function assumes LSB byte order when retrieving the value from the data.
See also get_word_16().
*int get_word_16_lsb(data $data, softint $offset = 0) (CONST)
my *int $val = get_word_16_lsb($bin, 2); # returns the third 16-bit value in LSB format of the binary object
Table 3.364. Arguments and Return Values for get_word_16_lsb()
Arguments | Return Type | Description |
|---|---|---|
The LSB integer value of the data at the 2-byte offset given in the string or binary object. If no offset is passed, then the first 16-bit value is returned. If the object is empty or the offset is larger than the object's size, then no value is returned. |
Returns the 32-bit integer value at the 4-byte offset (starting with 0) in the data passed. Of no offset is passed, then the value of the first 32-bit position at offset 0 is returned. Note that the [] operator provides a more efficient way to retrieve a byte from a binary object.
This function assumes MSB byte order when retrieving the value from the data.
Note that this function is identical to getWord32() except that this version has no RT_NOOP variant.
See also get_word_32_lsb().
*int get_word_32(data $data, softint $offset = 0) (CONST)
my *int $val = get_word_32($bin, 2); # returns the third 32-bit value in MSB format of the binary object
Table 3.365. Arguments and Return Values for get_word_32()
Arguments | Return Type | Description |
|---|---|---|
The MSB integer value of the data at the 4-byte offset given in the string or binary object. If no offset is passed, then the first 32-bit value is returned. If the object is empty or the offset is larger than the object's size, then no value is returned. |
Returns the 32-bit integer value at the 4-byte offset (starting with 0) in the data passed. Of no offset is passed, then the value of the first 32-bit position at offset 0 is returned. Note that the [] operator provides a more efficient way to retrieve a byte from a binary object.
This function assumes LSB byte order when retrieving the value from the data.
See also get_word_32().
*int get_word_32_lsb(data $data, softint $offset = 0) (CONST)
my *int $val = get_word_32_lsb($bin, 2); # returns the third 32-bit value in LSB format of the binary object
Table 3.366. Arguments and Return Values for get_word_32_lsb()
Arguments | Return Type | Description |
|---|---|---|
The LSB integer value of the data at the 4-byte offset given in the string or binary object. If no offset is passed, then the first 32-bit value is returned. If the object is empty or the offset is larger than the object's size, then no value is returned. |
Returns the 64-bit integer value at the 8-byte offset (starting with 0) in the data passed. Of no offset is passed, then the value of the first 64-bit position at offset 0 is returned. Note that the [] operator provides a more efficient way to retrieve a byte from a binary object.
This function assumes MSB byte order when retrieving the value from the data.
See also get_word_64_lsb().
*int get_word_64(data $data, softint $offset = 0) (CONST)
my *int $val = get_word_64($bin, 2); # returns the third 64-bit value in MSB format of the binary object
Table 3.367. Arguments and Return Values for get_word_64()
Arguments | Return Type | Description |
|---|---|---|
The MSB integer value of the data at the 8-byte offset given in the string or binary object. If no offset is passed, then the first 64-bit value is returned. If the object is empty or the offset is larger than the object's size, then no value is returned. |
Returns the 64-bit integer value at the 8-byte offset (starting with 0) in the data passed. Of no offset is passed, then the value of the first 64-bit position at offset 0 is returned. Note that the [] operator provides a more efficient way to retrieve a byte from a binary object.
This function assumes LSB byte order when retrieving the value from the data.
See also get_word_64().
*int get_word_64_lsb(data $data, softint $offset = 0) (CONST)
my *int $val = get_word_64_lsb($bin, 2); # returns the third 64-bit value in LSB format of the binary object
Table 3.368. Arguments and Return Values for get_word_64_lsb()
Arguments | Return Type | Description |
|---|---|---|
The LSB integer value of the data at the 8-byte offset given in the string or binary object. If no offset is passed, then the first 64-bit value is returned. If the object is empty or the offset is larger than the object's size, then no value is returned. |
Returns a hash of library build and version info with the keys in the table Library Info Hash. For constants giving the same information, see Build and Version Constants.
$info = get_qore_library_info();
Table 3.369. Arguments and Return Values for get_qore_library_info()
Arguments | Return Type | Description |
|---|---|---|
n/a | A hash of library build and version info with the keys in the table Library Info Hash. For constants giving the same information, see Build and Version Constants. |
This function does not throw any exceptions.
Table 3.370. Library Info Hash
Key | Description |
|---|---|
| The operating system used to build the Qore library. |
| The CPU used as a target for the Qore library build. |
| The full version string for this version of the Qore library. |
| An integer giving the Qore library's major version number. |
| An integer giving the Qore library's minor version number. |
| An integer giving the Qore library's release version number. |
| An integer giving the Qore library's subversion revision number. |
| A string giving information about the host used to compile the Qore library. |
| The compiler used to build the Qore library. |
| The module directory assumed by default in the Qore library. |
| The compiler flags used to compile the Qore library. |
| The linker flags used to link the Qore library. |
Returns a list of hashes giving information about Qore library options for the current build. See Library Option Hash for information about the elements in the list returned. See Library Options for information about Qore library options.
$list = get_qore_option_list();
Table 3.371. Arguments and Return Values for get_qore_option_list()
Arguments | Return Type | Description |
|---|---|---|
n/a | A list of hashes giving information about Qore library options for the current build. See Library Option Hash for information about the elements in the list returned. |
Table 3.372. Library Option Hash
Key | Description |
|---|---|
| The string description of the option |
| A string giving the name of the constant that has the boolean value for this option. |
| The type of option. |
| The boolean value of the option. |
This function does not throw any exceptions.
Returns the byte value of the offset (starting with 0) in the object passed. Of no offset is passed, then the value of the first byte (offset 0) is returned. Note that the [] operator provides a more efficient way to retrieve a byte from a binary object.
my *int $byte = getByte($bin, 2); # returns the third byte of the binary object
Returns the class name of an object.
$name = getClassName($obj);
This function does not throw any exceptions.
Returns an integer representing the capabilities of a DBI driver corresponding to the driver name passed as an argument. See SQL constants for constants for names of drivers shipping with the qore distribution.
$caps = getDBIDriverCapabilities("oracle");
Table 3.375. Arguments and Return Values for getDBIDriverCapabilities()
Argument Type | Return Type | Description |
|---|---|---|
Returns an integer representing the capabilities of a DBI driver binary-OR'ed together (see DBI Capability Constants). Returns NOTHING if the driver cannot be found. |
This function does not throw any exceptions.
Returns a list of each capability supported by the given DBI driver. See SQL constants for constants giving names of drivers shipping with the Qore distribution.
$list = getDBIDriverCapabilityList("mysql");
Table 3.376. Arguments and Return Values for getDBIDriverCapabilityList()
Argument Type | Return Type | Description |
|---|---|---|
Returns a list of each capability supported by the given DBI driver (see DBI Capability Constants). Returns NOTHING if the driver cannot be found. |
This function does not throw any exceptions.
Returns a list of strings of DBI drivers currently loaded.
my *list $list = getDBIDriverList();
Table 3.377. Arguments and Return Values for getDBIDriverList()
Argument Type | Return Type | Description |
|---|---|---|
n/a | Returns a list of strings of DBI drivers currently loaded or NOTHING if no drivers are loaded. |
This function does not throw any exceptions.
Returns a list of strings of the builtin and module-supplied features of Qore.
list getFeatureList() (CONST)
$list = getFeatureList();
Table 3.378. Arguments and Return Values for getFeatureList()
Argument Type | Return Type | Description |
|---|---|---|
n/a | Returns a list of strings of the builtin and module-supplied features of Qore. |
This function does not throw any exceptions.
Returns a list of strings of the names of the methods of the class of the object passed as a parameter.
$list = getMethodList($obj);
This function does not normally throw any exceptions, however an OBJECT-ALREADY-DELETED exception could be raised if there is a race condition and a stale pointer to an object is accessed with this function.
Returns a hash of hashes describing the currently-loaded Qore modules; the top-level hash keys are the module names.
This function was added in Qore 0.8.1
hash getModuleHash() (CONST)
my hash $h = getModuleHash();
Table 3.380. Arguments and Return Values for getModuleHash()
Argument Type | Return Type | Description |
|---|---|---|
n/a | Top-level keys are module/feature names, values are hashes describing the modules. |
This function does not throw any exceptions.
Returns a list of hashes describing the currently-loaded Qore modules.
list getModuleList() (CONST)
$list = getModuleList();
Table 3.381. Arguments and Return Values for getModuleList()
Argument Type | Return Type | Description |
|---|---|---|
n/a | Each element in the list is a hash describing currently-loaded qore modules. |
This function does not throw any exceptions.
Returns the name of the default character encoding for the currently-running Qore process.
$encoding = get_default_encoding();
Table 3.382. Arguments and Return Values for get_default_encoding()
Argument Type | Return Type | Description |
|---|---|---|
n/a | Returns the name of the default character encoding. |
This function does not throw any exceptions.
Returns a group information hash representing the group information for the group ID passed; or, if the group ID does not exist NOTHING is returned.
For a similar function that throws an exception if the group ID is invalid, see getgrgid2().
my *hash $hash = getgrgid(0); # returns the login information for root
Not available with PO_NO_EXTERNAL_INFO
Table 3.383. Arguments and Return Values for getgrgid()
|
Argument Type |
Return Type |
Description |
|---|---|---|
|
|
Returns a hash representing the group information for the group ID passed. If the gid does not exist, NOTHING is returned. See the Group Information Hash for information about the return value. |
Table 3.384. Exceptions Thrown by getgrgid()
err | desc |
|---|---|
| This exception is thrown when the function is not available on the runtime platform; for maximum portability, check the constant |
Returns a group information hash representing the group information for the group ID passed. If the group ID does not exist, an exception is raised.
For a similar function that does not throw an exception if the group ID is invalid, see getgrgid().
my hash $hash = getgrgid2(0); # returns the login information for root
Not available with PO_NO_EXTERNAL_INFO
Table 3.386. Arguments and Return Values for getgrgid2()
|
Argument Type |
Return Type |
Description |
|---|---|---|
|
|
Returns a hash representing the group information for the group ID passed. If the gid does not exist, an exception is thrown. See the Group Information Hash for information about the return value. |
Table 3.387. Exceptions Thrown by getgrgid2()
err | desc |
|---|---|
| The group information could not be retrieved (group does not exist or other error in call) |
| This exception is thrown when the function is not available on the runtime platform; for maximum portability, check the constant |
Returns a group information hash representing the group information for the group name passed; or, if the group name does not exist NOTHING is returned.
For a similar function that throws an exception if the group ID is invalid, see getgrnam2().
my *hash $hash = getgrnam("root"); # returns the login information for root
Not available with PO_NO_EXTERNAL_INFO
Table 3.388. Arguments and Return Values for getgrnam()
|
Argument Type |
Return Type |
Description |
|---|---|---|
|
|
Returns a hash representing the group information for the group name passed. If the group name does not exist, NOTHING is returned. See the Group Information Hash for information about the return value. |
Table 3.389. Exceptions Thrown by getgrnam()
err | desc |
|---|---|
| This exception is thrown when the function is not available on the runtime platform; for maximum portability, check the constant |
Returns a group information hash representing the group information for the group name passed. If the group name does not exist, an exception is rasied.
For a similar function that does not throw an exception if the group ID is invalid, see getgrnam().
my hash $hash = getgrnam2("root"); # returns the login information for root
Not available with PO_NO_EXTERNAL_INFO
Table 3.390. Arguments and Return Values for getgrnam2()
|
Argument Type |
Return Type |
Description |
|---|---|---|
|
|
Returns a hash representing the group information for the group name passed. If the group name does not exist, an exception is thrown. See the Group Information Hash for information about the return value. |
Table 3.391. Exceptions Thrown by getgrnam2()
err | desc |
|---|---|
| The group information could not be retrieved (group does not exist or other error in call) |
| This exception is thrown when the function is not available on the runtime platform; for maximum portability, check the constant |
Returns a password information hash representing the user information for the user name passed; or, if the user name does not exist NOTHING is returned.
For a similar function that throws an exception if the user ID is invalid, see getpwnam2().
my *hash $hash = getpwnam("root"); # returns the login information for root
Not available with PO_NO_EXTERNAL_INFO
Table 3.392. Arguments and Return Values for getpwnam()
|
Argument Type |
Return Type |
Description |
|---|---|---|
|
|
Returns a hash representing the user information for the user name passed. If the user name does not exist, NOTHING is returned. See the Password Information Hash for information about the return value. |
Table 3.393. Exceptions Thrown by getpwnam()
err | desc |
|---|---|
| This exception is thrown when the function is not available on the runtime platform; for maximum portability, check the constant |
Table 3.394. Password Information Hash
Key | Type | Description |
|---|---|---|
| The username of the user. | |
| The encrypted password for the user. | |
| The real name or description of the user. | |
| The user's home directory. | |
| The user's login shell. | |
| The user's userid. | |
| The group id of the user's primary group. |
Returns a password information hash representing the user information for the user name passed. If the user name does not exist, an exception is rasied.
For a similar function that does not throw an exception if the user ID is invalid, see getpwnam().
my hash $hash = getpwnam2("root"); # returns the login information for root
Not available with PO_NO_EXTERNAL_INFO
Table 3.395. Arguments and Return Values for getpwnam2()
|
Argument Type |
Return Type |
Description |
|---|---|---|
|
|
Returns a hash representing the user information for the user name passed. If the user name does not exist, an exception is thrown. See the Password Information Hash for information about the return value. |
Table 3.396. Exceptions Thrown by getpwnam2()
err | desc |
|---|---|
| The user information could not be retrieved (user does not exist or other error in call) |
| This exception is thrown when the function is not available on the runtime platform; for maximum portability, check the constant |
Returns a password information hash representing the user information for the user ID passed; or, if the user ID does not exist NOTHING is returned.
For a similar function that throws an exception if the user ID is invalid, see getpwuid2().
my *hash $hash = getpwuid(0); # returns the login information for root
Not available with PO_NO_EXTERNAL_INFO
Table 3.397. Arguments and Return Values for getpwuid()
|
Argument Type |
Return Type |
Description |
|---|---|---|
|
|
Returns a hash representing the user information for the user ID passed. If the uid does not exist, NOTHING is returned. See the Password Information Hash for information about the return value. |
Table 3.398. Exceptions Thrown by getpwuid()
err | desc |
|---|---|
| This exception is thrown when the function is not available on the runtime platform; for maximum portability, check the constant |
Returns a password information hash representing the user information for the user ID passed. If the user ID does not exist, an exception is raised.
For a similar function that does not throw an exception if the user ID is invalid, see getpwuid().
my hash $hash = getpwuid2(0); # returns the login information for root
Not available with PO_NO_EXTERNAL_INFO
Table 3.399. Arguments and Return Values for getpwuid2()
|
Argument Type |
Return Type |
Description |
|---|---|---|
|
|
Returns a hash representing the user information for the user ID passed. If the uid does not exist, an exception is thrown. See the Password Information Hash for information about the return value. |
Table 3.400. Exceptions Thrown by getpwuid2()
err | desc |
|---|---|
| The user information could not be retrieved (user does not exist or other error in call) |
| This exception is thrown when the function is not available on the runtime platform; for maximum portability, check the constant |
Returns the path (directory and filename) of the current script. Returns NOTHING if unknown (i.e. no parent script, script read from stdin, etc).
my *string $path = get_script_path();
This function does not throw any exceptions.
Returns the name of the directory from which the current script was executed. Returns NOTHING if the parent script is unknown (i.e. no parent script, script read from stdin, etc).
my *string $dir = get_script_dir();
This function does not throw any exceptions.
Returns the filename of the current script if known; returns NOTHING if not (i.e. no parent script, script read from stdin, etc).
my *string $name = get_script_name();
This function does not throw any exceptions.
Returns the 32-bit integer value at the 4-byte offset (starting with 0) in the data passed. Of no offset is passed, then the value of the first 32-bit position at offset 0 is returned. Note that the [] operator provides a more efficient way to retrieve a byte from a binary object.
This function assumes MSB byte order when retrieving the value from the data.
Note that this function is identical to get_word_32() except that this version has a RT_NOOP variant.
See also get_word_32_lsb().
my *int $val = getWord32($bin, 2); # returns the third 32-bit value in MSB format of the binary object
Table 3.404. Arguments and Return Values for getWord32()
Arguments | Return Type | Description |
|---|---|---|
The MSB integer value of the data at the 4-byte offset given in the string or binary object. If no offset is passed, then the first 32-bit value is returned. If the object is empty or the offset is larger than the object's size, then no value is returned. |
Returns True if the given key exists in the hash or object (does not necessarily have to have a value assigned); exceptions are only raised if string encoding errors are encountered or in case of object access errors.
bool has_key(hash $hash, string $key) (RET_VALUE_ONLY)
bool has_key(object $obj, string $key) (RET_VALUE_ONLY)
my bool $b = has_key($hash, "key");
Table 3.405. Arguments and Return Values for has_key()
|
Argument Type |
Return Type |
Description |
|---|---|---|
Returns | ||
Returns |
Exceptions are only raised if string encoding errors are encountered or in case of object access errors.
Returns a list of all the values in the hash argument passed.
list hash_values(hash) (CONST)
my list $l = hash_values($hash);
This function does not throw any exceptions.
This function does not throw any exceptions.
Returns a string with any HTML escape codes translated to the original characters.
html_decode("<hello>"); # returns "<hello>"
This function does not throw any exceptions.
Returns a string with any characters that can be escaped translated to HTML escape codes.
$str = html_encode("<hello>"); # returns "<hello>"
This function does not throw any exceptions.
Tests if the first argument is a member of the second argument list; types are converted if necessary. If the second argument is NOTHING, then False is returned unconditionally (i.e. even if the first argument is NOTHING as well), however if the second argument is not a list then the return value of the function is the comparison of the two arguments. For a version of this function that requires types to be equal for the comparison to succeed, see inlist_hard().
bool inlist(any $value, list $list)
my $bool = inlist(123, (True, "123",False); # this will return True
Table 3.410. Arguments and Return Values for inlist()
Argument Type | Return Type | Description |
|---|---|---|
Returns | ||
Always returns | ||
Returns the value of the comparison of the first argument with the second argument; types are converted if necessary. |
This function does not throw any exceptions.
Tests if the first argument is a member of the second argument list; no type conversions are performed (i.e. the comparison fails if types are not equal). If the second argument is NOTHING, then False is returned unconditionally (i.e. even if the first argument is NOTHING as well), however if the second argument is not a list then the return value of the function is the comparison of the two arguments (types must be equal). For a "soft" version of this function that performs type conversions when doing the comparison, see inlist().
bool inlist_hard(any $value, list $list)
bool inlist_hard(any $value, any $other_value)
my $bool = inlist_hard(123, (True, "123",False); # this will return False
Table 3.411. Arguments and Return Values for inlist_hard()
Argument Type | Return Type | Description |
|---|---|---|
Returns | ||
Always returns | ||
Returns the value of the comparison of the first argument with the second argument; no type conversions are performed (the comparison fails if the types are not equal). |
This function does not throw any exceptions.
Loads in a Qore module at run-time. If a feature with the same name already exists, then this feature's code is imported into the current Program object if necessary and no further action is taken. Note that modules providing objects resolved at parse time (classes, constants, functions, etc) must be loaded with the %requires directive instead, unless all references to the objects provided by the module will be made in code embedded in Program objects.
See also getFeatureList() for a function providing a list of available features.
nothing load_module(string $path_or_name)
load_module("pgsql");
Table 3.413. Exceptions Thrown by load_module()
err | desc |
|---|---|
| An error occurred loading the module (module not found, libraries not resolved, wrong module API, etc). |
Returns a base64-encoded representation of a binary object or a string (see also makeHexString()).
$str = makeBase64String($bin);
This function does not throw any exceptions.
Returns a hex-encoded representation of a binary object or a string (see also makeBase64String()).
$str = makeHexString($bin);
This function does not throw any exceptions.
Returns the maximum value in a list (see also min()). Without a callback, this function will only work on basic data types. A closure or call reference can be used to find the maximum value of a list of complex data types. The closure or call reference must accept two arguments and must return -1, 0, or 1 if the first is less than, equal to, or greater than the second, respectively.
$max = max($complex_list, \callback_function());
$max = max(1, 2, 3, 4);
Table 3.416. Arguments and Return Values for max()
Argument Type | Return Type | Description |
|---|---|---|
Finds the maxmimum value in the list and returns that value. The list must be made up of basic data types unless a closure or call reference is used as described above. | ||
... | Finds the maximum value in the list of simple data types passed as top-level arguments to the function and returns that value. No callback reference can be specified with this variant. |
This function does not throw any exceptions (note a closure or call reference could throw an exception).
Returns the minumum value in a list (see also max()). Without a callback, this function will only work on basic data types. A closure or call reference can be used to find the minimum value of a list of complex data types. The closure or call reference must accept two arguments and must return -1, 0, or 1 if the first is less than, equal to, or greater than the second, respectively.
$min = min($complex_list, \callback_function());
$min = min(1, 10, 2, 3);
Table 3.417. Arguments and Return Values for min()
Argument Type | Return Type | Description |
|---|---|---|
Finds the minimum value in the list and returns that value. The list must be made up of basic data types unless a closure or call reference is used as described above. | ||
... | Finds the minimum value in the list of simple data types passed as top-level arguments to the function and returns that value. No callback reference can be specified with this variant. |
This function does not throw any exceptions (note that a closure or call reference could throw an exception).
Parses a URL string and returns a hash of the components with the following keys (if data in the URL is present): protocol, path, username, password, host, port. If the URL cannot be parsed, an exception is thrown..
For a similar function that returns NOTHING instead of throwing an exception if the URL string cannot be parsed, see parseURL().
my hash $hash = parse_url($url_string);
Table 3.421. Exceptions Thrown by parse_url()
err | desc |
|---|---|
| The URL string given could not be parsed. |
Parses a base64 encoded string and returns the binary object (see also parseHexString()).
$bin = parseBase64String($base64_string);
Table 3.423. Exceptions Thrown by parseBase64String()
err | desc |
|---|---|
| A syntax error occurred parsing the base64 string (invalid character, etc). |
Returns a hash of the components of a datasource string.
$hash = parseDatasource($ds_string);
Table 3.424. Arguments and Return Values for parseDatasource()
Argument Type | Return Type | Description |
|---|---|---|
Returns a hash of the components of a datasource string. A datasource string has the following structure: |
Table 3.425. Exceptions Thrown by parseDatasource()
err | desc |
|---|---|
| A syntax error occurred parsing the datasource string (missing field, unexpected character, etc). |
Table 3.426. parseDatasource() hash
Key | Description |
|---|---|
| the name of the driver, if present |
| the username given in the string |
| the password for the connection |
| the database name for the connection |
| The name of the DB-specific character encoding to use for the connection, if present in the string |
| the hostname for the connection, if present in the string |
| the port number to use for the connection, if present in the string |
| A hash of options given in the string, if present. Currently-supported options are |
Parses a hex-encoded string and returns the binary object (see also parseBase64String()).
$bin = parseHexString($hex_string);
Table 3.428. Exceptions Thrown by parseHexString()
err | desc |
|---|---|
| A syntax error occurred parsing the hex string (odd number of digits, invalid character, etc). |
Parses a URL string and returns a hash of the components with the following keys (if data in the URL is present): protocol, path, username, password, host, port. If the URL cannot be parsed, no value is returned.
For a similar function that throws an exception instead of returning NOTHING if the URL string cannot be parsed, see parse_url().
my *hash $hash = parseURL($url_string);
This function does not throw any exceptions.
Removes a signal handler and returns the signal handling state to the default. By the time this function returns, changes to the signal handling thread have already been effected. See Signal Handling for more information.
remove_signal_handler(SIGINT);
Not available with PO_NO_PROCESS_CONTROL
Table 3.431. Arguments and Return Values for remove_signal_handler()
Argument Type | Return Type | Description |
|---|---|---|
n/a | The signal number to process. |
This function does not throw any exceptions.
This function does not throw any exceptions.
Sets or replaces a signal handler according to the signal number and closure or call reference (function or object method reference) passed. By the time this function returns, changes to the signal handling thread have already been effected. See Signal Handling for more information.
When a signal is raised and the signal handler code is called, the signal number is passed as an integer argument to the signal handling code.
nothing set_signal_handler(softint $signal, code $handler)
set_signal_handler(SIGINT, \signal_handler());
Not available with PO_NO_PROCESS_CONTROL
This function does not throw any exceptions.
Performs an unstable sort in ascending order and returns the new list (for a stable version see sortStable()). Without a callback, this function will only sort basic data types. A closure or call reference can be used to sort complex data types. The closure or call reference must accept two arguments and must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively.
list sort(list $list, code $code)
$list = sort($complex_list, \callback());
This function does not throw any exceptions.
Performs an unstable sort in descending order and returns the new list (for a stable version see sortDescendingStable()). Without a closure or call reference, this function will only sort basic data types. A closure or call reference can be used to sort complex data types. The closure or call reference must accept two arguments and must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively.
list sortDescending(list $list) (CONST)
list sortDescending(list $list, code $code)
list sortDescending(list $list, string $func_name)
$list = sortDescending($complex_list, \callback());
This function does not throw any exceptions.
Performs a stable sort in descending order and returns the new list (for an unstable version see sortDescending()). Without a closure or call reference, this function will only sort basic data types. A closure or call reference can be used to sort complex data types. The closure or call reference must accept two arguments and must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively.
list sortDescendingStable(list $list) (CONST)
list sortDescendingStable(list $list, code $code)
list sortDescendingStable(list $list, string $func_name)
$list = sortDescendingStable($complex_list, \callback());
This function does not throw any exceptions.
Performs a stable sort in ascending order and returns the new list (for an unstable version see sort()). Without a closure or call reference, this function will only sort basic data types. A closure or call reference can be used to sort complex data types. The closure or call reference must accept two arguments and must return -1, 0, or 1 if the first is less than the second, if the first and second are equal, or if the first is greater than the second, respectively.
list sortStable(list $list) (CONST)
list sortStable(list $list, code $code)
list sortStable(list $list, string $func_name)
nothing sortStable() (RT_NOOP)
$list = sortStable($complex_list, \callback());
This function does not throw any exceptions.
Seeds the random number generator with the integer passed (uses the C library function srandom()).
This function is tagged with PO_NO_PROCESS_CONTROL because it affects the process as a whole.
srand(now()); # seeds with current time
Not available with PO_NO_PROCESS_CONTROL
This function does not throw any exceptions.
Table 3.439. Arguments and Return Values for strtoint()
|
Argument Type |
Return Type |
Description |
|---|---|---|
|
|
Returns an integer corresponding to the string value in the base specified. If no base is passed, then base 10 is assumed. |
This function does not throw any exceptions.