code
stringlengths 2.5k
150k
| kind
stringclasses 1
value |
---|---|
php None Returning References
--------------------
Returning by reference is useful when you want to use a function to find to which variable a reference should be bound. Do *not* use return-by-reference to increase performance. The engine will automatically optimize this on its own. Only return references when you have a valid technical reason to do so. To return references, use this syntax:
```
<?php
class foo {
public $value = 42;
public function &getValue() {
return $this->value;
}
}
$obj = new foo;
$myValue = &$obj->getValue(); // $myValue is a reference to $obj->value, which is 42.
$obj->value = 2;
echo $myValue; // prints the new value of $obj->value, i.e. 2.
?>
```
In this example, the property of the object returned by the getValue function would be set, not the copy, as it would be without using reference syntax.
> **Note**: Unlike parameter passing, here you have to use `&` in both places - to indicate that you want to return by reference, not a copy, and to indicate that reference binding, rather than usual assignment, should be done for $myValue.
>
>
> **Note**: If you try to return a reference from a function with the syntax: `return ($this->value);` this will *not* work as you are attempting to return the result of an *expression*, and not a variable, by reference. You can only return variables by reference from a function - nothing else.
>
>
To use the returned reference, you must use reference assignment:
```
<?php
function &collector() {
static $collection = array();
return $collection;
}
$collection = &collector();
$collection[] = 'foo';
?>
```
To pass the returned reference to another function expecting a reference you can use this syntax:
```
<?php
function &collector() {
static $collection = array();
return $collection;
}
array_push(collector(), 'foo');
?>
```
> **Note**: Note that `array_push(&collector(), 'foo');` will *not* work, it results in a fatal error.
>
>
php stats_stat_independent_t stats\_stat\_independent\_t
===========================
(PECL stats >= 1.0.0)
stats\_stat\_independent\_t — Returns the t-value from the independent two-sample t-test
### Description
```
stats_stat_independent_t(array $arr1, array $arr2): float
```
Returns the t-value of the independent two-sample t-test between `arr1` and `arr2`.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`arr1`
The first set of values
`arr2`
The second set of values
### Return Values
Returns the t-value, or **`false`** if failure.
php Spoofchecker::setAllowedLocales Spoofchecker::setAllowedLocales
===============================
(PHP 5 >= 5.4.0, PHP 7, PHP 8, PECL intl >= 2.0.0)
Spoofchecker::setAllowedLocales — Locales to use when running checks
### Description
```
public Spoofchecker::setAllowedLocales(string $locales): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`locales`
### Return Values
php Transliterator::createFromRules Transliterator::createFromRules
===============================
transliterator\_create\_from\_rules
===================================
(PHP 5 >= 5.4.0, PHP 7, PHP 8, PECL intl >= 2.0.0)
Transliterator::createFromRules -- transliterator\_create\_from\_rules — Create transliterator from rules
### Description
Object-oriented style
```
public static Transliterator::createFromRules(string $rules, int $direction = Transliterator::FORWARD): ?Transliterator
```
Procedural style
```
transliterator_create_from_rules(string $rules, int $direction = Transliterator::FORWARD): ?Transliterator
```
Creates a Transliterator from rules.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`rules`
The rules as defined in Transform Rules Syntax of UTS #35: Unicode LDML.
`direction`
The direction, defaults to [Transliterator::FORWARD](class.transliterator#transliterator.constants.forward). May also be set to [Transliterator::REVERSE](class.transliterator#transliterator.constants.reverse).
### Return Values
Returns a [Transliterator](class.transliterator) object on success, or **`null`** on failure.
### See Also
* [Transliterator::getErrorMessage()](transliterator.geterrormessage) - Get last error message
* [Transliterator::create()](transliterator.create) - Create a transliterator
php The EvCheck class
The EvCheck class
=================
Introduction
------------
(PECL ev >= 0.2.0)
[EvPrepare](class.evprepare) and **EvCheck** watchers are usually used in pairs. [EvPrepare](class.evprepare) watchers get invoked before the process blocks, **EvCheck** afterwards.
It is not allowed to call [EvLoop::run()](evloop.run) or similar methods or functions that enter the current event loop from either [EvPrepare](class.evprepare) or **EvCheck** watchers. Other loops than the current one are fine, however. The rationale behind this is that one don't need to check for recursion in those watchers, i.e. the sequence will always be: [EvPrepare](class.evprepare) -> blocking -> **EvCheck** , so having a watcher of each kind they will always be called in pairs bracketing the blocking call.
The main purpose is to integrate other event mechanisms into *libev* and their use is somewhat advanced. They could be used, for example, to track variable changes, implement custom watchers, integrate net-snmp or a coroutine library and lots more. They are also occasionally useful to cache some data and want to flush it before blocking.
It is recommended to give **EvCheck** watchers highest( **`Ev::MAXPRI`** ) priority, to ensure that they are being run before any other watchers after the poll (this doesn’t matter for [EvPrepare](class.evprepare) watchers).
Also, **EvCheck** watchers should not activate/feed events. While *libev* fully supports this, they might get executed before other **EvCheck** watchers did their job.
Class synopsis
--------------
class **EvCheck** extends [EvWatcher](class.evwatcher) { /\* Inherited properties \*/ public [$is\_active](class.evwatcher#evwatcher.props.is-active);
public [$data](class.evwatcher#evwatcher.props.data);
public [$is\_pending](class.evwatcher#evwatcher.props.is-pending);
public [$priority](class.evwatcher#evwatcher.props.priority); /\* Methods \*/ public [\_\_construct](evcheck.construct)( [callable](language.types.callable) `$callback` , [mixed](language.types.declarations#language.types.declarations.mixed) `$data` = ?, int `$priority` = ?)
```
final public static createStopped( string $callback , string $data = ?, string $priority = ?): object
```
/\* Inherited methods \*/
```
public EvWatcher::clear(): int
```
```
public EvWatcher::feed( int $revents ): void
```
```
public EvWatcher::getLoop(): EvLoop
```
```
public EvWatcher::invoke( int $revents ): void
```
```
public EvWatcher::keepalive( bool $value = ?): bool
```
```
public EvWatcher::setCallback( callable $callback ): void
```
```
public EvWatcher::start(): void
```
```
public EvWatcher::stop(): void
```
} Table of Contents
-----------------
* [EvCheck::\_\_construct](evcheck.construct) — Constructs the EvCheck watcher object
* [EvCheck::createStopped](evcheck.createstopped) — Create instance of a stopped EvCheck watcher
php setrawcookie setrawcookie
============
(PHP 5, PHP 7, PHP 8)
setrawcookie — Send a cookie without urlencoding the cookie value
### Description
```
setrawcookie(
string $name,
string $value = ?,
int $expires_or_options = 0,
string $path = ?,
string $domain = ?,
bool $secure = false,
bool $httponly = false
): bool
```
Alternative signature available as of PHP 7.3.0 (not supported with named parameters):
```
setrawcookie(string $name, string $value = ?, array $options = []): bool
```
**setrawcookie()** is exactly the same as [setcookie()](function.setcookie) except that the cookie value will not be automatically urlencoded when sent to the browser.
### Parameters
For parameter information, see the [setcookie()](function.setcookie) documentation.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 7.3.0 | An alternative signature supporting an `options` array has been added. This signature supports also setting of the SameSite cookie attribute. |
### See Also
* [setcookie()](function.setcookie) - Send a cookie
php Yaf_Request_Simple::getRequest Yaf\_Request\_Simple::getRequest
================================
(Yaf >=1.0.0)
Yaf\_Request\_Simple::getRequest — The getRequest purpose
### Description
```
public Yaf_Request_Simple::getRequest(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php sodium_crypto_aead_aes256gcm_decrypt sodium\_crypto\_aead\_aes256gcm\_decrypt
========================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_aead\_aes256gcm\_decrypt — Verify then decrypt a message with AES-256-GCM
### Description
```
sodium_crypto_aead_aes256gcm_decrypt(
string $ciphertext,
string $additional_data,
string $nonce,
string $key
): string|false
```
Verify then decrypt with AES-256-GCM. Only available if [sodium\_crypto\_aead\_aes256gcm\_is\_available()](function.sodium-crypto-aead-aes256gcm-is-available) returns **`true`**.
### Parameters
`ciphertext`
Must be in the format provided by [sodium\_crypto\_aead\_aes256gcm\_encrypt()](function.sodium-crypto-aead-aes256gcm-encrypt) (ciphertext and tag, concatenated).
`additional_data`
Additional, authenticated data. This is used in the verification of the authentication tag appended to the ciphertext, but it is not encrypted or stored in the ciphertext.
`nonce`
A number that must be only used once, per message. 12 bytes long.
`key`
Encryption key (256-bit).
### Return Values
Returns the plaintext on success, or **`false`** on failure.
php svn_cleanup svn\_cleanup
============
(PECL svn >= 0.1.0)
svn\_cleanup — Recursively cleanup a working copy directory, finishing incomplete operations and removing locks
### Description
```
svn_cleanup(string $workingdir): bool
```
Recursively cleanup working copy directory `workingdir`, finishing any incomplete operations and removing working copy locks. Use when a working copy is in limbo and needs to be usable again.
### Parameters
`workingdir`
String path to local working directory to cleanup
> **Note**: Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working directory, use [realpath()](function.realpath) or dirname(\_\_FILE\_\_).
>
>
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Basic example**
This example demonstrates clean up of a working copy in a directory named help-me:
```
<?php
svn_cleanup(realpath('help-me'));
?>
```
The [realpath()](function.realpath) call is necessary due to SVN's quirky handling of relative paths.
### Notes
**Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
### See Also
* **update()**
* [» SVN documentation on svn cleanup](http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.cleanup.html)
php SQLite3Stmt::bindParam SQLite3Stmt::bindParam
======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3Stmt::bindParam — Binds a parameter to a statement variable
### Description
```
public SQLite3Stmt::bindParam(string|int $param, mixed &$var, int $type = SQLITE3_TEXT): bool
```
Binds a parameter to a statement variable.
**Caution** Before PHP 7.2.14 and 7.3.0, respectively, [SQLite3Stmt::reset()](sqlite3stmt.reset) must be called after the first call to [SQLite3Stmt::execute()](sqlite3stmt.execute) if the bound value should be properly updated on following calls to [SQLite3Stmt::execute()](sqlite3stmt.execute). If [SQLite3Stmt::reset()](sqlite3stmt.reset) is not called, the bound value will not change, even if the value assigned to the variable passed to **SQLite3Stmt::bindParam()** has changed, or **SQLite3Stmt::bindParam()** has been called again.
### Parameters
`param`
Either a string (for named parameters) or an int (for positional parameters) identifying the statement variable to which the value should be bound. If a named parameter does not start with a colon (`:`) or an at sign (`@`), a colon (`:`) is automatically preprended. Positional parameters start with `1`.
`var`
The parameter to bind to a statement variable.
`type`
The data type of the parameter to bind.
* **`SQLITE3_INTEGER`**: The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.
* **`SQLITE3_FLOAT`**: The value is a floating point value, stored as an 8-byte IEEE floating point number.
* **`SQLITE3_TEXT`**: The value is a text string, stored using the database encoding (UTF-8, UTF-16BE or UTF-16-LE).
* **`SQLITE3_BLOB`**: The value is a blob of data, stored exactly as it was input.
* **`SQLITE3_NULL`**: The value is a NULL value.
As of PHP 7.0.7, if `type` is omitted, it is automatically detected from the type of the `var`: bool and int are treated as **`SQLITE3_INTEGER`**, float as **`SQLITE3_FLOAT`**, null as **`SQLITE3_NULL`** and all others as **`SQLITE3_TEXT`**. Formerly, if `type` has been omitted, it has defaulted to **`SQLITE3_TEXT`**.
>
> **Note**:
>
>
> If `var` is **`null`**, it is always treated as **`SQLITE3_NULL`**, regardless of the given `type`.
>
>
### Return Values
Returns **`true`** if the parameter is bound to the statement variable, **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 7.4.0 | `param` now also supports the `@param` notation. |
### Examples
**Example #1 **SQLite3Stmt::bindParam()** Usage**
This example shows how a single prepared statement with a single parameter binding can be used to insert multiple rows with different values.
```
<?php
$db = new SQLite3(':memory:');
$db->exec("CREATE TABLE foo (bar TEXT)");
$stmt = $db->prepare("INSERT INTO foo VALUES (:bar)");
$stmt->bindParam(':bar', $bar, SQLITE3_TEXT);
$bar = 'baz';
$stmt->execute();
$bar = 42;
$stmt->execute();
$res = $db->query("SELECT * FROM foo");
while (($row = $res->fetchArray(SQLITE3_ASSOC))) {
var_dump($row);
}
?>
```
The above example will output:
```
array(1) {
["bar"]=>
string(3) "baz"
}
array(1) {
["bar"]=>
string(2) "42"
}
```
### See Also
* [SQLite3Stmt::bindValue()](sqlite3stmt.bindvalue) - Binds the value of a parameter to a statement variable
* [SQLite3::prepare()](sqlite3.prepare) - Prepares an SQL statement for execution
php OAuth::getCAPath OAuth::getCAPath
================
(PECL OAuth >= 0.99.8)
OAuth::getCAPath — Gets CA information
### Description
```
public OAuth::getCAPath(): array
```
Gets the Certificate Authority information, which includes the ca\_path and ca\_info set by [OAuth::setCaPath()](oauth.setcapath).
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
An array of Certificate Authority information, specifically as `ca_path` and `ca_info` keys within the returned associative array.
### See Also
* [OAuth::setCAPath()](oauth.setcapath) - Set CA path and info
* [OAuth::getLastResponseInfo()](oauth.getlastresponseinfo) - Get HTTP information about the last response
php SolrQuery::getMltMinDocFrequency SolrQuery::getMltMinDocFrequency
================================
(PECL solr >= 0.9.2)
SolrQuery::getMltMinDocFrequency — Returns the treshold frequency at which words will be ignored which do not occur in at least this many docs
### Description
```
public SolrQuery::getMltMinDocFrequency(): int
```
Returns the treshold frequency at which words will be ignored which do not occur in at least this many docs
### Parameters
This function has no parameters.
### Return Values
Returns an integer on success and **`null`** if not set.
php SplFileObject::fseek SplFileObject::fseek
====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::fseek — Seek to a position
### Description
```
public SplFileObject::fseek(int $offset, int $whence = SEEK_SET): int
```
Seek to a position in the file measured in bytes from the beginning of the file, obtained by adding `offset` to the position specified by `whence`.
### Parameters
`offset`
The offset. A negative value can be used to move backwards through the file which is useful when SEEK\_END is used as the `whence` value.
`whence`
`whence` values are:
* **`SEEK_SET`** - Set position equal to `offset` bytes.
* **`SEEK_CUR`** - Set position to current location plus `offset`.
* **`SEEK_END`** - Set position to end-of-file plus `offset`.
If `whence` is not specified, it is assumed to be **`SEEK_SET`**.
### Return Values
Returns 0 if the seek was successful, -1 otherwise. Note that seeking past EOF is not considered an error.
### Examples
**Example #1 **SplFileObject::fseek()** example**
```
<?php
$file = new SplFileObject("somefile.txt");
// Read first line
$data = $file->fgets();
// Move back to the beginning of the file
// Same as $file->rewind();
$file->fseek(0);
?>
```
### See Also
* [fseek()](function.fseek) - Seeks on a file pointer
php Yaf_Session::valid Yaf\_Session::valid
===================
(Yaf >=1.0.0)
Yaf\_Session::valid — The valid purpose
### Description
```
public Yaf_Session::valid(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php get_class get\_class
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
get\_class — Returns the name of the class of an object
### Description
```
get_class(object $object = ?): string
```
Gets the name of the class of the given `object`.
### Parameters
`object`
The tested object. This parameter may be omitted when inside a class.
> **Note**: Explicitly passing **`null`** as the `object` is no longer allowed as of PHP 7.2.0 and emits an **`E_WARNING`**. As of PHP 8.0.0, a [TypeError](class.typeerror) is emitted when **`null`** is used.
>
>
### Return Values
Returns the name of the class of which `object` is an instance.
If `object` is omitted when inside a class, the name of that class is returned.
If the `object` is an instance of a class which exists in a namespace, the qualified namespaced name of that class is returned.
### Errors/Exceptions
If **get\_class()** is called with anything other than an object, [TypeError](class.typeerror) is raised. Prior to PHP 8.0.0, an **`E_WARNING`** level error was raised.
If **get\_class()** is called with no arguments from outside a class, [Error](class.error) is raised. Prior to PHP 8.0.0, an **`E_WARNING`** level error was raised.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Calling this function from outside a class, without any arguments, will trigger an [Error](class.error). Previously, an **`E_WARNING`** was raised and the function returned **`false`**. |
| 7.2.0 | Prior to this version the default value for `object` was **`null`** and it had the same effect as not passing any value. Now **`null`** has been removed as the default value for `object`, and is no longer a valid input. |
### Examples
**Example #1 Using **get\_class()****
```
<?php
class foo {
function name()
{
echo "My name is " , get_class($this) , "\n";
}
}
// create an object
$bar = new foo();
// external call
echo "Its name is " , get_class($bar) , "\n";
// internal call
$bar->name();
?>
```
The above example will output:
```
Its name is foo
My name is foo
```
**Example #2 Using **get\_class()** in superclass**
```
<?php
abstract class bar {
public function __construct()
{
var_dump(get_class($this));
var_dump(get_class());
}
}
class foo extends bar {
}
new foo;
?>
```
The above example will output:
```
string(3) "foo"
string(3) "bar"
```
**Example #3 Using **get\_class()** with namespaced classes**
```
<?php
namespace Foo\Bar;
class Baz {
public function __construct()
{
}
}
$baz = new \Foo\Bar\Baz;
var_dump(get_class($baz));
?>
```
The above example will output:
```
string(11) "Foo\Bar\Baz"
```
### See Also
* [get\_called\_class()](function.get-called-class) - The "Late Static Binding" class name
* [get\_parent\_class()](function.get-parent-class) - Retrieves the parent class name for object or class
* [gettype()](function.gettype) - Get the type of a variable
* [get\_debug\_type()](function.get-debug-type) - Gets the type name of a variable in a way that is suitable for debugging
* [is\_subclass\_of()](function.is-subclass-of) - Checks if the object has this class as one of its parents or implements it
| programming_docs |
php highlight_string highlight\_string
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
highlight\_string — Syntax highlighting of a string
### Description
```
highlight_string(string $string, bool $return = false): string|bool
```
Outputs or returns html markup for a syntax highlighted version of the given PHP code using the colors defined in the built-in syntax highlighter for PHP.
### Parameters
`string`
The PHP code to be highlighted. This should include the opening tag.
`return`
Set this parameter to **`true`** to make this function return the highlighted code.
### Return Values
If `return` is set to **`true`**, returns the highlighted code as a string instead of printing it out. Otherwise, it will return **`true`** on success, **`false`** on failure.
### Examples
**Example #1 **highlight\_string()** example**
```
<?php
highlight_string('<?php phpinfo(); ?>');
?>
```
The above example will output:
```
<code><span style="color: #000000">
<span style="color: #0000BB"><?php phpinfo</span><span style="color: #007700">(); </span><span style="color: #0000BB">?></span>
</span>
</code>
```
### Notes
>
> **Note**:
>
>
> When the `return` parameter is used, this function uses internal output buffering so it cannot be used inside an [ob\_start()](function.ob-start) callback function.
>
>
>
The HTML markup generated is subject to change.
### See Also
* [highlight\_file()](function.highlight-file) - Syntax highlighting of a file
* [Highlighting INI directives](https://www.php.net/manual/en/misc.configuration.php#ini.syntax-highlighting)
php Ds\Set::add Ds\Set::add
===========
(PECL ds >= 1.0.0)
Ds\Set::add — Adds values to the set
### Description
```
public Ds\Set::add(mixed ...$values): void
```
Adds all given values to the set that haven't already been added.
>
> **Note**:
>
>
> Values of type object are supported. If an object implements **Ds\Hashable**, equality will be determined by the object's `equals` function. If an object does not implement **Ds\Hashable**, objects must be references to the same instance to be considered equal.
>
>
**Caution** All comparisons are strict (type and value).
### Parameters
`values`
Values to add to the set.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Set::add()** example using integers**
```
<?php
$set = new \Ds\Set();
$set->add(1);
$set->add(1);
$set->add(2);
$set->add(3);
// Strict comparison would not treat these the same as int(1)
$set->add("1");
$set->add(true);
var_dump($set);
?>
```
The above example will output something similar to:
```
object(Ds\Set)#1 (5) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
string(1) "1"
[4]=>
bool(true)
}
```
**Example #2 **Ds\Set::add()** example using objects**
```
<?php
class HashableObject implements \Ds\Hashable
{
/**
* An arbitrary value to use as the hash value. Does not define equality.
*/
private $value;
public function __construct($value)
{
$this->value = $value;
}
public function hash()
{
return $this->value;
}
public function equals($obj): bool
{
return $this->value === $obj->value;
}
}
$set = new \Ds\Set();
$obj = new \ArrayIterator([]);
// Adding the same instance multiple times will only add the first.
$set->add($obj);
$set->add($obj);
// Adding multiple instances of the same object will add them all.
$set->add(new \stdClass());
$set->add(new \stdClass());
// Adding multiple instances of equal hashable objects will only add the first.
$set->add(new \HashableObject(1));
$set->add(new \HashableObject(1));
$set->add(new \HashableObject(2));
$set->add(new \HashableObject(2));
var_dump($set);
?>
```
The above example will output something similar to:
```
object(Ds\Set)#1 (5) {
[0]=>
object(ArrayIterator)#2 (1) {
["storage":"ArrayIterator":private]=>
array(0) {
}
}
[1]=>
object(stdClass)#3 (0) {
}
[2]=>
object(stdClass)#4 (0) {
}
[3]=>
object(HashableObject)#5 (1) {
["value":"HashableObject":private]=>
int(1)
}
[4]=>
object(HashableObject)#6 (1) {
["value":"HashableObject":private]=>
int(2)
}
}
```
php Parle\Parser::precedence Parle\Parser::precedence
========================
(PECL parle >= 0.5.1)
Parle\Parser::precedence — Declare a precedence rule
### Description
```
public Parle\Parser::precedence(string $tok): void
```
Declares a precedence rule for a fictitious terminal symbol. This rule can be later used in the specific grammar rules.
### Parameters
`tok`
Token name.
### Return Values
No value is returned.
php mysqli::$server_version mysqli::$server\_version
========================
mysqli\_get\_server\_version
============================
(PHP 5, PHP 7, PHP 8)
mysqli::$server\_version -- mysqli\_get\_server\_version — Returns the version of the MySQL server as an integer
### Description
Object-oriented style
int [$mysqli->server\_version](mysqli.get-server-version); Procedural style
```
mysqli_get_server_version(mysqli $mysql): int
```
The **mysqli\_get\_server\_version()** function returns the version of the server connected to (represented by the `mysql` parameter) as an integer.
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
### Return Values
An integer representing the server version.
The form of this version number is `main_version * 10000 + minor_version * 100 + sub_version` (i.e. version 4.1.0 is 40100).
### Examples
**Example #1 $mysqli->server\_version example**
Object-oriented style
```
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* print server version */
printf("Server version: %d\n", $mysqli->server_version);
/* close connection */
$mysqli->close();
?>
```
Procedural style
```
<?php
$link = mysqli_connect("localhost", "my_user", "my_password");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* print server version */
printf("Server version: %d\n", mysqli_get_server_version($link));
/* close connection */
mysqli_close($link);
?>
```
The above examples will output:
```
Server version: 40102
```
### See Also
* [mysqli\_get\_client\_info()](mysqli.get-client-info) - Get MySQL client info
* [mysqli\_get\_client\_version()](mysqli.get-client-version) - Returns the MySQL client version as an integer
* [mysqli\_get\_server\_info()](mysqli.get-server-info) - Returns the version of the MySQL server
php NoRewindIterator::key NoRewindIterator::key
=====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
NoRewindIterator::key — Get the current key
### Description
```
public NoRewindIterator::key(): mixed
```
Gets the current key.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
The current key.
### See Also
* [NoRewindIterator::next()](norewinditerator.next) - Forward to the next element
php Locale::getAllVariants Locale::getAllVariants
======================
locale\_get\_all\_variants
==========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
Locale::getAllVariants -- locale\_get\_all\_variants — Gets the variants for the input locale
### Description
Object-oriented style
```
public static Locale::getAllVariants(string $locale): ?array
```
Procedural style
```
locale_get_all_variants(string $locale): ?array
```
Gets the variants for the input locale
### Parameters
`locale`
The locale to extract the variants from
### Return Values
The array containing the list of all variants subtag for the locale or **`null`** if not present
Returns **`null`** when the length of `locale` exceeds **`INTL_MAX_LOCALE_LEN`**.
### Examples
**Example #1 **locale\_get\_all\_variants()** example**
```
<?php
$arr = locale_get_all_variants('sl_IT_NEDIS_ROJAZ_1901');
var_export( $arr );
?>
```
**Example #2 OO example**
```
<?php
$arr = Locale::getAllVariants('sl_IT_NEDIS_ROJAZ_1901');
var_export( $arr );
?>
```
The above example will output:
```
array (
0 => 'NEDIS',
1 => 'ROJAZ',
2 => '1901',
)
```
### See Also
* [locale\_get\_primary\_language()](locale.getprimarylanguage) - Gets the primary language for the input locale
* [locale\_get\_script()](locale.getscript) - Gets the script for the input locale
* [locale\_get\_region()](locale.getregion) - Gets the region for the input locale
php runkit7_method_remove runkit7\_method\_remove
=======================
(PECL runkit7 >= Unknown)
runkit7\_method\_remove — Dynamically removes the given method
### Description
```
runkit7_method_remove(string $class_name, string $method_name): bool
```
> **Note**: This function cannot be used to manipulate the currently running (or chained) method.
>
>
### Parameters
`class_name`
The class in which to remove the method
`method_name`
The name of the method to remove
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **runkit7\_method\_remove()** example**
```
<?php
class Example {
function foo() {
return "foo!\n";
}
function bar() {
return "bar!\n";
}
}
// Remove the 'foo' method
runkit7_method_remove(
'Example',
'foo'
);
echo implode(' ', get_class_methods('Example'));
?>
```
The above example will output:
```
bar
```
### See Also
* [runkit7\_method\_add()](function.runkit7-method-add) - Dynamically adds a new method to a given class
* [runkit7\_method\_copy()](function.runkit7-method-copy) - Copies a method from class to another
* [runkit7\_method\_redefine()](function.runkit7-method-redefine) - Dynamically changes the code of the given method
* [runkit7\_method\_rename()](function.runkit7-method-rename) - Dynamically changes the name of the given method
* [runkit7\_function\_remove()](function.runkit7-function-remove) - Remove a function definition
php Phar::isValidPharFilename Phar::isValidPharFilename
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.2.0)
Phar::isValidPharFilename — Returns whether the given filename is a valid phar filename
### Description
```
final public static Phar::isValidPharFilename(string $filename, bool $executable = true): bool
```
Returns whether the given filename is a valid phar filename that will be recognized as a phar archive by the phar extension. This can be used to test a name without having to instantiate a phar archive and catch the inevitable Exception that will be thrown if an invalid name is specified.
### Parameters
`filename`
The name or full path to a phar archive not yet created
`executable`
This parameter determines whether the filename should be treated as a phar executable archive, or a data non-executable archive
### Return Values
Returns **`true`** if the filename is valid, **`false`** if not.
php sqlsrv_next_result sqlsrv\_next\_result
====================
(No version information available, might only be in Git)
sqlsrv\_next\_result — Makes the next result of the specified statement active
### Description
```
sqlsrv_next_result(resource $stmt): mixed
```
Makes the next result of the specified statement active. Results include result sets, row counts, and output parameters.
### Parameters
`stmt`
The statement on which the next result is being called.
### Return Values
Returns **`true`** if the next result was successfully retrieved, **`false`** if an error occurred, and **`null`** if there are no more results to retrieve.
### Examples
**Example #1 **sqlsrv\_next\_result()** example**
The following example executes a batch query that inserts into a table and then selects from the table. This produces two results on the statement: one for the rows affected by the INSERT and one for the rows returned by the SELECT. To get to the rows returned by the SELECT, **sqlsrv\_next\_result()** must be called to move past the first result.
```
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array("Database"=>"dbName", "UID"=>"userName", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$query = "INSERT INTO Table_1 (id, data) VALUES (?,?); SELECT * FROM TABLE_1;";
$params = array(1, "some data");
$stmt = sqlsrv_query($conn, $query, $params);
// Consume the first result (rows affected by INSERT) without calling sqlsrv_next_result.
echo "Rows affected: ".sqlsrv_rows_affected($stmt)."<br />";
// Move to the next result and display results.
$next_result = sqlsrv_next_result($stmt);
if( $next_result ) {
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC)){
echo $row['id'].": ".$row['data']."<br />";
}
} elseif( is_null($next_result)) {
echo "No more results.<br />";
} else {
die(print_r(sqlsrv_errors(), true));
}
?>
```
### See Also
* [sqlsrv\_query()](function.sqlsrv-query) - Prepares and executes a query
* [sqlsrv\_fetch\_array()](function.sqlsrv-fetch-array) - Returns a row as an array
* [sqlsrv\_rows\_affected()](function.sqlsrv-rows-affected) - Returns the number of rows modified by the last INSERT, UPDATE, or DELETE query executed
php stripslashes stripslashes
============
(PHP 4, PHP 5, PHP 7, PHP 8)
stripslashes — Un-quotes a quoted string
### Description
```
stripslashes(string $string): string
```
Un-quotes a quoted string.
**stripslashes()** can be used if you aren't inserting this data into a place (such as a database) that requires escaping. For example, if you're simply outputting data straight from an HTML form.
### Parameters
`string`
The input string.
### Return Values
Returns a string with backslashes stripped off. (`\'` becomes `'` and so on.) Double backslashes (`\\`) are made into a single backslash (`\`).
### Examples
**Example #1 A **stripslashes()** example**
```
<?php
$str = "Is your name O\'reilly?";
// Outputs: Is your name O'reilly?
echo stripslashes($str);
?>
```
>
> **Note**:
>
>
> **stripslashes()** is not recursive. If you want to apply this function to a multi-dimensional array, you need to use a recursive function.
>
>
**Example #2 Using **stripslashes()** on an array**
```
<?php
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
// Example
$array = array("f\\'oo", "b\\'ar", array("fo\\'o", "b\\'ar"));
$array = stripslashes_deep($array);
// Output
print_r($array);
?>
```
The above example will output:
```
Array
(
[0] => f'oo
[1] => b'ar
[2] => Array
(
[0] => fo'o
[1] => b'ar
)
)
```
### See Also
* [addslashes()](function.addslashes) - Quote string with slashes
* [get\_magic\_quotes\_gpc()](function.get-magic-quotes-gpc) - Gets the current configuration setting of magic\_quotes\_gpc
php parse_ini_string parse\_ini\_string
==================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
parse\_ini\_string — Parse a configuration string
### Description
```
parse_ini_string(string $ini_string, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array|false
```
**parse\_ini\_string()** returns the settings in string `ini_string` in an associative array.
The structure of the ini string is the same as the php.ini's.
### Parameters
`ini_string`
The contents of the ini file being parsed.
`process_sections`
By setting the `process_sections` parameter to **`true`**, you get a multidimensional array, with the section names and settings included. The default for `process_sections` is **`false`**
`scanner_mode`
Can either be **`INI_SCANNER_NORMAL`** (default) or **`INI_SCANNER_RAW`**. If **`INI_SCANNER_RAW`** is supplied, then option values will not be parsed.
As of PHP 5.6.1 can also be specified as **`INI_SCANNER_TYPED`**. In this mode boolean, null and integer types are preserved when possible. String values `"true"`, `"on"` and `"yes"` are converted to **`true`**. `"false"`, `"off"`, `"no"` and `"none"` are considered **`false`**. `"null"` is converted to **`null`** in typed mode. Also, all numeric strings are converted to integer type if it is possible.
### Return Values
The settings are returned as an associative array on success, and **`false`** on failure.
### Notes
> **Note**: There are reserved words which must not be used as keys for ini files. These include: `null`, `yes`, `no`, `true`, `false`, `on`, `off`, `none`. Values `null`, `off`, `no` and `false` result in `""`, and values `on`, `yes` and `true` result in `"1"`, unless **`INI_SCANNER_TYPED`** mode is used. Characters `?{}|&~ - Parse a configuration file
php htmlspecialchars_decode htmlspecialchars\_decode
========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
htmlspecialchars\_decode — Convert special HTML entities back to characters
### Description
```
htmlspecialchars_decode(string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401): string
```
This function is the opposite of [htmlspecialchars()](function.htmlspecialchars). It converts special HTML entities back to characters.
The converted entities are: `&`, `"` (when **`ENT_NOQUOTES`** is not set), `'` (when **`ENT_QUOTES`** is set), `<` and `>`.
### Parameters
`string`
The string to decode.
`flags`
A bitmask of one or more of the following flags, which specify how to handle quotes and which document type to use. The default is `ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401`.
**Available `flags` constants**| Constant Name | Description |
| --- | --- |
| **`ENT_COMPAT`** | Will convert double-quotes and leave single-quotes alone. |
| **`ENT_QUOTES`** | Will convert both double and single quotes. |
| **`ENT_NOQUOTES`** | Will leave both double and single quotes unconverted. |
| **`ENT_SUBSTITUTE`** | Replace invalid code unit sequences with a Unicode Replacement Character U+FFFD (UTF-8) or � (otherwise) instead of returning an empty string. |
| **`ENT_HTML401`** | Handle code as HTML 4.01. |
| **`ENT_XML1`** | Handle code as XML 1. |
| **`ENT_XHTML`** | Handle code as XHTML. |
| **`ENT_HTML5`** | Handle code as HTML 5. |
### Return Values
Returns the decoded string.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | `flags` changed from **`ENT_COMPAT`** to **`ENT_QUOTES`** | **`ENT_SUBSTITUTE`** | **`ENT_HTML401`**. |
### Examples
**Example #1 A **htmlspecialchars\_decode()** example**
```
<?php
$str = "<p>this -> "</p>\n";
echo htmlspecialchars_decode($str);
// note that here the quotes aren't converted
echo htmlspecialchars_decode($str, ENT_NOQUOTES);
?>
```
The above example will output:
```
<p>this -> "</p>
<p>this -> "</p>
```
### See Also
* [htmlspecialchars()](function.htmlspecialchars) - Convert special characters to HTML entities
* [html\_entity\_decode()](function.html-entity-decode) - Convert HTML entities to their corresponding characters
* [get\_html\_translation\_table()](function.get-html-translation-table) - Returns the translation table used by htmlspecialchars and htmlentities
| programming_docs |
php strpos strpos
======
(PHP 4, PHP 5, PHP 7, PHP 8)
strpos — Find the position of the first occurrence of a substring in a string
### Description
```
strpos(string $haystack, string $needle, int $offset = 0): int|false
```
Find the numeric position of the first occurrence of `needle` in the `haystack` string.
### Parameters
`haystack`
The string to search in.
`needle`
Prior to PHP 8.0.0, if `needle` is not a string, it is converted to an integer and applied as the ordinal value of a character. This behavior is deprecated as of PHP 7.3.0, and relying on it is highly discouraged. Depending on the intended behavior, the `needle` should either be explicitly cast to string, or an explicit call to [chr()](function.chr) should be performed.
`offset`
If specified, search will start this number of characters counted from the beginning of the string. If the offset is negative, the search will start this number of characters counted from the end of the string.
### Return Values
Returns the position of where the needle exists relative to the beginning of the `haystack` string (independent of offset). Also note that string positions start at 0, and not 1.
Returns **`false`** if the needle was not found.
**Warning**This function may return Boolean **`false`**, but may also return a non-Boolean value which evaluates to **`false`**. Please read the section on [Booleans](language.types.boolean) for more information. Use [the === operator](language.operators.comparison) for testing the return value of this function.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Passing an int as `needle` is no longer supported. |
| 7.3.0 | Passing an int as `needle` has been deprecated. |
| 7.1.0 | Support for negative `offset`s has been added. |
### Examples
**Example #1 Using `===`**
```
<?php
$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
// Note our use of ===. Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos === false) {
echo "The string '$findme' was not found in the string '$mystring'";
} else {
echo "The string '$findme' was found in the string '$mystring'";
echo " and exists at position $pos";
}
?>
```
**Example #2 Using !==**
```
<?php
$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
// The !== operator can also be used. Using != would not work as expected
// because the position of 'a' is 0. The statement (0 != false) evaluates
// to false.
if ($pos !== false) {
echo "The string '$findme' was found in the string '$mystring'";
echo " and exists at position $pos";
} else {
echo "The string '$findme' was not found in the string '$mystring'";
}
?>
```
**Example #3 Using an offset**
```
<?php
// We can search for the character, ignoring anything before the offset
$newstring = 'abcdef abcdef';
$pos = strpos($newstring, 'a', 1); // $pos = 7, not 0
?>
```
### Notes
> **Note**: This function is binary-safe.
>
>
### See Also
* [stripos()](function.stripos) - Find the position of the first occurrence of a case-insensitive substring in a string
* [str\_contains()](function.str-contains) - Determine if a string contains a given substring
* [str\_ends\_with()](function.str-ends-with) - Checks if a string ends with a given substring
* [str\_starts\_with()](function.str-starts-with) - Checks if a string starts with a given substring
* [strrpos()](function.strrpos) - Find the position of the last occurrence of a substring in a string
* [strripos()](function.strripos) - Find the position of the last occurrence of a case-insensitive substring in a string
* [strstr()](function.strstr) - Find the first occurrence of a string
* [strpbrk()](function.strpbrk) - Search a string for any of a set of characters
* [substr()](function.substr) - Return part of a string
* [preg\_match()](function.preg-match) - Perform a regular expression match
php SoapClient::__getLastRequestHeaders SoapClient::\_\_getLastRequestHeaders
=====================================
(PHP 5, PHP 7, PHP 8)
SoapClient::\_\_getLastRequestHeaders — Returns the SOAP headers from the last request
### Description
```
public SoapClient::__getLastRequestHeaders(): ?string
```
Returns the SOAP headers from the last request.
>
> **Note**:
>
>
> This function only works if the [SoapClient](class.soapclient) object was created with the `trace` option set to **`true`**.
>
>
### Parameters
This function has no parameters.
### Return Values
The last SOAP request headers.
### Examples
**Example #1 SoapClient::\_\_getLastRequestHeaders() example**
```
<?php
$client = SoapClient("some.wsdl", array('trace' => 1));
$result = $client->SomeFunction();
echo "REQUEST HEADERS:\n" . $client->__getLastRequestHeaders() . "\n";
?>
```
### See Also
* [SoapClient::\_\_getLastResponseHeaders()](soapclient.getlastresponseheaders) - Returns the SOAP headers from the last response
* [SoapClient::\_\_getLastRequest()](soapclient.getlastrequest) - Returns last SOAP request
* [SoapClient::\_\_getLastResponse()](soapclient.getlastresponse) - Returns last SOAP response
php SplHeap::insert SplHeap::insert
===============
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplHeap::insert — Inserts an element in the heap by sifting it up
### Description
```
public SplHeap::insert(mixed $value): bool
```
Insert `value` in the heap.
### Parameters
`value`
The value to insert.
### Return Values
Always returns **`true`**.
php pg_transaction_status pg\_transaction\_status
=======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
pg\_transaction\_status — Returns the current in-transaction status of the server
### Description
```
pg_transaction_status(PgSql\Connection $connection): int
```
Returns the current in-transaction status of the server.
**Caution** **pg\_transaction\_status()** will give incorrect results when using a PostgreSQL 7.3 server that has the parameter `autocommit` set to off. The server-side autocommit feature has been deprecated and does not exist in later server versions.
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance.
### Return Values
The status can be **`PGSQL_TRANSACTION_IDLE`** (currently idle), **`PGSQL_TRANSACTION_ACTIVE`** (a command is in progress), **`PGSQL_TRANSACTION_INTRANS`** (idle, in a valid transaction block), or **`PGSQL_TRANSACTION_INERROR`** (idle, in a failed transaction block). **`PGSQL_TRANSACTION_UNKNOWN`** is reported if the connection is bad. **`PGSQL_TRANSACTION_ACTIVE`** is reported only when a query has been sent to the server and not yet completed.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **pg\_transaction\_status()** example**
```
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$stat = pg_transaction_status($dbconn);
if ($stat === PGSQL_TRANSACTION_UNKNOWN) {
echo 'Connection is bad';
} else if ($stat === PGSQL_TRANSACTION_IDLE) {
echo 'Connection is currently idle';
} else {
echo 'Connection is in a transaction state';
}
?>
```
php EventHttpRequest::sendError EventHttpRequest::sendError
===========================
(PECL event >= 1.4.0-beta)
EventHttpRequest::sendError — Send an HTML error message to the client
### Description
```
public EventHttpRequest::sendError( int $error , string $reason = null ): void
```
Send an HTML error message to the client.
### Parameters
`error` The HTTP error code.
`reason` A brief explanation ofthe error. If **`null`**, the standard meaning of the error code will be used.
### Return Values
No value is returned.
### Examples
**Example #1 **EventHttpRequest::sendError()** example**
```
<?php
function _http_400($req) {
$req->sendError(400);
}
$base = new EventBase();
$http = new EventHttp($base);
$http->setCallback("/err400", "_http_400");
$http->bind("0.0.0.0", 8010);
$base->loop();
?>
```
### See Also
* [EventHttpRequest::sendReply()](eventhttprequest.sendreply) - Send an HTML reply to the client
php odbc_fetch_row odbc\_fetch\_row
================
(PHP 4, PHP 5, PHP 7, PHP 8)
odbc\_fetch\_row — Fetch a row
### Description
```
odbc_fetch_row(resource $statement, ?int $row = null): bool
```
Fetches a row of the data that was returned by [odbc\_do()](function.odbc-do) or [odbc\_exec()](function.odbc-exec). After **odbc\_fetch\_row()** is called, the fields of that row can be accessed with [odbc\_result()](function.odbc-result).
### Parameters
`statement`
The result identifier.
`row`
If `row` is not specified, **odbc\_fetch\_row()** will try to fetch the next row in the result set. Calls to **odbc\_fetch\_row()** with and without `row` can be mixed.
To step through the result more than once, you can call **odbc\_fetch\_row()** with `row` 1, and then continue doing **odbc\_fetch\_row()** without `row` to review the result. If a driver doesn't support fetching rows by number, the `row` parameter is ignored.
### Return Values
Returns **`true`** if there was a row, **`false`** otherwise.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `row` is nullable now. |
php Yaf_Route_Simple::__construct Yaf\_Route\_Simple::\_\_construct
=================================
(Yaf >=1.0.0)
Yaf\_Route\_Simple::\_\_construct — Yaf\_Route\_Simple constructor
### Description
public **Yaf\_Route\_Simple::\_\_construct**(string `$module_name`, string `$controller_name`, string `$action_name`) [Yaf\_Route\_Simple](class.yaf-route-simple) will get route info from query string. and the parameters of this constructor will used as keys while searching for the route info in $\_GET.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`module_name`
The key name of the module info.
`controller_name`
the key name of the controller info.
`action_name`
the key name of the action info.
### Return Values
Always return **`true`**.
### Examples
**Example #1 [Yaf\_Route\_Simple::route()](yaf-route-simple.route)example**
```
<?php
$route = new Yaf_Route_Simple("m", "controller", "act");
Yaf_Router::getInstance()->addRoute("simple", $route);
?>
```
**Example #2 [Yaf\_Route\_Simple::route()](yaf-route-simple.route)example**
```
Request: http://yourdomain.com/path/?controller=a&act=b
=> module = default(index), controller = a, action = b
Request: http://yourdomain.com/path
=> module = default(index), controller = default(index), action = default(index)
```
### See Also
* [Yaf\_Route\_Supervar::route()](yaf-route-supervar.route) - The route purpose
* [Yaf\_Route\_Static::route()](yaf-route-static.route) - Route a request
* [Yaf\_Route\_Regex::route()](yaf-route-regex.route) - The route purpose
* [Yaf\_Route\_Rewrite::route()](yaf-route-rewrite.route) - The route purpose
* [Yaf\_Route\_Map::route()](yaf-route-map.route) - The route purpose
php Yaf_Application::__construct Yaf\_Application::\_\_construct
===============================
(Yaf >=1.0.0)
Yaf\_Application::\_\_construct — Yaf\_Application constructor
### Description
public **Yaf\_Application::\_\_construct**([mixed](language.types.declarations#language.types.declarations.mixed) `$config`, string `$envrion` = ?) Instance a [Yaf\_Application](class.yaf-application).
### Parameters
`config`
A ini config file path, or a config array
If is a ini config file, there should be a section named as the one defined by [yaf.environ](https://www.php.net/manual/en/yaf.configuration.php#ini.yaf.environ), which is "product" by default.
>
> **Note**:
>
>
> If you use a ini configuration file as your applicatioin's config container. you would open the [yaf.cache\_config](https://www.php.net/manual/en/yaf.configuration.php#ini.yaf.cache-config) to improve performance.
>
>
And the config entry(and there default value) list blow:
**Example #1 A ini config file example**
```
[product]
;this one should alway be defined, and have no default value
application.directory=APPLICATION_PATH
;following configs have default value, you may no need to define them
application.library = APPLICATION_PATH . "/library"
application.dispatcher.throwException=1
application.dispatcher.catchException=1
application.baseUri=""
;the php script ext name
ap.ext=php
;the view template ext name
ap.view.ext=phtml
ap.dispatcher.defaultModuel=Index
ap.dispatcher.defaultController=Index
ap.dispatcher.defaultAction=index
;defined modules
ap.modules=Index
```
`envrion`
Which section will be loaded as the final config
### Return Values
### Examples
**Example #2 **Yaf\_Application::\_\_construct()**example**
```
<?php
defined('APPLICATION_PATH') // APPLICATION_PATH will be used in the ini config file
|| define('APPLICATION_PATH', __DIR__));
$application = new Yaf_Application(APPLICATION_PATH.'/conf/application.ini');
$application->bootstrap()->run();
?>
```
The above example will output something similar to:
**Example #3 **Yaf\_Application::\_\_construct()**example**
```
<?php
$config = array(
"application" => array(
"directory" => realpath(dirname(__FILE__)) . "/application",
),
);
/** Yaf_Application */
$application = new Yaf_Application($config);
$application->bootstrap()->run();
?>
```
The above example will output something similar to:
### See Also
* [Yaf\_Config\_Ini](class.yaf-config-ini)
php ReflectionZendExtension::export ReflectionZendExtension::export
===============================
(PHP 5 >= 5.4.0, PHP 7)
ReflectionZendExtension::export — Export
**Warning**This function has been *DEPRECATED* as of PHP 7.4.0, and *REMOVED* as of PHP 8.0.0. Relying on this function is highly discouraged.
### Description
```
public static ReflectionZendExtension::export(string $name, bool $return = ?): string
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`name`
`return`
### Return Values
### See Also
* [ReflectionClassConstant::\_\_toString()](reflectionclassconstant.tostring) - Returns the string representation of the ReflectionClassConstant object
php mysqli::autocommit mysqli::autocommit
==================
mysqli\_autocommit
==================
(PHP 5, PHP 7, PHP 8)
mysqli::autocommit -- mysqli\_autocommit — Turns on or off auto-committing database modifications
### Description
Object-oriented style
```
public mysqli::autocommit(bool $enable): bool
```
Procedural style
```
mysqli_autocommit(mysqli $mysql, bool $enable): bool
```
Turns on or off auto-commit mode on queries for the database connection.
To determine the current state of autocommit use the SQL command `SELECT @@autocommit`.
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
`enable`
Whether to turn on auto-commit or not.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **mysqli::autocommit()** example**
Object-oriented style
```
<?php
/* Tell mysqli to throw an exception if an error occurs */
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* The table engine has to support transactions */
$mysqli->query("CREATE TABLE IF NOT EXISTS language (
Code text NOT NULL,
Speakers int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
/* Turn autocommit off */
$mysqli->autocommit(false);
$result = $mysqli->query("SELECT @@autocommit");
$row = $result->fetch_row();
printf("Autocommit is %s\n", $row[0]);
try {
/* Prepare insert statement */
$stmt = $mysqli->prepare('INSERT INTO language(Code, Speakers) VALUES (?,?)');
$stmt->bind_param('ss', $language_code, $native_speakers);
/* Insert some values */
$language_code = 'DE';
$native_speakers = 50_123_456;
$stmt->execute();
$language_code = 'FR';
$native_speakers = 40_546_321;
$stmt->execute();
/* Commit the data in the database. This doesn't set autocommit=true */
$mysqli->commit();
print "Committed 2 rows in the database\n";
$result = $mysqli->query("SELECT @@autocommit");
$row = $result->fetch_row();
printf("Autocommit is %s\n", $row[0]);
/* Try to insert more values */
$language_code = 'PL';
$native_speakers = 30_555_444;
$stmt->execute();
$language_code = 'DK';
$native_speakers = 5_222_444;
$stmt->execute();
/* Setting autocommit=true will trigger a commit */
$mysqli->autocommit(true);
print "Committed 2 row in the database\n";
} catch (mysqli_sql_exception $exception) {
$mysqli->rollback();
throw $exception;
}
```
Procedural style
```
<?php
/* Tell mysqli to throw an exception if an error occurs */
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = mysqli_connect("localhost", "my_user", "my_password", "world");
/* The table engine has to support transactions */
mysqli_query($mysqli, "CREATE TABLE IF NOT EXISTS language (
Code text NOT NULL,
Speakers int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;");
/* Turn autocommit off */
mysqli_autocommit($mysqli, false);
$result = mysqli_query($mysqli, "SELECT @@autocommit");
$row = mysqli_fetch_row($result);
printf("Autocommit is %s\n", $row[0]);
try {
/* Prepare insert statement */
$stmt = mysqli_prepare($mysqli, 'INSERT INTO language(Code, Speakers) VALUES (?,?)');
mysqli_stmt_bind_param($stmt, 'ss', $language_code, $native_speakers);
/* Insert some values */
$language_code = 'DE';
$native_speakers = 50_123_456;
mysqli_stmt_execute($stmt);
$language_code = 'FR';
$native_speakers = 40_546_321;
mysqli_stmt_execute($stmt);
/* Commit the data in the database. This doesn't set autocommit=true */
mysqli_commit($mysqli);
print "Committed 2 rows in the database\n";
$result = mysqli_query($mysqli, "SELECT @@autocommit");
$row = mysqli_fetch_row($result);
printf("Autocommit is %s\n", $row[0]);
/* Try to insert more values */
$language_code = 'PL';
$native_speakers = 30_555_444;
mysqli_stmt_execute($stmt);
$language_code = 'DK';
$native_speakers = 5_222_444;
mysqli_stmt_execute($stmt);
/* Setting autocommit=true will trigger a commit */
mysqli_autocommit($mysqli, true);
print "Committed 2 row in the database\n";
} catch (mysqli_sql_exception $exception) {
mysqli_rollback($mysqli);
throw $exception;
}
```
The above examples will output:
```
Autocommit is 0
Committed 2 rows in the database
Autocommit is 0
Committed 2 row in the database
Autocommit is 0
Committed 2 rows in the database
Autocommit is 0
Committed 2 row in the database
```
### Notes
>
> **Note**:
>
>
> This function does not work with non transactional table types (like MyISAM or ISAM).
>
>
### See Also
* [mysqli\_begin\_transaction()](mysqli.begin-transaction) - Starts a transaction
* [mysqli\_commit()](mysqli.commit) - Commits the current transaction
* [mysqli\_rollback()](mysqli.rollback) - Rolls back current transaction
php ImagickPixel::getIndex ImagickPixel::getIndex
======================
(PECL imagick 2 >= 2.3.0, PECL imagick 3)
ImagickPixel::getIndex — Description
### Description
```
public ImagickPixel::getIndex(): int
```
Gets the colormap index of the pixel wand.
### Parameters
This function has no parameters.
### Return Values
| programming_docs |
php svn_import svn\_import
===========
(PECL svn >= 0.2.0)
svn\_import — Imports an unversioned path into a repository
### Description
```
svn_import(string $path, string $url, bool $nonrecursive): bool
```
Commits unversioned `path` into repository at `url`. If `path` is a directory and `nonrecursive` is **`false`**, the directory will be imported recursively.
### Parameters
`path`
Path of file or directory to import.
> **Note**: Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working directory, use [realpath()](function.realpath) or dirname(\_\_FILE\_\_).
>
>
`url`
Repository URL to import into.
`nonrecursive`
Whether or not to refrain from recursively processing directories.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Basic example**
This example demonstrates a basic use-case of this function. To import a directory named new-files into the repository at http://www.example.com/svnroot/incoming/abc, use:
```
<?php
svn_import(realpath('new-files'), 'http://www.example.com/svnroot/incoming/abc', false);
?>
```
### Notes
**Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
### See Also
* [svn\_add()](function.svn-add) - Schedules the addition of an item in a working directory
* [» SVN documentation for svn import](http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.import.html)
php ImagickDraw::getStrokeDashOffset ImagickDraw::getStrokeDashOffset
================================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::getStrokeDashOffset — Returns the offset into the dash pattern to start the dash
### Description
```
public ImagickDraw::getStrokeDashOffset(): float
```
**Warning**This function is currently not documented; only its argument list is available.
Returns the offset into the dash pattern to start the dash.
### Return Values
Returns a float representing the offset and 0 if it's not set.
php Gmagick::getimageinterlacescheme Gmagick::getimageinterlacescheme
================================
(PECL gmagick >= Unknown)
Gmagick::getimageinterlacescheme — Gets the image interlace scheme
### Description
```
public Gmagick::getimageinterlacescheme(): int
```
Gets the image interlace scheme.
### Parameters
This function has no parameters.
### Return Values
Returns the interlace scheme as an integer on success
### Errors/Exceptions
Throws an **GmagickException** on error.
php RecursiveTreeIterator::next RecursiveTreeIterator::next
===========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
RecursiveTreeIterator::next — Move to next element
### Description
```
public RecursiveTreeIterator::next(): void
```
Moves forward to the next element.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php svn_fs_make_file svn\_fs\_make\_file
===================
(PECL svn >= 0.2.0)
svn\_fs\_make\_file — Creates a new empty file
### Description
```
svn_fs_make_file(resource $root, string $path): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Creates a new empty file.
### Parameters
`root`
`path`
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Notes
**Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
php rawurlencode rawurlencode
============
(PHP 4, PHP 5, PHP 7, PHP 8)
rawurlencode — URL-encode according to RFC 3986
### Description
```
rawurlencode(string $string): string
```
Encodes the given string according to [» RFC 3986](http://www.faqs.org/rfcs/rfc3986).
### Parameters
`string`
The URL to be encoded.
### Return Values
Returns a string in which all non-alphanumeric characters except `-_.~` have been replaced with a percent (`%`) sign followed by two hex digits. This is the encoding described in [» RFC 3986](http://www.faqs.org/rfcs/rfc3986) for protecting literal characters from being interpreted as special URL delimiters, and for protecting URLs from being mangled by transmission media with character conversions (like some email systems).
### Examples
**Example #1 including a password in an FTP URL**
```
<?php
echo '<a href="ftp://user:', rawurlencode('foo @+%/'),
'@ftp.example.com/x.txt">';
?>
```
The above example will output:
```
<a href="ftp://user:foo%20%40%2B%25%[email protected]/x.txt">
```
Or, if you pass information in a PATH\_INFO component of the URL:
**Example #2 **rawurlencode()** example 2**
```
<?php
echo '<a href="http://example.com/department_list_script/',
rawurlencode('sales and marketing/Miami'), '">';
?>
```
The above example will output:
```
<a href="http://example.com/department_list_script/sales%20and%20marketing%2FMiami">
```
### See Also
* [rawurldecode()](function.rawurldecode) - Decode URL-encoded strings
* [urldecode()](function.urldecode) - Decodes URL-encoded string
* [urlencode()](function.urlencode) - URL-encodes string
* [» RFC 3986](http://www.faqs.org/rfcs/rfc3986)
php enchant_broker_describe enchant\_broker\_describe
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant >= 0.1.0)
enchant\_broker\_describe — Enumerates the Enchant providers
### Description
```
enchant_broker_describe(EnchantBroker $broker): array
```
Enumerates the Enchant providers and tells you some rudimentary information about them. The same info is provided through phpinfo().
### Parameters
`broker`
An Enchant broker returned by [enchant\_broker\_init()](function.enchant-broker-init).
### Return Values
Returns an array of available Enchant providers with their details.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `broker` expects an [EnchantBroker](class.enchantbroker) instance now; previoulsy, a [resource](language.types.resource) was expected. |
| 8.0.0 | Prior to this version, the function returned **`false`** on failure. |
### Examples
**Example #1 List the backends provided by the given broker**
```
<?php
$r = enchant_broker_init();
$bprovides = enchant_broker_describe($r);
echo "Current broker provides the following backend(s):\n";
print_r($bprovides);
?>
```
The above example will output something similar to:
```
Current broker provides the following backend(s):
Array
(
[0] => Array
(
[name] => aspell
[desc] => Aspell Provider
[file] => /usr/lib/enchant/libenchant_aspell.so
)
[1] => Array
(
[name] => hspell
[desc] => Hspell Provider
[file] => /usr/lib/enchant/libenchant_hspell.so
)
[2] => Array
(
[name] => ispell
[desc] => Ispell Provider
[file] => /usr/lib/enchant/libenchant_ispell.so
)
[3] => Array
(
[name] => myspell
[desc] => Myspell Provider
[file] => /usr/lib/enchant/libenchant_myspell.so
)
)
```
php gnupg_encrypt gnupg\_encrypt
==============
(PECL gnupg >= 0.1)
gnupg\_encrypt — Encrypts a given text
### Description
```
gnupg_encrypt(resource $identifier, string $plaintext): string
```
Encrypts the given `plaintext` with the keys, which were set with [gnupg\_addencryptkey](function.gnupg-addencryptkey) before and returns the encrypted text.
### Parameters
`identifier`
The gnupg identifier, from a call to [gnupg\_init()](function.gnupg-init) or **gnupg**.
`plaintext`
The text being encrypted.
### Return Values
On success, this function returns the encrypted text. On failure, this function returns **`false`**.
### Examples
**Example #1 Procedural **gnupg\_encrypt()** example**
```
<?php
$res = gnupg_init();
gnupg_addencryptkey($res,"8660281B6051D071D94B5B230549F9DC851566DC");
$enc = gnupg_encrypt($res, "just a test");
echo $enc;
?>
```
**Example #2 OO **gnupg\_encrypt()** example**
```
<?php
$gpg = new gnupg();
$gpg->addencryptkey("8660281B6051D071D94B5B230549F9DC851566DC");
$enc = $gpg->encrypt("just a test");
echo $enc;
?>
```
php eio_sendfile eio\_sendfile
=============
(PECL eio >= 0.0.1dev)
eio\_sendfile — Transfer data between file descriptors
### Description
```
eio_sendfile(
mixed $out_fd,
mixed $in_fd,
int $offset,
int $length,
int $pri = ?,
callable $callback = ?,
string $data = ?
): resource
```
**eio\_sendfile()** copies data between one file descriptor and another. See `SENDFILE(2)` man page for details.
### Parameters
`out_fd`
Output stream, Socket resource, or file descriptor. Should be opened for writing.
`in_fd`
Input stream, Socket resource, or file descriptor. Should be opened for reading.
`offset`
Offset within the source file.
`length`
Number of bytes to copy.
`pri`
The request priority: **`EIO_PRI_DEFAULT`**, **`EIO_PRI_MIN`**, **`EIO_PRI_MAX`**, or **`null`**. If **`null`** passed, `pri` internally is set to **`EIO_PRI_DEFAULT`**.
`callback`
`callback` function is called when the request is done. It should match the following prototype:
```
void callback(mixed $data, int $result[, resource $req]);
```
`data`
is custom data passed to the request.
`result`
request-specific result value; basically, the value returned by corresponding system call.
`req`
is optional request resource which can be used with functions like [eio\_get\_last\_error()](function.eio-get-last-error)
`data`
Arbitrary variable passed to `callback`.
### Return Values
**eio\_sendfile()** returns request resource on success, or **`false`** on failure.
php ImagickDraw::setStrokeDashArray ImagickDraw::setStrokeDashArray
===============================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setStrokeDashArray — Specifies the pattern of dashes and gaps used to stroke paths
### Description
```
public ImagickDraw::setStrokeDashArray(array $dashArray): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Specifies the pattern of dashes and gaps used to stroke paths. The strokeDashArray represents an array of numbers that specify the lengths of alternating dashes and gaps in pixels. If an odd number of values is provided, then the list of values is repeated to yield an even number of values. To remove an existing dash array, pass a zero number\_elements argument and null dash\_array. A typical strokeDashArray\_ array might contain the members 5 3 2.
### Parameters
`dashArray`
array of floats
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **ImagickDraw::setStrokeDashArray()** example**
```
<?php
function setStrokeDashArray($strokeColor, $fillColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(4);
$draw->setStrokeDashArray([10, 10]);
$draw->rectangle(100, 50, 225, 175);
$draw->setStrokeDashArray([20, 5, 20, 5, 5, 5,]);
$draw->rectangle(275, 50, 400, 175);
$draw->setStrokeDashArray([20, 5, 20, 5, 5]);
$draw->rectangle(100, 200, 225, 350);
$draw->setStrokeDashArray([1, 1, 1, 1, 2, 2, 3, 3, 5, 5, 8, 8, 13, 13, 21, 21, 34, 34, 55, 55, 89, 89, 144, 144, 233, 233, 377, 377, 610, 610, 987, 987, 1597, 1597, 2584, 2584, 4181, 4181,]);
$draw->rectangle(275, 200, 400, 350);
$image = new \Imagick();
$image->newImage(500, 400, $backgroundColor);
$image->setImageFormat("png");
$image->drawImage($draw);
header("Content-Type: image/png");
echo $image->getImageBlob();
}
?>
```
php Transliterator::getErrorCode Transliterator::getErrorCode
============================
transliterator\_get\_error\_code
================================
(PHP 5 >= 5.4.0, PHP 7, PHP 8, PECL intl >= 2.0.0)
Transliterator::getErrorCode -- transliterator\_get\_error\_code — Get last error code
### Description
Object-oriented style
```
public Transliterator::getErrorCode(): int|false
```
Procedural style
```
transliterator_get_error_code(Transliterator $transliterator): int|false
```
Gets the last error code for this transliterator.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`transliterator`
### Return Values
The error code on success, or **`false`** if none exists, or on failure.
### See Also
* [Transliterator::getErrorMessage()](transliterator.geterrormessage) - Get last error message
* [Transliterator::listIDs()](transliterator.listids) - Get transliterator IDs
php Comparison of floating point numbers Comparison Operators
--------------------
Comparison operators, as their name implies, allow you to compare two values. You may also be interested in viewing [the type comparison tables](https://www.php.net/manual/en/types.comparisons.php), as they show examples of various type related comparisons.
**Comparison Operators**| Example | Name | Result |
| --- | --- | --- |
| $a == $b | Equal | **`true`** if $a is equal to $b after type juggling. |
| $a === $b | Identical | **`true`** if $a is equal to $b, and they are of the same type. |
| $a != $b | Not equal | **`true`** if $a is not equal to $b after type juggling. |
| $a <> $b | Not equal | **`true`** if $a is not equal to $b after type juggling. |
| $a !== $b | Not identical | **`true`** if $a is not equal to $b, or they are not of the same type. |
| $a < $b | Less than | **`true`** if $a is strictly less than $b. |
| $a > $b | Greater than | **`true`** if $a is strictly greater than $b. |
| $a <= $b | Less than or equal to | **`true`** if $a is less than or equal to $b. |
| $a >= $b | Greater than or equal to | **`true`** if $a is greater than or equal to $b. |
| $a <=> $b | Spaceship | An int less than, equal to, or greater than zero when $a is less than, equal to, or greater than $b, respectively. |
If both operands are [numeric strings](language.types.numeric-strings), or one operand is a number and the other one is a [numeric string](language.types.numeric-strings), then the comparison is done numerically. These rules also apply to the [switch](control-structures.switch) statement. The type conversion does not take place when the comparison is `===` or `!==` as this involves comparing the type as well as the value.
**Warning** Prior to PHP 8.0.0, if a string is compared to a number or a numeric string then the string was converted to a number before performing the comparison. This can lead to surprising results as can be seen with the following example:
```
<?php
var_dump(0 == "a");
var_dump("1" == "01");
var_dump("10" == "1e1");
var_dump(100 == "1e2");
switch ("a") {
case 0:
echo "0";
break;
case "a":
echo "a";
break;
}
?>
```
Output of the above example in PHP 7:
```
bool(true)
bool(true)
bool(true)
bool(true)
0
```
Output of the above example in PHP 8:
```
bool(false)
bool(true)
bool(true)
bool(true)
a
```
```
<?php
// Integers
echo 1 <=> 1; // 0
echo 1 <=> 2; // -1
echo 2 <=> 1; // 1
// Floats
echo 1.5 <=> 1.5; // 0
echo 1.5 <=> 2.5; // -1
echo 2.5 <=> 1.5; // 1
// Strings
echo "a" <=> "a"; // 0
echo "a" <=> "b"; // -1
echo "b" <=> "a"; // 1
echo "a" <=> "aa"; // -1
echo "zz" <=> "aa"; // 1
// Arrays
echo [] <=> []; // 0
echo [1, 2, 3] <=> [1, 2, 3]; // 0
echo [1, 2, 3] <=> []; // 1
echo [1, 2, 3] <=> [1, 2, 1]; // 1
echo [1, 2, 3] <=> [1, 2, 4]; // -1
// Objects
$a = (object) ["a" => "b"];
$b = (object) ["a" => "b"];
echo $a <=> $b; // 0
$a = (object) ["a" => "b"];
$b = (object) ["a" => "c"];
echo $a <=> $b; // -1
$a = (object) ["a" => "c"];
$b = (object) ["a" => "b"];
echo $a <=> $b; // 1
// not only values are compared; keys must match
$a = (object) ["a" => "b"];
$b = (object) ["b" => "b"];
echo $a <=> $b; // 1
?>
```
For various types, comparison is done according to the following table (in order).
**Comparison with Various Types**| Type of Operand 1 | Type of Operand 2 | Result |
| --- | --- | --- |
| null or string | string | Convert **`null`** to "", numerical or lexical comparison |
| bool or null | anything | Convert both sides to bool, **`false`** < **`true`** |
| object | object | Built-in classes can define its own comparison, different classes are incomparable, same class see [Object Comparison](language.oop5.object-comparison) |
| string, resource, int or float | string, resource, int or float | Translate strings and resources to numbers, usual math |
| array | array | Array with fewer members is smaller, if key from operand 1 is not found in operand 2 then arrays are incomparable, otherwise - compare value by value (see following example) |
| object | anything | object is always greater |
| array | anything | array is always greater |
**Example #1 Boolean/null comparison**
```
<?php
// Bool and null are compared as bool always
var_dump(1 == TRUE); // TRUE - same as (bool)1 == TRUE
var_dump(0 == FALSE); // TRUE - same as (bool)0 == FALSE
var_dump(100 < TRUE); // FALSE - same as (bool)100 < TRUE
var_dump(-10 < FALSE);// FALSE - same as (bool)-10 < FALSE
var_dump(min(-100, -10, NULL, 10, 100)); // NULL - (bool)NULL < (bool)-100 is FALSE < TRUE
?>
```
**Example #2 Transcription of standard array comparison**
```
<?php
// Arrays are compared like this with standard comparison operators as well as the spaceship operator.
function standard_array_compare($op1, $op2)
{
if (count($op1) < count($op2)) {
return -1; // $op1 < $op2
} elseif (count($op1) > count($op2)) {
return 1; // $op1 > $op2
}
foreach ($op1 as $key => $val) {
if (!array_key_exists($key, $op2)) {
return 1;
} elseif ($val < $op2[$key]) {
return -1;
} elseif ($val > $op2[$key]) {
return 1;
}
}
return 0; // $op1 == $op2
}
?>
```
**Warning** Comparison of floating point numbers
====================================
Because of the way floats are represented internally, you should not test two floats for equality.
See the documentation for float for more information.
> **Note**: Be aware that PHP's type juggling is not always obvious when comparing values of different types, particularly comparing ints to bools or ints to strings. It is therefore generally advisable to use `===` and `!==` comparisons rather than `==` and `!=` in most cases.
>
>
### Incomparable Values
While identity comparison (`===` and `!==`) can be applied to arbitrary values, the other comparison operators should only be applied to comparable values. The result of comparing incomparable values is undefined, and should not be relied upon.
### See Also
* [strcasecmp()](function.strcasecmp)
* [strcmp()](function.strcmp)
* [Array operators](language.operators.array)
* [Types](https://www.php.net/manual/en/language.types.php)
### Ternary Operator
Another conditional operator is the "?:" (or ternary) operator.
**Example #3 Assigning a default value**
```
<?php
// Example usage for: Ternary Operator
$action = (empty($_POST['action'])) ? 'default' : $_POST['action'];
// The above is identical to this if/else statement
if (empty($_POST['action'])) {
$action = 'default';
} else {
$action = $_POST['action'];
}
?>
```
The expression `(expr1) ? (expr2) : (expr3)` evaluates to expr2 if expr1 evaluates to **`true`**, and expr3 if expr1 evaluates to **`false`**. It is possible to leave out the middle part of the ternary operator. Expression `expr1 ?: expr3` evaluates to the result of expr1 if expr1 evaluates to **`true`**, and expr3 otherwise. expr1 is only evaluated once in this case.
> **Note**: Please note that the ternary operator is an expression, and that it doesn't evaluate to a variable, but to the result of an expression. This is important to know if you want to return a variable by reference. The statement `return $var == 42 ? $a : $b;` in a return-by-reference function will therefore not work and a warning is issued.
>
>
>
> **Note**:
>
>
> It is recommended to avoid "stacking" ternary expressions. PHP's behaviour when using more than one unparenthesized ternary operator within a single expression is non-obvious compared to other languages. Indeed prior to PHP 8.0.0, ternary expressions were evaluated left-associative, instead of right-associative like most other programming languages. Relying on left-associativity is deprecated as of PHP 7.4.0. As of PHP 8.0.0, the ternary operator is non-associative.
>
>
> **Example #4 Non-obvious Ternary Behaviour**
>
>
> ```
> <?php
> // on first glance, the following appears to output 'true'
> echo (true ? 'true' : false ? 't' : 'f');
>
> // however, the actual output of the above is 't' prior to PHP 8.0.0
> // this is because ternary expressions are left-associative
>
> // the following is a more obvious version of the same code as above
> echo ((true ? 'true' : false) ? 't' : 'f');
>
> // here, one can see that the first expression is evaluated to 'true', which
> // in turn evaluates to (bool)true, thus returning the true branch of the
> // second ternary expression.
> ?>
> ```
>
>
> **Note**:
>
>
> Chaining of short-ternaries (`?:`), however, is stable and behaves reasonably. It will evaluate to the first argument that evaluates to a non-falsy value. Note that undefined values will still raise a warning.
>
>
> **Example #5 Short-ternary chaining**
>
>
> ```
> <?php
> echo 0 ?: 1 ?: 2 ?: 3, PHP_EOL; //1
> echo 0 ?: 0 ?: 2 ?: 3, PHP_EOL; //2
> echo 0 ?: 0 ?: 0 ?: 3, PHP_EOL; //3
> ?>
> ```
>
### Null Coalescing Operator
Another useful shorthand operator is the "??" (or null coalescing) operator.
**Example #6 Assigning a default value**
```
<?php
// Example usage for: Null Coalesce Operator
$action = $_POST['action'] ?? 'default';
// The above is identical to this if/else statement
if (isset($_POST['action'])) {
$action = $_POST['action'];
} else {
$action = 'default';
}
?>
```
The expression `(expr1) ?? (expr2)` evaluates to expr2 if expr1 is **`null`**, and expr1 otherwise. In particular, this operator does not emit a notice or warning if the left-hand side value does not exist, just like [isset()](function.isset). This is especially useful on array keys.
> **Note**: Please note that the null coalescing operator is an expression, and that it doesn't evaluate to a variable, but to the result of an expression. This is important to know if you want to return a variable by reference. The statement `return $foo ?? $bar;` in a return-by-reference function will therefore not work and a warning is issued.
>
>
>
> **Note**:
>
>
> The null coalescing operator has low precedence. That means if mixing it with other operators (such as string concatenation or arithmetic operators) parentheses will likely be required.
>
>
> ```
> <?php
> // Raises a warning that $name is undefined.
> print 'Mr. ' . $name ?? 'Anonymous';
>
> // Prints "Mr. Anonymous"
> print 'Mr. ' . ($name ?? 'Anonymous');
> ?>
> ```
>
>
> **Note**:
>
>
> Please note that the null coalescing operator allows for simple nesting:
>
>
> **Example #7 Nesting null coalescing operator**
>
>
> ```
> <?php
>
> $foo = null;
> $bar = null;
> $baz = 1;
> $qux = 2;
>
> echo $foo ?? $bar ?? $baz ?? $qux; // outputs 1
>
> ?>
> ```
>
| programming_docs |
php SolrQuery::addFacetQuery SolrQuery::addFacetQuery
========================
(PECL solr >= 0.9.2)
SolrQuery::addFacetQuery — Adds a facet query
### Description
```
public SolrQuery::addFacetQuery(string $facetQuery): SolrQuery
```
Adds a facet query
### Parameters
`facetQuery`
The facet query
### Return Values
Returns the current SolrQuery object, if the return value is used.
### Examples
**Example #1 [SolrQuery::addFacetField()](solrquery.addfacetfield) example**
```
<?php
$options = array
(
'hostname' => SOLR_SERVER_HOSTNAME,
'login' => SOLR_SERVER_USERNAME,
'password' => SOLR_SERVER_PASSWORD,
'port' => SOLR_SERVER_PORT,
);
$client = new SolrClient($options);
$query = new SolrQuery('*:*');
$query->setFacet(true);
$query->addFacetQuery('price:[* TO 500]')->addFacetQuery('price:[500 TO *]');
$query_response = $client->query($query);
$response = $query_response->getResponse();
print_r($response->facet_counts->facet_queries);
?>
```
The above example will output something similar to:
```
SolrObject Object
(
[price:[* TO 500]] => 14
[price:[500 TO *]] => 2
)
```
php ssh2_auth_none ssh2\_auth\_none
================
(PECL ssh2 >= 0.9.0)
ssh2\_auth\_none — Authenticate as "none"
### Description
```
ssh2_auth_none(resource $session, string $username): mixed
```
Attempt "none" authentication which usually will (and should) fail. As part of the failure, this function will return an array of accepted authentication methods.
### Parameters
`session`
An SSH connection link identifier, obtained from a call to [ssh2\_connect()](function.ssh2-connect).
`username`
Remote user name.
### Return Values
Returns **`true`** if the server does accept "none" as an authentication method, or an array of accepted authentication methods on failure.
### Examples
**Example #1 Retrieving a list of authentication methods**
```
<?php
$connection = ssh2_connect('shell.example.com', 22);
$auth_methods = ssh2_auth_none($connection, 'user');
if (in_array('password', $auth_methods)) {
echo "Server supports password based authentication\n";
}
?>
```
php user_error user\_error
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
user\_error — Alias of [trigger\_error()](function.trigger-error)
### Description
This function is an alias of: [trigger\_error()](function.trigger-error).
php SolrDocument::key SolrDocument::key
=================
(PECL solr >= 0.9.2)
SolrDocument::key — Retrieves the current key
### Description
```
public SolrDocument::key(): string
```
Retrieves the current key.
### Parameters
This function has no parameters.
### Return Values
Returns the current key.
php dns_get_record dns\_get\_record
================
(PHP 5, PHP 7, PHP 8)
dns\_get\_record — Fetch DNS Resource Records associated with a hostname
### Description
```
dns_get_record(
string $hostname,
int $type = DNS_ANY,
array &$authoritative_name_servers = null,
array &$additional_records = null,
bool $raw = false
): array|false
```
Fetch DNS Resource Records associated with the given `hostname`.
### Parameters
`hostname`
`hostname` should be a valid DNS hostname such as "`www.example.com`". Reverse lookups can be generated using `in-addr.arpa` notation, but [gethostbyaddr()](function.gethostbyaddr) is more suitable for the majority of reverse lookups.
>
> **Note**:
>
>
> Per DNS standards, email addresses are given in `user.host` format (for example: `hostmaster.example.com` as opposed to `[email protected]`), be sure to check this value and modify if necessary before using it with a functions such as [mail()](function.mail).
>
>
`type`
By default, **dns\_get\_record()** will search for any resource records associated with `hostname`. To limit the query, specify the optional `type` parameter. May be any one of the following: **`DNS_A`**, **`DNS_CNAME`**, **`DNS_HINFO`**, **`DNS_CAA`**, **`DNS_MX`**, **`DNS_NS`**, **`DNS_PTR`**, **`DNS_SOA`**, **`DNS_TXT`**, **`DNS_AAAA`**, **`DNS_SRV`**, **`DNS_NAPTR`**, **`DNS_A6`**, **`DNS_ALL`** or **`DNS_ANY`**.
>
> **Note**:
>
>
> Because of eccentricities in the performance of libresolv between platforms, **`DNS_ANY`** will not always return every record, the slower **`DNS_ALL`** will collect all records more reliably.
>
>
>
> **Note**:
>
>
> Windows: **`DNS_CAA`** is not supported. Support for **`DNS_A6`** is not implemented.
>
>
`authoritative_name_servers`
Passed by reference and, if given, will be populated with Resource Records for the *Authoritative Name Servers*.
`additional_records`
Passed by reference and, if given, will be populated with any *Additional Records*.
`raw`
The `type` will be interpreted as a raw DNS type ID (the `DNS_*` constants cannot be used). The return value will contain a `data` key, which needs to be manually parsed.
### Return Values
This function returns an array of associative arrays, or **`false`** on failure. Each associative array contains *at minimum* the following keys:
**Basic DNS attributes**| Attribute | Meaning |
| --- | --- |
| host | The record in the DNS namespace to which the rest of the associated data refers. |
| class | **dns\_get\_record()** only returns Internet class records and as such this parameter will always return `IN`. |
| type | String containing the record type. Additional attributes will also be contained in the resulting array dependant on the value of type. See table below. |
| ttl | `"Time To Live"` remaining for this record. This will *not* equal the record's original ttl, but will rather equal the original ttl minus whatever length of time has passed since the authoritative name server was queried. |
**Other keys in associative arrays dependant on 'type'**| Type | Extra Columns |
| --- | --- |
| `A` | `ip`: An IPv4 addresses in dotted decimal notation. |
| `MX` | `pri`: Priority of mail exchanger. Lower numbers indicate greater priority. `target`: FQDN of the mail exchanger. See also [dns\_get\_mx()](function.dns-get-mx). |
| `CNAME` | `target`: FQDN of location in DNS namespace to which the record is aliased. |
| `NS` | `target`: FQDN of the name server which is authoritative for this hostname. |
| `PTR` | `target`: Location within the DNS namespace to which this record points. |
| `TXT` | `txt`: Arbitrary string data associated with this record. |
| `HINFO` | `cpu`: IANA number designating the CPU of the machine referenced by this record. `os`: IANA number designating the Operating System on the machine referenced by this record. See IANA's [» `Operating System
Names`](http://www.iana.org/assignments/operating-system-names) for the meaning of these values. |
| `CAA` | `flags`: A one-byte bitfield; currently only bit 0 is defined, meaning 'critical'; other bits are reserved and should be ignored. `tag`: The CAA tag name (alphanumeric ASCII string). `value`: The CAA tag value (binary string, may use subformats). For additional information see: [» RFC 6844](http://www.faqs.org/rfcs/rfc6844) |
| `SOA` | `mname`: FQDN of the machine from which the resource records originated. `rname`: Email address of the administrative contact for this domain. `serial`: Serial # of this revision of the requested domain. `refresh`: Refresh interval (seconds) secondary name servers should use when updating remote copies of this domain. `retry`: Length of time (seconds) to wait after a failed refresh before making a second attempt. `expire`: Maximum length of time (seconds) a secondary DNS server should retain remote copies of the zone data without a successful refresh before discarding. `minimum-ttl`: Minimum length of time (seconds) a client can continue to use a DNS resolution before it should request a new resolution from the server. Can be overridden by individual resource records. |
| `AAAA` | `ipv6`: IPv6 address |
| `A6` | `masklen`: Length (in bits) to inherit from the target specified by `chain`. `ipv6`: Address for this specific record to merge with `chain`. `chain`: Parent record to merge with `ipv6` data. |
| `SRV` | `pri`: (Priority) lowest priorities should be used first. `weight`: Ranking to weight which of commonly prioritized `targets` should be chosen at random. `target` and `port`: hostname and port where the requested service can be found. For additional information see: [» RFC 2782](http://www.faqs.org/rfcs/rfc2782) |
| `NAPTR` | `order` and `pref`: Equivalent to `pri` and `weight` above. `flags`, `services`, `regex`, and `replacement`: Parameters as defined by [» RFC 2915](http://www.faqs.org/rfcs/rfc2915). |
### Changelog
| Version | Description |
| --- | --- |
| 7.0.16, 7.1.2 | Added support for CAA record type. |
### Examples
**Example #1 Using **dns\_get\_record()****
```
<?php
$result = dns_get_record("php.net");
print_r($result);
?>
```
The above example will output something similar to:
```
Array
(
[0] => Array
(
[host] => php.net
[type] => MX
[pri] => 5
[target] => pair2.php.net
[class] => IN
[ttl] => 6765
)
[1] => Array
(
[host] => php.net
[type] => A
[ip] => 64.246.30.37
[class] => IN
[ttl] => 8125
)
)
```
**Example #2 Using **dns\_get\_record()** and DNS\_ANY**
Since it's very common to want the IP address of a mail server once the MX record has been resolved, **dns\_get\_record()** also returns an array in `additional_records` which contains associate records. `authoritative_name_servers` is returned as well containing a list of authoritative name servers.
```
<?php
/* Request "ANY" record for php.net,
and create $authns and $addtl arrays
containing list of name servers and
any additional records which go with
them */
$result = dns_get_record("php.net", DNS_ANY, $authns, $addtl);
echo "Result = ";
print_r($result);
echo "Auth NS = ";
print_r($authns);
echo "Additional = ";
print_r($addtl);
?>
```
The above example will output something similar to:
```
Result = Array
(
[0] => Array
(
[host] => php.net
[type] => MX
[pri] => 5
[target] => pair2.php.net
[class] => IN
[ttl] => 6765
)
[1] => Array
(
[host] => php.net
[type] => A
[ip] => 64.246.30.37
[class] => IN
[ttl] => 8125
)
)
Auth NS = Array
(
[0] => Array
(
[host] => php.net
[type] => NS
[target] => remote1.easydns.com
[class] => IN
[ttl] => 10722
)
[1] => Array
(
[host] => php.net
[type] => NS
[target] => remote2.easydns.com
[class] => IN
[ttl] => 10722
)
[2] => Array
(
[host] => php.net
[type] => NS
[target] => ns1.easydns.com
[class] => IN
[ttl] => 10722
)
[3] => Array
(
[host] => php.net
[type] => NS
[target] => ns2.easydns.com
[class] => IN
[ttl] => 10722
)
)
Additional = Array
(
[0] => Array
(
[host] => pair2.php.net
[type] => A
[ip] => 216.92.131.5
[class] => IN
[ttl] => 6766
)
[1] => Array
(
[host] => remote1.easydns.com
[type] => A
[ip] => 64.39.29.212
[class] => IN
[ttl] => 100384
)
[2] => Array
(
[host] => remote2.easydns.com
[type] => A
[ip] => 212.100.224.80
[class] => IN
[ttl] => 81241
)
[3] => Array
(
[host] => ns1.easydns.com
[type] => A
[ip] => 216.220.40.243
[class] => IN
[ttl] => 81241
)
[4] => Array
(
[host] => ns2.easydns.com
[type] => A
[ip] => 216.220.40.244
[class] => IN
[ttl] => 81241
)
)
```
### See Also
* [dns\_get\_mx()](function.dns-get-mx) - Alias of getmxrr
* [dns\_check\_record()](function.dns-check-record) - Alias of checkdnsrr
php Imagick::count Imagick::count
==============
(PECL imagick 3 >= 3.3.0)
Imagick::count — Get the number of images
### Description
```
public Imagick::count(int $mode = 0): int
```
Returns the number of images.
### Parameters
`mode`
An unused argument. Currently there is a non-particularly well defined feature in PHP where calling count() on a countable object might (or might not) require this method to accept a parameter. This parameter is here to be conformant with the interface of countable, even though the param is not used.
### Return Values
Returns the number of images.
php SimpleXMLElement::attributes SimpleXMLElement::attributes
============================
(PHP 5, PHP 7, PHP 8)
SimpleXMLElement::attributes — Identifies an element's attributes
### Description
```
public SimpleXMLElement::attributes(?string $namespaceOrPrefix = null, bool $isPrefix = false): ?SimpleXMLElement
```
This function provides the attributes and values defined within an xml tag.
> **Note**: SimpleXML has made a rule of adding iterative properties to most methods. They cannot be viewed using [var\_dump()](function.var-dump) or anything else which can examine objects.
>
>
### Parameters
`namespaceOrPrefix`
An optional namespace for the retrieved attributes
`isPrefix`
Default to **`false`**
### Return Values
Returns a [SimpleXMLElement](class.simplexmlelement) object that can be iterated over to loop through the attributes on the tag.
Returns **`null`** if called on a [SimpleXMLElement](class.simplexmlelement) object that already represents an attribute and not a tag.
### Examples
**Example #1 Interpret an XML string**
```
<?php
$string = <<<XML
<a>
<foo name="one" game="lonely">1</foo>
</a>
XML;
$xml = simplexml_load_string($string);
foreach($xml->foo[0]->attributes() as $a => $b) {
echo $a,'="',$b,"\"\n";
}
?>
```
The above example will output:
```
name="one"
game="lonely"
```
### See Also
* [Basic SimpleXML usage](https://www.php.net/manual/en/simplexml.examples-basic.php)
php posix_geteuid posix\_geteuid
==============
(PHP 4, PHP 5, PHP 7, PHP 8)
posix\_geteuid — Return the effective user ID of the current process
### Description
```
posix_geteuid(): int
```
Return the numeric effective user ID of the current process. See also [posix\_getpwuid()](function.posix-getpwuid) for information on how to convert this into a useable username.
### Parameters
This function has no parameters.
### Return Values
Returns the user id, as an int
### Examples
**Example #1 **posix\_geteuid()** example**
This example will show the current user id then set the effective user id to a separate id using [posix\_seteuid()](function.posix-seteuid), then show the difference between the real id and the effective id.
```
<?php
echo posix_getuid()."\n"; //10001
echo posix_geteuid()."\n"; //10001
posix_seteuid(10000);
echo posix_getuid()."\n"; //10001
echo posix_geteuid()."\n"; //10000
?>
```
### See Also
* [posix\_getpwuid()](function.posix-getpwuid) - Return info about a user by user id
* [posix\_getuid()](function.posix-getuid) - Return the real user ID of the current process
* [posix\_setuid()](function.posix-setuid) - Set the UID of the current process
* POSIX man page GETEUID(2)
php QuickHashStringIntHash::delete QuickHashStringIntHash::delete
==============================
(No version information available, might only be in Git)
QuickHashStringIntHash::delete — This method deletes an entry from the hash
### Description
```
public QuickHashStringIntHash::delete(string $key): bool
```
This method deletes an entry from the hash, and returns whether the entry was deleted or not. Associated memory structures will not be freed immediately, but rather when the hash itself is freed.
Elements can not be deleted when the hash is used in an iterator. The method will not throw an exception, but simply return **`false`** like would happen with any other deletion failure.
### Parameters
`key`
The key of the entry to delete.
### Return Values
**`true`** when the entry was deleted, and **`false`** if the entry was not deleted.
### Examples
**Example #1 **QuickHashStringIntHash::delete()** example**
```
<?php
$hash = new QuickHashStringIntHash( 1024 );
var_dump( $hash->exists( 'four' ) );
var_dump( $hash->add( 'four', 5 ) );
var_dump( $hash->get( 'four' ) );
var_dump( $hash->delete( 'four' ) );
var_dump( $hash->exists( 'four' ) );
var_dump( $hash->get( 'four' ) );
var_dump( $hash->delete( 'four' ) );
?>
```
The above example will output something similar to:
```
bool(false)
bool(true)
int(5)
bool(true)
bool(false)
bool(false)
bool(false)
```
php Exception::__toString Exception::\_\_toString
=======================
(PHP 5, PHP 7, PHP 8)
Exception::\_\_toString — String representation of the exception
### Description
```
public Exception::__toString(): string
```
Returns the string representation of the exception.
### Parameters
This function has no parameters.
### Return Values
Returns the string representation of the exception.
### Examples
**Example #1 **Exception::\_\_toString()** example**
```
<?php
try {
throw new Exception("Some error message");
} catch(Exception $e) {
echo $e;
}
?>
```
The above example will output something similar to:
```
exception 'Exception' with message 'Some error message' in /home/bjori/tmp/ex.php:3
Stack trace:
#0 {main}
```
### See Also
* [Throwable::\_\_toString()](throwable.tostring) - Gets a string representation of the thrown object
php Ds\Map::slice Ds\Map::slice
=============
(PECL ds >= 1.0.0)
Ds\Map::slice — Returns a subset of the map defined by a starting index and length
### Description
```
public Ds\Map::slice(int $index, int $length = ?): Ds\Map
```
Returns a subset of the map defined by a starting `index` and `length`.
### Parameters
`index`
The index at which the range starts.
If positive, the range will start at that index in the map. If negative, the range will start that far from the end.
`length`
If a length is given and is positive, the resulting map will have up to that many pairs in it. If a length is given and is negative, the range will stop that many pairs from the end. If the length results in an overflow, only pairs up to the end of the map will be included. If a length is not provided, the resulting map will contain all pairs between the index and the end of the map.
### Return Values
A subset of the map defined by a starting index and length.
### Examples
**Example #1 **Ds\Map::slice()** example**
```
<?php
$map = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3, "d" => 4, "e" => 5]);
// Slice from 2 onwards
print_r($map->slice(2)->toArray());
// Slice from 1, for a length of 3
print_r($map->slice(1, 3)->toArray());
// Slice from 1 onwards
print_r($map->slice(1)->toArray());
// Slice from 2 from the end onwards
print_r($map->slice(-2)->toArray());
// Slice from 1 to 1 from the end
print_r($map->slice(1, -1)->toArray());
?>
```
The above example will output something similar to:
```
Array
(
[c] => 3
[d] => 4
[e] => 5
)
Array
(
[b] => 2
[c] => 3
[d] => 4
)
Array
(
[b] => 2
[c] => 3
[d] => 4
[e] => 5
)
Array
(
[d] => 4
[e] => 5
)
Array
(
[b] => 2
[c] => 3
[d] => 4
)
```
| programming_docs |
php Yaf_Router::getRoute Yaf\_Router::getRoute
=====================
(Yaf >=1.0.0)
Yaf\_Router::getRoute — Retrieve a route by name
### Description
```
public Yaf_Router::getRoute(string $name): Yaf_Route_Interface
```
Retrieve a route by name, see also [Yaf\_Router::getCurrentRoute()](yaf-router.getcurrentroute)
### Parameters
This function has no parameters.
### Return Values
### See Also
* [Yaf\_Bootstrap\_Abstract](class.yaf-bootstrap-abstract)
* [Yaf\_Plugin\_Abstract](class.yaf-plugin-abstract)
* [Yaf\_Router::addRoute()](yaf-router.addroute) - Add new Route into Router
* [Yaf\_Router::getCurrentRoute()](yaf-router.getcurrentroute) - Get the effective route name
php exif_imagetype exif\_imagetype
===============
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
exif\_imagetype — Determine the type of an image
### Description
```
exif_imagetype(string $filename): int|false
```
**exif\_imagetype()** reads the first bytes of an image and checks its signature.
**exif\_imagetype()** can be used to avoid calls to other [exif](https://www.php.net/manual/en/ref.exif.php) functions with unsupported file types or in conjunction with [$\_SERVER['HTTP\_ACCEPT']](reserved.variables.server) to check whether or not the viewer is able to see a specific image in the browser.
### Parameters
`filename`
The image being checked. ### Return Values
When a correct signature is found, the appropriate constant value will be returned otherwise the return value is **`false`**. The return value is the same value that [getimagesize()](function.getimagesize) returns in index 2 but **exif\_imagetype()** is much faster.
The following constants are defined, and represent possible **exif\_imagetype()** return values:
**Imagetype Constants**| Value | Constant |
| --- | --- |
| 1 | **`IMAGETYPE_GIF`** |
| 2 | **`IMAGETYPE_JPEG`** |
| 3 | **`IMAGETYPE_PNG`** |
| 4 | **`IMAGETYPE_SWF`** |
| 5 | **`IMAGETYPE_PSD`** |
| 6 | **`IMAGETYPE_BMP`** |
| 7 | **`IMAGETYPE_TIFF_II`** (intel byte order) |
| 8 | **`IMAGETYPE_TIFF_MM`** (motorola byte order) |
| 9 | **`IMAGETYPE_JPC`** |
| 10 | **`IMAGETYPE_JP2`** |
| 11 | **`IMAGETYPE_JPX`** |
| 12 | **`IMAGETYPE_JB2`** |
| 13 | **`IMAGETYPE_SWC`** |
| 14 | **`IMAGETYPE_IFF`** |
| 15 | **`IMAGETYPE_WBMP`** |
| 16 | **`IMAGETYPE_XBM`** |
| 17 | **`IMAGETYPE_ICO`** |
| 18 | **`IMAGETYPE_WEBP`** |
>
> **Note**:
>
>
> **exif\_imagetype()** will emit an **`E_NOTICE`** and return **`false`** if it is unable to read enough bytes from the file to determine the image type.
>
>
### Changelog
| Version | Description |
| --- | --- |
| 7.1.0 | Added WebP support. |
### Examples
**Example #1 **exif\_imagetype()** example**
```
<?php
if (exif_imagetype('image.gif') != IMAGETYPE_GIF) {
echo 'The picture is not a gif';
}
?>
```
### See Also
* [image\_type\_to\_mime\_type()](function.image-type-to-mime-type) - Get Mime-Type for image-type returned by getimagesize, exif\_read\_data, exif\_thumbnail, exif\_imagetype
* [getimagesize()](function.getimagesize) - Get the size of an image
php EventDnsBase::setSearchNdots EventDnsBase::setSearchNdots
============================
(PECL event >= 1.2.6-beta)
EventDnsBase::setSearchNdots — Set the 'ndots' parameter for searches
### Description
```
public EventDnsBase::setSearchNdots( int $ndots ): bool
```
Set the **`'ndots'`** parameter for searches. Sets the number of dots which, when found in a name, causes the first query to be without any search domain.
### Parameters
`ndots` The number of dots.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php pspell_save_wordlist pspell\_save\_wordlist
======================
(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)
pspell\_save\_wordlist — Save the personal wordlist to a file
### Description
```
pspell_save_wordlist(PSpell\Dictionary $dictionary): bool
```
**pspell\_save\_wordlist()** saves the personal wordlist from the current session. The location of files to be saved specified with [pspell\_config\_personal()](function.pspell-config-personal) and (optionally) [pspell\_config\_repl()](function.pspell-config-repl).
### Parameters
`dictionary`
An [PSpell\Dictionary](class.pspell-dictionary) instance.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `dictionary` parameter expects an [PSpell\Dictionary](class.pspell-dictionary) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 [pspell\_add\_to\_personal()](function.pspell-add-to-personal)**
```
<?php
$pspell_config = pspell_config_create("en");
pspell_config_personal($pspell_config, "/tmp/dicts/newdict");
$pspell = pspell_new_config($pspell_config);
pspell_add_to_personal($pspell, "Vlad");
pspell_save_wordlist($pspell);
?>
```
### Notes
>
> **Note**:
>
>
> This function will not work unless you have pspell .11.2 and aspell .32.5 or later.
>
>
php ImagickDraw::getTextDecoration ImagickDraw::getTextDecoration
==============================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::getTextDecoration — Returns the text decoration
### Description
```
public ImagickDraw::getTextDecoration(): int
```
**Warning**This function is currently not documented; only its argument list is available.
Returns the decoration applied when annotating with text.
### Return Values
Returns a [DECORATION](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.decoration) constant (`imagick::DECORATION_*`), and 0 if no decoration is set.
php openlog openlog
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
openlog — Open connection to system logger
### Description
```
openlog(string $prefix, int $flags, int $facility): bool
```
**openlog()** opens a connection to the system logger for a program.
The use of **openlog()** is optional. It will automatically be called by [syslog()](function.syslog) if necessary, in which case `prefix` will default to **`false`**.
### Parameters
`prefix`
The string `prefix` is added to each message.
`flags`
The `flags` argument is used to indicate what logging options will be used when generating a log message.
****openlog()** Options**| Constant | Description |
| --- | --- |
| **`LOG_CONS`** | if there is an error while sending data to the system logger, write directly to the system console |
| **`LOG_NDELAY`** | open the connection to the logger immediately |
| **`LOG_ODELAY`** | (default) delay opening the connection until the first message is logged |
| **`LOG_PERROR`** | print log message also to standard error |
| **`LOG_PID`** | include PID with each message |
You can use one or more of these options. When using multiple options you need to `OR` them, i.e. to open the connection immediately, write to the console and include the PID in each message, you will use: `LOG_CONS | LOG_NDELAY | LOG_PID` `facility`
The `facility` argument is used to specify what type of program is logging the message. This allows you to specify (in your machine's syslog configuration) how messages coming from different facilities will be handled.
****openlog()** Facilities**| Constant | Description |
| --- | --- |
| **`LOG_AUTH`** | security/authorization messages (use **`LOG_AUTHPRIV`** instead in systems where that constant is defined) |
| **`LOG_AUTHPRIV`** | security/authorization messages (private) |
| **`LOG_CRON`** | clock daemon (cron and at) |
| **`LOG_DAEMON`** | other system daemons |
| **`LOG_KERN`** | kernel messages |
| **`LOG_LOCAL0`** ... **`LOG_LOCAL7`** | reserved for local use, these are not available in Windows |
| **`LOG_LPR`** | line printer subsystem |
| **`LOG_MAIL`** | mail subsystem |
| **`LOG_NEWS`** | USENET news subsystem |
| **`LOG_SYSLOG`** | messages generated internally by syslogd |
| **`LOG_USER`** | generic user-level messages |
| **`LOG_UUCP`** | UUCP subsystem |
>
> **Note**:
>
>
> **`LOG_USER`** is the only valid log type under Windows operating systems
>
>
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [syslog()](function.syslog) - Generate a system log message
* [closelog()](function.closelog) - Close connection to system logger
php SolrQuery::getGroupTruncate SolrQuery::getGroupTruncate
===========================
(PECL solr >= 2.2.0)
SolrQuery::getGroupTruncate — Returns the group.truncate value
### Description
```
public SolrQuery::getGroupTruncate(): bool
```
Returns the group.truncate value
### Parameters
This function has no parameters.
### Return Values
### See Also
* [SolrQuery::setGroupTruncate()](solrquery.setgrouptruncate) - If true, facet counts are based on the most relevant document of each group matching the query
php pcntl_alarm pcntl\_alarm
============
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
pcntl\_alarm — Set an alarm clock for delivery of a signal
### Description
```
pcntl_alarm(int $seconds): int
```
Creates a timer that will send a **`SIGALRM`** signal to the process after the given number of seconds. Any call to **pcntl\_alarm()** will cancel any previously set alarm.
### Parameters
`seconds`
The number of seconds to wait. If `seconds` is zero, no new alarm is created.
### Return Values
Returns the time in seconds that any previously scheduled alarm had remaining before it was to be delivered, or `0` if there was no previously scheduled alarm.
php pg_trace pg\_trace
=========
(PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8)
pg\_trace — Enable tracing a PostgreSQL connection
### Description
```
pg_trace(string $filename, string $mode = "w", ?PgSql\Connection $connection = null): bool
```
**pg\_trace()** enables tracing of the PostgreSQL frontend/backend communication to a file. To fully understand the results, one needs to be familiar with the internals of PostgreSQL communication protocol.
For those who are not, it can still be useful for tracing errors in queries sent to the server, you could do for example **grep '^To backend' trace.log** and see what queries actually were sent to the PostgreSQL server. For more information, refer to the [» PostgreSQL Documentation](http://www.postgresql.org/docs/current/interactive/).
### Parameters
`filename`
The full path and file name of the file in which to write the trace log. Same as in [fopen()](function.fopen).
`mode`
An optional file access mode, same as for [fopen()](function.fopen).
`connection`
An [PgSql\Connection](class.pgsql-connection) instance. When `connection` is **`null`**, the default connection is used. The default connection is the last connection made by [pg\_connect()](function.pg-connect) or [pg\_pconnect()](function.pg-pconnect).
**Warning**As of PHP 8.1.0, using the default connection is deprecated.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. |
| 8.0.0 | `connection` is now nullable. |
### Examples
**Example #1 **pg\_trace()** example**
```
<?php
$pgsql_conn = pg_connect("dbname=mark host=localhost");
if ($pgsql_conn) {
pg_trace('/tmp/trace.log', 'w', $pgsql_conn);
pg_query("SELECT 1");
pg_untrace($pgsql_conn);
// Now /tmp/trace.log will contain backend communication
} else {
print pg_last_error($pgsql_conn);
exit;
}
?>
```
### See Also
* [fopen()](function.fopen) - Opens file or URL
* [pg\_untrace()](function.pg-untrace) - Disable tracing of a PostgreSQL connection
php ImagickDraw::setTextEncoding ImagickDraw::setTextEncoding
============================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setTextEncoding — Specifies the text code set
### Description
```
public ImagickDraw::setTextEncoding(string $encoding): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Specifies the code set to use for text annotations. The only character encoding which may be specified at this time is "UTF-8" for representing Unicode as a sequence of bytes. Specify an empty string to set text encoding to the system's default. Successful text annotation using Unicode may require fonts designed to support Unicode.
### Parameters
`encoding`
the encoding name
### Return Values
No value is returned.
php Yaf_Request_Abstract::getMethod Yaf\_Request\_Abstract::getMethod
=================================
(Yaf >=1.0.0)
Yaf\_Request\_Abstract::getMethod — Retrieve the request method
### Description
```
public Yaf_Request_Abstract::getMethod(): string
```
### Parameters
This function has no parameters.
### Return Values
Return a string, like "POST", "GET" etc.
### See Also
* [Yaf\_Request\_Abstract::isHead()](yaf-request-abstract.ishead) - Determine if request is HEAD request
* [Yaf\_Request\_Abstract::isCli()](yaf-request-abstract.iscli) - Determine if request is CLI request
* [Yaf\_Request\_Abstract::isPost()](yaf-request-abstract.ispost) - Determine if request is POST request
* [Yaf\_Request\_Abstract::isPut()](yaf-request-abstract.isput) - Determine if request is PUT request
* [Yaf\_Request\_Abstract::isOptions()](yaf-request-abstract.isoptions) - Determine if request is OPTIONS request
* [Yaf\_Request\_Abstract::isXmlHTTPRequest()](yaf-request-abstract.isxmlhttprequest) - Determine if request is AJAX request
php ini_parse_quantity ini\_parse\_quantity
====================
(PHP 8 >= 8.2.0)
ini\_parse\_quantity — Get interpreted size from ini shorthand syntax
### Description
```
ini_parse_quantity(string $shorthand): int
```
Returns the interpreted size in bytes on success from an [ini shorthand](https://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes).
### Parameters
`shorthand`
Ini shorthand to parse, must be a number followed by an optional multiplier. The followig multipliers are supported: `k`/`K` (`1024`), `m`/`M` (`1048576`), `g`/`G` (`1073741824`). The number can be a decimal, hex (prefixed with `0x` or `0X`), octal (prefixed with `0o`, `0O` or `0`) or binary (prefixed with `0b` or `0B`)
### Return Values
Returns the interpreted size in bytes as an int.
### Errors/Exceptions
If the value cannot be parsed, or an invalid multiplier is used, an **`E_WARNING`** is raised.
### Examples
**Example #1 A few **ini\_parse\_quantity()** examples**
```
<?php
var_dump(ini_parse_quantity('1024'));
var_dump(ini_parse_quantity('1024M'));
var_dump(ini_parse_quantity('512K'));
var_dump(ini_parse_quantity('0xFFk'));
var_dump(ini_parse_quantity('0b1010k'));
var_dump(ini_parse_quantity('0o1024'));
var_dump(ini_parse_quantity('01024'));
var_dump(ini_parse_quantity('Foobar'));
var_dump(ini_parse_quantity('10F'));
?>
```
The above example will output something similar to:
```
int(1024)
int(1073741824)
int(524288)
int(261120)
int(10240)
int(532)
int(532)
Warning: Invalid quantity "Foobar": no valid leading digits, interpreting as "0" for backwards compatibility
int(0)
Warning: Invalid quantity "10F": unknown multiplier "F", interpreting as "10" for backwards compatibility
int(10)
```
### See Also
* [ini\_get()](function.ini-get) - Gets the value of a configuration option
php Stomp::getSessionId Stomp::getSessionId
===================
stomp\_get\_session\_id
=======================
(PECL stomp >= 0.1.0)
Stomp::getSessionId -- stomp\_get\_session\_id — Gets the current stomp session ID
### Description
Object-oriented style (method):
```
public Stomp::getSessionId(): string|false
```
Procedural style:
```
stomp_get_session_id(resource $link): string|false
```
Gets the current stomp session ID.
### Parameters
`link`
Procedural style only: The stomp link identifier returned by [stomp\_connect()](stomp.construct).
### Return Values
string session id on success or **`false`** on failure.
### Examples
**Example #1 Object-oriented style**
```
<?php
/* connection */
try {
$stomp = new Stomp('tcp://localhost:61613');
} catch(StompException $e) {
die('Connection failed: ' . $e->getMessage());
}
var_dump($stomp->getSessionId());
/* close connection */
unset($stomp);
?>
```
The above example will output something similar to:
```
string(35) "ID:php.net-52873-1257291895530-4:14"
```
**Example #2 Procedural style**
```
<?php
/* connection */
$link = stomp_connect('ssl://localhost:61612');
/* check connection */
if (!$link) {
die('Connection failed: ' . stomp_connect_error());
}
var_dump(stomp_get_session_id($link));
/* close connection */
stomp_close($link);
?>
```
The above example will output something similar to:
```
string(35) "ID:php.net-52873-1257291895530-4:14"
```
php ImagickDraw::color ImagickDraw::color
==================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::color — Draws color on image
### Description
```
public ImagickDraw::color(float $x, float $y, int $paintMethod): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Draws color on image using the current fill color, starting at specified position, and using specified paint method.
### Parameters
`x`
x coordinate of the paint
`y`
y coordinate of the paint
`paintMethod`
One of the [PAINT](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.paint) constant (`imagick::PAINT_*`).
### Return Values
No value is returned.
php Yaf_Config_Simple::offsetExists Yaf\_Config\_Simple::offsetExists
=================================
(Yaf >=1.0.0)
Yaf\_Config\_Simple::offsetExists — The offsetExists purpose
### Description
```
public Yaf_Config_Simple::offsetExists(string $name): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`name`
### Return Values
php mb_convert_case mb\_convert\_case
=================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
mb\_convert\_case — Perform case folding on a string
### Description
```
mb_convert_case(string $string, int $mode, ?string $encoding = null): string
```
Performs case folding on a string, converted in the way specified by `mode`.
### Parameters
`string`
The string being converted.
`mode`
The mode of the conversion. It can be one of **`MB_CASE_UPPER`**, **`MB_CASE_LOWER`**, **`MB_CASE_TITLE`**, **`MB_CASE_FOLD`**, **`MB_CASE_UPPER_SIMPLE`**, **`MB_CASE_LOWER_SIMPLE`**, **`MB_CASE_TITLE_SIMPLE`**, **`MB_CASE_FOLD_SIMPLE`**.
`encoding`
The `encoding` parameter is the character encoding. If it is omitted or **`null`**, the internal character encoding value will be used.
### Return Values
A case folded version of `string` converted in the way specified by `mode`.
### Changelog
| Version | Description |
| --- | --- |
| 7.3.0 | Added support for **`MB_CASE_FOLD`**, **`MB_CASE_UPPER_SIMPLE`**, **`MB_CASE_LOWER_SIMPLE`**, **`MB_CASE_TITLE_SIMPLE`**, and **`MB_CASE_FOLD_SIMPLE`** as `mode`. |
### Examples
**Example #1 **mb\_convert\_case()** example**
```
<?php
$str = "mary had a Little lamb and she loved it so";
$str = mb_convert_case($str, MB_CASE_UPPER, "UTF-8");
echo $str; // Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
$str = mb_convert_case($str, MB_CASE_TITLE, "UTF-8");
echo $str; // Prints Mary Had A Little Lamb And She Loved It So
?>
```
**Example #2 **mb\_convert\_case()** example with non-Latin UTF-8 text**
```
<?php
$str = "Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός";
$str = mb_convert_case($str, MB_CASE_UPPER, "UTF-8");
echo $str; // Prints ΤΆΧΙΣΤΗ ΑΛΏΠΗΞ ΒΑΦΉΣ ΨΗΜΈΝΗ ΓΗ, ΔΡΑΣΚΕΛΊΖΕΙ ΥΠΈΡ ΝΩΘΡΟΎ ΚΥΝΌΣ
$str = mb_convert_case($str, MB_CASE_TITLE, "UTF-8");
echo $str; // Prints Τάχιστη Αλώπηξ Βαφήσ Ψημένη Γη, Δρασκελίζει Υπέρ Νωθρού Κυνόσ
?>
```
### Notes
By contrast to the standard case folding functions such as [strtolower()](function.strtolower) and [strtoupper()](function.strtoupper), case folding is performed on the basis of the Unicode character properties. Thus the behaviour of this function is not affected by locale settings and it can convert any characters that have 'alphabetic' property, such a-umlaut (ä).
For more information about the Unicode properties, please see [» http://www.unicode.org/reports/tr21/](http://www.unicode.org/reports/tr21/).
### See Also
* [mb\_strtolower()](function.mb-strtolower) - Make a string lowercase
* [mb\_strtoupper()](function.mb-strtoupper) - Make a string uppercase
* [strtolower()](function.strtolower) - Make a string lowercase
* [strtoupper()](function.strtoupper) - Make a string uppercase
* [ucfirst()](function.ucfirst) - Make a string's first character uppercase
* [ucwords()](function.ucwords) - Uppercase the first character of each word in a string
| programming_docs |
php SplFixedArray::offsetSet SplFixedArray::offsetSet
========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplFixedArray::offsetSet — Sets a new value at a specified index
### Description
```
public SplFixedArray::offsetSet(int $index, mixed $value): void
```
Sets the value at the specified `index` to `value`.
### Parameters
`index`
The index being set.
`value`
The new value for the `index`.
### Return Values
No value is returned.
### Errors/Exceptions
Throws [RuntimeException](class.runtimeexception) when `index` is outside the defined size of the array or when `index` cannot be parsed as an integer.
php svn_auth_get_parameter svn\_auth\_get\_parameter
=========================
(PECL svn >= 0.1.0)
svn\_auth\_get\_parameter — Retrieves authentication parameter
### Description
```
svn_auth_get_parameter(string $key): string
```
Retrieves authentication parameter at `key`. For a list of valid keys and their meanings, consult the [authentication constants list](https://www.php.net/manual/en/svn.constants.php#svn.constants.auth).
### Parameters
`key`
String key name. Use the [authentication constants](https://www.php.net/manual/en/svn.constants.php#svn.constants.auth) defined by this extension to specify a key.
### Return Values
Returns the string value of the parameter at `key`; returns **`null`** if parameter does not exist.
### Notes
**Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
### See Also
* [svn\_auth\_set\_parameter()](function.svn-auth-set-parameter) - Sets an authentication parameter
* [Authentication constants](https://www.php.net/manual/en/svn.constants.php#svn.constants.auth)
php The IntlDatePatternGenerator class
The IntlDatePatternGenerator class
==================================
Introduction
------------
(PHP 8 >= 8.1.0)
Generates localized date and/or time format pattern strings suitable for use in [IntlDateFormatter](class.intldateformatter).
Class synopsis
--------------
class **IntlDatePatternGenerator** { /\* Methods \*/ public [\_\_construct](intldatepatterngenerator.create)(?string `$locale` = **`null`**)
```
public static create(?string $locale = null): ?IntlDatePatternGenerator
```
```
public getBestPattern(string $skeleton): string|false
```
} Table of Contents
-----------------
* [IntlDatePatternGenerator::create](intldatepatterngenerator.create) — Creates a new IntlDatePatternGenerator instance
* [IntlDatePatternGenerator::getBestPattern](intldatepatterngenerator.getbestpattern) — Determines the most suitable date/time format
php Imagick::spreadImage Imagick::spreadImage
====================
(PECL imagick 2, PECL imagick 3)
Imagick::spreadImage — Randomly displaces each pixel in a block
### Description
```
public Imagick::spreadImage(float $radius): bool
```
Special effects method that randomly displaces each pixel in a block defined by the radius parameter.
### Parameters
`radius`
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::spreadImage()****
```
<?php
function spreadImage($imagePath, $radius) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->spreadImage($radius);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php sqrt sqrt
====
(PHP 4, PHP 5, PHP 7, PHP 8)
sqrt — Square root
### Description
```
sqrt(float $num): float
```
Returns the square root of `num`.
### Parameters
`num`
The argument to process
### Return Values
The square root of `num` or the special value `NAN` for negative numbers.
### Examples
**Example #1 **sqrt()** example**
```
<?php
// Precision depends on your precision directive
echo sqrt(9); // 3
echo sqrt(10); // 3.16227766 ...
?>
```
### See Also
* [pow()](function.pow) - Exponential expression
* **`M_SQRTPI`** - `sqrt(pi)`
* **`M_2_SQRTPI`** - `2/sqrt(pi)`
* **`M_SQRT2`** - `sqrt(2)`
* **`M_SQRT3`** - `sqrt(3)`
* **`M_SQRT1_2`** - `1/sqrt(2)`
php hash hash
====
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL hash >= 1.1)
hash — Generate a hash value (message digest)
### Description
```
hash(
string $algo,
string $data,
bool $binary = false,
array $options = []
): string
```
### Parameters
`algo`
Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..). For a list of supported algorithms see [hash\_algos()](function.hash-algos).
`data`
Message to be hashed.
`binary`
When set to **`true`**, outputs raw binary data. **`false`** outputs lowercase hexits.
`options`
An array of options for the various hashing algorithms. Currently, only the "seed" parameter is supported by the MurmurHash variants.
### Return Values
Returns a string containing the calculated message digest as lowercase hexits unless `binary` is set to true in which case the raw binary representation of the message digest is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `options` parameter has been added. |
| 8.0.0 | **hash()** now throws a [ValueError](class.valueerror) exception if `algo` is unknown; previously, **`false`** was returned instead. |
### Examples
**Example #1 A **hash()** example**
```
<?php
echo hash('ripemd160', 'The quick brown fox jumped over the lazy dog.');
?>
```
The above example will output:
```
ec457d0a974c48d5685a7efa03d137dc8bbde7e3
```
### See Also
* [hash\_file()](function.hash-file) - Generate a hash value using the contents of a given file
* [hash\_hmac()](function.hash-hmac) - Generate a keyed hash value using the HMAC method
* [hash\_init()](function.hash-init) - Initialize an incremental hashing context
* [md5()](function.md5) - Calculate the md5 hash of a string
* [sha1()](function.sha1) - Calculate the sha1 hash of a string
php Imagick::getImageProfiles Imagick::getImageProfiles
=========================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageProfiles — Returns the image profiles
### Description
```
public Imagick::getImageProfiles(string $pattern = "*", bool $include_values = true): array
```
Returns all associated profiles that match the pattern. If **`false`** is passed as second parameter only the profile names are returned. This method is available if Imagick has been compiled against ImageMagick version 6.3.6 or newer.
### Parameters
`pattern`
The pattern for profile names.
`include_values`
Whether to return only profile names. If **`false`** then only profile names will be returned.
### Return Values
Returns an array containing the image profiles or profile names.
php eio_grp_add eio\_grp\_add
=============
(PECL eio >= 0.0.1dev)
eio\_grp\_add — Adds a request to the request group
### Description
```
eio_grp_add(resource $grp, resource $req): void
```
**eio\_grp\_add()** adds a request to the request group.
### Parameters
`grp`
The request group resource returned by [eio\_grp()](function.eio-grp)
`req`
The request resource
### Return Values
No value is returned.
### Examples
**Example #1 Grouping requests**
```
<?php
/*
* Create a group request to open, read and close a file
*/
// Create temporary file and write some bytes to it
$temp_filename = dirname(__FILE__) ."/eio-file.tmp";
$fp = fopen($temp_filename, "w");
fwrite($fp, "some data");
fclose($fp);
/* Is called when the group requests are done */
function my_grp_done($data, $result) {
var_dump($result == 0);
@unlink($data);
}
/* Is called when eio_open() done */
function my_grp_file_opened_callback($data, $result) {
global $grp;
// $result should contain the file descriptor
var_dump($result > 0);
// Create eio_read() request and add it to the group
// Pass file descriptor to the callback
$req = eio_read($result, 4, 0,
EIO_PRI_DEFAULT, "my_grp_file_read_callback", $result);
eio_grp_add($grp, $req);
}
/* Is called when eio_read() done */
function my_grp_file_read_callback($data, $result) {
global $grp;
// Read bytes
var_dump($result);
// Create eio_close() request and add it to the group
// $data should contain the file descriptor
$req = eio_close($data);
eio_grp_add($grp, $req);
}
// Create request group
$grp = eio_grp("my_grp_done", $temp_filename);
var_dump($grp);
// Create eio_open() request and add it to the group
$req = eio_open($temp_filename, EIO_O_RDWR | EIO_O_APPEND , NULL,
EIO_PRI_DEFAULT, "my_grp_file_opened_callback", NULL);
eio_grp_add($grp, $req);
// Process requests
eio_event_loop();
?>
```
The above example will output something similar to:
```
resource(6) of type (EIO Group Descriptor)
bool(true)
string(4) "some"
bool(true)
```
### See Also
* [eio\_grp()](function.eio-grp) - Creates a request group
* [eio\_grp\_cancel()](function.eio-grp-cancel) - Cancels a request group
* [eio\_grp\_limit()](function.eio-grp-limit) - Set group limit
php Imagick::vignetteImage Imagick::vignetteImage
======================
(PECL imagick 2, PECL imagick 3)
Imagick::vignetteImage — Adds vignette filter to the image
### Description
```
public Imagick::vignetteImage(
float $blackPoint,
float $whitePoint,
int $x,
int $y
): bool
```
Softens the edges of the image in vignette style. This method is available if Imagick has been compiled against ImageMagick version 6.2.9 or newer.
### Parameters
`blackPoint`
The black point.
`whitePoint`
The white point
`x`
X offset of the ellipse
`y`
Y offset of the ellipse
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::vignetteImage()****
```
<?php
function vignetteImage($imagePath, $blackPoint, $whitePoint, $x, $y) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->vignetteImage($blackPoint, $whitePoint, $x, $y);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
### See Also
* [Imagick::waveImage()](imagick.waveimage) - Applies wave filter to the image
* [Imagick::swirlImage()](imagick.swirlimage) - Swirls the pixels about the center of the image
php The Sequence interface
The Sequence interface
======================
Introduction
------------
(No version information available, might only be in Git)
A Sequence describes the behaviour of values arranged in a single, linear dimension. Some languages refer to this as a "List". It’s similar to an array that uses incremental integer keys, with the exception of a few characteristics:
* Values will always be indexed as [0, 1, 2, …, size - 1].
* Only allowed to access values by index in the range [0, size - 1].
Use cases:
* Wherever you would use an array as a list (not concerned with keys).
* A more efficient alternative to [SplDoublyLinkedList](class.spldoublylinkedlist) and [SplFixedArray](class.splfixedarray).
Interface synopsis
------------------
class **Ds\Sequence** implements **Ds\Collection**, [ArrayAccess](class.arrayaccess) { /\* Methods \*/
```
abstract public allocate(int $capacity): void
```
```
abstract public apply(callable $callback): void
```
```
abstract public capacity(): int
```
```
abstract public contains(mixed ...$values): bool
```
```
abstract public filter(callable $callback = ?): Ds\Sequence
```
```
abstract public find(mixed $value): mixed
```
```
abstract public first(): mixed
```
```
abstract public get(int $index): mixed
```
```
abstract public insert(int $index, mixed ...$values): void
```
```
abstract public join(string $glue = ?): string
```
```
abstract public last(): mixed
```
```
abstract public map(callable $callback): Ds\Sequence
```
```
abstract public merge(mixed $values): Ds\Sequence
```
```
abstract public pop(): mixed
```
```
abstract public push(mixed ...$values): void
```
```
abstract public reduce(callable $callback, mixed $initial = ?): mixed
```
```
abstract public remove(int $index): mixed
```
```
abstract public reverse(): void
```
```
abstract public reversed(): Ds\Sequence
```
```
abstract public rotate(int $rotations): void
```
```
abstract public set(int $index, mixed $value): void
```
```
abstract public shift(): mixed
```
```
abstract public slice(int $index, int $length = ?): Ds\Sequence
```
```
abstract public sort(callable $comparator = ?): void
```
```
abstract public sorted(callable $comparator = ?): Ds\Sequence
```
```
abstract public sum(): int|float
```
```
abstract public unshift(mixed $values = ?): void
```
} Changelog
---------
| Version | Description |
| --- | --- |
| PECL ds 1.3.0 | The interface now extends [ArrayAccess](class.arrayaccess). |
Table of Contents
-----------------
* [Ds\Sequence::allocate](ds-sequence.allocate) — Allocates enough memory for a required capacity
* [Ds\Sequence::apply](ds-sequence.apply) — Updates all values by applying a callback function to each value
* [Ds\Sequence::capacity](ds-sequence.capacity) — Returns the current capacity
* [Ds\Sequence::contains](ds-sequence.contains) — Determines if the sequence contains given values
* [Ds\Sequence::filter](ds-sequence.filter) — Creates a new sequence using a callable to determine which values to include
* [Ds\Sequence::find](ds-sequence.find) — Attempts to find a value's index
* [Ds\Sequence::first](ds-sequence.first) — Returns the first value in the sequence
* [Ds\Sequence::get](ds-sequence.get) — Returns the value at a given index
* [Ds\Sequence::insert](ds-sequence.insert) — Inserts values at a given index
* [Ds\Sequence::join](ds-sequence.join) — Joins all values together as a string
* [Ds\Sequence::last](ds-sequence.last) — Returns the last value
* [Ds\Sequence::map](ds-sequence.map) — Returns the result of applying a callback to each value
* [Ds\Sequence::merge](ds-sequence.merge) — Returns the result of adding all given values to the sequence
* [Ds\Sequence::pop](ds-sequence.pop) — Removes and returns the last value
* [Ds\Sequence::push](ds-sequence.push) — Adds values to the end of the sequence
* [Ds\Sequence::reduce](ds-sequence.reduce) — Reduces the sequence to a single value using a callback function
* [Ds\Sequence::remove](ds-sequence.remove) — Removes and returns a value by index
* [Ds\Sequence::reverse](ds-sequence.reverse) — Reverses the sequence in-place
* [Ds\Sequence::reversed](ds-sequence.reversed) — Returns a reversed copy
* [Ds\Sequence::rotate](ds-sequence.rotate) — Rotates the sequence by a given number of rotations
* [Ds\Sequence::set](ds-sequence.set) — Updates a value at a given index
* [Ds\Sequence::shift](ds-sequence.shift) — Removes and returns the first value
* [Ds\Sequence::slice](ds-sequence.slice) — Returns a sub-sequence of a given range
* [Ds\Sequence::sort](ds-sequence.sort) — Sorts the sequence in-place
* [Ds\Sequence::sorted](ds-sequence.sorted) — Returns a sorted copy
* [Ds\Sequence::sum](ds-sequence.sum) — Returns the sum of all values in the sequence
* [Ds\Sequence::unshift](ds-sequence.unshift) — Adds values to the front of the sequence
php Gmagick::setimageindex Gmagick::setimageindex
======================
(PECL gmagick >= Unknown)
Gmagick::setimageindex — Set the iterator to the position in the image list specified with the index parameter
### Description
```
public Gmagick::setimageindex(int $index): Gmagick
```
Set the iterator to the position in the image list specified with the index parameter.
### Parameters
`index`
The scene number.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php Gmagick::haspreviousimage Gmagick::haspreviousimage
=========================
(PECL gmagick >= Unknown)
Gmagick::haspreviousimage — Checks if the object has a previous image
### Description
```
public Gmagick::haspreviousimage(): mixed
```
Returns **`true`** if the object has more images when traversing the list in the reverse direction.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the object has more images when traversing the list in the reverse direction, returns **`false`** if there are none.
### Errors/Exceptions
Throws an **GmagickException** on error.
php The Directory class
The Directory class
===================
Introduction
------------
(PHP 4, PHP 5, PHP 7, PHP 8)
Instances of **Directory** are created by calling the [dir()](function.dir) function, not by the [new](language.oop5.basic#language.oop5.basic.new) operator.
Class synopsis
--------------
class **Directory** { /\* Properties \*/ public readonly string [$path](class.directory#directory.props.path);
public readonly resource [$handle](class.directory#directory.props.handle); /\* Methods \*/
```
public close(): void
```
```
public read(): string|false
```
```
public rewind(): void
```
} Properties
----------
path The directory that was opened.
handle Can be used with other directory functions such as [readdir()](function.readdir), [rewinddir()](function.rewinddir) and [closedir()](function.closedir).
Changelog
---------
| Version | Description |
| --- | --- |
| 8.1.0 | The path and handle properties are now readonly. |
Table of Contents
-----------------
* [Directory::close](directory.close) — Close directory handle
* [Directory::read](directory.read) — Read entry from directory handle
* [Directory::rewind](directory.rewind) — Rewind directory handle
php SQLite3::prepare SQLite3::prepare
================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3::prepare — Prepares an SQL statement for execution
### Description
```
public SQLite3::prepare(string $query): SQLite3Stmt|false
```
Prepares an SQL statement for execution and returns an [SQLite3Stmt](class.sqlite3stmt) object.
### Parameters
`query`
The SQL query to prepare.
### Return Values
Returns an [SQLite3Stmt](class.sqlite3stmt) object on success or **`false`** on failure.
### Examples
**Example #1 **SQLite3::prepare()** example**
```
<?php
unlink('mysqlitedb.db');
$db = new SQLite3('mysqlitedb.db');
$db->exec('CREATE TABLE foo (id INTEGER, bar STRING)');
$db->exec("INSERT INTO foo (id, bar) VALUES (1, 'This is a test')");
$stmt = $db->prepare('SELECT bar FROM foo WHERE id=:id');
$stmt->bindValue(':id', 1, SQLITE3_INTEGER);
$result = $stmt->execute();
var_dump($result->fetchArray());
?>
```
### See Also
* [SQLite3Stmt::paramCount()](sqlite3stmt.paramcount) - Returns the number of parameters within the prepared statement
* [SQLite3Stmt::bindValue()](sqlite3stmt.bindvalue) - Binds the value of a parameter to a statement variable
* [SQLite3Stmt::bindParam()](sqlite3stmt.bindparam) - Binds a parameter to a statement variable
php gmp_perfect_square gmp\_perfect\_square
====================
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_perfect\_square — Perfect square check
### Description
```
gmp_perfect_square(GMP|int|string $num): bool
```
Check if a number is a perfect square.
### Parameters
`num`
The number being checked as a perfect square.
A [GMP](class.gmp) object, an int or a numeric string.
### Return Values
Returns **`true`** if `num` is a perfect square, **`false`** otherwise.
### Examples
**Example #1 **gmp\_perfect\_square()** example**
```
<?php
// 3 * 3, perfect square
var_dump(gmp_perfect_square("9"));
// not a perfect square
var_dump(gmp_perfect_square("7"));
// 1234567890 * 1234567890, perfect square
var_dump(gmp_perfect_square("1524157875019052100"));
?>
```
The above example will output:
```
bool(true)
bool(false)
bool(true)
```
### See Also
* [gmp\_perfect\_power()](function.gmp-perfect-power) - Perfect power check
* [gmp\_sqrt()](function.gmp-sqrt) - Calculate square root
* [gmp\_sqrtrem()](function.gmp-sqrtrem) - Square root with remainder
| programming_docs |
php Phar::compress Phar::compress
==============
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
Phar::compress — Compresses the entire Phar archive using Gzip or Bzip2 compression
### Description
```
public Phar::compress(int $compression, ?string $extension = null): ?Phar
```
>
> **Note**:
>
>
> This method requires the php.ini setting `phar.readonly` to be set to `0` in order to work for [Phar](class.phar) objects. Otherwise, a [PharException](class.pharexception) will be thrown.
>
>
>
For tar-based and phar-based phar archives, this method compresses the entire archive using gzip compression or bzip2 compression. The resulting file can be processed with the gunzip command/bunzip command, or accessed directly and transparently with the Phar extension.
For Zip-based phar archives, this method fails with an exception. The [zlib](https://www.php.net/manual/en/ref.zlib.php) extension must be enabled to compress with gzip compression, the [bzip2](https://www.php.net/manual/en/ref.bzip2.php) extension must be enabled in order to compress with bzip2 compression. As with all functionality that modifies the contents of a phar, the [phar.readonly](https://www.php.net/manual/en/phar.configuration.php#ini.phar.readonly) INI variable must be off in order to succeed.
In addition, this method automatically renames the archive, appending `.gz`, `.bz2` or removing the extension if passed `Phar::NONE` to remove compression. Alternatively, a file extension may be specified with the second parameter.
### Parameters
`compression`
Compression must be one of `Phar::GZ`, `Phar::BZ2` to add compression, or `Phar::NONE` to remove compression.
`extension`
By default, the extension is `.phar.gz` or `.phar.bz2` for compressing phar archives, and `.phar.tar.gz` or `.phar.tar.bz2` for compressing tar archives. For decompressing, the default file extensions are `.phar` and `.phar.tar`.
### Return Values
Returns a [Phar](class.phar) object, or **`null`** on failure.
### Errors/Exceptions
Throws [BadMethodCallException](class.badmethodcallexception) if the [phar.readonly](https://www.php.net/manual/en/phar.configuration.php#ini.phar.readonly) INI variable is on, the [zlib](https://www.php.net/manual/en/ref.zlib.php) extension is not available, or the [bzip2](https://www.php.net/manual/en/ref.bzip2.php) extension is not enabled.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `extension` is now nullable. |
### Examples
**Example #1 A **Phar::compress()** example**
```
<?php
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
$p['myfile.txt'] = 'hi';
$p['myfile2.txt'] = 'hi';
$p1 = $p->compress(Phar::GZ); // copies to /path/to/my.phar.gz
$p2 = $p->compress(Phar::BZ2); // copies to /path/to/my.phar.bz2
$p3 = $p2->compress(Phar::NONE); // exception: /path/to/my.phar already exists
?>
```
### See Also
* [PharFileInfo::getCompressedSize()](pharfileinfo.getcompressedsize) - Returns the actual size of the file (with compression) inside the Phar archive
* [PharFileInfo::isCompressed()](pharfileinfo.iscompressed) - Returns whether the entry is compressed
* [PharFileInfo::compress()](pharfileinfo.compress) - Compresses the current Phar entry with either zlib or bzip2 compression
* [PharFileInfo::decompress()](pharfileinfo.decompress) - Decompresses the current Phar entry within the phar
* [PharData::compress()](phardata.compress) - Compresses the entire tar/zip archive using Gzip or Bzip2 compression
* [Phar::canCompress()](phar.cancompress) - Returns whether phar extension supports compression using either zlib or bzip2
* [Phar::isCompressed()](phar.iscompressed) - Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)
* [Phar::decompress()](phar.decompress) - Decompresses the entire Phar archive
* [Phar::getSupportedCompression()](phar.getsupportedcompression) - Return array of supported compression algorithms
* [Phar::compressFiles()](phar.compressfiles) - Compresses all files in the current Phar archive
* [Phar::decompressFiles()](phar.decompressfiles) - Decompresses all files in the current Phar archive
php None OOP Changelog
-------------
Changes to the PHP OOP model are logged here. Descriptions and other notes regarding these features are documented within the OOP model documentation.
| Version | Description |
| --- | --- |
| 8.1.0 | Added: Support for the final modifier for class constants. Also, interface constants become overridable by default. |
| 8.0.0 | Added: Support for the [nullsafe operator](language.oop5.basic#language.oop5.basic.nullsafe) *?->* to access properties and methods on objects that may be null. |
| 7.4.0 | Changed: It is now possible to throw exception within **\_\_toString()**. |
| 7.4.0 | Added: Support for limited return type covariance and argument type contravariance. Full variance support is only available if autoloading is used. Inside a single file only non-cyclic type references are possible. |
| 7.4.0 | Added: It is now possible to type class properties. |
| 7.3.0 | Incompatibility: Argument unpacking of [Traversable](class.traversable)s with non-int keys is no longer supported. This behaviour was not intended and thus has been removed. |
| 7.3.0 | Incompatibility: In previous versions it was possible to separate the static properties by assigning a reference. This has been removed. |
| 7.3.0 | Changed: The [instanceof](language.operators.type) operator now allows literals as the first operand, in which case the result is always **`false`**. |
| 7.2.0 | Deprecated: The [\_\_autoload()](function.autoload) method has been deprecated in favour of [spl\_autoload\_register()](function.spl-autoload-register). |
| 7.2.0 | Changed: The following name cannot be used to name classes, interfaces, or traits: `object`. |
| 7.2.0 | Changed: A trailing comma can now be added to the group-use syntax for namespaces. |
| 7.2.0 | Changed: Parameter type widening. Parameter types from overridden methods and from interface implementations may now be omitted. |
| 7.2.0 | Changed: Abstract methods can now be overridden when an abstract class extends another abstract class. |
| 7.1.0 | Changed: The following names cannot be used to name classes, interfaces, or traits: `void` and `iterable`. |
| 7.1.0 | Added: It is now possible to specify the [visibility of class constants](language.oop5.visibility#language.oop5.visiblity-constants). |
| 7.0.0 | Deprecated: [Static](language.oop5.static) calls to methods that are not declared static. |
| 7.0.0 | Deprecated: PHP 4 style [constructor](language.oop5.decon). I.e. methods that have the same name as the class they are defined in. |
| 7.0.0 | Added: Group *use* declaration: classes, functions and constants being imported from the same namespace can now be grouped together in a single use statement. |
| 7.0.0 | Added: Support for [anonymous classes](language.oop5.anonymous) has been added via `new class`. |
| 7.0.0 | Incompatibility: Iterating over a non-[Traversable](class.traversable) object will now have the same behaviour as iterating over by-reference arrays. |
| 7.0.0 | Changed: Defining (compatible) properties in two used [traits](language.oop5.traits) no longer triggers an error. |
| 5.6.0 | Added: The [\_\_debugInfo()](language.oop5.magic#object.debuginfo) method. |
| 5.5.0 | Added: The [::class](language.oop5.basic#language.oop5.basic.class.class) magic constant. |
| 5.5.0 | Added: [finally](language.exceptions) to handle exceptions. |
| 5.4.0 | Added: [traits](language.oop5.traits). |
| 5.4.0 | Changed: If an [abstract](language.oop5.abstract) class defines a signature for the [constructor](language.oop5.decon) it will now be enforced. |
| 5.3.3 | Changed: Methods with the same name as the last element of a [namespaced](https://www.php.net/manual/en/language.namespaces.php) class name will no longer be treated as [constructor](language.oop5.decon). This change doesn't affect non-namespaced classes. |
| 5.3.0 | Changed: Classes that implement interfaces with methods that have default values in the prototype are no longer required to match the interface's default value. |
| 5.3.0 | Changed: It's now possible to reference the class using a variable (e.g., `echo $classname::constant;`). The variable's value can not be a keyword (e.g., `self`, `parent` or `static`). |
| 5.3.0 | Changed: An **`E_WARNING`** level error is issued if the magic [overloading](language.oop5.overloading) methods are declared [static](language.oop5.static). It also enforces the public visibility requirement. |
| 5.3.0 | Changed: Prior to 5.3.0, exceptions thrown in the [\_\_autoload()](function.autoload) function could not be caught in the [catch](language.exceptions) block, and would result in a fatal error. Exceptions now thrown in the \_\_autoload function can be caught in the [catch](language.exceptions) block, with one provison. If throwing a custom exception, then the custom exception class must be available. The \_\_autoload function may be used recursively to autoload the custom exception class. |
| 5.3.0 | Added: The [\_\_callStatic](language.oop5.overloading) method. |
| 5.3.0 | Added: [heredoc](language.types.string#language.types.string.syntax.heredoc) and [nowdoc](language.types.string#language.types.string.syntax.nowdoc) support for class *const* and property definitions. Note: heredoc values must follow the same rules as double-quoted strings, (e.g. no variables within). |
| 5.3.0 | Added: [Late Static Bindings](language.oop5.late-static-bindings). |
| 5.3.0 | Added: The [\_\_invoke()](language.oop5.magic#object.invoke) method. |
| 5.2.0 | Changed: The [\_\_toString()](language.oop5.magic#object.tostring) method was only called when it was directly combined with [echo](function.echo) or [print](function.print). But now, it is called in any string context (e.g. in [printf()](function.printf) with `%s` modifier) but not in other types contexts (e.g. with `%d` modifier). As of PHP 5.2.0, converting objects without a [\_\_toString](language.oop5.magic#object.tostring) method to string emits a **`E_RECOVERABLE_ERROR`** level error. |
| 5.1.3 | Changed: In previous versions of PHP 5, the use of `var` was considered deprecated and would issue an **`E_STRICT`** level error. It's no longer deprecated, therefore does not emit the error. |
| 5.1.0 | Changed: The [\_\_set\_state()](language.oop5.magic#object.set-state) static method is now called for classes exported by [var\_export()](function.var-export). |
| 5.1.0 | Added: The [\_\_isset()](language.oop5.overloading#object.isset) and [\_\_unset()](language.oop5.overloading#object.unset) methods. |
php SoapClient::__construct SoapClient::\_\_construct
=========================
(PHP 5, PHP 7, PHP 8)
SoapClient::\_\_construct — SoapClient constructor
### Description
public **SoapClient::\_\_construct**(?string `$wsdl`, array `$options` = []) Creates a [SoapClient](class.soapclient) object to connect to a SOAP service.
### Parameters
`wsdl`
URI of a WSDL file describing the service, which is used to automatically configure the client. If not provided, the client will operate in non-WSDL mode.
>
> **Note**:
>
>
> By default, the WSDL file will be cached for performance. To disable or configure this caching, see [SOAP Configure Options](https://www.php.net/manual/en/soap.configuration.php#soap.configuration.list) and the [`cache_wsdl` option](soapclient.construct#soapclient.construct.options.cache-wsdl).
>
>
`options`
An associative array specifying additional options for the SOAP client. If `wsdl` is provided, this is optional; otherwise, at least `location` and `url` must be provided.
`location` string The URL of the SOAP server to send the request to.
Required if the `wsdl` parameter is not provided. If both a `wsdl` parameter and `location` option are provided, the `location` option will over-ride any location specified in the WSDL file.
`uri` string The target namespace of the SOAP service.
Required if the `wsdl` parameter is not provided; ignored otherwise.
`style` int Specifies the binding style to use for this client, using the constants **`SOAP_RPC`** and **`SOAP_DOCUMENT`**. **`SOAP_RPC`** indicates RPC-style binding, where the SOAP request body contains a standard encoding of a function call. **`SOAP_DOCUMENT`** indicates document-style binding, where the SOAP request body contains an XML document with service-defined meaning.
If the `wsdl` parameter is provided, this option is ignored, and the style is read from the WSDL file.
If neither this option nor the `wsdl` parameter is provided, RPC-style is used.
`use` int Specifies the encoding style to use for this client, using the constants **`SOAP_ENCODED`** or **`SOAP_LITERAL`**. **`SOAP_ENCODED`** indicates encoding using the types defined in the SOAP specification. **`SOAP_LITERAL`** indicates encoding using a schema defined by the service.
If the `wsdl` parameter is provided, this option is ignored, and the encoding is read from the WSDL file.
If neither this option nor the `wsdl` parameter is provided, the "encoded" style is used.
`soap_version` int Specifies the version of the SOAP protocol to use: **`SOAP_1_1`** for SOAP 1.1, or **`SOAP_1_2`** for SOAP 1.2.
If omitted, SOAP 1.1 is used.
`authentication` int Specifies the authentication method when using HTTP authentication in requests. The value may be either **`SOAP_AUTHENTICATION_BASIC`** or **`SOAP_AUTHENTICATION_DIGEST`**.
If omitted, and the `login` option is provided, Basic Authentication is used.
`login` string Username to use with HTTP Basic or Digest Authentication.
`password` string Password to use with HTTP Basic or Digest Authentication.
Not to be confused with `passphrase`, which is used with HTTPS Client Certificate authentication.
`local_cert` string Path to a client certificate for use with HTTPS authentication. It must be a PEM encoded file which contains your certificate and private key.
The file can also include a chain of issuers, which must come after the client certificate.
Can also be set via [`stream_context`](soapclient.construct#soapclient.construct.options.stream-context), which also supports specifying a separate private key file.
`passphrase` string Passphrase for the client certificate specified in the `local_cert` option.
Not to be confused with `password`, which is used for Basic or Digest Authentication.
Can also be set via [`stream_context`](soapclient.construct#soapclient.construct.options.stream-context).
`proxy_host` string Hostname to use as a proxy server for HTTP requests.
The `proxy_port` option must also be specified.
`proxy_port` int TCP port to use when connecting to the proxy server specified in `proxy_host`.
`proxy_login` string Optional username to authenticate with the proxy server specified in `proxy_host`, using HTTP Basic Authentication.
`proxy_password` string Optional password to authenticate with the proxy server specified in `proxy_host`, using HTTP Basic Authentication.
`compression` int Enables compression of HTTP SOAP requests and responses.
The value should be the bitwise OR of three parts: an optional **`SOAP_COMPRESSION_ACCEPT`**, to send an "Accept-Encoding" header; either **`SOAP_COMPRESSION_GZIP`** or **`SOAP_COMPRESSION_DEFLATE`** to indicate the compression algorithm to use; and a number between 1 and 9 to indicate the level of compression to use in the request. For example, to enable two-way gzip compression with the maximum compression level, use `SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9`.
`encoding` string Defines the internal character encoding. Requests are always sent in UTF-8, and converted to and from this encoding.
`trace` bool Captures request and response information, which can then be accessed with the methods [SoapClient::\_\_getLastRequest()](soapclient.getlastrequest), [SoapClient::\_\_getLastRequestHeaders()](soapclient.getlastrequestheaders), [SoapClient::\_\_getLastResponse()](soapclient.getlastresponse), and [SoapClient::\_\_getLastResponseHeaders()](soapclient.getlastresponseheaders).
If omitted, defaults to **`false`**
`classmap` array Used to map types defined in the WSDL to PHP classes. It should be specified as an associative array with type names from the WSDL as keys and names of PHP classes as values. Note that the type names of an element is not necessarily the same as the element (tag) name.
The provided class names should always be fully qualified with any [namespaces](https://www.php.net/manual/en/language.namespaces.php), and never start with a leading `\`. The correct form can be generated by using [::class](language.oop5.basic#language.oop5.basic.class.class).
Note that when creating a class, the constructor will not be called, but magic [\_\_set()](language.oop5.overloading#object.set) and [\_\_get()](language.oop5.overloading#object.get) methods for individual properties will be.
`typemap` array Used to define type mappings using user-defined callback functions. Each type mapping should be an array with keys `type_name` (string specifying the XML element type); `type_ns` (string containing namespace URI); `from_xml` ([callable](language.types.callable) accepting one string parameter and returning an object) and `to_xml` ([callable](language.types.callable) accepting one object parameter and returning a string).
`exceptions` bool Defines whether errors throw exceptions of type [SoapFault](class.soapfault).
Defaults to **`true`**
`connection_timeout` int Defines a timeout in seconds for the connection to the SOAP service. This option does not define a timeout for services with slow responses. To limit the time to wait for calls to finish the [default\_socket\_timeout](https://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout) configuration option is available.
`cache_wsdl` int If the `wsdl` parameter is provided, and the [soap.wsdl\_cache\_enabled](https://www.php.net/manual/en/soap.configuration.php#ini.soap.wsdl-cache-enabled) configuration option is on, this option determines the type of caching. One of **`WSDL_CACHE_NONE`**, **`WSDL_CACHE_DISK`**, **`WSDL_CACHE_MEMORY`** or **`WSDL_CACHE_BOTH`**.
Two types of cache are available: in-memory caching, which caches the WSDL in the memory of the current process; and disk caching, which caches the WSDL in a file on disk, shared between all processes. The directory to use for the disk cache is determined by the [soap.wsdl\_cache\_dir](https://www.php.net/manual/en/soap.configuration.php#ini.soap.wsdl-cache-dir) configuration option. Both caches use the same lifetime, determined by the [soap.wsdl\_cache\_ttl](https://www.php.net/manual/en/soap.configuration.php#ini.soap.wsdl-cache-ttl) configuration option. The in-memory cache also has a maximum number of entries determined by the [soap.wsdl\_cache\_limit](https://www.php.net/manual/en/soap.configuration.php#ini.soap.wsdl-cache-limit) configuration option.
If not specified, the [soap.wsdl\_cache](https://www.php.net/manual/en/soap.configuration.php#ini.soap.wsdl-cache) configuration option will be used.
`user_agent` string The value to use in the `User-Agent` HTTP header when making requests.
Can also be set via [`stream_context`](soapclient.construct#soapclient.construct.options.stream-context).
If not specified, the user agent will be `"PHP-SOAP/"` followed by the value of **`PHP_VERSION`**.
`stream_context` resource A [stream context](https://www.php.net/manual/en/context.php) created by [stream\_context\_create()](function.stream-context-create), which allows additional options to be set.
The context may include [socket context options](https://www.php.net/manual/en/context.socket.php), [SSL context options](https://www.php.net/manual/en/context.ssl.php), plus selected [HTTP context options](https://www.php.net/manual/en/context.http.php): `content_type`, `header`, `max_redirects`, `protocol_version`, and `user_agent`.
Note that the following HTTP headers are generated automatically or from other options, and will be ignored if specified in the `'header'` context option: `host`, `connection`, `user-agent`, `content-length`, `content-type`, `cookie`, `authorization`, and `proxy-authorization`
`features` int A bitmask to enable one or more of the following features:
**`SOAP_SINGLE_ELEMENT_ARRAYS`** When decoding a response to an array, the default behaviour is to detect whether an element name appears once or multiple times in a particular parent element. For elements which appear only once, an object property allows direct access to the content; for elements which appear more than once, the property contains an array with the content of each matching element.
If the **`SOAP_SINGLE_ELEMENT_ARRAYS`** feature is enabled, elements which appear only once are placed in a single-element array, so that access is consistent for all elements. This only has an effect when using a WSDL containing a schema for the response. See Examples section for an illustration.
**`SOAP_USE_XSI_ARRAY_TYPE`** When the [`use` option](soapclient.construct#soapclient.construct.options.use) or WSDL property is set to `encoded`, force arrays to use a type of `SOAP-ENC:Array`, rather than a schema-specific type.
**`SOAP_WAIT_ONE_WAY_CALLS`** Wait for a response even if the WSDL indicates a one-way request.
`keep_alive` bool a boolean value defining whether to send the `Connection: Keep-Alive` header or `Connection: close`.
Defaults to **`true`**
`ssl_method` string Specifies the SSL or TLS protocol version to use with secure HTTP connections, instead of the default negotiation. Specifying **`SOAP_SSL_METHOD_SSLv2`** or **`SOAP_SSL_METHOD_SSLv3`** will force use of SSL 2 or SSL 3, respectively. Specifying **`SOAP_SSL_METHOD_SSLv23`** has no effect; the constant exists only for backwards compatibility. As of PHP 7.2, specifying **`SOAP_SSL_METHOD_TLS`** also has no effect; in earlier versions, it forced use of TLS 1.0.
Note that SSL versions 2 and 3 are considered insecure, and may not be supported by the installed OpenSSL library.
This option is *DEPRECATED* as of PHP 8.1.0. A more flexible alternative, which allows specifying individual versions of TLS, is to use the [`stream_context`](soapclient.construct#soapclient.construct.options.stream-context) option with the 'crypto\_method' context parameter.
**Example #1 Specifying use of TLS 1.3 only**
```
<?php
$context = stream_context_create([
'ssl' => [
'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT
]
];
$client = new SoapClient("some.wsdl", ['context' => $context]);
```
### Errors/Exceptions
**SoapClient::\_\_construct()** will generate an **`E_ERROR`** error if the `location` and `uri` options aren't provided in non-WSDL mode.
A [SoapFault](class.soapfault) exception will be thrown if the `wsdl` URI cannot be loaded.
### Examples
**Example #2 **SoapClient::\_\_construct()** example**
```
<?php
$client = new SoapClient("some.wsdl");
$client = new SoapClient("some.wsdl", array('soap_version' => SOAP_1_2));
$client = new SoapClient("some.wsdl", array('login' => "some_name",
'password' => "some_password"));
$client = new SoapClient("some.wsdl", array('proxy_host' => "localhost",
'proxy_port' => 8080));
$client = new SoapClient("some.wsdl", array('proxy_host' => "localhost",
'proxy_port' => 8080,
'proxy_login' => "some_name",
'proxy_password' => "some_password"));
$client = new SoapClient("some.wsdl", array('local_cert' => "cert_key.pem"));
$client = new SoapClient(null, array('location' => "http://localhost/soap.php",
'uri' => "http://test-uri/"));
$client = new SoapClient(null, array('location' => "http://localhost/soap.php",
'uri' => "http://test-uri/",
'style' => SOAP_DOCUMENT,
'use' => SOAP_LITERAL));
$client = new SoapClient("some.wsdl",
array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9));
$client = new SoapClient("some.wsdl", array('encoding'=>'ISO-8859-1'));
class MyBook {
public $title;
public $author;
}
$client = new SoapClient("books.wsdl", array('classmap' => array('book' => "MyBook")));
$typemap = array(
array("type_ns" => "http://schemas.example.com",
"type_name" => "book",
"from_xml" => "unserialize_book",
"to_xml" => "serialize_book")
);
$client = new SoapClient("books.wsdl", array('typemap' => $typemap));
?>
```
**Example #3 Using the **`SOAP_SINGLE_ELEMENT_ARRAYS`** feature**
```
/* Assuming a response like this, and an appropriate WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:example">
<SOAP-ENV:Body>
<response>
<collection>
<item>Single</item>
</collection>
<collection>
<item>First</item>
<item>Second</item>
</collection>
</response>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
*/
echo "Default:\n";
$client = new TestSoapClient(__DIR__ . '/temp.wsdl');
$response = $client->exampleRequest();
var_dump( $response->collection[0]->item );
var_dump( $response->collection[1]->item );
echo "\nWith SOAP_SINGLE_ELEMENT_ARRAYS:\n";
$client = new TestSoapClient(__DIR__ . '/temp.wsdl', ['features' => SOAP_SINGLE_ELEMENT_ARRAYS]);
$response = $client->exampleRequest();
var_dump( $response->collection[0]->item );
var_dump( $response->collection[1]->item );
```
The above example will output:
```
Default:
string(6) "Single"
array(2) {
[0] =>
string(5) "First"
[1] =>
string(6) "Second"
}
With SOAP_SINGLE_ELEMENT_ARRAYS:
array(1) {
[0] =>
string(6) "Single"
}
array(2) {
[0] =>
string(5) "First"
[1] =>
string(6) "Second"
}
```
| programming_docs |
php Ds\Sequence::reversed Ds\Sequence::reversed
=====================
(PECL ds >= 1.0.0)
Ds\Sequence::reversed — Returns a reversed copy
### Description
```
abstract public Ds\Sequence::reversed(): Ds\Sequence
```
Returns a reversed copy of the sequence.
### Parameters
This function has no parameters.
### Return Values
A reversed copy of the sequence.
>
> **Note**:
>
>
> The current instance is not affected.
>
>
### Examples
**Example #1 **Ds\Sequence::reversed()** example**
```
<?php
$sequence = new \Ds\Vector(["a", "b", "c"]);
print_r($sequence->reversed());
print_r($sequence);
?>
```
The above example will output something similar to:
```
Ds\Vector Object
(
[0] => c
[1] => b
[2] => a
)
Ds\Vector Object
(
[0] => a
[1] => b
[2] => c
)
```
php Threaded::notifyOne Threaded::notifyOne
===================
(PECL pthreads >= 3.0.0)
Threaded::notifyOne — Synchronization
### Description
```
public Threaded::notifyOne(): bool
```
Send notification to the referenced object. This unblocks at least one of the blocked threads (as opposed to unblocking all of them, as seen with [Threaded::notify()](threaded.notify)).
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Notifications and Waiting**
```
<?php
class My extends Thread {
public function run() {
/** cause this thread to wait **/
$this->synchronized(function($thread){
if (!$thread->done)
$thread->wait();
}, $this);
}
}
$my = new My();
$my->start();
/** send notification to the waiting thread **/
$my->synchronized(function($thread){
$thread->done = true;
$thread->notifyOne();
}, $my);
var_dump($my->join());
?>
```
The above example will output:
```
bool(true)
```
php Phar::offsetExists Phar::offsetExists
==================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
Phar::offsetExists — Determines whether a file exists in the phar
### Description
```
public Phar::offsetExists(string $localName): bool
```
This is an implementation of the [ArrayAccess](class.arrayaccess) interface allowing direct manipulation of the contents of a Phar archive using array access brackets.
offsetExists() is called whenever [isset()](function.isset) is called.
### Parameters
`localName`
The filename (relative path) to look for in a Phar.
### Return Values
Returns **`true`** if the file exists within the phar, or **`false`** if not.
### Examples
**Example #1 A **Phar::offsetExists()** example**
```
<?php
$p = new Phar(dirname(__FILE__) . '/my.phar', 0, 'my.phar');
$p['firstfile.txt'] = 'first file';
$p['secondfile.txt'] = 'second file';
// the next set of lines call offsetExists() indirectly
var_dump(isset($p['firstfile.txt']));
var_dump(isset($p['nothere.txt']));
?>
```
The above example will output:
```
bool(true)
bool(false)
```
### See Also
* [Phar::offsetGet()](phar.offsetget) - Gets a PharFileInfo object for a specific file
* [Phar::offsetSet()](phar.offsetset) - Set the contents of an internal file to those of an external file
* [Phar::offsetUnset()](phar.offsetunset) - Remove a file from a phar
php SimpleXMLElement::addChild SimpleXMLElement::addChild
==========================
(PHP 5 >= 5.1.3, PHP 7, PHP 8)
SimpleXMLElement::addChild — Adds a child element to the XML node
### Description
```
public SimpleXMLElement::addChild(string $qualifiedName, ?string $value = null, ?string $namespace = null): ?SimpleXMLElement
```
Adds a child element to the node and returns a SimpleXMLElement of the child.
### Parameters
`qualifiedName`
The name of the child element to add.
`value`
If specified, the value of the child element.
`namespace`
If specified, the namespace to which the child element belongs.
### Return Values
The `addChild` method returns a [SimpleXMLElement](class.simplexmlelement) object representing the child added to the XML node on success; **`null`** on failure.
### Examples
>
> **Note**:
>
>
> Listed examples may include `example.php`, which refers to the XML string found in the first example of the [basic usage](https://www.php.net/manual/en/simplexml.examples-basic.php) guide.
>
>
**Example #1 Add attributes and children to a SimpleXML element**
```
<?php
include 'example.php';
$sxe = new SimpleXMLElement($xmlstr);
$sxe->addAttribute('type', 'documentary');
$movie = $sxe->addChild('movie');
$movie->addChild('title', 'PHP2: More Parser Stories');
$movie->addChild('plot', 'This is all about the people who make it work.');
$characters = $movie->addChild('characters');
$character = $characters->addChild('character');
$character->addChild('name', 'Mr. Parser');
$character->addChild('actor', 'John Doe');
$rating = $movie->addChild('rating', '5');
$rating->addAttribute('type', 'stars');
echo $sxe->asXML();
?>
```
The above example will output something similar to:
```
<?xml version="1.0" standalone="yes"?>
<movies type="documentary">
<movie>
<title>PHP: Behind the Parser</title>
<characters>
<character>
<name>Ms. Coder</name>
<actor>Onlivia Actora</actor>
</character>
<character>
<name>Mr. Coder</name>
<actor>El ActÓr</actor>
</character>
</characters>
<plot>
So, this language. It's like, a programming language. Or is it a
scripting language? All is revealed in this thrilling horror spoof
of a documentary.
</plot>
<great-lines>
<line>PHP solves all my web problems</line>
</great-lines>
<rating type="thumbs">7</rating>
<rating type="stars">5</rating>
</movie>
<movie>
<title>PHP2: More Parser Stories</title>
<plot>This is all about the people who make it work.</plot>
<characters>
<character>
<name>Mr. Parser</name>
<actor>John Doe</actor>
</character>
</characters>
<rating type="stars">5</rating>
</movie>
</movies>
```
### See Also
* [SimpleXMLElement::addAttribute()](simplexmlelement.addattribute) - Adds an attribute to the SimpleXML element
* [Basic SimpleXML usage](https://www.php.net/manual/en/simplexml.examples-basic.php)
php Ds\Sequence::apply Ds\Sequence::apply
==================
(PECL ds >= 1.0.0)
Ds\Sequence::apply — Updates all values by applying a callback function to each value
### Description
```
abstract public Ds\Sequence::apply(callable $callback): void
```
Updates all values by applying a `callback` function to each value in the sequence.
### Parameters
`callback`
```
callback(mixed $value): mixed
```
A [callable](language.types.callable) to apply to each value in the sequence.
The callback should return what the value should be replaced by.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Sequence::apply()** example**
```
<?php
$sequence = new \Ds\Sequence([1, 2, 3]);
$sequence->apply(function($value) { return $value * 2; });
print_r($sequence);
?>
```
The above example will output something similar to:
```
Ds\Vector Object
(
[0] => 2
[1] => 4
[2] => 6
)
```
php sodium_crypto_stream_xchacha20_keygen sodium\_crypto\_stream\_xchacha20\_keygen
=========================================
(PHP 8 >= 8.1.0)
sodium\_crypto\_stream\_xchacha20\_keygen — Returns a secure random key
### Description
```
sodium_crypto_stream_xchacha20_keygen(): string
```
Returns a secure random key for use with [sodium\_crypto\_stream\_xchacha20()](function.sodium-crypto-stream-xchacha20).
### Parameters
This function has no parameters.
### Return Values
Returns a 32-byte secure random key for use with [sodium\_crypto\_stream\_xchacha20()](function.sodium-crypto-stream-xchacha20).
php UConverter::transcode UConverter::transcode
=====================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
UConverter::transcode — Convert a string from one character encoding to another
### Description
```
public static UConverter::transcode(
string $str,
string $toEncoding,
string $fromEncoding,
?array $options = null
): string|false
```
Converts `str` from `fromEncoding` to `toEncoding`.
### Parameters
`str`
The string to be converted.
`toEncoding`
The desired encoding of the result.
`fromEncoding`
The current encoding used to interpret `str`.
`options`
An optional array, which may contain the following keys:
* `'to_subst'` - the substitution character to use in place of any character of `str` which cannot be encoded in `toEncoding`. If specified, it must represent a single character in the target encoding.
### Return Values
Returns the converted string or **`false`** on failure.
### Examples
**Example #1 Converting from UTF-8 to UTF-16 and back**
```
<?php
$utf8_string = "\x5A\x6F\xC3\xAB"; // 'Zoë' in UTF-8
$utf16_string = UConverter::transcode($utf8_string, 'UTF-16BE', 'UTF-8');
echo bin2hex($utf16_string), "\n";
$new_utf8_string = UConverter::transcode($utf16_string, 'UTF-8', 'UTF-16BE');
echo bin2hex($new_utf8_string), "\n";
?>
```
The above example will output:
```
005a006f00eb
5a6fc3ab
```
**Example #2 Invalid characters in input**
If the input string contains a sequence of bytes which is not valid in the encoding specified by `fromEncoding`, they are replaced by Unicode code point U+FFFD (Replacement Character) before converting to `toEncoding`.
```
<?php
$invalid_utf8_string = "\xC3"; // incomplete multi-byte UTF-8 sequence
$utf16_string = UConverter::transcode($invalid_utf8_string, 'UTF-16BE', 'UTF-8');
echo bin2hex($utf16_string), "\n";
?>
```
The above example will output:
```
fffd
```
**Example #3 Characters which cannot be encoded**
If the input string contains characters which cannot be represented in `toEncoding`, they are replaced with a single character. The default character to use depends on the encoding, and can be controlled using the `'to_subst'` option.
```
<?php
$utf8_string = "\xE2\x82\xAC"; // € (Euro Sign) does not exist in ISO 8859-1
// Default replacement in ISO 8859-1 is "\x1A" (Substitute)
$iso8859_1_string = UConverter::transcode($utf8_string, 'ISO-8859-1', 'UTF-8');
echo bin2hex($iso8859_1_string), "\n";
// Specify a replacement of '?' ("\x3F") instead
$iso8859_1_string = UConverter::transcode(
$utf8_string, 'ISO-8859-1', 'UTF-8', ['to_subst' => '?']
);
echo bin2hex($iso8859_1_string), "\n";
// Since ISO 8859-1 cannot map U+FFFD, invalid input is also replaced by to_subst
$invalid_utf8_string = "\xC3"; // incomplete multi-byte UTF-8 sequence
$iso8859_1_string = UConverter::transcode(
$invalid_utf8_string, 'ISO-8859-1', 'UTF-8', ['to_subst' => '?']
);
echo bin2hex($iso8859_1_string), "\n";
?>
```
The above example will output:
```
1a
3f
3f
```
### See Also
* [mb\_convert\_encoding()](function.mb-convert-encoding) - Convert a string from one character encoding to another
* [iconv()](function.iconv) - Convert a string from one character encoding to another
php SplFileObject::fflush SplFileObject::fflush
=====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::fflush — Flushes the output to the file
### Description
```
public SplFileObject::fflush(): bool
```
Forces a write of all buffered output to the file.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **SplFileObject::fflush()** example**
```
<?php
$file = new SplFileObject('misc.txt', 'r+');
$file->rewind();
$file->fwrite("Foo");
$file->fflush();
$file->ftruncate($file->ftell());
?>
```
### See Also
* [SplFileObject::fwrite()](splfileobject.fwrite) - Write to file
php openssl_public_encrypt openssl\_public\_encrypt
========================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
openssl\_public\_encrypt — Encrypts data with public key
### Description
```
openssl_public_encrypt(
string $data,
string &$encrypted_data,
OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $public_key,
int $padding = OPENSSL_PKCS1_PADDING
): bool
```
**openssl\_public\_encrypt()** encrypts `data` with public `public_key` and stores the result into `encrypted_data`. Encrypted data can be decrypted via [openssl\_private\_decrypt()](function.openssl-private-decrypt).
This function can be used e.g. to encrypt message which can be then read only by owner of the private key. It can be also used to store secure data in database.
### Parameters
`data`
`encrypted_data`
This will hold the result of the encryption.
`public_key`
The public key.
`padding`
`padding` can be one of **`OPENSSL_PKCS1_PADDING`**, **`OPENSSL_SSLV23_PADDING`**, **`OPENSSL_PKCS1_OAEP_PADDING`**, **`OPENSSL_NO_PADDING`**.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `public_key` accepts an [OpenSSLAsymmetricKey](class.opensslasymmetrickey) or [OpenSSLCertificate](class.opensslcertificate) instance now; previously, a [resource](language.types.resource) of type `OpenSSL key` or `OpenSSL X.509` was accepted. |
### See Also
* [openssl\_private\_encrypt()](function.openssl-private-encrypt) - Encrypts data with private key
* [openssl\_private\_decrypt()](function.openssl-private-decrypt) - Decrypts data with private key
php Imagick::setPage Imagick::setPage
================
(PECL imagick 2, PECL imagick 3)
Imagick::setPage — Sets the page geometry of the Imagick object
### Description
```
public Imagick::setPage(
int $width,
int $height,
int $x,
int $y
): bool
```
Sets the page geometry of the Imagick object.
### Parameters
`width`
`height`
`x`
`y`
### Return Values
Returns **`true`** on success.
php XSLTProcessor::transformToDoc XSLTProcessor::transformToDoc
=============================
(PHP 5, PHP 7, PHP 8)
XSLTProcessor::transformToDoc — Transform to a DOMDocument
### Description
```
public XSLTProcessor::transformToDoc(object $document, ?string $returnClass = null): DOMDocument|false
```
Transforms the source node to a [DOMDocument](class.domdocument) applying the stylesheet given by the [XSLTProcessor::importStylesheet()](xsltprocessor.importstylesheet) method.
### Parameters
`document`
The node to be transformed.
### Return Values
The resulting [DOMDocument](class.domdocument) or **`false`** on error.
### Examples
**Example #1 Transforming to a DOMDocument**
```
<?php
// Load the XML source
$xml = new DOMDocument;
$xml->load('collection.xml');
$xsl = new DOMDocument;
$xsl->load('collection.xsl');
// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules
echo trim($proc->transformToDoc($xml)->firstChild->wholeText);
?>
```
The above example will output:
```
Hey! Welcome to Nicolas Eliaszewicz's sweet CD collection!
```
### See Also
* [XSLTProcessor::transformToUri()](xsltprocessor.transformtouri) - Transform to URI
* [XSLTProcessor::transformToXml()](xsltprocessor.transformtoxml) - Transform to XML
php ftp_nb_fget ftp\_nb\_fget
=============
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
ftp\_nb\_fget — Retrieves a file from the FTP server and writes it to an open file (non-blocking)
### Description
```
ftp_nb_fget(
FTP\Connection $ftp,
resource $stream,
string $remote_filename,
int $mode = FTP_BINARY,
int $offset = 0
): int
```
**ftp\_nb\_fget()** retrieves a remote file from the FTP server.
The difference between this function and [ftp\_fget()](function.ftp-fget) is that this function retrieves the file asynchronously, so your program can perform other operations while the file is being downloaded.
### Parameters
`ftp`
An [FTP\Connection](class.ftp-connection) instance.
`stream`
An open file pointer in which we store the data.
`remote_filename`
The remote file path.
`mode`
The transfer mode. Must be either **`FTP_ASCII`** or **`FTP_BINARY`**.
`offset`
The position in the remote file to start downloading from.
### Return Values
Returns **`FTP_FAILED`** or **`FTP_FINISHED`** or **`FTP_MOREDATA`**.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `ftp` parameter expects an [FTP\Connection](class.ftp-connection) instance now; previously, a [resource](language.types.resource) was expected. |
| 7.3.0 | The `mode` parameter is now optional. Formerly it has been mandatory. |
### Examples
**Example #1 **ftp\_nb\_fget()** example**
```
<?php
// open some file for reading
$file = 'index.php';
$fp = fopen($file, 'w');
$ftp = ftp_connect($ftp_server);
$login_result = ftp_login($ftp, $ftp_user_name, $ftp_user_pass);
// Initiate the download
$ret = ftp_nb_fget($ftp, $fp, $file, FTP_BINARY);
while ($ret == FTP_MOREDATA) {
// Do whatever you want
echo ".";
// Continue downloading...
$ret = ftp_nb_continue($ftp);
}
if ($ret != FTP_FINISHED) {
echo "There was an error downloading the file...";
exit(1);
}
// close filepointer
fclose($fp);
?>
```
### See Also
* [ftp\_nb\_get()](function.ftp-nb-get) - Retrieves a file from the FTP server and writes it to a local file (non-blocking)
* [ftp\_nb\_continue()](function.ftp-nb-continue) - Continues retrieving/sending a file (non-blocking)
* [ftp\_fget()](function.ftp-fget) - Downloads a file from the FTP server and saves to an open file
* [ftp\_get()](function.ftp-get) - Downloads a file from the FTP server
php ReflectionClass::getReflectionConstants ReflectionClass::getReflectionConstants
=======================================
(PHP 7 >= 7.1.0, PHP 8)
ReflectionClass::getReflectionConstants — Gets class constants
### Description
```
public ReflectionClass::getReflectionConstants(?int $filter = null): array
```
Retrieves reflected constants.
### Parameters
`filter`
The optional filter, for filtering desired constant visibilities. It's configured using the [ReflectionClassConstant constants](class.reflectionclassconstant#reflectionclassconstant.constants.modifiers), and defaults to all constant visibilities.
### Return Values
An array of [ReflectionClassConstant](class.reflectionclassconstant) objects.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `filter` has been added. |
### Examples
**Example #1 Basic **ReflectionClass::getReflectionConstants()** example**
```
<?php
class Foo {
public const FOO = 1;
protected const BAR = 2;
private const BAZ = 3;
}
$foo = new Foo();
$reflect = new ReflectionClass($foo);
$consts = $reflect->getReflectionConstants();
foreach ($consts as $const) {
print $const->getName() . "\n";
}
var_dump($consts);
?>
```
The above example will output something similar to:
```
FOO
BAR
BAZ
array(3) {
[0]=>
object(ReflectionClassConstant)#3 (2) {
["name"]=>
string(3) "FOO"
["class"]=>
string(3) "Foo"
}
[1]=>
object(ReflectionClassConstant)#4 (2) {
["name"]=>
string(3) "BAR"
["class"]=>
string(3) "Foo"
}
[2]=>
object(ReflectionClassConstant)#5 (2) {
["name"]=>
string(3) "BAZ"
["class"]=>
string(3) "Foo"
}
}
```
### See Also
* [ReflectionClass::getReflectionConstant()](reflectionclass.getreflectionconstant) - Gets a ReflectionClassConstant for a class's constant
* [ReflectionClassConstant](class.reflectionclassconstant)
php SolrQuery::getGroupFunctions SolrQuery::getGroupFunctions
============================
(PECL solr >= 2.2.0)
SolrQuery::getGroupFunctions — Returns group functions (group.func parameter values)
### Description
```
public SolrQuery::getGroupFunctions(): array
```
Returns group functions (group.func parameter values)
### Parameters
This function has no parameters.
### Return Values
### See Also
* [SolrQuery::addGroupFunction()](solrquery.addgroupfunction) - Allows grouping results based on the unique values of a function query (group.func parameter)
| programming_docs |
php Imagick::raiseImage Imagick::raiseImage
===================
(PECL imagick 2, PECL imagick 3)
Imagick::raiseImage — Creates a simulated 3d button-like effect
### Description
```
public Imagick::raiseImage(
int $width,
int $height,
int $x,
int $y,
bool $raise
): bool
```
Creates a simulated three-dimensional button-like effect by lightening and darkening the edges of the image. Members width and height of raise\_info define the width of the vertical and horizontal edge of the effect.
### Parameters
`width`
`height`
`x`
`y`
`raise`
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::raiseImage()****
```
<?php
function raiseImage($imagePath, $width, $height, $x, $y, $raise) {
$imagick = new \Imagick(realpath($imagePath));
//x and y do nothing?
$imagick->raiseImage($width, $height, $x, $y, $raise);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php Ev::nowUpdate Ev::nowUpdate
=============
(PECL ev >= 0.2.0)
Ev::nowUpdate — Establishes the current time by querying the kernel, updating the time returned by Ev::now in the progress
### Description
```
final public static Ev::nowUpdate(): void
```
Establishes the current time by querying the kernel, updating the time returned by [Ev::now()](ev.now) in the progress. This is a costly operation and is usually done automatically within [Ev::run()](ev.run) .
This method is rarely useful, but when some event callback runs for a very long time without entering the event loop, updating *libev* 's consideration of the current time is a good idea.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### See Also
* [Ev::now()](ev.now) - Returns the time when the last iteration of the default event loop has started
php Yaf_Route_Regex::assemble Yaf\_Route\_Regex::assemble
===========================
(Yaf >=2.3.0)
Yaf\_Route\_Regex::assemble — Assemble a url
### Description
```
public Yaf_Route_Regex::assemble(array $info, array $query = ?): ?string
```
Assemble a url.
### Parameters
`info`
`query`
### Return Values
Returns string on success or **`null`** on failure.
### Examples
**Example #1 **Yaf\_Route\_Regex::assemble()**example**
```
<?php
$router = new Yaf_Router();
$route = new Yaf_Route_Regex(
"#^/product/([^/]+)/([^/])+#",
array(
'controller' => "product", //route to product controller,
),
array(),
array(),
'/:m/:c/:a'
);
$router->addRoute("regex", $route);
var_dump($router->getRoute('regex')->assemble(
array(
':m' => 'module',
':c' => 'controller',
':a' => 'action'
),
array(
'tkey1' => 'tval1',
'tkey2' =>
'tval2'
)
)
);
```
The above example will output something similar to:
```
string(49) "/module/controller/action?tkey1=tval1&tkey2=tval2"
```
php The EventBufferEvent class
The EventBufferEvent class
==========================
Introduction
------------
(PECL event >= 1.2.6-beta)
Represents Libevent's buffer event.
Usually an application wants to perform some amount of data buffering in addition to just responding to events. When we want to write data, for example, the usual pattern looks like:
1. Decide that we want to write some data to a connection; put that data in a buffer.
2. Wait for the connection to become writable
3. Write as much of the data as we can
4. Remember how much we wrote, and if we still have more data to write, wait for the connection to become writable again.
This buffered I/O pattern is common enough that Libevent provides a generic mechanism for it. A "buffer event" consists of an underlying transport (like a socket), a read buffer, and a write buffer. Instead of regular events, which give callbacks when the underlying transport is ready to be read or written, a buffer event invokes its user-supplied callbacks when it has read or written enough data.
Class synopsis
--------------
final class **EventBufferEvent** { /\* Constants \*/ const int [READING](class.eventbufferevent#eventbufferevent.constants.reading) = 1;
const int [WRITING](class.eventbufferevent#eventbufferevent.constants.writing) = 2;
const int [EOF](class.eventbufferevent#eventbufferevent.constants.eof) = 16;
const int [ERROR](class.eventbufferevent#eventbufferevent.constants.error) = 32;
const int [TIMEOUT](class.eventbufferevent#eventbufferevent.constants.timeout) = 64;
const int [CONNECTED](class.eventbufferevent#eventbufferevent.constants.connected) = 128;
const int [OPT\_CLOSE\_ON\_FREE](class.eventbufferevent#eventbufferevent.constants.opt-close-on-free) = 1;
const int [OPT\_THREADSAFE](class.eventbufferevent#eventbufferevent.constants.opt-threadsafe) = 2;
const int [OPT\_DEFER\_CALLBACKS](class.eventbufferevent#eventbufferevent.constants.opt-defer-callbacks) = 4;
const int [OPT\_UNLOCK\_CALLBACKS](class.eventbufferevent#eventbufferevent.constants.opt-unlock-callbacks) = 8;
const int [SSL\_OPEN](class.eventbufferevent#eventbufferevent.constants.ssl-open) = 0;
const int [SSL\_CONNECTING](class.eventbufferevent#eventbufferevent.constants.ssl-connecting) = 1;
const int [SSL\_ACCEPTING](class.eventbufferevent#eventbufferevent.constants.ssl-accepting) = 2; /\* Properties \*/
public int [$fd](class.eventbufferevent#eventbufferevent.props.fd);
public int [$priority](class.eventbufferevent#eventbufferevent.props.priority);
public readonly [EventBuffer](class.eventbuffer) [$input](class.eventbufferevent#eventbufferevent.props.input);
public readonly [EventBuffer](class.eventbuffer) [$output](class.eventbufferevent#eventbufferevent.props.output); /\* Methods \*/
```
public close(): void
```
```
public connect( string $addr ): bool
```
```
public connectHost(
EventDnsBase $dns_base ,
string $hostname ,
int $port ,
int $family = EventUtil::AF_UNSPEC
): bool
```
```
public __construct(
EventBase $base ,
mixed $socket = null ,
int $options = 0 ,
callable $readcb = null ,
callable $writecb = null ,
callable $eventcb = null ,
mixed $arg = null
)
```
```
public static createPair( EventBase $base , int $options = 0 ): array
```
```
public disable( int $events ): bool
```
```
public enable( int $events ): bool
```
```
public free(): void
```
```
public getDnsErrorString(): string
```
```
public getEnabled(): int
```
```
public getInput(): EventBuffer
```
```
public getOutput(): EventBuffer
```
```
public read( int $size ): string
```
```
public readBuffer( EventBuffer $buf ): bool
```
```
public setCallbacks(
callable $readcb ,
callable $writecb ,
callable $eventcb ,
mixed $arg = ?
): void
```
```
public setPriority( int $priority ): bool
```
```
public setTimeouts( float $timeout_read , float $timeout_write ): bool
```
```
public setWatermark( int $events , int $lowmark , int $highmark ): void
```
```
public sslError(): string
```
```
public static sslFilter(
EventBase $base ,
EventBufferEvent $underlying ,
EventSslContext $ctx ,
int $state ,
int $options = 0
): EventBufferEvent
```
```
public sslGetCipherInfo(): string
```
```
public sslGetCipherName(): string
```
```
public sslGetCipherVersion(): string
```
```
public sslGetProtocol(): string
```
```
public sslRenegotiate(): void
```
```
public static sslSocket(
EventBase $base ,
mixed $socket ,
EventSslContext $ctx ,
int $state ,
int $options = ?
): EventBufferEvent
```
```
public write( string $data ): bool
```
```
public writeBuffer( EventBuffer $buf ): bool
```
} Properties
----------
fd Numeric file descriptor associated with the buffer event. Normally represents a bound socket. Equals to **`null`**, if there is no file descriptor(socket) associated with the buffer event.
priority The priority of the events used to implement the buffer event.
input Underlying input buffer object( [EventBuffer](class.eventbuffer) )
output Underlying output buffer object( [EventBuffer](class.eventbuffer) )
Predefined Constants
--------------------
**`EventBufferEvent::READING`** An event occurred during a read operation on the bufferevent. See the other flags for which event it was.
**`EventBufferEvent::WRITING`** An event occurred during a write operation on the bufferevent. See the other flags for which event it was.
**`EventBufferEvent::EOF`** Got an end-of-file indication on the buffer event.
**`EventBufferEvent::ERROR`** An error occurred during a bufferevent operation. For more information on what the error was, call [EventUtil::getLastSocketErrno()](eventutil.getlastsocketerrno) and/or [EventUtil::getLastSocketError()](eventutil.getlastsocketerror) .
**`EventBufferEvent::TIMEOUT`** **`EventBufferEvent::CONNECTED`** Finished a requested connection on the bufferevent.
**`EventBufferEvent::OPT_CLOSE_ON_FREE`** When the buffer event is freed, close the underlying transport. This will close an underlying socket, free an underlying buffer event, etc.
**`EventBufferEvent::OPT_THREADSAFE`** Automatically allocate locks for the bufferevent, so that it’s safe to use from multiple threads.
**`EventBufferEvent::OPT_DEFER_CALLBACKS`** When this flag is set, the bufferevent defers all of its callbacks. See [» Fast portable non-blocking network programming with Libevent, Deferred callbacks](http://www.wangafu.net/~nickm/libevent-book/Ref6_bufferevent.html#_deferred_callbacks) .
**`EventBufferEvent::OPT_UNLOCK_CALLBACKS`** By default, when the bufferevent is set up to be threadsafe, the buffer event’s locks are held whenever the any user-provided callback is invoked. Setting this option makes Libevent release the buffer event’s lock when it’s invoking the callbacks.
**`EventBufferEvent::SSL_OPEN`** The SSL handshake is done
**`EventBufferEvent::SSL_CONNECTING`** SSL is currently performing negotiation as a client
**`EventBufferEvent::SSL_ACCEPTING`** SSL is currently performing negotiation as a server
Table of Contents
-----------------
* [EventBufferEvent::close](eventbufferevent.close) — Closes file descriptor associated with the current buffer event
* [EventBufferEvent::connect](eventbufferevent.connect) — Connect buffer event's file descriptor to given address or UNIX socket
* [EventBufferEvent::connectHost](eventbufferevent.connecthost) — Connects to a hostname with optionally asyncronous DNS resolving
* [EventBufferEvent::\_\_construct](eventbufferevent.construct) — Constructs EventBufferEvent object
* [EventBufferEvent::createPair](eventbufferevent.createpair) — Creates two buffer events connected to each other
* [EventBufferEvent::disable](eventbufferevent.disable) — Disable events read, write, or both on a buffer event
* [EventBufferEvent::enable](eventbufferevent.enable) — Enable events read, write, or both on a buffer event
* [EventBufferEvent::free](eventbufferevent.free) — Free a buffer event
* [EventBufferEvent::getDnsErrorString](eventbufferevent.getdnserrorstring) — Returns string describing the last failed DNS lookup attempt
* [EventBufferEvent::getEnabled](eventbufferevent.getenabled) — Returns bitmask of events currently enabled on the buffer event
* [EventBufferEvent::getInput](eventbufferevent.getinput) — Returns underlying input buffer associated with current buffer event
* [EventBufferEvent::getOutput](eventbufferevent.getoutput) — Returns underlying output buffer associated with current buffer event
* [EventBufferEvent::read](eventbufferevent.read) — Read buffer's data
* [EventBufferEvent::readBuffer](eventbufferevent.readbuffer) — Drains the entire contents of the input buffer and places them into buf
* [EventBufferEvent::setCallbacks](eventbufferevent.setcallbacks) — Assigns read, write and event(status) callbacks
* [EventBufferEvent::setPriority](eventbufferevent.setpriority) — Assign a priority to a bufferevent
* [EventBufferEvent::setTimeouts](eventbufferevent.settimeouts) — Set the read and write timeout for a buffer event
* [EventBufferEvent::setWatermark](eventbufferevent.setwatermark) — Adjusts read and/or write watermarks
* [EventBufferEvent::sslError](eventbufferevent.sslerror) — Returns most recent OpenSSL error reported on the buffer event
* [EventBufferEvent::sslFilter](eventbufferevent.sslfilter) — Create a new SSL buffer event to send its data over another buffer event
* [EventBufferEvent::sslGetCipherInfo](eventbufferevent.sslgetcipherinfo) — Returns a textual description of the cipher
* [EventBufferEvent::sslGetCipherName](eventbufferevent.sslgetciphername) — Returns the current cipher name of the SSL connection
* [EventBufferEvent::sslGetCipherVersion](eventbufferevent.sslgetcipherversion) — Returns version of cipher used by current SSL connection
* [EventBufferEvent::sslGetProtocol](eventbufferevent.sslgetprotocol) — Returns the name of the protocol used for current SSL connection
* [EventBufferEvent::sslRenegotiate](eventbufferevent.sslrenegotiate) — Tells a bufferevent to begin SSL renegotiation
* [EventBufferEvent::sslSocket](eventbufferevent.sslsocket) — Creates a new SSL buffer event to send its data over an SSL on a socket
* [EventBufferEvent::write](eventbufferevent.write) — Adds data to a buffer event's output buffer
* [EventBufferEvent::writeBuffer](eventbufferevent.writebuffer) — Adds contents of the entire buffer to a buffer event's output buffer
php None Global space
------------
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
Without any namespace definition, all class and function definitions are placed into the global space - as it was in PHP before namespaces were supported. Prefixing a name with `\` will specify that the name is required from the global space even in the context of the namespace.
**Example #1 Using global space specification**
```
<?php
namespace A\B\C;
/* This function is A\B\C\fopen */
function fopen() {
/* ... */
$f = \fopen(...); // call global fopen
return $f;
}
?>
```
php curl_setopt_array curl\_setopt\_array
===================
(PHP 5 >= 5.1.3, PHP 7, PHP 8)
curl\_setopt\_array — Set multiple options for a cURL transfer
### Description
```
curl_setopt_array(CurlHandle $handle, array $options): bool
```
Sets multiple options for a cURL session. This function is useful for setting a large number of cURL options without repetitively calling [curl\_setopt()](function.curl-setopt).
### Parameters
`handle` A cURL handle returned by [curl\_init()](function.curl-init).
`options`
An array specifying which options to set and their values. The keys should be valid [curl\_setopt()](function.curl-setopt) constants or their integer equivalents.
### Return Values
Returns **`true`** if all options were successfully set. If an option could not be successfully set, **`false`** is immediately returned, ignoring any future options in the `options` array.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `handle` expects a [CurlHandle](class.curlhandle) instance now; previously, a resource was expected. |
### Examples
**Example #1 Initializing a new cURL session and fetching a web page**
```
<?php
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
$options = array(CURLOPT_URL => 'http://www.example.com/',
CURLOPT_HEADER => false
);
curl_setopt_array($ch, $options);
// grab URL and pass it to the browser
curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
?>
```
### Notes
>
> **Note**:
>
>
> As with [curl\_setopt()](function.curl-setopt), passing an array to **`CURLOPT_POST`** will encode the data as *multipart/form-data*, while passing a URL-encoded string will encode the data as *application/x-www-form-urlencoded*.
>
>
### See Also
* [curl\_setopt()](function.curl-setopt) - Set an option for a cURL transfer
php ReflectionParameter::isArray ReflectionParameter::isArray
============================
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
ReflectionParameter::isArray — Checks if parameter expects an array
**Warning**This function has been *DEPRECATED* as of PHP 8.0.0. Relying on this function is highly discouraged.
See the example below for an alternative way to derive this information.
### Description
```
public ReflectionParameter::isArray(): bool
```
Checks if the parameter expects an array.
### Parameters
This function has no parameters.
### Return Values
**`true`** if an array is expected, **`false`** otherwise.
### Examples
**Example #1 PHP 8.0.0 equivalent**
As of PHP 8.0.0, the following code will report if a type declares arrays, including as part of a union.
```
<?php
function declaresArray(ReflectionParameter $reflectionParameter): bool
{
$reflectionType = $reflectionParameter->getType();
if (!$reflectionType) return false;
$types = $reflectionType instanceof ReflectionUnionType
? $reflectionType->getTypes()
: [$reflectionType];
return in_array('array', array_map(fn(ReflectionNamedType $t) => $t->getName(), $types));
}
?>
```
### See Also
* [ReflectionParameter::isOptional()](reflectionparameter.isoptional) - Checks if optional
php ArrayIterator::getFlags ArrayIterator::getFlags
=======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
ArrayIterator::getFlags — Get behavior flags
### Description
```
public ArrayIterator::getFlags(): int
```
Gets the behavior flags of the [ArrayIterator](class.arrayiterator). See the [ArrayIterator::setFlags](arrayiterator.setflags) method for a list of the available flags.
### Parameters
This function has no parameters.
### Return Values
Returns the behavior flags of the ArrayIterator.
### See Also
* [ArrayIterator::setFlags()](arrayiterator.setflags) - Set behaviour flags
* [ArrayIterator::valid()](arrayiterator.valid) - Check whether array contains more entries
php posix_initgroups posix\_initgroups
=================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
posix\_initgroups — Calculate the group access list
### Description
```
posix_initgroups(string $username, int $group_id): bool
```
Calculates the group access list for the user specified in name.
### Parameters
`username`
The user to calculate the list for.
`group_id`
Typically the group number from the password file.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* The Unix manual page for initgroups(3).
php GearmanTask::sendWorkload GearmanTask::sendWorkload
=========================
(PECL gearman >= 0.6.0)
GearmanTask::sendWorkload — Send data for a task
### Description
```
public GearmanTask::sendWorkload(string $data): int
```
**Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
### Parameters
`data`
Data to send to the worker.
### Return Values
The length of data sent, or **`false`** if the send failed.
### See Also
* [GearmanTask::recvData()](gearmantask.recvdata) - Read work or result data into a buffer for a task
php EventBuffer::read EventBuffer::read
=================
(PECL event >= 1.6.0)
EventBuffer::read — Read data from an evbuffer and drain the bytes read
### Description
```
public EventBuffer::read( int $max_bytes ): string
```
Read the first `max_bytes` from the buffer and drain the bytes read. If more `max_bytes` are requested than are available in the buffer, it only extracts as many bytes as available.
### Parameters
`max_bytes` Maxmimum number of bytes to read from the buffer.
### Return Values
Returns string read, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| PECL event 1.6.0 | Renamed **EventBuffer::read()**(the old method name) to **EventBuffer::read()**. **EventBuffer::read()** now takes only `max_bytes` argument; returns string instead of integer. |
### See Also
* [EventBuffer::copyout()](eventbuffer.copyout) - Copies out specified number of bytes from the front of the buffer
* [EventBuffer::drain()](eventbuffer.drain) - Removes specified number of bytes from the front of the buffer without copying it anywhere
* [EventBuffer::pullup()](eventbuffer.pullup) - Linearizes data within buffer and returns it's contents as a string
* [EventBuffer::readLine()](eventbuffer.readline) - Extracts a line from the front of the buffer
* [EventBuffer::appendFrom()](eventbuffer.appendfrom) - Moves the specified number of bytes from a source buffer to the end of the current buffer
| programming_docs |
php Error::getTrace Error::getTrace
===============
(PHP 7, PHP 8)
Error::getTrace — Gets the stack trace
### Description
```
final public Error::getTrace(): array
```
Returns the stack trace.
### Parameters
This function has no parameters.
### Return Values
Returns the stack trace as an array.
### Examples
**Example #1 **Error::getTrace()** example**
```
<?php
function test() {
throw new Error;
}
try {
test();
} catch(Error $e) {
var_dump($e->getTrace());
}
?>
```
The above example will output something similar to:
```
array(1) {
[0]=>
array(4) {
["file"]=>
string(22) "/home/bjori/tmp/ex.php"
["line"]=>
int(7)
["function"]=>
string(4) "test"
["args"]=>
array(0) {
}
}
}
```
### See Also
* [Throwable::getTrace()](throwable.gettrace) - Gets the stack trace
php EvIdle::createStopped EvIdle::createStopped
=====================
(PECL ev >= 0.2.0)
EvIdle::createStopped — Creates instance of a stopped EvIdle watcher object
### Description
```
final public static EvIdle::createStopped( string $callback , mixed $data = ?, int $priority = ?): object
```
The same as [EvIdle::\_\_construct()](evidle.construct) , but doesn't start the watcher automatically.
### Parameters
`callback` See [Watcher callbacks](https://www.php.net/manual/en/ev.watcher-callbacks.php) .
`data` Custom data associated with the watcher.
`priority` [Watcher priority](class.ev#ev.constants.watcher-pri)
### Return Values
Returns EvIdle object on success.
### See Also
* [EvIdle::\_\_construct()](evidle.construct) - Constructs the EvIdle watcher object
* [EvLoop::idle()](evloop.idle) - Creates EvIdle watcher object associated with the current event loop instance
php DateTimeZone::getOffset DateTimeZone::getOffset
=======================
timezone\_offset\_get
=====================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
DateTimeZone::getOffset -- timezone\_offset\_get — Returns the timezone offset from GMT
### Description
Object-oriented style
```
public DateTimeZone::getOffset(DateTimeInterface $datetime): int
```
Procedural style
```
timezone_offset_get(DateTimeZone $object, DateTimeInterface $datetime): int
```
This function returns the offset to GMT for the date/time specified in the `datetime` parameter. The GMT offset is calculated with the timezone information contained in the DateTimeZone object being used.
### Parameters
`object`
Procedural style only: A [DateTimeZone](class.datetimezone) object returned by [timezone\_open()](function.timezone-open)
`datetime`
DateTime that contains the date/time to compute the offset from.
### Return Values
Returns time zone offset in seconds.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Prior to this version, **`false`** was returned on failure. |
### Examples
**Example #1 **DateTimeZone::getOffset()** examples**
```
<?php
// Create two timezone objects, one for Taipei (Taiwan) and one for
// Tokyo (Japan)
$dateTimeZoneTaipei = new DateTimeZone("Asia/Taipei");
$dateTimeZoneJapan = new DateTimeZone("Asia/Tokyo");
// Create two DateTime objects that will contain the same Unix timestamp, but
// have different timezones attached to them.
$dateTimeTaipei = new DateTime("now", $dateTimeZoneTaipei);
$dateTimeJapan = new DateTime("now", $dateTimeZoneJapan);
// Calculate the GMT offset for the date/time contained in the $dateTimeTaipei
// object, but using the timezone rules as defined for Tokyo
// ($dateTimeZoneJapan).
$timeOffset = $dateTimeZoneJapan->getOffset($dateTimeTaipei);
// Should show int(32400) (for dates after Sat Sep 8 01:00:00 1951 JST).
var_dump($timeOffset);
?>
```
php mysqli::select_db mysqli::select\_db
==================
mysqli\_select\_db
==================
(PHP 5, PHP 7, PHP 8)
mysqli::select\_db -- mysqli\_select\_db — Selects the default database for database queries
### Description
Object-oriented style
```
public mysqli::select_db(string $database): bool
```
Procedural style
```
mysqli_select_db(mysqli $mysql, string $database): bool
```
Selects the default database to be used when performing queries against the database connection.
>
> **Note**:
>
>
> This function should only be used to change the default database for the connection. You can select the default database with 4th parameter in [mysqli\_connect()](function.mysqli-connect).
>
>
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
`database`
The database name.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **mysqli::select\_db()** example**
Object-oriented style
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "test");
/* get the name of the current default database */
$result = $mysqli->query("SELECT DATABASE()");
$row = $result->fetch_row();
printf("Default database is %s.\n", $row[0]);
/* change default database to "world" */
$mysqli->select_db("world");
/* get the name of the current default database */
$result = $mysqli->query("SELECT DATABASE()");
$row = $result->fetch_row();
printf("Default database is %s.\n", $row[0]);
```
Procedural style
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$link = mysqli_connect("localhost", "my_user", "my_password", "test");
/* get the name of the current default database */
$result = mysqli_query($link, "SELECT DATABASE()");
$row = mysqli_fetch_row($result);
printf("Default database is %s.\n", $row[0]);
/* change default database to "world" */
mysqli_select_db($link, "world");
/* get the name of the current default database */
$result = mysqli_query($link, "SELECT DATABASE()");
$row = mysqli_fetch_row($result);
printf("Default database is %s.\n", $row[0]);
```
The above examples will output:
```
Default database is test.
Default database is world.
```
### See Also
* [mysqli\_connect()](function.mysqli-connect) - Alias of mysqli::\_\_construct
* [mysqli\_real\_connect()](mysqli.real-connect) - Opens a connection to a mysql server
php ZipArchive::getCommentName ZipArchive::getCommentName
==========================
(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.4.0)
ZipArchive::getCommentName — Returns the comment of an entry using the entry name
### Description
```
public ZipArchive::getCommentName(string $name, int $flags = 0): string|false
```
Returns the comment of an entry using the entry name.
### Parameters
`name`
Name of the entry
`flags`
If flags is set to **`ZipArchive::FL_UNCHANGED`**, the original unchanged comment is returned.
### Return Values
Returns the comment on success or **`false`** on failure.
### Examples
**Example #1 Dump an entry comment**
```
<?php
$zip = new ZipArchive;
$res = $zip->open('test1.zip');
if ($res === TRUE) {
var_dump($zip->getCommentName('test/entry1.txt'));
} else {
echo 'failed, code:' . $res;
}
?>
```
php imagecreatefromgif imagecreatefromgif
==================
(PHP 4, PHP 5, PHP 7, PHP 8)
imagecreatefromgif — Create a new image from file or URL
### Description
```
imagecreatefromgif(string $filename): GdImage|false
```
**imagecreatefromgif()** returns an image identifier representing the image obtained from the given filename.
**Caution** When reading GIF files into memory, only the first frame is returned in the image object. The size of the image is not necessarily what is reported by [getimagesize()](function.getimagesize).
**Tip**A URL can be used as a filename with this function if the [fopen wrappers](https://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen) have been enabled. See [fopen()](function.fopen) for more details on how to specify the filename. See the [Supported Protocols and Wrappers](https://www.php.net/manual/en/wrappers.php) for links to information about what abilities the various wrappers have, notes on their usage, and information on any predefined variables they may provide.
### Parameters
`filename`
Path to the GIF image.
### Return Values
Returns an image object on success, **`false`** on errors.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | On success, this function returns a [GDImage](class.gdimage) instance now; previously, a resource was returned. |
### Examples
**Example #1 Example to handle an error during loading of a GIF**
```
<?php
function LoadGif($imgname)
{
/* Attempt to open */
$im = @imagecreatefromgif($imgname);
/* See if it failed */
if(!$im)
{
/* Create a blank image */
$im = imagecreatetruecolor (150, 30);
$bgc = imagecolorallocate ($im, 255, 255, 255);
$tc = imagecolorallocate ($im, 0, 0, 0);
imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);
/* Output an error message */
imagestring ($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
}
return $im;
}
header('Content-Type: image/gif');
$img = LoadGif('bogus.image');
imagegif($img);
imagedestroy($img);
?>
```
The above example will output something similar to:
php SolrQuery::removeFacetDateOther SolrQuery::removeFacetDateOther
===============================
(PECL solr >= 0.9.2)
SolrQuery::removeFacetDateOther — Removes one of the facet.date.other parameters
### Description
```
public SolrQuery::removeFacetDateOther(string $value, string $field_override = ?): SolrQuery
```
Removes one of the facet.date.other parameters
### Parameters
`value`
The value
`field_override`
The name of the field.
### Return Values
Returns the current SolrQuery object, if the return value is used.
php timezone_offset_get timezone\_offset\_get
=====================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
timezone\_offset\_get — Alias of [DateTimeZone::getOffset()](datetimezone.getoffset)
### Description
This function is an alias of: [DateTimeZone::getOffset()](datetimezone.getoffset)
php Closure::__construct Closure::\_\_construct
======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
Closure::\_\_construct — Constructor that disallows instantiation
### Description
private **Closure::\_\_construct**() This method exists only to disallow instantiation of the [Closure](class.closure) class. Objects of this class are created in the fashion described on the [anonymous functions](functions.anonymous) page.
### Parameters
This function has no parameters.
### See Also
* [Anonymous functions](functions.anonymous)
php sodium_crypto_generichash_init sodium\_crypto\_generichash\_init
=================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_generichash\_init — Initialize a hash for streaming
### Description
```
sodium_crypto_generichash_init(string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string
```
The initialization method for the streaming generichash API.
### Parameters
`key`
The generichash key.
`length`
The expected output length of the hash function.
### Return Values
Returns a hash state, serialized as a raw binary string.
### Examples
**Example #1 **sodium\_crypto\_generichash\_init()** example**
```
<?php
$messages = [random_bytes(32), random_bytes(32), random_bytes(16)];
$state = sodium_crypto_generichash_init('', 32);
foreach ($messages as $message) {
sodium_crypto_generichash_update($state, $message);
}
$final = sodium_crypto_generichash_final($state, 32);
var_dump(sodium_bin2hex($final));
$allAtOnce = sodium_crypto_generichash(implode('', $messages));
var_dump(sodium_bin2hex($allAtOnce));
?>
```
The above example will output something similar to:
```
string(64) "a2939a9163cb7c796ec28e01028489e72475c136b2697ea59e3e760ab4a8ab20"
string(64) "a2939a9163cb7c796ec28e01028489e72475c136b2697ea59e3e760ab4a8ab20"
```
php stats_dens_pmf_hypergeometric stats\_dens\_pmf\_hypergeometric
================================
(PECL stats >= 1.0.0)
stats\_dens\_pmf\_hypergeometric — Probability mass function of the hypergeometric distribution
### Description
```
stats_dens_pmf_hypergeometric(
float $n1,
float $n2,
float $N1,
float $N2
): float
```
Returns the probability mass at `n1`, where the random variable follows the hypergeometric distribution of which the number of failure is `n2`, the number of success samples is `N1`, and the number of failure samples is `N2`.
### Parameters
`n1`
The number of success, at which the probability mass is calculated
`n2`
The number of failure of the distribution
`N1`
The number of success samples of the distribution
`N2`
The number of failure samples of the distribution
### Return Values
The probability mass at `n1` or **`false`** for failure.
php The Traversable interface
The Traversable interface
=========================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
Interface to detect if a class is traversable using [foreach](control-structures.foreach).
Abstract base interface that cannot be implemented alone. Instead it must be implemented by either [IteratorAggregate](class.iteratoraggregate) or [Iterator](class.iterator).
>
> **Note**:
>
>
> Internal (built-in) classes that implement this interface can be used in a [foreach](control-structures.foreach) construct and do not need to implement [IteratorAggregate](class.iteratoraggregate) or [Iterator](class.iterator).
>
>
>
> **Note**:
>
>
> This is an internal engine interface which cannot be implemented in PHP scripts. Either [IteratorAggregate](class.iteratoraggregate) or [Iterator](class.iterator) must be used instead. When implementing an interface which extends Traversable, make sure to list [IteratorAggregate](class.iteratoraggregate) or [Iterator](class.iterator) before its name in the implements clause.
>
>
Interface synopsis
------------------
interface **Traversable** { } This interface has no methods, its only purpose is to be the base interface for all traversable classes.
php ImagickDraw::ellipse ImagickDraw::ellipse
====================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::ellipse — Draws an ellipse on the image
### Description
```
public ImagickDraw::ellipse(
float $ox,
float $oy,
float $rx,
float $ry,
float $start,
float $end
): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Draws an ellipse on the image.
### Parameters
`ox`
`oy`
`rx`
`ry`
`start`
`end`
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::ellipse()** example**
```
<?php
function ellipse($strokeColor, $fillColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFontSize(72);
$draw->ellipse(125, 70, 100, 50, 0, 360);
$draw->ellipse(350, 70, 100, 50, 0, 315);
$draw->push();
$draw->translate(125, 250);
$draw->rotate(30);
$draw->ellipse(0, 0, 100, 50, 0, 360);
$draw->pop();
$draw->push();
$draw->translate(350, 250);
$draw->rotate(30);
$draw->ellipse(0, 0, 100, 50, 0, 315);
$draw->pop();
$imagick = new \Imagick();
$imagick->newImage(500, 500, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
php array_splice array\_splice
=============
(PHP 4, PHP 5, PHP 7, PHP 8)
array\_splice — Remove a portion of the array and replace it with something else
### Description
```
array_splice(
array &$array,
int $offset,
?int $length = null,
mixed $replacement = []
): array
```
Removes the elements designated by `offset` and `length` from the `array` array, and replaces them with the elements of the `replacement` array, if supplied.
>
> **Note**:
>
>
> Numerical keys in `array` are not preserved.
>
>
> **Note**: If `replacement` is not an array, it will be [typecast](language.types.array#language.types.array.casting) to one (i.e. `(array) $replacement`). This may result in unexpected behavior when using an object or **`null`** `replacement`.
>
>
### Parameters
`array`
The input array.
`offset`
If `offset` is positive then the start of the removed portion is at that offset from the beginning of the `array` array.
If `offset` is negative then the start of the removed portion is at that offset from the end of the `array` array.
`length`
If `length` is omitted, removes everything from `offset` to the end of the array.
If `length` is specified and is positive, then that many elements will be removed.
If `length` is specified and is negative, then the end of the removed portion will be that many elements from the end of the array.
If `length` is specified and is zero, no elements will be removed.
**Tip** To remove everything from `offset` to the end of the array when `replacement` is also specified, use `count($input)` for `length`.
`replacement`
If `replacement` array is specified, then the removed elements are replaced with elements from this array.
If `offset` and `length` are such that nothing is removed, then the elements from the `replacement` array are inserted in the place specified by the `offset`.
>
> **Note**:
>
>
> Keys in the `replacement` array are not preserved.
>
>
If `replacement` is just one element it is not necessary to put `array()` or square brackets around it, unless the element is an array itself, an object or **`null`**.
### Return Values
Returns an array consisting of the extracted elements.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `length` is nullable now. |
### Examples
**Example #1 **array\_splice()** examples**
```
<?php
$input = array("red", "green", "blue", "yellow");
array_splice($input, 2);
var_dump($input);
$input = array("red", "green", "blue", "yellow");
array_splice($input, 1, -1);
var_dump($input);
$input = array("red", "green", "blue", "yellow");
array_splice($input, 1, count($input), "orange");
var_dump($input);
$input = array("red", "green", "blue", "yellow");
array_splice($input, -1, 1, array("black", "maroon"));
var_dump($input);
?>
```
The above example will output:
```
array(2) {
[0]=>
string(3) "red"
[1]=>
string(5) "green"
}
array(2) {
[0]=>
string(3) "red"
[1]=>
string(6) "yellow"
}
array(2) {
[0]=>
string(3) "red"
[1]=>
string(6) "orange"
}
array(5) {
[0]=>
string(3) "red"
[1]=>
string(5) "green"
[2]=>
string(4) "blue"
[3]=>
string(5) "black"
[4]=>
string(6) "maroon"
}
```
**Example #2 Equivalent statements to various **array\_splice()** examples**
The following statements are equivalent:
```
<?php
// append two elements to $input
array_push($input, $x, $y);
array_splice($input, count($input), 0, array($x, $y));
// remove the last element of $input
array_pop($input);
array_splice($input, -1);
// remove the first element of $input
array_shift($input);
array_splice($input, 0, 1);
// insert an element at the start of $input
array_unshift($input, $x, $y);
array_splice($input, 0, 0, array($x, $y));
// replace the value in $input at index $x
$input[$x] = $y; // for arrays where key equals offset
array_splice($input, $x, 1, $y);
?>
```
### See Also
* [array\_merge()](function.array-merge) - Merge one or more arrays
* [array\_slice()](function.array-slice) - Extract a slice of the array
* [unset()](function.unset) - Unset a given variable
| programming_docs |
php ImagickDraw::getTextInterwordSpacing ImagickDraw::getTextInterwordSpacing
====================================
(PECL imagick 2 >= 2.3.0, PECL imagick 3 >= 3.1.0)
ImagickDraw::getTextInterwordSpacing — Description
### Description
```
public ImagickDraw::getTextInterwordSpacing(): float
```
Gets the text interword spacing.
### Parameters
This function has no parameters.
### Return Values
php Phar::offsetGet Phar::offsetGet
===============
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
Phar::offsetGet — Gets a [PharFileInfo](class.pharfileinfo) object for a specific file
### Description
```
public Phar::offsetGet(string $localName): SplFileInfo
```
This is an implementation of the [ArrayAccess](class.arrayaccess) interface allowing direct manipulation of the contents of a Phar archive using array access brackets. **Phar::offsetGet()** is used for retrieving files from a Phar archive.
### Parameters
`localName`
The filename (relative path) to look for in a Phar.
### Return Values
A [PharFileInfo](class.pharfileinfo) object is returned that can be used to iterate over a file's contents or to retrieve information about the current file.
### Errors/Exceptions
This method throws [BadMethodCallException](class.badmethodcallexception) if the file does not exist in the Phar archive.
### Examples
**Example #1 **Phar::offsetGet()** example**
As with all classes that implement the [ArrayAccess](class.arrayaccess) interface, **Phar::offsetGet()** is automatically called when using the `[]` angle bracket operator.
```
<?php
$p = new Phar(dirname(__FILE__) . '/myphar.phar', 0, 'myphar.phar');
$p['exists.txt'] = "file exists\n";
try {
// automatically calls offsetGet()
echo $p['exists.txt'];
echo $p['doesnotexist.txt'];
} catch (BadMethodCallException $e) {
echo $e;
}
?>
```
The above example will output:
```
file exists
Entry doesnotexist.txt does not exist
```
### See Also
* [Phar::offsetExists()](phar.offsetexists) - Determines whether a file exists in the phar
* [Phar::offsetSet()](phar.offsetset) - Set the contents of an internal file to those of an external file
* [Phar::offsetUnset()](phar.offsetunset) - Remove a file from a phar
php Parle\RParser::errorInfo Parle\RParser::errorInfo
========================
(PECL parle >= 0.7.0)
Parle\RParser::errorInfo — Retrieve the error information
### Description
```
public Parle\RParser::errorInfo(): Parle\ErrorInfo
```
Retrieve the error information in case **Parle\RParser::action()** returned the error action.
### Parameters
This function has no parameters.
### Return Values
Returns an instance of [Parle\ErrorInfo](class.parle-errorinfo).
php imap_rfc822_parse_headers imap\_rfc822\_parse\_headers
============================
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_rfc822\_parse\_headers — Parse mail headers from a string
### Description
```
imap_rfc822_parse_headers(string $headers, string $default_hostname = "UNKNOWN"): stdClass
```
Gets an object of various header elements, similar to [imap\_header()](function.imap-header).
### Parameters
`headers`
The parsed headers data
`default_hostname`
The default host name
### Return Values
Returns an object similar to the one returned by [imap\_header()](function.imap-header), except for the flags and other properties that come from the IMAP server.
### See Also
* [imap\_rfc822\_parse\_adrlist()](function.imap-rfc822-parse-adrlist) - Parses an address string
php ldap_set_rebind_proc ldap\_set\_rebind\_proc
=======================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
ldap\_set\_rebind\_proc — Set a callback function to do re-binds on referral chasing
### Description
```
ldap_set_rebind_proc(LDAP\Connection $ldap, ?callable $callback): bool
```
**Warning**This function is currently not documented; only its argument list is available.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `ldap` parameter expects an [LDAP\Connection](class.ldap-connection) instance now; previously, a [resource](language.types.resource) was expected. |
| 8.0.0 | `callback` is nullable now. |
php Yaf_Route_Static::match Yaf\_Route\_Static::match
=========================
(Yaf >=1.0.0)
Yaf\_Route\_Static::match — The match purpose
### Description
```
public Yaf_Route_Static::match(string $uri): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`uri`
### Return Values
php get_defined_vars get\_defined\_vars
==================
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
get\_defined\_vars — Returns an array of all defined variables
### Description
```
get_defined_vars(): array
```
This function returns a multidimensional array containing a list of all defined variables, be them environment, server or user-defined variables, within the scope that **get\_defined\_vars()** is called.
### Parameters
This function has no parameters.
### Return Values
A multidimensional array with all the variables.
### Examples
**Example #1 **get\_defined\_vars()** Example**
```
<?php
$b = array(1, 1, 2, 3, 5, 8);
$arr = get_defined_vars();
// print $b
print_r($arr["b"]);
/* print path to the PHP interpreter (if used as a CGI)
* e.g. /usr/local/bin/php */
echo $arr["_"];
// print the command-line parameters if any
print_r($arr["argv"]);
// print all the server vars
print_r($arr["_SERVER"]);
// print all the available keys for the arrays of variables
print_r(array_keys(get_defined_vars()));
?>
```
### See Also
* [isset()](function.isset) - Determine if a variable is declared and is different than null
* [get\_defined\_functions()](function.get-defined-functions) - Returns an array of all defined functions
* [get\_defined\_constants()](function.get-defined-constants) - Returns an associative array with the names of all the constants and their values
php EvEmbed::__construct EvEmbed::\_\_construct
======================
(PECL ev >= 0.2.0)
EvEmbed::\_\_construct — Constructs the EvEmbed object
### Description
public **EvEmbed::\_\_construct**(
object `$other` ,
[callable](language.types.callable) `$callback` = ?,
[mixed](language.types.declarations#language.types.declarations.mixed) `$data` = ?,
int `$priority` = ?
) This is a rather advanced watcher type that lets to embed one event loop into another(currently only IO events are supported in the embedded loop, other types of watchers might be handled in a delayed or incorrect fashion and must not be used).
See [» the libev documentation](http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#code_ev_embed_code_when_one_backend_) for details.
This watcher is most useful on *BSD* systems without working `kqueue` to still be able to handle a large number of sockets. See example below.
### Parameters
`other` Instance of [EvLoop](class.evloop) . The loop to embed, this loop must be embeddable(see [Ev::embeddableBackends()](ev.embeddablebackends) ).
`callback` See [Watcher callbacks](https://www.php.net/manual/en/ev.watcher-callbacks.php) .
`data` Custom data associated with the watcher.
`priority` [Watcher priority](class.ev#ev.constants.watcher-pri)
### Examples
**Example #1 Embedding loop created with kqueue backend into the default loop**
```
<?php
/*
* Check if kqueue is available but not recommended and create a kqueue backend
* for use with sockets (which usually work with any kqueue implementation).
* Store the kqueue/socket-only event loop in loop_socket. (One might optionally
* use EVFLAG_NOENV, too)
*
* Example borrowed from
* http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#Examples_CONTENT-9
*/
$loop = EvLoop::defaultLoop();
$socket_loop = NULL;
$embed = NULL;
if (Ev::supportedBackends() & ~Ev::recommendedBackends() & Ev::BACKEND_KQUEUE) {
if (($socket_loop = new EvLoop(Ev::BACKEND_KQUEUE))) {
$embed = new EvEmbed($loop);
}
}
if (!$socket_loop) {
$socket_loop = $loop;
}
// Now use $socket_loop for all sockets, and $loop for anything else
?>
```
### See Also
* [Ev::embeddableBackends()](ev.embeddablebackends) - Returns the set of backends that are embeddable in other event loops
php The ReflectionClassConstant class
The ReflectionClassConstant class
=================================
Introduction
------------
(PHP 7 >= 7.1.0, PHP 8)
The **ReflectionClassConstant** class reports information about a class constant.
Class synopsis
--------------
class **ReflectionClassConstant** implements [Reflector](class.reflector) { /\* Constants \*/ public const int [IS\_PUBLIC](class.reflectionclassconstant#reflectionclassconstant.constants.is-public);
public const int [IS\_PROTECTED](class.reflectionclassconstant#reflectionclassconstant.constants.is-protected);
public const int [IS\_PRIVATE](class.reflectionclassconstant#reflectionclassconstant.constants.is-private);
public const int [IS\_FINAL](class.reflectionclassconstant#reflectionclassconstant.constants.is-final); /\* Properties \*/
public string [$name](class.reflectionclassconstant#reflectionclassconstant.props.name);
public string [$class](class.reflectionclassconstant#reflectionclassconstant.props.class); /\* Methods \*/ public [\_\_construct](reflectionclassconstant.construct)(object|string `$class`, string `$constant`)
```
public static export(mixed $class, string $name, bool $return = ?): string
```
```
public getAttributes(?string $name = null, int $flags = 0): array
```
```
public getDeclaringClass(): ReflectionClass
```
```
public getDocComment(): string|false
```
```
public getModifiers(): int
```
```
public getName(): string
```
```
public getValue(): mixed
```
```
public isEnumCase(): bool
```
```
public isFinal(): bool
```
```
public isPrivate(): bool
```
```
public isProtected(): bool
```
```
public isPublic(): bool
```
```
public __toString(): string
```
} Properties
----------
name Name of the class constant. Read-only, throws [ReflectionException](class.reflectionexception) in attempt to write.
class Name of the class where the class constant is defined. Read-only, throws [ReflectionException](class.reflectionexception) in attempt to write.
Predefined Constants
--------------------
ReflectionClassConstant Modifiers
---------------------------------
**`ReflectionClassConstant::IS_PUBLIC`** Indicates [public](language.oop5.visibility) constants. Prior to PHP 7.4.0, the value was `256`.
**`ReflectionClassConstant::IS_PROTECTED`** Indicates [protected](language.oop5.visibility) constants. Prior to PHP 7.4.0, the value was `512`.
**`ReflectionClassConstant::IS_PRIVATE`** Indicates [private](language.oop5.visibility) constants. Prior to PHP 7.4.0, the value was `1024`.
**`ReflectionClassConstant::IS_FINAL`** Indicates [final](language.oop5.final) constants. Available as of PHP 8.1.0.
>
> **Note**:
>
>
> The values of these constants may change between PHP versions. It is recommended to always use the constants and not rely on the values directly.
>
>
Table of Contents
-----------------
* [ReflectionClassConstant::\_\_construct](reflectionclassconstant.construct) — Constructs a ReflectionClassConstant
* [ReflectionClassConstant::export](reflectionclassconstant.export) — Export
* [ReflectionClassConstant::getAttributes](reflectionclassconstant.getattributes) — Gets Attributes
* [ReflectionClassConstant::getDeclaringClass](reflectionclassconstant.getdeclaringclass) — Gets declaring class
* [ReflectionClassConstant::getDocComment](reflectionclassconstant.getdoccomment) — Gets doc comments
* [ReflectionClassConstant::getModifiers](reflectionclassconstant.getmodifiers) — Gets the class constant modifiers
* [ReflectionClassConstant::getName](reflectionclassconstant.getname) — Get name of the constant
* [ReflectionClassConstant::getValue](reflectionclassconstant.getvalue) — Gets value
* [ReflectionClassConstant::isEnumCase](reflectionclassconstant.isenumcase) — Checks if class constant is an Enum case
* [ReflectionClassConstant::isFinal](reflectionclassconstant.isfinal) — Checks if class constant is final
* [ReflectionClassConstant::isPrivate](reflectionclassconstant.isprivate) — Checks if class constant is private
* [ReflectionClassConstant::isProtected](reflectionclassconstant.isprotected) — Checks if class constant is protected
* [ReflectionClassConstant::isPublic](reflectionclassconstant.ispublic) — Checks if class constant is public
* [ReflectionClassConstant::\_\_toString](reflectionclassconstant.tostring) — Returns the string representation of the ReflectionClassConstant object
php enchant_dict_is_added enchant\_dict\_is\_added
========================
(PHP 8)
enchant\_dict\_is\_added — Whether or not 'word' exists in this spelling-session
### Description
```
enchant_dict_is_added(EnchantDictionary $dictionary, string $word): bool
```
Tells whether or not a word already exists in the current session.
### Parameters
`dictionary`
An Enchant dictionary returned by [enchant\_broker\_request\_dict()](function.enchant-broker-request-dict) or [enchant\_broker\_request\_pwl\_dict()](function.enchant-broker-request-pwl-dict).
`word`
The word to lookup
### Return Values
Returns **`true`** if the word exists or **`false`**
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `dictionary` expects an [EnchantDictionary](class.enchantdictionary) instance now; previoulsy, a [resource](language.types.resource) was expected. |
### See Also
* [enchant\_dict\_add\_to\_session()](function.enchant-dict-add-to-session) - Add 'word' to this spell-checking session
php xdiff_file_merge3 xdiff\_file\_merge3
===================
(PECL xdiff >= 0.2.0)
xdiff\_file\_merge3 — Merge 3 files into one
### Description
```
xdiff_file_merge3(
string $old_file,
string $new_file1,
string $new_file2,
string $dest
): mixed
```
Merges three files into one and stores the result in a file `dest`. The `old_file` is an original version while `new_file1` and `new_file2` are modified versions of an original.
### Parameters
`old_file`
Path to the first file. It acts as "old" file.
`new_file1`
Path to the second file. It acts as modified version of `old_file`.
`new_file2`
Path to the third file. It acts as modified version of `old_file`.
`dest`
Path of the resulting file, containing merged changed from both `new_file1` and `new_file2`.
### Return Values
Returns **`true`** if merge was successful, string with rejected chunks if it was not or **`false`** if an internal error happened.
### Examples
**Example #1 **xdiff\_file\_merge3()** example**
The following code merges three files into one.
```
<?php
$old_version = 'original_script.php';
$fix1 = 'script_with_fix1.php';
$fix2 = 'script_with_fix2.php';
$errors = xdiff_file_merge3($old_version, $fix1, $fix2, 'fixed_script.php');
if (is_string($errors)) {
echo "Rejects:\n";
echo $errors;
}
?>
```
### See Also
* [xdiff\_string\_merge3()](function.xdiff-string-merge3) - Merge 3 strings into one
php gzgets gzgets
======
(PHP 4, PHP 5, PHP 7, PHP 8)
gzgets — Get line from file pointer
### Description
```
gzgets(resource $stream, ?int $length = null): string|false
```
Gets a (uncompressed) string of up to length - 1 bytes read from the given file pointer. Reading ends when length - 1 bytes have been read, on a newline, or on EOF (whichever comes first).
### Parameters
`stream`
The gz-file pointer. It must be valid, and must point to a file successfully opened by [gzopen()](function.gzopen).
`length`
The length of data to get.
### Return Values
The uncompressed string, or **`false`** on error.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `length` is nullable now; previously, the default was `1024`. |
### Examples
**Example #1 **gzgets()** example**
```
<?php
$handle = gzopen('somefile.gz', 'r');
while (!gzeof($handle)) {
$buffer = gzgets($handle, 4096);
echo $buffer;
}
gzclose($handle);
?>
```
### See Also
* [gzopen()](function.gzopen) - Open gz-file
* [gzgetc()](function.gzgetc) - Get character from gz-file pointer
* [gzwrite()](function.gzwrite) - Binary-safe gz-file write
php Imagick::colorizeImage Imagick::colorizeImage
======================
(PECL imagick 2, PECL imagick 3)
Imagick::colorizeImage — Blends the fill color with the image
### Description
```
public Imagick::colorizeImage(mixed $colorize, mixed $opacity, bool $legacy = false): bool
```
Blends the fill color with each pixel in the image.
### Parameters
`colorize`
ImagickPixel object or a string containing the colorize color
`opacity`
ImagickPixel object or an float containing the opacity value. 1.0 is fully opaque and 0.0 is fully transparent.
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Changelog
| Version | Description |
| --- | --- |
| PECL imagick 2.1.0 | Now allows a string representing the color as the first parameter and a float representing the opacity value as the second parameter. Previous versions allow only an ImagickPixel objects. |
### Examples
**Example #1 **Imagick::colorizeImage()****
```
<?php
function colorizeImage($imagePath, $color, $opacity) {
$imagick = new \Imagick(realpath($imagePath));
$opacity = $opacity / 255.0;
$opacityColor = new \ImagickPixel("rgba(0, 0, 0, $opacity)");
$imagick->colorizeImage($color, $opacityColor);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php The IntlCodePointBreakIterator class
The IntlCodePointBreakIterator class
====================================
Introduction
------------
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
This [break iterator](class.intlbreakiterator) identifies the boundaries between UTF-8 code points.
Class synopsis
--------------
class **IntlCodePointBreakIterator** extends [IntlBreakIterator](class.intlbreakiterator) { /\* Inherited constants \*/ public const int [IntlBreakIterator::DONE](class.intlbreakiterator#intlbreakiterator.constants.done);
public const int [IntlBreakIterator::WORD\_NONE](class.intlbreakiterator#intlbreakiterator.constants.word-none);
public const int [IntlBreakIterator::WORD\_NONE\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.word-none-limit);
public const int [IntlBreakIterator::WORD\_NUMBER](class.intlbreakiterator#intlbreakiterator.constants.word-number);
public const int [IntlBreakIterator::WORD\_NUMBER\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.word-number-limit);
public const int [IntlBreakIterator::WORD\_LETTER](class.intlbreakiterator#intlbreakiterator.constants.word-letter);
public const int [IntlBreakIterator::WORD\_LETTER\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.word-letter-limit);
public const int [IntlBreakIterator::WORD\_KANA](class.intlbreakiterator#intlbreakiterator.constants.word-kana);
public const int [IntlBreakIterator::WORD\_KANA\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.word-kana-limit);
public const int [IntlBreakIterator::WORD\_IDEO](class.intlbreakiterator#intlbreakiterator.constants.word-ideo);
public const int [IntlBreakIterator::WORD\_IDEO\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.word-ideo-limit);
public const int [IntlBreakIterator::LINE\_SOFT](class.intlbreakiterator#intlbreakiterator.constants.line-soft);
public const int [IntlBreakIterator::LINE\_SOFT\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.line-soft-limit);
public const int [IntlBreakIterator::LINE\_HARD](class.intlbreakiterator#intlbreakiterator.constants.line-hard);
public const int [IntlBreakIterator::LINE\_HARD\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.line-hard-limit);
public const int [IntlBreakIterator::SENTENCE\_TERM](class.intlbreakiterator#intlbreakiterator.constants.sentence-term);
public const int [IntlBreakIterator::SENTENCE\_TERM\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.sentence-term-limit);
public const int [IntlBreakIterator::SENTENCE\_SEP](class.intlbreakiterator#intlbreakiterator.constants.sentence-sep);
public const int [IntlBreakIterator::SENTENCE\_SEP\_LIMIT](class.intlbreakiterator#intlbreakiterator.constants.sentence-sep-limit); /\* Methods \*/
```
public getLastCodePoint(): int
```
/\* Inherited methods \*/
```
public static IntlBreakIterator::createCharacterInstance(?string $locale = null): ?IntlBreakIterator
```
```
public static IntlBreakIterator::createCodePointInstance(): IntlCodePointBreakIterator
```
```
public static IntlBreakIterator::createLineInstance(?string $locale = null): ?IntlBreakIterator
```
```
public static IntlBreakIterator::createSentenceInstance(?string $locale = null): ?IntlBreakIterator
```
```
public static IntlBreakIterator::createTitleInstance(?string $locale = null): ?IntlBreakIterator
```
```
public static IntlBreakIterator::createWordInstance(?string $locale = null): ?IntlBreakIterator
```
```
public IntlBreakIterator::current(): int
```
```
public IntlBreakIterator::first(): int
```
```
public IntlBreakIterator::following(int $offset): int
```
```
public IntlBreakIterator::getErrorCode(): int
```
```
public IntlBreakIterator::getErrorMessage(): string
```
```
public IntlBreakIterator::getLocale(int $type): string|false
```
```
public IntlBreakIterator::getPartsIterator(string $type = IntlPartsIterator::KEY_SEQUENTIAL): IntlPartsIterator
```
```
public IntlBreakIterator::getText(): ?string
```
```
public IntlBreakIterator::isBoundary(int $offset): bool
```
```
public IntlBreakIterator::last(): int
```
```
public IntlBreakIterator::next(?int $offset = null): int
```
```
public IntlBreakIterator::preceding(int $offset): int
```
```
public IntlBreakIterator::previous(): int
```
```
public IntlBreakIterator::setText(string $text): ?bool
```
} Table of Contents
-----------------
* [IntlCodePointBreakIterator::getLastCodePoint](intlcodepointbreakiterator.getlastcodepoint) — Get last code point passed over after advancing or receding the iterator
| programming_docs |
php EventConfig::requireFeatures EventConfig::requireFeatures
============================
(PECL event >= 1.2.6-beta)
EventConfig::requireFeatures — Enters a required event method feature that the application demands
### Description
```
public EventConfig::requireFeatures( int $feature ): bool
```
Enters a required event method feature that the application demands
### Parameters
`feature` Bitmask of required features. See [`EventConfig::FEATURE_*` constants](class.eventconfig#eventconfig.constants)
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **EventConfig::requireFeatures()** example**
```
<?php
$cfg = new EventConfig();
// Create event_base associated with the config
$base = new EventBase($cfg);
// Require FDS feature
if ($cfg->requireFeatures(EventConfig::FEATURE_FDS)) {
echo "FDS feature is now requried\n";
$base = new EventBase($cfg);
($base->getFeatures() & EventConfig::FEATURE_FDS)
and print("FDS - arbitrary file descriptor types, and not just sockets\n");
}
?>
```
The above example will output something similar to:
```
FDS feature is now requried
FDS - arbitrary file descriptor types, and not just sockets
```
### See Also
* [EventBase::getFeatures()](eventbase.getfeatures) - Returns bitmask of features supported
php Imagick::sepiaToneImage Imagick::sepiaToneImage
=======================
(PECL imagick 2, PECL imagick 3)
Imagick::sepiaToneImage — Sepia tones an image
### Description
```
public Imagick::sepiaToneImage(float $threshold): bool
```
Applies a special effect to the image, similar to the effect achieved in a photo darkroom by sepia toning. Threshold ranges from 0 to QuantumRange and is a measure of the extent of the sepia toning. A threshold of 80 is a good starting point for a reasonable tone.
### Parameters
`threshold`
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::sepiaToneImage()****
```
<?php
function sepiaToneImage($imagePath, $sepia) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->sepiaToneImage($sepia);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php Ds\Vector::count Ds\Vector::count
================
(PECL ds >= 1.0.0)
Ds\Vector::count — Returns the number of values in the collection
See [Countable::count()](countable.count)
php sodium_bin2hex sodium\_bin2hex
===============
(PHP 7 >= 7.2.0, PHP 8)
sodium\_bin2hex — Encode to hexadecimal
### Description
```
sodium_bin2hex(string $string): string
```
Converts a raw binary string into a hex-encoded string. Unlike the standard hex-encoding function, **sodium\_bin2hex()** is constant-time (a property that is important for any code that touches cryptographic inputs, such as plaintexts or keys).
### Parameters
`string`
Raw binary string.
### Return Values
Hex encoded string.
php Ds\Vector::find Ds\Vector::find
===============
(PECL ds >= 1.0.0)
Ds\Vector::find — Attempts to find a value's index
### Description
```
public Ds\Vector::find(mixed $value): mixed
```
Returns the index of the `value`, or **`false`** if not found.
### Parameters
`value`
The value to find.
### Return Values
The index of the value, or **`false`** if not found.
>
> **Note**:
>
>
> Values will be compared by value and by type.
>
>
### Examples
**Example #1 **Ds\Vector::find()** example**
```
<?php
$vector = new \Ds\Vector(["a", 1, true]);
var_dump($vector->find("a")); // 0
var_dump($vector->find("b")); // false
var_dump($vector->find("1")); // false
var_dump($vector->find(1)); // 1
?>
```
The above example will output something similar to:
```
int(0)
bool(false)
bool(false)
int(1)
```
php date_create date\_create
============
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
date\_create — create a new [DateTime](class.datetime) object
### Description
```
date_create(string $datetime = "now", ?DateTimeZone $timezone = null): DateTime|false
```
This is the procedural version of [DateTime::\_\_construct()](datetime.construct).
Unlike the [DateTime](class.datetime) constructor, it will return **`false`** instead of an exception if the passed in `datetime` string is invalid.
### Parameters
See [DateTimeImmutable::\_\_construct](datetimeimmutable.construct).
### Return Values
Returns a new DateTime instance. Procedural style returns **`false`** on failure.
### See Also
* [DateTimeImmutable::\_\_construct()](datetimeimmutable.construct) - Returns new DateTimeImmutable object
* [DateTimeImmutable::createFromFormat()](datetimeimmutable.createfromformat) - Parses a time string according to a specified format
* [DateTime::\_\_construct()](datetime.construct) - Returns new DateTime object
php iptcparse iptcparse
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
iptcparse — Parse a binary IPTC block into single tags
### Description
```
iptcparse(string $iptc_block): array|false
```
Parses an [» IPTC](http://www.iptc.org/) block into its single tags.
### Parameters
`iptc_block`
A binary IPTC block.
### Return Values
Returns an array using the tagmarker as an index and the value as the value. It returns **`false`** on error or if no IPTC data was found.
### Examples
**Example #1 iptcparse() used together with [getimagesize()](function.getimagesize)**
```
<?php
$size = getimagesize('./test.jpg', $info);
if(isset($info['APP13']))
{
$iptc = iptcparse($info['APP13']);
var_dump($iptc);
}
?>
```
### Notes
>
> **Note**:
>
>
> This function does not require the GD image library.
>
>
>
php dio_close dio\_close
==========
(PHP 4 >= 4.2.0, PHP 5 < 5.1.0)
dio\_close — Closes the file descriptor given by fd
### Description
```
dio_close(resource $fd): void
```
The function **dio\_close()** closes the file descriptor `fd`.
### Parameters
`fd`
The file descriptor returned by [dio\_open()](function.dio-open).
### Return Values
No value is returned.
### Examples
**Example #1 Closing an open file descriptor**
```
<?php
$fd = dio_open('/dev/ttyS0', O_RDWR);
dio_close($fd);
?>
```
### See Also
* [dio\_open()](function.dio-open) - Opens a file (creating it if necessary) at a lower level than the C library input/ouput stream functions allow
php None foreach
-------
(PHP 4, PHP 5, PHP 7, PHP 8)
The `foreach` construct provides an easy way to iterate over arrays. `foreach` works only on arrays and objects, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable. There are two syntaxes:
```
foreach (iterable_expression as $value)
statement
foreach (iterable_expression as $key => $value)
statement
```
The first form traverses the iterable given by `iterable_expression`. On each iteration, the value of the current element is assigned to `$value`.
The second form will additionally assign the current element's key to the `$key` variable on each iteration.
Note that `foreach` does not modify the internal array pointer, which is used by functions such as [current()](function.current) and [key()](function.key).
It is possible to [customize object iteration](language.oop5.iterations).
In order to be able to directly modify array elements within the loop precede `$value` with &. In that case the value will be assigned by [reference](https://www.php.net/manual/en/language.references.php).
```
<?php
$arr = array(1, 2, 3, 4);
foreach ($arr as &$value) {
$value = $value * 2;
}
// $arr is now array(2, 4, 6, 8)
unset($value); // break the reference with the last element
?>
```
**Warning** Reference of a `$value` and the last array element remain even after the `foreach` loop. It is recommended to destroy it by [unset()](function.unset). Otherwise you will experience the following behavior:
```
<?php
$arr = array(1, 2, 3, 4);
foreach ($arr as &$value) {
$value = $value * 2;
}
// $arr is now array(2, 4, 6, 8)
// without an unset($value), $value is still a reference to the last item: $arr[3]
foreach ($arr as $key => $value) {
// $arr[3] will be updated with each value from $arr...
echo "{$key} => {$value} ";
print_r($arr);
}
// ...until ultimately the second-to-last value is copied onto the last value
// output:
// 0 => 2 Array ( [0] => 2, [1] => 4, [2] => 6, [3] => 2 )
// 1 => 4 Array ( [0] => 2, [1] => 4, [2] => 6, [3] => 4 )
// 2 => 6 Array ( [0] => 2, [1] => 4, [2] => 6, [3] => 6 )
// 3 => 6 Array ( [0] => 2, [1] => 4, [2] => 6, [3] => 6 )
?>
```
It is possible to iterate a constant array's value by reference:
```
<?php
foreach (array(1, 2, 3, 4) as &$value) {
$value = $value * 2;
}
?>
```
>
> **Note**:
>
>
> `foreach` does not support the ability to suppress error messages using `@`.
>
>
Some more examples to demonstrate usage:
```
<?php
/* foreach example 1: value only */
$a = array(1, 2, 3, 17);
foreach ($a as $v) {
echo "Current value of \$a: $v.\n";
}
/* foreach example 2: value (with its manual access notation printed for illustration) */
$a = array(1, 2, 3, 17);
$i = 0; /* for illustrative purposes only */
foreach ($a as $v) {
echo "\$a[$i] => $v.\n";
$i++;
}
/* foreach example 3: key and value */
$a = array(
"one" => 1,
"two" => 2,
"three" => 3,
"seventeen" => 17
);
foreach ($a as $k => $v) {
echo "\$a[$k] => $v.\n";
}
/* foreach example 4: multi-dimensional arrays */
$a = array();
$a[0][0] = "a";
$a[0][1] = "b";
$a[1][0] = "y";
$a[1][1] = "z";
foreach ($a as $v1) {
foreach ($v1 as $v2) {
echo "$v2\n";
}
}
/* foreach example 5: dynamic arrays */
foreach (array(1, 2, 3, 4, 5) as $v) {
echo "$v\n";
}
?>
```
### Unpacking nested arrays with list()
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
It is possible to iterate over an array of arrays and unpack the nested array into loop variables by providing a [list()](function.list) as the value.
For example:
```
<?php
$array = [
[1, 2],
[3, 4],
];
foreach ($array as list($a, $b)) {
// $a contains the first element of the nested array,
// and $b contains the second element.
echo "A: $a; B: $b\n";
}
?>
```
The above example will output:
```
A: 1; B: 2
A: 3; B: 4
```
You can provide fewer elements in the [list()](function.list) than there are in the nested array, in which case the leftover array values will be ignored:
```
<?php
$array = [
[1, 2],
[3, 4],
];
foreach ($array as list($a)) {
// Note that there is no $b here.
echo "$a\n";
}
?>
```
The above example will output:
```
1
3
```
A notice will be generated if there aren't enough array elements to fill the [list()](function.list):
```
<?php
$array = [
[1, 2],
[3, 4],
];
foreach ($array as list($a, $b, $c)) {
echo "A: $a; B: $b; C: $c\n";
}
?>
```
The above example will output:
```
Notice: Undefined offset: 2 in example.php on line 7
A: 1; B: 2; C:
Notice: Undefined offset: 2 in example.php on line 7
A: 3; B: 4; C:
```
php Yaf_Router::addRoute Yaf\_Router::addRoute
=====================
(Yaf >=1.0.0)
Yaf\_Router::addRoute — Add new Route into Router
### Description
```
public Yaf_Router::addRoute(string $name, Yaf_Route_Abstract $route): bool
```
defaultly, Yaf\_Router using a [Yaf\_Route\_Static](class.yaf-route-static) as its defualt route. you can add new routes into router's route stack by calling this method.
the newer route will be called before the older(route stack), and if the newer router return **`true`**, the router process will be end. otherwise, the older one will be called.
### Parameters
This function has no parameters.
### Return Values
### Examples
**Example #1 [Yaf\_Dispatcher::autoRender()](yaf-dispatcher.autorender)example**
```
<?php
class Bootstrap extends Yaf_Bootstrap_Abstract{
public function _initConfig() {
$config = Yaf_Application::app()->getConfig();
Yaf_Registry::set("config", $config);
}
public function _initRoute(Yaf_Dispatcher $dispatcher) {
$router = $dispatcher->getRouter();
/**
* we can add some pre-defined routes in application.ini
*/
$router->addConfig(Yaf_Registry::get("config")->routes);
/**
* add a Rewrite route, then for a request uri:
* http://example.com/product/list/22/foo
* will be matched by this route, and result:
*
* [module] =>
* [controller] => product
* [action] => info
* [method] => GET
* [params:protected] => Array
* (
* [id] => 22
* [name] => foo
* )
*
*/
$route = new Yaf_Route_Rewrite(
"/product/list/:id/:name",
array(
"controller" => "product",
"action" => "info",
)
);
$router->addRoute('dummy', $route);
}
}
?>
```
### See Also
* [Yaf\_Router::addConfig()](yaf-router.addconfig) - Add config-defined routes into Router
* [Yaf\_Route\_Static](class.yaf-route-static)
* [Yaf\_Route\_Supervar](class.yaf-route-supervar)
* [Yaf\_Route\_Simple](class.yaf-route-simple)
* [Yaf\_Route\_Regex](class.yaf-route-regex)
* [Yaf\_Route\_Rewrite](class.yaf-route-rewrite)
* [Yaf\_Route\_Map](class.yaf-route-map)
php The DomainException class
The DomainException class
=========================
Introduction
------------
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
Exception thrown if a value does not adhere to a defined valid data domain.
Class synopsis
--------------
class **DomainException** extends [LogicException](class.logicexception) { /\* Inherited properties \*/ protected string [$message](class.exception#exception.props.message) = "";
private string [$string](class.exception#exception.props.string) = "";
protected int [$code](class.exception#exception.props.code);
protected string [$file](class.exception#exception.props.file) = "";
protected int [$line](class.exception#exception.props.line);
private array [$trace](class.exception#exception.props.trace) = [];
private ?[Throwable](class.throwable) [$previous](class.exception#exception.props.previous) = null; /\* Inherited methods \*/
```
final public Exception::getMessage(): string
```
```
final public Exception::getPrevious(): ?Throwable
```
```
final public Exception::getCode(): int
```
```
final public Exception::getFile(): string
```
```
final public Exception::getLine(): int
```
```
final public Exception::getTrace(): array
```
```
final public Exception::getTraceAsString(): string
```
```
public Exception::__toString(): string
```
```
private Exception::__clone(): void
```
}
php ReflectionClassConstant::isPrivate ReflectionClassConstant::isPrivate
==================================
(PHP 7 >= 7.1.0, PHP 8)
ReflectionClassConstant::isPrivate — Checks if class constant is private
### Description
```
public ReflectionClassConstant::isPrivate(): bool
```
Checks if the class constant is private.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the class constant is private, otherwise **`false`**
### See Also
* [ReflectionClassConstant::isFinal()](reflectionclassconstant.isfinal) - Checks if class constant is final
* [ReflectionClassConstant::isPublic()](reflectionclassconstant.ispublic) - Checks if class constant is public
* [ReflectionClassConstant::isProtected()](reflectionclassconstant.isprotected) - Checks if class constant is protected
php Imagick::setBackgroundColor Imagick::setBackgroundColor
===========================
(PECL imagick 2, PECL imagick 3)
Imagick::setBackgroundColor — Sets the object's default background color
### Description
```
public Imagick::setBackgroundColor(mixed $background): bool
```
Sets the object's default background color.
### Parameters
`background`
### Return Values
Returns **`true`** on success.
### Changelog
| Version | Description |
| --- | --- |
| PECL imagick 2.1.0 | Now allows a string representing the color as a parameter. Previous versions allow only an ImagickPixel object. |
php CachingIterator::next CachingIterator::next
=====================
(PHP 5, PHP 7, PHP 8)
CachingIterator::next — Move the iterator forward
### Description
```
public CachingIterator::next(): void
```
**Warning**This function is currently not documented; only its argument list is available.
Move the iterator forward.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php ImagickDraw::pathLineToHorizontalAbsolute ImagickDraw::pathLineToHorizontalAbsolute
=========================================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::pathLineToHorizontalAbsolute — Draws a horizontal line path
### Description
```
public ImagickDraw::pathLineToHorizontalAbsolute(float $x): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Draws a horizontal line path from the current point to the target point using absolute coordinates. The target point then becomes the new current point.
### Parameters
`x`
x coordinate
### Return Values
No value is returned.
php LimitIterator::valid LimitIterator::valid
====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
LimitIterator::valid — Check whether the current element is valid
### Description
```
public LimitIterator::valid(): bool
```
Checks whether the current element is valid.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [LimitIterator::current()](limititerator.current) - Get current element
* [LimitIterator::key()](limititerator.key) - Get current key
* [LimitIterator::rewind()](limititerator.rewind) - Rewind the iterator to the specified starting offset
* [LimitIterator::next()](limititerator.next) - Move the iterator forward
* [LimitIterator::seek()](limititerator.seek) - Seek to the given position
php apache_setenv apache\_setenv
==============
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
apache\_setenv — Set an Apache subprocess\_env variable
### Description
```
apache_setenv(string $variable, string $value, bool $walk_to_top = false): bool
```
**apache\_setenv()** sets the value of the Apache environment variable specified by `variable`.
>
> **Note**:
>
>
> When setting an Apache environment variable, the corresponding [$\_SERVER](reserved.variables.server) variable is not changed.
>
>
### Parameters
`variable`
The environment variable that's being set.
`value`
The new `variable` value.
`walk_to_top`
Whether to set the top-level variable available to all Apache layers.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Setting an Apache environment variable using **apache\_setenv()****
```
<?php
apache_setenv("EXAMPLE_VAR", "Example Value");
?>
```
### Notes
>
> **Note**:
>
>
> **apache\_setenv()** can be paired up with [apache\_getenv()](function.apache-getenv) across separate pages or for setting variables to pass to Server Side Includes (.shtml) that have been included in PHP scripts.
>
>
### See Also
* [apache\_getenv()](function.apache-getenv) - Get an Apache subprocess\_env variable
| programming_docs |
php pg_execute pg\_execute
===========
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
pg\_execute — Sends a request to execute a prepared statement with given parameters, and waits for the result
### Description
```
pg_execute(PgSql\Connection $connection = ?, string $stmtname, array $params): PgSql\Result|false
```
Sends a request to execute a prepared statement with given parameters, and waits for the result.
**pg\_execute()** is like [pg\_query\_params()](function.pg-query-params), but the command to be executed is specified by naming a previously-prepared statement, instead of giving a query string. This feature allows commands that will be used repeatedly to be parsed and planned just once, rather than each time they are executed. The statement must have been prepared previously in the current session. **pg\_execute()** is supported only against PostgreSQL 7.4 or higher connections; it will fail when using earlier versions.
The parameters are identical to [pg\_query\_params()](function.pg-query-params), except that the name of a prepared statement is given instead of a query string.
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance. When `connection` is unspecified, the default connection is used. The default connection is the last connection made by [pg\_connect()](function.pg-connect) or [pg\_pconnect()](function.pg-pconnect).
**Warning**As of PHP 8.1.0, using the default connection is deprecated.
`stmtname`
The name of the prepared statement to execute. if "" is specified, then the unnamed statement is executed. The name must have been previously prepared using [pg\_prepare()](function.pg-prepare), [pg\_send\_prepare()](function.pg-send-prepare) or a `PREPARE` SQL command.
`params`
An array of parameter values to substitute for the $1, $2, etc. placeholders in the original prepared query string. The number of elements in the array must match the number of placeholders.
**Warning** Elements are converted to strings by calling this function.
### Return Values
An [PgSql\Result](class.pgsql-result) instance on success, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | Returns an [PgSql\Result](class.pgsql-result) instance now; previously, a [resource](language.types.resource) was returned. |
| 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 Using **pg\_execute()****
```
<?php
// Connect to a database named "mary"
$dbconn = pg_connect("dbname=mary");
// Prepare a query for execution
$result = pg_prepare($dbconn, "my_query", 'SELECT * FROM shops WHERE name = $1');
// Execute the prepared query. Note that it is not necessary to escape
// the string "Joe's Widgets" in any way
$result = pg_execute($dbconn, "my_query", array("Joe's Widgets"));
// Execute the same prepared query, this time with a different parameter
$result = pg_execute($dbconn, "my_query", array("Clothes Clothes Clothes"));
?>
```
### See Also
* [pg\_prepare()](function.pg-prepare) - Submits a request to create a prepared statement with the given parameters, and waits for completion
* [pg\_send\_prepare()](function.pg-send-prepare) - Sends a request to create a prepared statement with the given parameters, without waiting for completion
* [pg\_query\_params()](function.pg-query-params) - Submits a command to the server and waits for the result, with the ability to pass parameters separately from the SQL command text
php libxml_set_streams_context libxml\_set\_streams\_context
=============================
(PHP 5, PHP 7, PHP 8)
libxml\_set\_streams\_context — Set the streams context for the next libxml document load or write
### Description
```
libxml_set_streams_context(resource $context): void
```
Sets the streams context for the next libxml document load or write.
### Parameters
`context`
The stream context resource (created with [stream\_context\_create()](function.stream-context-create))
### Return Values
No value is returned.
### Examples
**Example #1 A **libxml\_set\_streams\_context()** example**
```
<?php
$opts = array(
'http' => array(
'user_agent' => 'PHP libxml agent',
)
);
$context = stream_context_create($opts);
libxml_set_streams_context($context);
// request a file through HTTP
$doc = DOMDocument::load('http://www.example.com/file.xml');
?>
```
### See Also
* [stream\_context\_create()](function.stream-context-create) - Creates a stream context
php FilesystemIterator::rewind FilesystemIterator::rewind
==========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
FilesystemIterator::rewind — Rewinds back to the beginning
### Description
```
public FilesystemIterator::rewind(): void
```
Rewinds the directory back to the start.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Examples
**Example #1 **FilesystemIterator::rewind()** example**
```
<?php
$iterator = new FilesystemIterator(dirname(__FILE__), FilesystemIterator::KEY_AS_FILENAME);
echo $iterator->key() . "\n";
$iterator->next();
echo $iterator->key() . "\n";
$iterator->rewind();
echo $iterator->key() . "\n";
?>
```
The above example will output something similar to:
```
apple.jpg
banana.jpg
apple.jpg
```
### See Also
* [DirectoryIterator::rewind()](directoryiterator.rewind) - Rewind the DirectoryIterator back to the start
php asinh asinh
=====
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
asinh — Inverse hyperbolic sine
### Description
```
asinh(float $num): float
```
Returns the inverse hyperbolic sine of `num`, i.e. the value whose hyperbolic sine is `num`.
### Parameters
`num`
The argument to process
### Return Values
The inverse hyperbolic sine of `num`
### See Also
* [sinh()](function.sinh) - Hyperbolic sine
* [asin()](function.asin) - Arc sine
* [acosh()](function.acosh) - Inverse hyperbolic cosine
* [atanh()](function.atanh) - Inverse hyperbolic tangent
php Yaf_Config_Abstract::readonly Yaf\_Config\_Abstract::readonly
===============================
(Yaf >=1.0.0)
Yaf\_Config\_Abstract::readonly — Find a config whether readonly
### Description
```
abstract public Yaf_Config_Abstract::readonly(): bool
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php Memcached::isPersistent Memcached::isPersistent
=======================
(PECL memcached >= 2.0.0)
Memcached::isPersistent — Check if a persitent connection to memcache is being used
### Description
```
public Memcached::isPersistent(): bool
```
**Memcached::isPersistent()** checks if the connections to the memcache servers are persistent connections.
### Parameters
This function has no parameters.
### Return Values
Returns true if Memcache instance uses a persistent connection, false otherwise.
### See Also
* [Memcached::isPristine()](memcached.ispristine) - Check if the instance was recently created
php enchant_dict_add enchant\_dict\_add
==================
(PHP 8)
enchant\_dict\_add — Add a word to personal word list
### Description
```
enchant_dict_add(EnchantDictionary $dictionary, string $word): void
```
Add a word to personal word list of the given dictionary.
### Parameters
`dictionary`
An Enchant dictionary returned by [enchant\_broker\_request\_dict()](function.enchant-broker-request-dict) or [enchant\_broker\_request\_pwl\_dict()](function.enchant-broker-request-pwl-dict).
`word`
The word to add
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `dictionary` expects an [EnchantDictionary](class.enchantdictionary) instance now; previoulsy, a [resource](language.types.resource) was expected. |
**Example #1 Adding a word to a PWL**
```
<?php
$filename = './my_word_list.pwl';
$word = 'Supercalifragilisticexpialidocious';
$broker = enchant_broker_init();
$dict = enchant_broker_request_pwl_dict($broker, $filename);
enchant_dict_add($dict, $word);
enchant_broker_free($broker);
?>
```
### See Also
* [enchant\_broker\_request\_pwl\_dict()](function.enchant-broker-request-pwl-dict) - Creates a dictionary using a PWL file
* [enchant\_broker\_request\_dict()](function.enchant-broker-request-dict) - Create a new dictionary using a tag
php phpcredits phpcredits
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
phpcredits — Prints out the credits for PHP
### Description
```
phpcredits(int $flags = CREDITS_ALL): bool
```
This function prints out the credits listing the PHP developers, modules, etc. It generates the appropriate HTML codes to insert the information in a page.
### Parameters
`flags`
To generate a custom credits page, you may want to use the `flags` parameter.
**Pre-defined **phpcredits()** flags**| name | description |
| --- | --- |
| CREDITS\_ALL | All the credits, equivalent to using: **`CREDITS_DOCS`** + **`CREDITS_GENERAL`** + **`CREDITS_GROUP`** + **`CREDITS_MODULES`** + **`CREDITS_FULLPAGE`**. It generates a complete stand-alone HTML page with the appropriate tags. |
| CREDITS\_DOCS | The credits for the documentation team |
| CREDITS\_FULLPAGE | Usually used in combination with the other flags. Indicates that a complete stand-alone HTML page needs to be printed including the information indicated by the other flags. |
| CREDITS\_GENERAL | General credits: Language design and concept, PHP authors and SAPI module. |
| CREDITS\_GROUP | A list of the core developers |
| CREDITS\_MODULES | A list of the extension modules for PHP, and their authors |
| CREDITS\_SAPI | A list of the server API modules for PHP, and their authors |
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Prints the general credits**
```
<?php
phpcredits(CREDITS_GENERAL);
?>
```
**Example #2 Prints the core developers and the documentation group**
```
<?php
phpcredits(CREDITS_GROUP | CREDITS_DOCS | CREDITS_FULLPAGE);
?>
```
**Example #3 Printing all the credits**
```
<html>
<head>
<title>My credits page</title>
</head>
<body>
<?php
// some code of your own
phpcredits(CREDITS_ALL - CREDITS_FULLPAGE);
// some more code
?>
</body>
</html>
```
### Notes
>
> **Note**:
>
>
> **phpcredits()** outputs plain text instead of HTML when using the CLI mode.
>
>
### See Also
* [phpversion()](function.phpversion) - Gets the current PHP version
* [phpinfo()](function.phpinfo) - Outputs information about PHP's configuration
php strncasecmp strncasecmp
===========
(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)
strncasecmp — Binary safe case-insensitive string comparison of the first n characters
### Description
```
strncasecmp(string $string1, string $string2, int $length): int
```
This function is similar to [strcasecmp()](function.strcasecmp), with the difference that you can specify the (upper limit of the) number of characters from each string to be used in the comparison.
### Parameters
`string1`
The first string.
`string2`
The second string.
`length`
The length of strings to be used in the comparison.
### Return Values
Returns `-1` if `string1` is less than `string2`; `1` if `string1` is greater than `string2`, and `0` if they are equal.
### Changelog
| Version | Description |
| --- | --- |
| 8.2.0 | This function now returns `-1` or `1`, where it previously returned a negative or positive number. |
### Examples
**Example #1 **strncasecmp()** example**
```
<?php
$var1 = 'Hello John';
$var2 = 'hello Doe';
if (strncasecmp($var1, $var2, 5) === 0) {
echo 'First 5 characters of $var1 and $var2 are equals in a case-insensitive string comparison';
}
?>
```
### See Also
* [strncmp()](function.strncmp) - Binary safe string comparison of the first n characters
* [preg\_match()](function.preg-match) - Perform a regular expression match
* [substr\_compare()](function.substr-compare) - Binary safe comparison of two strings from an offset, up to length characters
* [strcasecmp()](function.strcasecmp) - Binary safe case-insensitive string comparison
* [stristr()](function.stristr) - Case-insensitive strstr
* [substr()](function.substr) - Return part of a string
php SolrPingResponse::__construct SolrPingResponse::\_\_construct
===============================
(PECL solr >= 0.9.2)
SolrPingResponse::\_\_construct — Constructor
### Description
public **SolrPingResponse::\_\_construct**() Constructor
### Parameters
This function has no parameters.
### Return Values
None
php Gmagick::profileimage Gmagick::profileimage
=====================
(PECL gmagick >= Unknown)
Gmagick::profileimage — Adds or removes a profile from an image
### Description
```
public Gmagick::profileimage(string $name, string $profile): Gmagick
```
Adds or removes a ICC, IPTC, or generic profile from an image. If the profile is **`null`**, it is removed from the image otherwise added. Use a name of `*` and a profile of **`null`** to remove all profiles from the image.
### Parameters
`name`
Name of profile to add or remove: ICC, IPTC, or generic profile.
`profile`
The profile.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php imagedashedline imagedashedline
===============
(PHP 4, PHP 5, PHP 7, PHP 8)
imagedashedline — Draw a dashed line
### Description
```
imagedashedline(
GdImage $image,
int $x1,
int $y1,
int $x2,
int $y2,
int $color
): bool
```
This function is deprecated. Use combination of [imagesetstyle()](function.imagesetstyle) and [imageline()](function.imageline) instead.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`x1`
Upper left x coordinate.
`y1`
Upper left y coordinate 0, 0 is the top left corner of the image.
`x2`
Bottom right x coordinate.
`y2`
Bottom right y coordinate.
`color`
The fill color. A color identifier created with [imagecolorallocate()](function.imagecolorallocate).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 **imagedashedline()** example**
```
<?php
// Create a 100x100 image
$im = imagecreatetruecolor(100, 100);
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
// Draw a vertical dashed line
imagedashedline($im, 50, 25, 50, 75, $white);
// Save the image
imagepng($im, './dashedline.png');
imagedestroy($im);
?>
```
The above example will output something similar to:
**Example #2 Alternative to **imagedashedline()****
```
<?php
// Create a 100x100 image
$im = imagecreatetruecolor(100, 100);
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
// Define our style: First 4 pixels is white and the
// next 4 is transparent. This creates the dashed line effect
$style = Array(
$white,
$white,
$white,
$white,
IMG_COLOR_TRANSPARENT,
IMG_COLOR_TRANSPARENT,
IMG_COLOR_TRANSPARENT,
IMG_COLOR_TRANSPARENT
);
imagesetstyle($im, $style);
// Draw the dashed line
imageline($im, 50, 25, 50, 75, IMG_COLOR_STYLED);
// Save the image
imagepng($im, './imageline.png');
imagedestroy($im);
?>
```
### See Also
* [imagesetstyle()](function.imagesetstyle) - Set the style for line drawing
* [imageline()](function.imageline) - Draw a line
php ImagickDraw::scale ImagickDraw::scale
==================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::scale — Adjusts the scaling factor
### Description
```
public ImagickDraw::scale(float $x, float $y): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Adjusts the scaling factor to apply in the horizontal and vertical directions to the current coordinate space.
### Parameters
`x`
horizontal factor
`y`
vertical factor
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::scale()** example**
```
<?php
function scale($strokeColor, $fillColor, $backgroundColor, $fillModifiedColor) {
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setStrokeWidth(4);
$draw->setFillColor($fillColor);
$draw->rectangle(200, 200, 300, 300);
$draw->setFillColor($fillModifiedColor);
$draw->scale(1.4, 1.4);
$draw->rectangle(200, 200, 300, 300);
$image = new \Imagick();
$image->newImage(500, 500, $backgroundColor);
$image->setImageFormat("png");
$image->drawImage($draw);
header("Content-Type: image/png");
echo $image->getImageBlob();
}
?>
```
php Ds\Stack::pop Ds\Stack::pop
=============
(PECL ds >= 1.0.0)
Ds\Stack::pop — Removes and returns the value at the top of the stack
### Description
```
public Ds\Stack::pop(): mixed
```
Removes and returns the value at the top of the stack.
### Parameters
This function has no parameters.
### Return Values
The removed value which was at the top of the stack.
### Errors/Exceptions
[UnderflowException](class.underflowexception) if empty.
### Examples
**Example #1 **Ds\Stack::pop()** example**
```
<?php
$stack = new \Ds\Stack();
$stack->push("a");
$stack->push("b");
$stack->push("c");
var_dump($stack->pop());
var_dump($stack->pop());
var_dump($stack->pop());
?>
```
The above example will output something similar to:
```
string(1) "c"
string(1) "b"
string(1) "a"
```
php sodium_crypto_box_secretkey sodium\_crypto\_box\_secretkey
==============================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_box\_secretkey — Extracts the secret key from a crypto\_box keypair
### Description
```
sodium_crypto_box_secretkey(string $key_pair): string
```
Given a keypair, fetch only the secret key.
### Parameters
`key_pair`
A keypair, such as one generated by [sodium\_crypto\_box\_keypair()](function.sodium-crypto-box-keypair) or [sodium\_crypto\_box\_seed\_keypair()](function.sodium-crypto-box-seed-keypair)
### Return Values
X25519 secret key.
php The Yaf_Route_Supervar class
The Yaf\_Route\_Supervar class
==============================
Introduction
------------
(Yaf >=1.0.0)
Class synopsis
--------------
class **Yaf\_Route\_Supervar** implements [Yaf\_Route\_Interface](class.yaf-route-interface) { /\* Properties \*/ protected [$\_var\_name](class.yaf-route-supervar#yaf-route-supervar.props.var-name); /\* Methods \*/ public [\_\_construct](yaf-route-supervar.construct)(string `$supervar_name`)
```
public assemble(array $info, array $query = ?): string
```
```
public route(Yaf_Request_Abstract $request): bool
```
} Properties
----------
\_var\_name Table of Contents
-----------------
* [Yaf\_Route\_Supervar::assemble](yaf-route-supervar.assemble) — Assemble a url
* [Yaf\_Route\_Supervar::\_\_construct](yaf-route-supervar.construct) — The \_\_construct purpose
* [Yaf\_Route\_Supervar::route](yaf-route-supervar.route) — The route purpose
| programming_docs |
php unset unset
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
unset — Unset a given variable
### Description
```
unset(mixed $var, mixed ...$vars): void
```
**unset()** destroys the specified variables.
The behavior of **unset()** inside of a function can vary depending on what type of variable you are attempting to destroy.
If a globalized variable is **unset()** inside of a function, only the local variable is destroyed. The variable in the calling environment will retain the same value as before **unset()** was called.
```
<?php
function destroy_foo()
{
global $foo;
unset($foo);
}
$foo = 'bar';
destroy_foo();
echo $foo;
?>
```
The above example will output:
```
bar
```
To **unset()** a global variable inside of a function, then use the [$GLOBALS](reserved.variables.globals) array to do so:
```
<?php
function foo()
{
unset($GLOBALS['bar']);
}
$bar = "something";
foo();
?>
```
If a variable that is PASSED BY REFERENCE is **unset()** inside of a function, only the local variable is destroyed. The variable in the calling environment will retain the same value as before **unset()** was called.
```
<?php
function foo(&$bar)
{
unset($bar);
$bar = "blah";
}
$bar = 'something';
echo "$bar\n";
foo($bar);
echo "$bar\n";
?>
```
The above example will output:
```
something
something
```
If a static variable is **unset()** inside of a function, **unset()** destroys the variable only in the context of the rest of a function. Following calls will restore the previous value of a variable.
```
<?php
function foo()
{
static $bar;
$bar++;
echo "Before unset: $bar, ";
unset($bar);
$bar = 23;
echo "after unset: $bar\n";
}
foo();
foo();
foo();
?>
```
The above example will output:
```
Before unset: 1, after unset: 23
Before unset: 2, after unset: 23
Before unset: 3, after unset: 23
```
### Parameters
`var`
The variable to be unset.
`vars`
Further variables.
### Return Values
No value is returned.
### Examples
**Example #1 **unset()** example**
```
<?php
// destroy a single variable
unset($foo);
// destroy a single element of an array
unset($bar['quux']);
// destroy more than one variable
unset($foo1, $foo2, $foo3);
?>
```
**Example #2 Using `(unset)` casting**
[`(unset)`](language.types.null#language.types.null.casting) casting is often confused with the **unset()** function. `(unset)` casting serves only as a `NULL`-type cast, for completeness. It does not alter the variable it's casting. The (unset) cast is deprecated as of PHP 7.2.0, removed as of 8.0.0.
```
<?php
$name = 'Felipe';
var_dump((unset) $name);
var_dump($name);
?>
```
The above example will output:
```
NULL
string(6) "Felipe"
```
### Notes
> **Note**: Because this is a language construct and not a function, it cannot be called using [variable functions](functions.variable-functions), or [named arguments](functions.arguments#functions.named-arguments).
>
>
>
> **Note**:
>
>
> It is possible to unset even object properties visible in current context.
>
>
>
> **Note**:
>
>
> It is not possible to unset `$this` inside an object method.
>
>
>
> **Note**:
>
>
> When using **unset()** on inaccessible object properties, the [\_\_unset()](language.oop5.overloading#object.unset) overloading method will be called, if declared.
>
>
### See Also
* [isset()](function.isset) - Determine if a variable is declared and is different than null
* [empty()](function.empty) - Determine whether a variable is empty
* [\_\_unset()](language.oop5.overloading#object.unset)
* [array\_splice()](function.array-splice) - Remove a portion of the array and replace it with something else
* [(unset) casting](language.types.null#language.types.null.casting)
php Gmagick::getimageindex Gmagick::getimageindex
======================
(PECL gmagick >= Unknown)
Gmagick::getimageindex — Gets the index of the current active image
### Description
```
public Gmagick::getimageindex(): int
```
Returns the index of the current active image within the [Gmagick](class.gmagick) object.
### Parameters
This function has no parameters.
### Return Values
Index of current active image.
### Errors/Exceptions
Throws an **GmagickException** on error.
php XMLReader::getAttribute XMLReader::getAttribute
=======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
XMLReader::getAttribute — Get the value of a named attribute
### Description
```
public XMLReader::getAttribute(string $name): ?string
```
Returns the value of a named attribute or **`null`** if the attribute does not exist or not positioned on an element node.
### Parameters
`name`
The name of the attribute.
### Return Values
The value of the attribute, or **`null`** if no attribute with the given `name` is found or not positioned on an element node.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function can no longer return **`false`**. |
### See Also
* [XMLReader::getAttributeNo()](xmlreader.getattributeno) - Get the value of an attribute by index
* [XMLReader::getAttributeNs()](xmlreader.getattributens) - Get the value of an attribute by localname and URI
php IteratorIterator::rewind IteratorIterator::rewind
========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
IteratorIterator::rewind — Rewind to the first element
### Description
```
public IteratorIterator::rewind(): void
```
Rewinds to the first element.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### See Also
* [IteratorIterator::next()](iteratoriterator.next) - Forward to the next element
* [IteratorIterator::valid()](iteratoriterator.valid) - Checks if the iterator is valid
php odbc_gettypeinfo odbc\_gettypeinfo
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
odbc\_gettypeinfo — Retrieves information about data types supported by the data source
### Description
```
odbc_gettypeinfo(resource $odbc, int $data_type = 0): resource|false
```
Retrieves information about data types supported by the data source.
### Parameters
`odbc`
The ODBC connection identifier, see [odbc\_connect()](function.odbc-connect) for details.
`data_type`
The data type, which can be used to restrict the information to a single data type.
### Return Values
Returns an ODBC result identifier or **`false`** on failure.
The result set has the following columns:
* TYPE\_NAME
* DATA\_TYPE
* PRECISION
* LITERAL\_PREFIX
* LITERAL\_SUFFIX
* CREATE\_PARAMS
* NULLABLE
* CASE\_SENSITIVE
* SEARCHABLE
* UNSIGNED\_ATTRIBUTE
* MONEY
* AUTO\_INCREMENT
* LOCAL\_TYPE\_NAME
* MINIMUM\_SCALE
* MAXIMUM\_SCALE
The result set is ordered by DATA\_TYPE and TYPE\_NAME.
php svn_auth_set_parameter svn\_auth\_set\_parameter
=========================
(PECL svn >= 0.1.0)
svn\_auth\_set\_parameter — Sets an authentication parameter
### Description
```
svn_auth_set_parameter(string $key, string $value): void
```
Sets authentication parameter at `key` to `value`. For a list of valid keys and their meanings, consult the [authentication constants list](https://www.php.net/manual/en/svn.constants.php#svn.constants.auth).
### Parameters
`key`
String key name. Use the [authentication constants](https://www.php.net/manual/en/svn.constants.php#svn.constants.auth) defined by this extension to specify a key.
`value`
String value to set to parameter at key. Format of value varies with the parameter.
### Return Values
No value is returned.
### Examples
**Example #1 Default authentication example**
This example configures SVN so that the default username to use is 'Bob' and the default password is 'abc123':
```
<?php
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, 'Bob');
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, 'abc123');
?>
```
### Notes
**Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
### See Also
* [svn\_auth\_get\_parameter()](function.svn-auth-get-parameter) - Retrieves authentication parameter
* [Authentication constants](https://www.php.net/manual/en/svn.constants.php#svn.constants.auth)
php apache_child_terminate apache\_child\_terminate
========================
(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)
apache\_child\_terminate — Terminate apache process after this request
### Description
```
apache_child_terminate(): void
```
**apache\_child\_terminate()** will register the Apache process executing the current PHP request for termination once execution of PHP code is completed. It may be used to terminate a process after a script with high memory consumption has been run as memory will usually only be freed internally but not given back to the operating system.
Works in the Apache, and FastCGI webservers.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Notes
> **Note**: This function is not implemented on Windows platforms.
>
>
### See Also
* [exit()](function.exit) - Output a message and terminate the current script
php mailparse_msg_parse mailparse\_msg\_parse
=====================
(PECL mailparse >= 0.9.0)
mailparse\_msg\_parse — Incrementally parse data into buffer
### Description
```
mailparse_msg_parse(resource $mimemail, string $data): bool
```
Incrementally parse data into the supplied mime mail resource.
This function allow you to stream portions of a file at a time, rather than read and parse the whole thing.
### Parameters
`mimemail`
A valid `MIME` resource.
`data`
>
> **Note**:
>
>
> The final chunk of `data` is supposed to end with a newline (`CRLF`); otherwise the last line of the message will not be parsed.
>
>
### Return Values
Returns **`true`** on success or **`false`** on failure.
php PDO::errorInfo PDO::errorInfo
==============
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0)
PDO::errorInfo — Fetch extended error information associated with the last operation on the database handle
### Description
```
public PDO::errorInfo(): array
```
### Parameters
This function has no parameters.
### Return Values
**PDO::errorInfo()** returns an array of error information about the last operation performed by this database handle. The array consists of at least the following fields:
| Element | Information |
| --- | --- |
| 0 | SQLSTATE error code (a five characters alphanumeric identifier defined in the ANSI SQL standard). |
| 1 | Driver-specific error code. |
| 2 | Driver-specific error message. |
>
> **Note**:
>
>
> If the SQLSTATE error code is not set or there is no driver-specific error, the elements following element 0 will be set to **`null`**.
>
>
**PDO::errorInfo()** only retrieves error information for operations performed directly on the database handle. If you create a PDOStatement object through [PDO::prepare()](pdo.prepare) or [PDO::query()](pdo.query) and invoke an error on the statement handle, **PDO::errorInfo()** will not reflect the error from the statement handle. You must call [PDOStatement::errorInfo()](pdostatement.errorinfo) to return the error information for an operation performed on a particular statement handle.
### Examples
**Example #1 Displaying errorInfo() fields for a PDO\_ODBC connection to a DB2 database**
```
<?php
/* Provoke an error -- bogus SQL syntax */
$stmt = $dbh->prepare('bogus sql');
if (!$stmt) {
echo "\nPDO::errorInfo():\n";
print_r($dbh->errorInfo());
}
?>
```
The above example will output:
```
PDO::errorInfo():
Array
(
[0] => HY000
[1] => 1
[2] => near "bogus": syntax error
)
```
### See Also
* [PDO::errorCode()](pdo.errorcode) - Fetch the SQLSTATE associated with the last operation on the database handle
* [PDOStatement::errorCode()](pdostatement.errorcode) - Fetch the SQLSTATE associated with the last operation on the statement handle
* [PDOStatement::errorInfo()](pdostatement.errorinfo) - Fetch extended error information associated with the last operation on the statement handle
php Parle\Parser::dump Parle\Parser::dump
==================
(PECL parle >= 0.5.1)
Parle\Parser::dump — Dump the grammar
### Description
```
public Parle\Parser::dump(): void
```
Dump the current grammar to stdout.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php enchant_dict_describe enchant\_dict\_describe
=======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant >= 0.1.0 )
enchant\_dict\_describe — Describes an individual dictionary
### Description
```
enchant_dict_describe(EnchantDictionary $dictionary): array
```
Returns the details of the dictionary.
### Parameters
`dictionary`
An Enchant dictionary returned by [enchant\_broker\_request\_dict()](function.enchant-broker-request-dict) or [enchant\_broker\_request\_pwl\_dict()](function.enchant-broker-request-pwl-dict).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `dictionary` expects an [EnchantDictionary](class.enchantdictionary) instance now; previoulsy, a [resource](language.types.resource) was expected. |
| 8.0.0 | Prior to this version, the function returned **`false`** on failure. |
### Examples
**Example #1 A **enchant\_dict\_describe()** example**
Check if a dictionary exists using [enchant\_broker\_dict\_exists()](function.enchant-broker-dict-exists) and show the detail of it.
```
<?php
$tag = 'en_US';
$broker = enchant_broker_init();
if (enchant_broker_dict_exists($broker,$tag)) {
$dict = enchant_broker_request_dict($r, $tag);
$dict_details = enchant_dict_describe($dict);
print_r($dict_details);
}
?>
```
The above example will output something similar to:
```
Array
(
[lang] => en_US
[name] => aspell
[desc] => Aspell Provider
[file] => /usr/lib/enchant/libenchant_aspell.so
)
```
php proc_open proc\_open
==========
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
proc\_open — Execute a command and open file pointers for input/output
### Description
```
proc_open(
array|string $command,
array $descriptor_spec,
array &$pipes,
?string $cwd = null,
?array $env_vars = null,
?array $options = null
): resource|false
```
**proc\_open()** is similar to [popen()](function.popen) but provides a much greater degree of control over the program execution.
### Parameters
`command`
The commandline to execute as string. Special characters have to be properly escaped, and proper quoting has to be applied.
> **Note**: On *Windows*, unless `bypass_shell` is set to **`true`** in `options`, the `command` is passed to **cmd.exe** (actually, `%ComSpec%`) with the `/c` flag as *unquoted* string (i.e. exactly as has been given to **proc\_open()**). This can cause **cmd.exe** to remove enclosing quotes from `command` (for details see the **cmd.exe** documentation), resulting in unexpected, and potentially even dangerous behavior, because **cmd.exe** error messages may contain (parts of) the passed `command` (see example below).
>
>
As of PHP 7.4.0, `command` may be passed as array of command parameters. In this case the process will be opened directly (without going through a shell) and PHP will take care of any necessary argument escaping.
>
> **Note**:
>
>
> On Windows, the argument escaping of the array elements assumes that the command line parsing of the executed command is compatible with the parsing of command line arguments done by the VC runtime.
>
>
`descriptor_spec`
An indexed array where the key represents the descriptor number and the value represents how PHP will pass that descriptor to the child process. 0 is stdin, 1 is stdout, while 2 is stderr.
Each element can be:
* An array describing the pipe to pass to the process. The first element is the descriptor type and the second element is an option for the given type. Valid types are `pipe` (the second element is either `r` to pass the read end of the pipe to the process, or `w` to pass the write end) and `file` (the second element is a filename). Note that anything else than `w` is treated like `r`.
* A stream resource representing a real file descriptor (e.g. opened file, a socket, **`STDIN`**).
The file descriptor numbers are not limited to 0, 1 and 2 - you may specify any valid file descriptor number and it will be passed to the child process. This allows your script to interoperate with other scripts that run as "co-processes". In particular, this is useful for passing passphrases to programs like PGP, GPG and openssl in a more secure manner. It is also useful for reading status information provided by those programs on auxiliary file descriptors.
`pipes`
Will be set to an indexed array of file pointers that correspond to PHP's end of any pipes that are created.
`cwd`
The initial working dir for the command. This must be an *absolute* directory path, or **`null`** if you want to use the default value (the working dir of the current PHP process)
`env_vars`
An array with the environment variables for the command that will be run, or **`null`** to use the same environment as the current PHP process
`options`
Allows you to specify additional options. Currently supported options include:
* `suppress_errors` (windows only): suppresses errors generated by this function when it's set to **`true`**
* `bypass_shell` (windows only): bypass `cmd.exe` shell when set to **`true`**
* `blocking_pipes` (windows only): force blocking pipes when set to **`true`**
* `create_process_group` (windows only): allow the child process to handle `CTRL` events when set to **`true`**
* `create_new_console` (windows only): the new process has a new console, instead of inheriting its parent's console
### Return Values
Returns a resource representing the process, which should be freed using [proc\_close()](function.proc-close) when you are finished with it. On failure returns **`false`**.
### Changelog
| Version | Description |
| --- | --- |
| 7.4.4 | Added the `create_new_console` option to the `options` parameter. |
| 7.4.0 | **proc\_open()** now also accepts an array for the `command`. |
| 7.4.0 | Added the `create_process_group` option to the `options` parameter. |
### Examples
**Example #1 A **proc\_open()** example**
```
<?php
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file to write to
);
$cwd = '/tmp';
$env = array('some_option' => 'aeiou');
$process = proc_open('php', $descriptorspec, $pipes, $cwd, $env);
if (is_resource($process)) {
// $pipes now looks like this:
// 0 => writeable handle connected to child stdin
// 1 => readable handle connected to child stdout
// Any error output will be appended to /tmp/error-output.txt
fwrite($pipes[0], '<?php print_r($_ENV); ?>');
fclose($pipes[0]);
echo stream_get_contents($pipes[1]);
fclose($pipes[1]);
// It is important that you close any pipes before calling
// proc_close in order to avoid a deadlock
$return_value = proc_close($process);
echo "command returned $return_value\n";
}
?>
```
The above example will output something similar to:
```
Array
(
[some_option] => aeiou
[PWD] => /tmp
[SHLVL] => 1
[_] => /usr/local/bin/php
)
command returned 0
```
**Example #2 **proc\_open()** quirk on Windows**
While one may expect the following program to search the file filename.txt for the text `search` and to print the results, it behaves rather differently.
```
<?php
$descriptorspec = [STDIN, STDOUT, STDOUT];
$cmd = '"findstr" "search" "filename.txt"';
$proc = proc_open($cmd, $descriptorspec, $pipes);
proc_close($proc);
?>
```
The above example will output:
```
'findstr" "search" "filename.txt' is not recognized as an internal or external command,
operable program or batch file.
```
To work around that behavior, it is usually sufficient to enclose the `command` in additional quotes:
```
$cmd = '""findstr" "search" "filename.txt""';
```
### Notes
>
> **Note**:
>
>
> Windows compatibility: Descriptors beyond 2 (stderr) are made available to the child process as inheritable handles, but since the Windows architecture does not associate file descriptor numbers with low-level handles, the child process does not (yet) have a means of accessing those handles. Stdin, stdout and stderr work as expected.
>
>
>
> **Note**:
>
>
> If you only need a uni-directional (one-way) process pipe, use [popen()](function.popen) instead, as it is much easier to use.
>
>
### See Also
* [popen()](function.popen) - Opens process file pointer
* [exec()](function.exec) - Execute an external program
* [system()](function.system) - Execute an external program and display the output
* [passthru()](function.passthru) - Execute an external program and display raw output
* [stream\_select()](function.stream-select) - Runs the equivalent of the select() system call on the given arrays of streams with a timeout specified by seconds and microseconds
* The [backtick operator](language.operators.execution)
| programming_docs |
php radius_cvt_int radius\_cvt\_int
================
(PECL radius >= 1.1.0)
radius\_cvt\_int — Converts raw data to integer
### Description
```
radius_cvt_int(string $data): int
```
Converts raw data to integer
### Parameters
`data`
Input data
### Return Values
Returns the integer, retrieved from data.
### Examples
**Example #1 **radius\_cvt\_int()** example**
```
<?php
while ($resa = radius_get_attr($res)) {
if (!is_array($resa)) {
printf ("Error getting attribute: %s\n", radius_strerror($res));
exit;
}
$attr = $resa['attr'];
$data = $resa['data'];
switch ($attr) {
case RADIUS_FRAMED_MTU:
$mtu = radius_cvt_int($data);
echo "MTU: $mtu<br>\n";
break;
}
}
?>
```
### See Also
* [radius\_cvt\_addr()](function.radius-cvt-addr) - Converts raw data to IP-Address
* [radius\_cvt\_string()](function.radius-cvt-string) - Converts raw data to string
php sodium_crypto_sign_ed25519_pk_to_curve25519 sodium\_crypto\_sign\_ed25519\_pk\_to\_curve25519
=================================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_sign\_ed25519\_pk\_to\_curve25519 — Convert an Ed25519 public key to a Curve25519 public key
### Description
```
sodium_crypto_sign_ed25519_pk_to_curve25519(string $public_key): string
```
Given an Ed25519 public key, calculate the birationally equivalent X25519 public key.
### Parameters
`public_key`
Public key suitable for the crypto\_sign functions.
### Return Values
Public key suitable for the crypto\_box functions.
php session_get_cookie_params session\_get\_cookie\_params
============================
(PHP 4, PHP 5, PHP 7, PHP 8)
session\_get\_cookie\_params — Get the session cookie parameters
### Description
```
session_get_cookie_params(): array
```
Gets the session cookie parameters.
### Parameters
This function has no parameters.
### Return Values
Returns an array with the current session cookie information, the array contains the following items:
* ["lifetime"](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime) - The lifetime of the cookie in seconds.
* ["path"](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-path) - The path where information is stored.
* ["domain"](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-domain) - The domain of the cookie.
* ["secure"](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-secure) - The cookie should only be sent over secure connections.
* ["httponly"](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-httponly) - The cookie can only be accessed through the HTTP protocol.
* ["samesite"](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-samesite) - Controls the cross-domain sending of the cookie.
### Changelog
| Version | Description |
| --- | --- |
| 7.3.0 | The "samesite" entry was added in the returned array. |
### See Also
* [session.cookie\_lifetime](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime)
* [session.cookie\_path](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-path)
* [session.cookie\_domain](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-domain)
* [session.cookie\_secure](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-secure)
* [session.cookie\_httponly](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-httponly)
* [session.cookie\_samesite](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-samesite)
* [session\_set\_cookie\_params()](function.session-set-cookie-params) - Set the session cookie parameters
php CachingIterator::__construct CachingIterator::\_\_construct
==============================
(PHP 5, PHP 7, PHP 8)
CachingIterator::\_\_construct — Construct a new CachingIterator object for the iterator
### Description
public **CachingIterator::\_\_construct**([Iterator](class.iterator) `$iterator`, int `$flags` = CachingIterator::CALL\_TOSTRING)
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`iterator`
Iterator to cache
`flags`
Bitmask of flags.
php ReflectionAttribute::getTarget ReflectionAttribute::getTarget
==============================
(PHP 8)
ReflectionAttribute::getTarget — Returns the target of the attribute as bitmask
### Description
```
public ReflectionAttribute::getTarget(): int
```
Gets target of the attribute as bitmask.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
Gets target of the attribute as bitmask.
php imap_ping imap\_ping
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_ping — Check if the IMAP stream is still active
### Description
```
imap_ping(IMAP\Connection $imap): bool
```
**imap\_ping()** pings the stream to see if it's still active. It may discover new mail; this is the preferred method for a periodic "new mail check" as well as a "keep alive" for servers which have inactivity timeout.
### Parameters
`imap`
An [IMAP\Connection](class.imap-connection) instance.
### Return Values
Returns **`true`** if the stream is still alive, **`false`** otherwise.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `imap` parameter expects an [IMAP\Connection](class.imap-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **imap\_ping()** Example**
```
<?php
$imap = imap_open("{imap.example.org}", "mailadmin", "password");
// after some sleeping
if (!imap_ping($imap)) {
// do some stuff to reconnect
}
?>
```
php Ds\Vector::push Ds\Vector::push
===============
(PECL ds >= 1.0.0)
Ds\Vector::push — Adds values to the end of the vector
### Description
```
public Ds\Vector::push(mixed ...$values): void
```
Adds values to the end of the vector.
### Parameters
`values`
The values to add.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Vector::push()** example**
```
<?php
$vector = new \Ds\Vector();
$vector->push("a");
$vector->push("b");
$vector->push("c", "d");
$vector->push(...["e", "f"]);
print_r($vector);
?>
```
The above example will output something similar to:
```
Ds\Vector Object
(
[0] => a
[1] => b
[2] => c
[3] => d
[4] => e
[5] => f
)
```
php imageaffinematrixget imageaffinematrixget
====================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
imageaffinematrixget — Get an affine transformation matrix
### Description
```
imageaffinematrixget(int $type, array|float $options): array|false
```
Returns an affine transformation matrix.
### Parameters
`type`
One of the **`IMG_AFFINE_*`** constants.
`options`
If `type` is **`IMG_AFFINE_TRANSLATE`** or **`IMG_AFFINE_SCALE`**, `options` has to be an array with keys `x` and `y`, both having float values.
If `type` is **`IMG_AFFINE_ROTATE`**, **`IMG_AFFINE_SHEAR_HORIZONTAL`** or **`IMG_AFFINE_SHEAR_VERTICAL`**, `options` has to be a float specifying the angle.
### Return Values
An affine transformation matrix (an array with keys `0` to `5` and float values) or **`false`** on failure.
### Examples
**Example #1 **imageaffinematrixget()** example**
```
<?php
$matrix = imageaffinematrixget(IMG_AFFINE_TRANSLATE, array('x' => 2, 'y' => 3));
print_r($matrix);
?>
```
The above example will output:
```
Array
(
[0] => 1
[1] => 0
[2] => 0
[3] => 1
[4] => 2
[5] => 3
)
```
### See Also
* [imageaffine()](function.imageaffine) - Return an image containing the affine transformed src image, using an optional clipping area
* [imageaffinematrixconcat()](function.imageaffinematrixconcat) - Concatenate two affine transformation matrices
php QuickHashIntSet::loadFromFile QuickHashIntSet::loadFromFile
=============================
(PECL quickhash >= Unknown)
QuickHashIntSet::loadFromFile — This factory method creates a set from a file
### Description
```
public static QuickHashIntSet::loadFromFile(string $filename, int $size = ?, int $options = ?): QuickHashIntSet
```
This factory method creates a new set from a definition file on disk. The file format consists of 32 bit signed integers packed together in the Endianness that the system that the code runs on uses.
### Parameters
`filename`
The filename of the file to read the set from.
`size`
The amount of bucket lists to configure. The number you pass in will be automatically rounded up to the next power of two. It is also automatically limited from `4` to `4194304`.
`options`
The same options that the class' constructor takes; except that the size option is ignored. It is automatically calculated to be the same as the number of entries in the set, rounded up to the nearest power of two with a maximum limit of `4194304`.
### Return Values
Returns a new [QuickHashIntSet](class.quickhashintset).
### Examples
**Example #1 **QuickHashIntSet::loadFromFile()** example**
```
<?php
$file = dirname( __FILE__ ) . "/simple.set";
$set = QuickHashIntSet::loadFromFile(
$file,
QuickHashIntSet::DO_NOT_USE_ZEND_ALLOC
);
foreach( range( 0, 0x0f ) as $key )
{
printf( "Key %3d (%2x) is %s\n",
$key, $key,
$set->exists( $key ) ? 'set' : 'unset'
);
}
?>
```
The above example will output something similar to:
```
Key 0 ( 0) is unset
Key 1 ( 1) is set
Key 2 ( 2) is set
Key 3 ( 3) is set
Key 4 ( 4) is unset
Key 5 ( 5) is set
Key 6 ( 6) is unset
Key 7 ( 7) is set
Key 8 ( 8) is unset
Key 9 ( 9) is unset
Key 10 ( a) is unset
Key 11 ( b) is set
Key 12 ( c) is unset
Key 13 ( d) is set
Key 14 ( e) is unset
Key 15 ( f) is unset
```
php runkit7_constant_redefine runkit7\_constant\_redefine
===========================
(PECL runkit7 >= Unknown)
runkit7\_constant\_redefine — Redefine an already defined constant
### Description
```
runkit7_constant_redefine(string $constant_name, mixed $value, int $new_visibility = ?): bool
```
### Parameters
`constant_name`
Constant to redefine. Either the name of a global constant, or `classname::constname` indicating class constant.
`value`
Value to assign to the constant.
`new_visibility`
The new visibility of the constant, for class constants. Unchanged by default. One of the **`RUNKIT7_ACC_*`** constants.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [runkit7\_constant\_add()](function.runkit7-constant-add) - Similar to define(), but allows defining in class definitions as well
* [runkit7\_constant\_remove()](function.runkit7-constant-remove) - Remove/Delete an already defined constant
php RecursiveDirectoryIterator::__construct RecursiveDirectoryIterator::\_\_construct
=========================================
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
RecursiveDirectoryIterator::\_\_construct — Constructs a RecursiveDirectoryIterator
### Description
public **RecursiveDirectoryIterator::\_\_construct**(string `$directory`, int `$flags` = FilesystemIterator::KEY\_AS\_PATHNAME | FilesystemIterator::CURRENT\_AS\_FILEINFO) Constructs a **RecursiveDirectoryIterator()** for the provided `directory`.
### Parameters
`directory`
The path of the directory to be iterated over.
`flags`
Flags may be provided which will affect the behavior of some methods. A list of the flags can found under [FilesystemIterator predefined constants](class.filesystemiterator#filesystemiterator.constants). They can also be set later with [FilesystemIterator::setFlags()](filesystemiterator.setflags).
### Errors/Exceptions
Throws an [UnexpectedValueException](class.unexpectedvalueexception) if the `directory` does not exist.
Throws a [ValueError](class.valueerror) if the `directory` is an empty string.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Now throws a [ValueError](class.valueerror) if `directory` is an empty string; previously it threw a [RuntimeException](class.runtimeexception). |
### Examples
**Example #1 [RecursiveDirectoryIterator](class.recursivedirectoryiterator) example**
```
<?php
$directory = '/tmp';
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory));
$it->rewind();
while($it->valid()) {
if (!$it->isDot()) {
echo 'SubPathName: ' . $it->getSubPathName() . "\n";
echo 'SubPath: ' . $it->getSubPath() . "\n";
echo 'Key: ' . $it->key() . "\n\n";
}
$it->next();
}
?>
```
The above example will output something similar to:
```
SubPathName: fruit/apple.xml
SubPath: fruit
Key: /tmp/fruit/apple.xml
SubPathName: stuff.xml
SubPath:
Key: /tmp/stuff.xml
SubPathName: veggies/carrot.xml
SubPath: veggies
Key: /tmp/veggies/carrot.xml
```
### See Also
* [FilesystemIterator::\_\_construct()](filesystemiterator.construct) - Constructs a new filesystem iterator
* [RecursiveIteratorIterator::\_\_construct()](recursiveiteratoriterator.construct) - Construct a RecursiveIteratorIterator
* [FilesystemIterator predefined constants](class.filesystemiterator#filesystemiterator.constants)
php ImagickDraw::setFont ImagickDraw::setFont
====================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setFont — Sets the fully-specified font to use when annotating with text
### Description
```
public ImagickDraw::setFont(string $font_name): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Sets the fully-specified font to use when annotating with text.
### Parameters
`font_name`
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **ImagickDraw::setFont()** example**
```
<?php
function setFont($fillColor, $strokeColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFontSize(36);
$draw->setFont("../fonts/Arial.ttf");
$draw->annotation(50, 50, "Lorem Ipsum!");
$draw->setFont("../fonts/Consolas.ttf");
$draw->annotation(50, 100, "Lorem Ipsum!");
$draw->setFont("../fonts/CANDY.TTF");
$draw->annotation(50, 150, "Lorem Ipsum!");
$draw->setFont("../fonts/Inconsolata-dz.otf");
$draw->annotation(50, 200, "Lorem Ipsum!");
$imagick = new \Imagick();
$imagick->newImage(500, 300, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
php Ds\Set::clear Ds\Set::clear
=============
(PECL ds >= 1.0.0)
Ds\Set::clear — Removes all values
### Description
```
public Ds\Set::clear(): void
```
Removes all values from the set.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Set::clear()** example**
```
<?php
$set = new \Ds\Set([1, 2, 3]);
print_r($set);
$set->clear();
print_r($set);
?>
```
The above example will output something similar to:
```
Ds\Set Object
(
[0] => 1
[1] => 2
[2] => 3
)
Ds\Set Object
(
)
```
php shell_exec shell\_exec
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
shell\_exec — Execute command via shell and return the complete output as a string
### Description
```
shell_exec(string $command): string|false|null
```
This function is identical to the [backtick operator](language.operators.execution).
>
> **Note**:
>
>
> On Windows, the underlying pipe is opened in text mode which can cause the function to fail for binary output. Consider to use [popen()](function.popen) instead for such cases.
>
>
### Parameters
`command`
The command that will be executed.
### Return Values
A string containing the output from the executed command, **`false`** if the pipe cannot be established or **`null`** if an error occurs or the command produces no output.
>
> **Note**:
>
>
> This function can return **`null`** both when an error occurs or the program produces no output. It is not possible to detect execution failures using this function. [exec()](function.exec) should be used when access to the program exit code is required.
>
>
### Errors/Exceptions
An **`E_WARNING`** level error is generated when the pipe cannot be established.
### Examples
**Example #1 A **shell\_exec()** example**
```
<?php
$output = shell_exec('ls -lart');
echo "<pre>$output</pre>";
?>
```
### See Also
* [exec()](function.exec) - Execute an external program
* [escapeshellcmd()](function.escapeshellcmd) - Escape shell metacharacters
php fdf_set_submit_form_action fdf\_set\_submit\_form\_action
==============================
(PHP 4 >= 4.0.2, PHP 5 < 5.3.0, PECL fdf SVN)
fdf\_set\_submit\_form\_action — Sets a submit form action of a field
### Description
```
fdf_set_submit_form_action(
resource $fdf_document,
string $fieldname,
int $trigger,
string $script,
int $flags
): bool
```
Sets a submit form action for the given field.
### Parameters
`fdf_document`
The FDF document handle, returned by [fdf\_create()](function.fdf-create), [fdf\_open()](function.fdf-open) or [fdf\_open\_string()](function.fdf-open-string).
`fieldname`
Name of the FDF field, as a string.
`trigger`
`script`
`flags`
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [fdf\_set\_javascript\_action()](function.fdf-set-javascript-action) - Sets an javascript action of a field
php XMLWriter::startAttributeNs XMLWriter::startAttributeNs
===========================
xmlwriter\_start\_attribute\_ns
===============================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::startAttributeNs -- xmlwriter\_start\_attribute\_ns — Create start namespaced attribute
### Description
Object-oriented style
```
public XMLWriter::startAttributeNs(?string $prefix, string $name, ?string $namespace): bool
```
Procedural style
```
xmlwriter_start_attribute_ns(
XMLWriter $writer,
?string $prefix,
string $name,
?string $namespace
): bool
```
Starts a namespaced attribute.
### Parameters
`writer`
Only for procedural calls. The [XMLWriter](class.xmlwriter) instance that is being modified. This object is returned from a call to [xmlwriter\_open\_uri()](xmlwriter.openuri) or [xmlwriter\_open\_memory()](xmlwriter.openmemory).
`prefix`
The namespace prefix.
`name`
The attribute name.
`namespace`
The namespace URI. If `namespace` is **`null`**, the namespace declaration will be omitted.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `writer` expects an [XMLWriter](class.xmlwriter) instance now; previously, a resource was expected. |
| 8.0.0 | `prefix` is nullable now. |
### See Also
* [XMLWriter::startAttribute()](xmlwriter.startattribute) - Create start attribute
* [XMLWriter::endAttribute()](xmlwriter.endattribute) - End attribute
* [XMLWriter::writeAttribute()](xmlwriter.writeattribute) - Write full attribute
* [XMLWriter::writeAttributeNs()](xmlwriter.writeattributens) - Write full namespaced attribute
| programming_docs |
php ArrayIterator::ksort ArrayIterator::ksort
====================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
ArrayIterator::ksort — Sort entries by keys
### Description
```
public ArrayIterator::ksort(int $flags = SORT_REGULAR): bool
```
Sorts entries by their keys.
>
> **Note**:
>
>
> If two members compare as equal, they retain their original order. Prior to PHP 8.0.0, their relative order in the sorted array was undefined.
>
>
### Parameters
`flags`
The optional second parameter `flags` may be used to modify the sorting behavior using these values:
Sorting type flags:
* **`SORT_REGULAR`** - compare items normally; the details are described in the [comparison operators](language.operators.comparison) section
* **`SORT_NUMERIC`** - compare items numerically
* **`SORT_STRING`** - compare items as strings
* **`SORT_LOCALE_STRING`** - compare items as strings, based on the current locale. It uses the locale, which can be changed using [setlocale()](function.setlocale)
* **`SORT_NATURAL`** - compare items as strings using "natural ordering" like [natsort()](function.natsort)
* **`SORT_FLAG_CASE`** - can be combined (bitwise OR) with **`SORT_STRING`** or **`SORT_NATURAL`** to sort strings case-insensitively
### Return Values
Always returns **`true`**.
### See Also
* [ArrayIterator::asort()](arrayiterator.asort) - Sort entries by values
* [ArrayIterator::natcasesort()](arrayiterator.natcasesort) - Sort entries naturally, case insensitive
* [ArrayIterator::natsort()](arrayiterator.natsort) - Sort entries naturally
* [ArrayIterator::uasort()](arrayiterator.uasort) - Sort with a user-defined comparison function and maintain index association
* [ArrayIterator::uksort()](arrayiterator.uksort) - Sort by keys using a user-defined comparison function
* [ksort()](function.ksort) - Sort an array by key in ascending order
php dio_truncate dio\_truncate
=============
(PHP 4 >= 4.2.0, PHP 5 < 5.1.0)
dio\_truncate — Truncates file descriptor fd to offset bytes
### Description
```
dio_truncate(resource $fd, int $offset): bool
```
**dio\_truncate()** truncates a file to at most `offset` bytes in size.
If the file previously was larger than this size, the extra data is lost. If the file previously was shorter, it is unspecified whether the file is left unchanged or is extended. In the latter case the extended part reads as zero bytes.
### Parameters
`fd`
The file descriptor returned by [dio\_open()](function.dio-open).
`offset`
The offset in bytes.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Notes
> **Note**: This function is not implemented on Windows platforms.
>
>
php gzputs gzputs
======
(PHP 4, PHP 5, PHP 7, PHP 8)
gzputs — Alias of [gzwrite()](function.gzwrite)
### Description
This function is an alias of: [gzwrite()](function.gzwrite).
php mb_encode_mimeheader mb\_encode\_mimeheader
======================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
mb\_encode\_mimeheader — Encode string for MIME header
### Description
```
mb_encode_mimeheader(
string $string,
?string $charset = null,
?string $transfer_encoding = null,
string $newline = "\r\n",
int $indent = 0
): string
```
Encodes a given string `string` by the MIME header encoding scheme.
### Parameters
`string`
The string being encoded. Its encoding should be same as [mb\_internal\_encoding()](function.mb-internal-encoding).
`charset`
`charset` specifies the name of the character set in which `string` is represented in. The default value is determined by the current NLS setting (`mbstring.language`).
`transfer_encoding`
`transfer_encoding` specifies the scheme of MIME encoding. It should be either `"B"` (Base64) or `"Q"` (Quoted-Printable). Falls back to `"B"` if not given.
`newline`
`newline` specifies the EOL (end-of-line) marker with which **mb\_encode\_mimeheader()** performs line-folding (a [» RFC](http://www.faqs.org/rfcs/rfc2822) term, the act of breaking a line longer than a certain length into multiple lines. The length is currently hard-coded to 74 characters). Falls back to `"\r\n"` (CRLF) if not given.
`indent`
Indentation of the first line (number of characters in the header before `string`).
### Return Values
A converted version of the string represented in ASCII.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `charset` and `transfer_encoding` are nullable now. |
### Examples
**Example #1 **mb\_encode\_mimeheader()** example**
```
<?php
$name = "太郎"; // kanji
$mbox = "kru";
$doma = "gtinn.mon";
$addr = '"' . addcslashes(mb_encode_mimeheader($name, "UTF-7", "Q"), '"') . '" <' . $mbox . "@" . $doma . ">";
echo $addr;
?>
```
The above example will output:
```
"=?UTF-7?Q?+WSqQzg-?=" <[email protected]>
```
### Notes
>
> **Note**:
>
>
> This function isn't designed to break lines at higher-level contextual break points (word boundaries, etc.). This behaviour may clutter up the original string with unexpected spaces.
>
>
### See Also
* [mb\_decode\_mimeheader()](function.mb-decode-mimeheader) - Decode string in MIME header field
php ftp_get_option ftp\_get\_option
================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
ftp\_get\_option — Retrieves various runtime behaviours of the current FTP connection
### Description
```
ftp_get_option(FTP\Connection $ftp, int $option): int|bool
```
This function returns the value for the requested `option` from the specified FTP connection.
### Parameters
`ftp`
An [FTP\Connection](class.ftp-connection) instance.
`option`
Currently, the following options are supported:
**Supported runtime FTP options**| **`FTP_TIMEOUT_SEC`** | Returns the current timeout used for network related operations. |
| **`FTP_AUTOSEEK`** | Returns **`true`** if this option is on, **`false`** otherwise. |
### Return Values
Returns the value on success or **`false`** if the given `option` is not supported. In the latter case, a warning message is also thrown.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `ftp` parameter expects an [FTP\Connection](class.ftp-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **ftp\_get\_option()** example**
```
<?php
// Get the timeout of the given FTP connection
$timeout = ftp_get_option($ftp, FTP_TIMEOUT_SEC);
?>
```
### See Also
* [ftp\_set\_option()](function.ftp-set-option) - Set miscellaneous runtime FTP options
php Yaf_Exception::__construct Yaf\_Exception::\_\_construct
=============================
(Yaf >=1.0.0)
Yaf\_Exception::\_\_construct — The \_\_construct purpose
### Description
public **Yaf\_Exception::\_\_construct**()
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php DateTimeImmutable::__construct DateTimeImmutable::\_\_construct
================================
date\_create\_immutable
=======================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
DateTimeImmutable::\_\_construct -- date\_create\_immutable — Returns new DateTimeImmutable object
### Description
Object-oriented style
public **DateTimeImmutable::\_\_construct**(string `$datetime` = "now", ?[DateTimeZone](class.datetimezone) `$timezone` = **`null`**) Procedural style
```
date_create_immutable(string $datetime = "now", ?DateTimeZone $timezone = null): DateTimeImmutable|false
```
Returns new a DateTimeImmutable object.
### Parameters
`datetime`
A date/time string. Valid formats are explained in [Date and Time Formats](https://www.php.net/manual/en/datetime.formats.php).
Enter `"now"` here to obtain the current time when using the `$timezone` parameter.
`timezone`
A [DateTimeZone](class.datetimezone) object representing the timezone of `$datetime`.
If `$timezone` is omitted or **`null`**, the current timezone will be used.
>
> **Note**:
>
>
> The `$timezone` parameter and the current timezone are ignored when the `$datetime` parameter either is a UNIX timestamp (e.g. `@946684800`) or specifies a timezone (e.g. `2010-01-28T15:00:00+02:00`, or `2010-07-05T06:00:00Z`).
>
>
### Return Values
Returns a new DateTimeImmutable instance. Procedural style returns **`false`** on failure.
### Errors/Exceptions
Emits [Exception](class.exception) in case of an error.
### Changelog
| Version | Description |
| --- | --- |
| 7.1.0 | From now on microseconds are filled with actual value. Not with '00000'. |
### Examples
**Example #1 **DateTimeImmutable::\_\_construct()** example**
Object-oriented style
```
<?php
try {
$date = new DateTimeImmutable('2000-01-01');
} catch (Exception $e) {
echo $e->getMessage();
exit(1);
}
echo $date->format('Y-m-d');
?>
```
Procedural style
```
<?php
$date = date_create('2000-01-01');
if (!$date) {
$e = date_get_last_errors();
foreach ($e['errors'] as $error) {
echo "$error\n";
}
exit(1);
}
echo date_format($date, 'Y-m-d');
?>
```
The above examples will output:
```
2000-01-01
```
**Example #2 Intricacies of **DateTimeImmutable::\_\_construct()****
```
<?php
// Specified date/time in your computer's time zone.
$date = new DateTimeImmutable('2000-01-01');
echo $date->format('Y-m-d H:i:sP') . "\n";
// Specified date/time in the specified time zone.
$date = new DateTimeImmutable('2000-01-01', new DateTimeZone('Pacific/Nauru'));
echo $date->format('Y-m-d H:i:sP') . "\n";
// Current date/time in your computer's time zone.
$date = new DateTimeImmutable();
echo $date->format('Y-m-d H:i:sP') . "\n";
// Current date/time in the specified time zone.
$date = new DateTimeImmutable('now', new DateTimeZone('Pacific/Nauru'));
echo $date->format('Y-m-d H:i:sP') . "\n";
// Using a UNIX timestamp. Notice the result is in the UTC time zone.
$date = new DateTimeImmutable('@946684800');
echo $date->format('Y-m-d H:i:sP') . "\n";
// Non-existent values roll over.
$date = new DateTimeImmutable('2000-02-30');
echo $date->format('Y-m-d H:i:sP') . "\n";
?>
```
The above example will output something similar to:
```
2000-01-01 00:00:00-05:00
2000-01-01 00:00:00+12:00
2010-04-24 10:24:16-04:00
2010-04-25 02:24:16+12:00
2000-01-01 00:00:00+00:00
2000-03-01 00:00:00-05:00
```
**Example #3 Changing the associated timezone**
```
<?php
$timeZone = new \DateTimeZone('Asia/Tokyo');
$time = new \DateTimeImmutable();
$time = $time->setTimezone($timeZone);
echo $time->format('Y/m/d H:i:s'), "\n";
?>
```
The above example will output something similar to:
```
2022/08/12 23:49:23
```
**Example #4 Using a relative date/time string**
```
<?php
$time = new \DateTimeImmutable("-1 year");
echo $time->format('Y/m/d H:i:s'), "\n";
?>
```
The above example will output something similar to:
```
2021/08/12 15:43:51
```
php Yaf_Session::current Yaf\_Session::current
=====================
(Yaf >=1.0.0)
Yaf\_Session::current — The current purpose
### Description
```
public Yaf_Session::current(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php EventBufferEvent::connectHost EventBufferEvent::connectHost
=============================
(PECL event >= 1.2.6-beta)
EventBufferEvent::connectHost — Connects to a hostname with optionally asyncronous DNS resolving
### Description
```
public EventBufferEvent::connectHost(
EventDnsBase $dns_base ,
string $hostname ,
int $port ,
int $family = EventUtil::AF_UNSPEC
): bool
```
Resolves the DNS name hostname, looking for addresses of type `family` ( `EventUtil::AF_*` constants). If the name resolution fails, it invokes the event callback with an error event. If it succeeds, it launches a connection attempt just as [EventBufferEvent::connect()](eventbufferevent.connect) would.
`dns_base` is optional. May be **`null`**, or an object created with [EventDnsBase::\_\_construct()](eventdnsbase.construct) . For asyncronous hostname resolving pass a valid event dns base resource. Otherwise the hostname resolving will block.
>
> **Note**:
>
>
> [EventDnsBase](class.eventdnsbase) is available only if `Event` configured **--with-event-extra** ( `event_extra` library, *libevent protocol-specific functionality support including HTTP, DNS, and RPC* ).
>
>
>
> **Note**:
>
>
> **EventBufferEvent::connectHost()** requires `libevent-2.0.3-alpha` or greater.
>
>
### Parameters
`dns_base` Object of [EventDnsBase](class.eventdnsbase) in case if DNS is to be resolved asyncronously. Otherwise **`null`**.
`hostname` Hostname to connect to. Recognized formats are:
```
www.example.com (hostname)
1.2.3.4 (ipv4address)
::1 (ipv6address)
[::1] ([ipv6address])
```
`port` Port number
`family` Address family. **`EventUtil::AF_UNSPEC`** , **`EventUtil::AF_INET`** , or **`EventUtil::AF_INET6`** . See [EventUtil constants](class.eventutil#eventutil.constants) .
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **EventBufferEvent::connectHost()** example**
```
<?php
/* Read callback */
function readcb($bev, $base) {
//$input = $bev->input; //$bev->getInput();
//$pos = $input->search("TTP");
$pos = $bev->input->search("TTP");
while (($n = $bev->input->remove($buf, 1024)) > 0) {
echo $buf;
}
}
/* Event callback */
function eventcb($bev, $events, $base) {
if ($events & EventBufferEvent::CONNECTED) {
echo "Connected.\n";
} elseif ($events & (EventBufferEvent::ERROR | EventBufferEvent::EOF)) {
if ($events & EventBufferEvent::ERROR) {
echo "DNS error: ", $bev->getDnsErrorString(), PHP_EOL;
}
echo "Closing\n";
$base->exit();
exit("Done\n");
}
}
$base = new EventBase();
$dns_base = new EventDnsBase($base, TRUE); // We'll use async DNS resolving
if (!$dns_base) {
exit("Failed to init DNS Base\n");
}
$bev = new EventBufferEvent($base, /* use internal socket */ NULL,
EventBufferEvent::OPT_CLOSE_ON_FREE | EventBufferEvent::OPT_DEFER_CALLBACKS,
"readcb", /* writecb */ NULL, "eventcb", $base
);
if (!$bev) {
exit("Failed creating bufferevent socket\n");
}
//$bev->setCallbacks("readcb", /* writecb */ NULL, "eventcb", $base);
$bev->enable(Event::READ | Event::WRITE);
$output = $bev->output; //$bev->getOutput();
if (!$output->add(
"GET {$argv[2]} HTTP/1.0\r\n".
"Host: {$argv[1]}\r\n".
"Connection: Close\r\n\r\n"
)) {
exit("Failed adding request to output buffer\n");
}
if (!$bev->connectHost($dns_base, $argv[1], 80, EventUtil::AF_UNSPEC)) {
exit("Can't connect to host {$argv[1]}\n");
}
$base->dispatch();
?>
```
The above example will output something similar to:
```
Connected.
HTTP/1.0 301 Moved Permanently
Location: http://www.google.co.uk/
Content-Type: text/html; charset=UTF-8
Date: Sat, 09 Mar 2013 12:21:19 GMT
Expires: Mon, 08 Apr 2013 12:21:19 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 221
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.co.uk/">here</A>.
</BODY></HTML>
Closing
Done
```
### See Also
* [EventBufferEvent::connect()](eventbufferevent.connect) - Connect buffer event's file descriptor to given address or UNIX socket
php Imagick::setImageBorderColor Imagick::setImageBorderColor
============================
(PECL imagick 2, PECL imagick 3)
Imagick::setImageBorderColor — Sets the image border color
### Description
```
public Imagick::setImageBorderColor(mixed $border): bool
```
Sets the image border color.
### Parameters
`border`
The border color
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Changelog
| Version | Description |
| --- | --- |
| PECL imagick 2.1.0 | Now allows a string representing the color as a parameter. Previous versions allow only an ImagickPixel object. |
php ArrayObject::ksort ArrayObject::ksort
==================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
ArrayObject::ksort — Sort the entries by key
### Description
```
public ArrayObject::ksort(int $flags = SORT_REGULAR): bool
```
Sorts the entries by key, maintaining key to entry correlations. This is useful mainly for associative arrays.
>
> **Note**:
>
>
> If two members compare as equal, they retain their original order. Prior to PHP 8.0.0, their relative order in the sorted array was undefined.
>
>
### Parameters
`flags`
The optional second parameter `flags` may be used to modify the sorting behavior using these values:
Sorting type flags:
* **`SORT_REGULAR`** - compare items normally; the details are described in the [comparison operators](language.operators.comparison) section
* **`SORT_NUMERIC`** - compare items numerically
* **`SORT_STRING`** - compare items as strings
* **`SORT_LOCALE_STRING`** - compare items as strings, based on the current locale. It uses the locale, which can be changed using [setlocale()](function.setlocale)
* **`SORT_NATURAL`** - compare items as strings using "natural ordering" like [natsort()](function.natsort)
* **`SORT_FLAG_CASE`** - can be combined (bitwise OR) with **`SORT_STRING`** or **`SORT_NATURAL`** to sort strings case-insensitively
### Return Values
Always returns **`true`**.
### Examples
**Example #1 **ArrayObject::ksort()** example**
```
<?php
$fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple");
$fruitArrayObject = new ArrayObject($fruits);
$fruitArrayObject->ksort();
foreach ($fruitArrayObject as $key => $val) {
echo "$key = $val\n";
}
?>
```
The above example will output:
```
a = orange
b = banana
c = apple
d = lemon
```
### See Also
* [ArrayObject::asort()](arrayobject.asort) - Sort the entries by value
* [ArrayObject::natsort()](arrayobject.natsort) - Sort entries using a "natural order" algorithm
* [ArrayObject::natcasesort()](arrayobject.natcasesort) - Sort an array using a case insensitive "natural order" algorithm
* [ArrayObject::uasort()](arrayobject.uasort) - Sort the entries with a user-defined comparison function and maintain key association
* [ArrayObject::uksort()](arrayobject.uksort) - Sort the entries by keys using a user-defined comparison function
* [ksort()](function.ksort) - Sort an array by key in ascending order
php ReflectionParameter::getDeclaringClass ReflectionParameter::getDeclaringClass
======================================
(PHP 5 >= 5.1.3, PHP 7, PHP 8)
ReflectionParameter::getDeclaringClass — Gets declaring class
### Description
```
public ReflectionParameter::getDeclaringClass(): ?ReflectionClass
```
Gets the declaring class.
### Parameters
This function has no parameters.
### Return Values
A [ReflectionClass](class.reflectionclass) object or **`null`** if called on function.
### Examples
**Example #1 Getting the class that declared the method**
```
<?php
class Foo
{
public function bar(\DateTime $datetime)
{
}
}
class Baz extends Foo
{
}
$param = new \ReflectionParameter(['Baz', 'bar'], 0);
var_dump($param->getDeclaringClass());
```
The above example will output:
```
object(ReflectionClass)#2 (1) {
["name"]=>
string(3) "Foo"
}
```
### See Also
* [ReflectionParameter::getClass()](reflectionparameter.getclass) - Get a ReflectionClass object for the parameter being reflected or null
| programming_docs |
php SoapClient::__getLastResponse SoapClient::\_\_getLastResponse
===============================
(PHP 5, PHP 7, PHP 8)
SoapClient::\_\_getLastResponse — Returns last SOAP response
### Description
```
public SoapClient::__getLastResponse(): ?string
```
Returns the XML received in the last SOAP response.
>
> **Note**:
>
>
> This method works only if the [SoapClient](class.soapclient) object was created with the `trace` option set to **`true`**.
>
>
### Parameters
This function has no parameters.
### Return Values
The last SOAP response, as an XML string.
### Examples
**Example #1 SoapClient::\_\_getLastResponse() example**
```
<?php
$client = SoapClient("some.wsdl", array('trace' => 1));
$result = $client->SomeFunction();
echo "Response:\n" . $client->__getLastResponse() . "\n";
?>
```
### See Also
* [SoapClient::\_\_getLastResponseHeaders()](soapclient.getlastresponseheaders) - Returns the SOAP headers from the last response
* [SoapClient::\_\_getLastRequest()](soapclient.getlastrequest) - Returns last SOAP request
* [SoapClient::\_\_getLastRequestHeaders()](soapclient.getlastrequestheaders) - Returns the SOAP headers from the last request
php The IntlPartsIterator class
The IntlPartsIterator class
===========================
Introduction
------------
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
Objects of this class can be obtained from [IntlBreakIterator](class.intlbreakiterator) objects. While the break iterators provide a sequence of boundary positions when iterated, **IntlPartsIterator** objects provide, as a convenience, the text fragments comprehended between two successive boundaries.
The keys may represent the offset of the left boundary, right boundary, or they may just the sequence of non-negative integers. See [IntlBreakIterator::getPartsIterator()](intlbreakiterator.getpartsiterator).
Class synopsis
--------------
class **IntlPartsIterator** extends [IntlIterator](class.intliterator) { /\* Constants \*/ public const int [KEY\_SEQUENTIAL](class.intlpartsiterator#intlpartsiterator.constants.key-sequential);
public const int [KEY\_LEFT](class.intlpartsiterator#intlpartsiterator.constants.key-left);
public const int [KEY\_RIGHT](class.intlpartsiterator#intlpartsiterator.constants.key-right); /\* Methods \*/
```
public getBreakIterator(): IntlBreakIterator
```
/\* Inherited methods \*/
```
public IntlIterator::current(): mixed
```
```
public IntlIterator::key(): mixed
```
```
public IntlIterator::next(): void
```
```
public IntlIterator::rewind(): void
```
```
public IntlIterator::valid(): bool
```
} Predefined Constants
--------------------
**`IntlPartsIterator::KEY_SEQUENTIAL`** **`IntlPartsIterator::KEY_LEFT`** **`IntlPartsIterator::KEY_RIGHT`** Table of Contents
-----------------
* [IntlPartsIterator::getBreakIterator](intlpartsiterator.getbreakiterator) — Get IntlBreakIterator backing this parts iterator
php pg_tty pg\_tty
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
pg\_tty — Return the TTY name associated with the connection
### Description
```
pg_tty(?PgSql\Connection $connection = null): string
```
**pg\_tty()** returns the TTY name that server side debugging output is sent to on the given PostgreSQL `connection` instance.
>
> **Note**:
>
>
> **pg\_tty()** is obsolete, since the server no longer pays attention to the TTY setting, but the function remains for backwards compatibility.
>
>
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance. When `connection` is **`null`**, the default connection is used. The default connection is the last connection made by [pg\_connect()](function.pg-connect) or [pg\_pconnect()](function.pg-pconnect).
**Warning**As of PHP 8.1.0, using the default connection is deprecated.
### Return Values
A string containing the debug TTY of the `connection`.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. |
| 8.0.0 | `connection` is now nullable. |
### Examples
**Example #1 **pg\_tty()** example**
```
<?php
$pgsql_conn = pg_connect("dbname=mark host=localhost");
if ($pgsql_conn) {
print "Server debug TTY is: " . pg_tty($pgsql_conn) . "<br/>\n";
} else {
print pg_last_error($pgsql_conn);
exit;
}
?>
```
php imagerectangle imagerectangle
==============
(PHP 4, PHP 5, PHP 7, PHP 8)
imagerectangle — Draw a rectangle
### Description
```
imagerectangle(
GdImage $image,
int $x1,
int $y1,
int $x2,
int $y2,
int $color
): bool
```
**imagerectangle()** creates a rectangle starting at the specified coordinates.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`x1`
Upper left x coordinate.
`y1`
Upper left y coordinate 0, 0 is the top left corner of the image.
`x2`
Bottom right x coordinate.
`y2`
Bottom right y coordinate.
`color`
A color identifier created with [imagecolorallocate()](function.imagecolorallocate).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 Simple **imagerectangle()** example**
```
<?php
// Create a 200 x 200 image
$canvas = imagecreatetruecolor(200, 200);
// Allocate colors
$pink = imagecolorallocate($canvas, 255, 105, 180);
$white = imagecolorallocate($canvas, 255, 255, 255);
$green = imagecolorallocate($canvas, 132, 135, 28);
// Draw three rectangles each with its own color
imagerectangle($canvas, 50, 50, 150, 150, $pink);
imagerectangle($canvas, 45, 60, 120, 100, $white);
imagerectangle($canvas, 100, 120, 75, 160, $green);
// Output and free from memory
header('Content-Type: image/jpeg');
imagejpeg($canvas);
imagedestroy($canvas);
?>
```
The above example will output something similar to:
php Collator::create Collator::create
================
collator\_create
================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
Collator::create -- collator\_create — Create a collator
### Description
Object-oriented style
```
public static Collator::create(string $locale): ?Collator
```
Procedural style
```
collator_create(string $locale): ?Collator
```
The strings will be compared using the options already specified.
### Parameters
`locale`
The locale containing the required collation rules. Special values for locales can be passed in - if an empty string is passed for the locale, the default locale collation rules will be used. If `"root"` is passed, [» UCA](http://www.unicode.org/reports/tr10/) rules will be used.
### Return Values
Return new instance of [Collator](class.collator) object, or **`null`** on error.
### Examples
**Example #1 **collator\_create()** example**
```
<?php
$coll = collator_create( 'en_US' );
if( !isset( $coll ) ) {
printf( "Collator creation failed: %s\n", intl_get_error_message() );
exit( 1 );
}
?>
```
### See Also
* [Collator::\_\_construct()](collator.construct) - Create a collator
php radius_add_server radius\_add\_server
===================
(PECL radius >= 1.1.0)
radius\_add\_server — Adds a server
### Description
```
radius_add_server(
resource $radius_handle,
string $hostname,
int $port,
string $secret,
int $timeout,
int $max_tries
): bool
```
**radius\_add\_server()** may be called multiple times, and it may be used together with [radius\_config()](function.radius-config). At most 10 servers may be specified. When multiple servers are given, they are tried in round-robin fashion until a valid response is received, or until each server's `max_tries` limit has been reached.
### Parameters
`radius_handle`
`hostname`
The `hostname` parameter specifies the server host, either as a fully qualified domain name or as a dotted-quad IP address in text form.
`port`
The `port` specifies the UDP port to contact on the server. If port is given as 0, the library looks up the `radius/udp` or `radacct/udp` service in the network services database, and uses the port found there. If no entry is found, the library uses the standard Radius ports, 1812 for authentication and 1813 for accounting.
`secret`
The shared secret for the server host is passed to the `secret` parameter. The Radius protocol ignores all but the leading 128 bytes of the shared secret.
`timeout`
The timeout for receiving replies from the server is passed to the `timeout` parameter, in units of seconds.
`max_tries`
The maximum number of repeated requests to make before giving up is passed into the `max_tries`.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **radius\_add\_server()** example**
```
<?php
if (!radius_add_server($res, 'radius.example.com', 1812, 'testing123', 3, 3)) {
echo 'RadiusError:' . radius_strerror($res). "\n<br>";
exit;
}
?>
```
### See Also
* [radius\_config()](function.radius-config) - Causes the library to read the given configuration file
php SolrQuery::getGroupFormat SolrQuery::getGroupFormat
=========================
(PECL solr >= 2.2.0)
SolrQuery::getGroupFormat — Returns the group.format value
### Description
```
public SolrQuery::getGroupFormat(): string
```
Returns the group.format value
### Parameters
This function has no parameters.
### Return Values
### See Also
* [SolrQuery::setGroupFormat()](solrquery.setgroupformat) - Sets the group format, result structure (group.format parameter)
php DOMDocument::loadHTML DOMDocument::loadHTML
=====================
(PHP 5, PHP 7, PHP 8)
DOMDocument::loadHTML — Load HTML from a string
### Description
```
public DOMDocument::loadHTML(string $source, int $options = 0): DOMDocument|bool
```
The function parses the HTML contained in the string `source`. Unlike loading XML, HTML does not have to be well-formed to load. This function may also be called statically to load and create a [DOMDocument](class.domdocument) object. The static invocation may be used when no [DOMDocument](class.domdocument) properties need to be set prior to loading.
### Parameters
`source`
The HTML string.
`options`
Since Libxml 2.6.0, you may also use the `options` parameter to specify [additional Libxml parameters](https://www.php.net/manual/en/libxml.constants.php).
### Return Values
Returns **`true`** on success or **`false`** on failure. If called statically, returns a [DOMDocument](class.domdocument) or **`false`** on failure.
### Errors/Exceptions
If an empty string is passed as the `source`, a warning will be generated. This warning is not generated by libxml and cannot be handled using libxml's error handling functions.
Prior to PHP 8.0.0 this method *could* be called statically, but would issue an **`E_DEPRECATED`** error. As of PHP 8.0.0 calling this method statically throws an [Error](class.error) exception
While malformed HTML should load successfully, this function may generate **`E_WARNING`** errors when it encounters bad markup. [libxml's error handling functions](function.libxml-use-internal-errors) may be used to handle these errors.
### Examples
**Example #1 Creating a Document**
```
<?php
$doc = new DOMDocument();
$doc->loadHTML("<html><body>Test<br></body></html>");
echo $doc->saveHTML();
?>
```
### See Also
* [DOMDocument::loadHTMLFile()](domdocument.loadhtmlfile) - Load HTML from a file
* [DOMDocument::saveHTML()](domdocument.savehtml) - Dumps the internal document into a string using HTML formatting
* [DOMDocument::saveHTMLFile()](domdocument.savehtmlfile) - Dumps the internal document into a file using HTML formatting
php Imagick::tintImage Imagick::tintImage
==================
(PECL imagick 2, PECL imagick 3)
Imagick::tintImage — Applies a color vector to each pixel in the image
### Description
```
public Imagick::tintImage(mixed $tint, mixed $opacity, bool $legacy = false): bool
```
Applies a color vector to each pixel in the image. The length of the vector is 0 for black and white and at its maximum for the midtones. The vector weighing function is f(x)=(1-(4.0\*((x-0.5)\*(x-0.5)))).
### Parameters
`tint`
`opacity`
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Changelog
| Version | Description |
| --- | --- |
| PECL imagick 2.1.0 | Now allows a string representing the color as the first parameter and a float representing the opacity value as the second parameter. Previous versions allow only an ImagickPixel objects. |
### Examples
**Example #1 **Imagick::tintImage()****
```
<?php
function tintImage($r, $g, $b, $a) {
$a = $a / 100;
$imagick = new \Imagick();
$imagick->newPseudoImage(400, 400, 'gradient:black-white');
$tint = new \ImagickPixel("rgb($r, $g, $b)");
$opacity = new \ImagickPixel("rgb(128, 128, 128, $a)");
$imagick->tintImage($tint, $opacity);
$imagick->setImageFormat('png');
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
php Yaf_Controller_Abstract::getModuleName Yaf\_Controller\_Abstract::getModuleName
========================================
(Yaf >=1.0.0)
Yaf\_Controller\_Abstract::getModuleName — Get module name
### Description
```
public Yaf_Controller_Abstract::getModuleName(): string
```
get the controller's module name
### Parameters
This function has no parameters.
### Return Values
php DateTime::getLastErrors DateTime::getLastErrors
=======================
date\_get\_last\_errors
=======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
DateTime::getLastErrors -- date\_get\_last\_errors — Returns the warnings and errors
### Description
Object-oriented style
```
public static DateTime::getLastErrors(): array|false
```
Procedural style
```
date_get_last_errors(): array|false
```
Like [DateTimeImmutable::getLastErrors()](datetimeimmutable.getlasterrors) but works with [DateTime](class.datetime).
### Parameters
This function has no parameters.
### Return Values
Returns array containing info about warnings and errors, or **`false`** if there are neither warnings nor errors.
### See Also
* [DateTimeImmutable::getLastErrors()](datetimeimmutable.getlasterrors) - Returns the warnings and errors
php str_replace str\_replace
============
(PHP 4, PHP 5, PHP 7, PHP 8)
str\_replace — Replace all occurrences of the search string with the replacement string
### Description
```
str_replace(
array|string $search,
array|string $replace,
string|array $subject,
int &$count = null
): string|array
```
This function returns a string or an array with all occurrences of `search` in `subject` replaced with the given `replace` value.
If you don't need fancy replacing rules (like regular expressions), you should use this function instead of [preg\_replace()](function.preg-replace).
### Parameters
If `search` and `replace` are arrays, then **str\_replace()** takes a value from each array and uses them to search and replace on `subject`. If `replace` has fewer values than `search`, then an empty string is used for the rest of replacement values. If `search` is an array and `replace` is a string, then this replacement string is used for every value of `search`. The converse would not make sense, though.
If `search` or `replace` are arrays, their elements are processed first to last.
`search`
The value being searched for, otherwise known as the *needle*. An array may be used to designate multiple needles.
`replace`
The replacement value that replaces found `search` values. An array may be used to designate multiple replacements.
`subject`
The string or array being searched and replaced on, otherwise known as the *haystack*.
If `subject` is an array, then the search and replace is performed with every entry of `subject`, and the return value is an array as well.
`count`
If passed, this will be set to the number of replacements performed.
### Return Values
This function returns a string or an array with the replaced values.
### Examples
**Example #1 Basic **str\_replace()** examples**
```
<?php
// Provides: <body text='black'>
$bodytag = str_replace("%body%", "black", "<body text='%body%'>");
// Provides: Hll Wrld f PHP
$vowels = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U");
$onlyconsonants = str_replace($vowels, "", "Hello World of PHP");
// Provides: You should eat pizza, beer, and ice cream every day
$phrase = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy = array("pizza", "beer", "ice cream");
$newphrase = str_replace($healthy, $yummy, $phrase);
// Provides: 2
$str = str_replace("ll", "", "good golly miss molly!", $count);
echo $count;
?>
```
**Example #2 Examples of potential **str\_replace()** gotchas**
```
<?php
// Order of replacement
$str = "Line 1\nLine 2\rLine 3\r\nLine 4\n";
$order = array("\r\n", "\n", "\r");
$replace = '<br />';
// Processes \r\n's first so they aren't converted twice.
$newstr = str_replace($order, $replace, $str);
// Outputs F because A is replaced with B, then B is replaced with C, and so on...
// Finally E is replaced with F, because of left to right replacements.
$search = array('A', 'B', 'C', 'D', 'E');
$replace = array('B', 'C', 'D', 'E', 'F');
$subject = 'A';
echo str_replace($search, $replace, $subject);
// Outputs: apearpearle pear
// For the same reason mentioned above
$letters = array('a', 'p');
$fruit = array('apple', 'pear');
$text = 'a p';
$output = str_replace($letters, $fruit, $text);
echo $output;
?>
```
### Notes
> **Note**: This function is binary-safe.
>
>
**Caution** Replacement order gotcha
========================
Because **str\_replace()** replaces left to right, it might replace a previously inserted value when doing multiple replacements. See also the examples in this document.
>
> **Note**:
>
>
> This function is case-sensitive. Use [str\_ireplace()](function.str-ireplace) for case-insensitive replace.
>
>
### See Also
* [str\_ireplace()](function.str-ireplace) - Case-insensitive version of str\_replace
* [substr\_replace()](function.substr-replace) - Replace text within a portion of a string
* [preg\_replace()](function.preg-replace) - Perform a regular expression search and replace
* [strtr()](function.strtr) - Translate characters or replace substrings
php gmp_clrbit gmp\_clrbit
===========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_clrbit — Clear bit
### Description
```
gmp_clrbit(GMP $num, int $index): void
```
Clears (sets to 0) bit `index` in `num`. The index starts at 0.
### Parameters
`num`
A [GMP](class.gmp) object, an int or a numeric string.
`index`
The index of the bit to clear. Index 0 represents the least significant bit.
### Return Values
A [GMP](class.gmp) object.
### Examples
**Example #1 **gmp\_clrbit()** example**
```
<?php
$a = gmp_init("0xff");
gmp_clrbit($a, 0); // index starts at 0, least significant bit
echo gmp_strval($a) . "\n";
?>
```
The above example will output:
```
254
```
### Notes
>
> **Note**:
>
>
> Unlike most of the other GMP functions, **gmp\_clrbit()** must be called with a GMP object that already exists (using [gmp\_init()](function.gmp-init) for example). One will not be automatically created.
>
>
### See Also
* [gmp\_setbit()](function.gmp-setbit) - Set bit
* [gmp\_testbit()](function.gmp-testbit) - Tests if a bit is set
| programming_docs |
php simplexml_load_file simplexml\_load\_file
=====================
(PHP 5, PHP 7, PHP 8)
simplexml\_load\_file — Interprets an XML file into an object
### Description
```
simplexml_load_file(
string $filename,
?string $class_name = SimpleXMLElement::class,
int $options = 0,
string $namespace_or_prefix = "",
bool $is_prefix = false
): SimpleXMLElement|false
```
Convert the well-formed XML document in the given file to an object.
### Parameters
`filename`
Path to the XML file
`class_name`
You may use this optional parameter so that **simplexml\_load\_file()** will return an object of the specified class. That class should extend the [SimpleXMLElement](class.simplexmlelement) class.
`options`
Since Libxml 2.6.0, you may also use the `options` parameter to specify [additional Libxml parameters](https://www.php.net/manual/en/libxml.constants.php).
`namespace_or_prefix`
Namespace prefix or URI.
`is_prefix`
**`true`** if `namespace_or_prefix` is a prefix, **`false`** if it's a URI; defaults to **`false`**.
### Return Values
Returns an object of class [SimpleXMLElement](class.simplexmlelement) with properties containing the data held within the XML document, or **`false`** on failure.
**Warning**This function may return Boolean **`false`**, but may also return a non-Boolean value which evaluates to **`false`**. Please read the section on [Booleans](language.types.boolean) for more information. Use [the === operator](language.operators.comparison) for testing the return value of this function.
### Errors/Exceptions
Produces an **`E_WARNING`** error message for each error found in the XML data.
**Tip** Use [libxml\_use\_internal\_errors()](function.libxml-use-internal-errors) to suppress all XML errors, and [libxml\_get\_errors()](function.libxml-get-errors) to iterate over them afterwards.
### Examples
**Example #1 Interpret an XML document**
```
<?php
// The file test.xml contains an XML document with a root element
// and at least an element /[root]/title.
if (file_exists('test.xml')) {
$xml = simplexml_load_file('test.xml');
print_r($xml);
} else {
exit('Failed to open test.xml.');
}
?>
```
This script will display, on success:
```
SimpleXMLElement Object
(
[title] => Example Title
...
)
```
At this point, you can go about using `$xml->title` and any other elements.
### See Also
* [simplexml\_load\_string()](function.simplexml-load-string) - Interprets a string of XML into an object
* [SimpleXMLElement::\_\_construct()](simplexmlelement.construct) - Creates a new SimpleXMLElement object
* [Dealing with XML errors](https://www.php.net/manual/en/simplexml.examples-errors.php)
* [libxml\_use\_internal\_errors()](function.libxml-use-internal-errors) - Disable libxml errors and allow user to fetch error information as needed
* [Basic SimpleXML usage](https://www.php.net/manual/en/simplexml.examples-basic.php)
* [libxml\_set\_streams\_context()](function.libxml-set-streams-context) - Set the streams context for the next libxml document load or write
php runkit7_function_add runkit7\_function\_add
======================
(PECL runkit7 >= Unknown)
runkit7\_function\_add — Add a new function, similar to [create\_function()](function.create-function)
### Description
```
runkit7_function_add(
string $function_name,
string $argument_list,
string $code,
bool $return_by_reference = null,
string $doc_comment = null,
string $return_type = ?,
bool $is_strict = ?
): bool
```
```
runkit7_function_add(
string $function_name,
Closure $closure,
string $doc_comment = null,
string $return_type = ?,
bool $is_strict = ?
): bool
```
### Parameters
`function_name`
Name of the function to be created
`argument_list`
Comma separated argument list
`code`
Code making up the function
`closure`
A [closure](class.closure) that defines the function.
`return_by_reference`
Whether the function should return by reference.
`doc_comment`
The doc comment of the function.
`return_type`
The return type of the function.
`is_strict`
Whether the function should behave as if it were declared in a file with `strict_types=1`
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 A **runkit7\_function\_add()** example**
```
<?php
runkit7_function_add('testme','$a,$b','echo "The value of a is $a\n"; echo "The value of b is $b\n";');
testme(1,2);
?>
```
The above example will output:
```
The value of a is 1
The value of b is 2
```
### See Also
* [create\_function()](function.create-function) - Create a function dynamically by evaluating a string of code
* [runkit7\_function\_redefine()](function.runkit7-function-redefine) - Replace a function definition with a new implementation
* [runkit7\_function\_copy()](function.runkit7-function-copy) - Copy a function to a new function name
* [runkit7\_function\_rename()](function.runkit7-function-rename) - Change a function's name
* [runkit7\_function\_remove()](function.runkit7-function-remove) - Remove a function definition
* [runkit7\_method\_add()](function.runkit7-method-add) - Dynamically adds a new method to a given class
php EventBase::loop EventBase::loop
===============
(PECL event >= 1.2.6-beta)
EventBase::loop — Dispatch pending events
### Description
```
public EventBase::loop( int $flags = ?): bool
```
Wait for events to become active, and run their callbacks.
**Warning** Do *NOT* destroy the [EventBase](class.eventbase) object as long as resources of the associated `Event` objects are not released. Otherwise, it will lead to unpredictable results!
### Parameters
`flags` Optional flags. One of `EventBase::LOOP_*` constants. See [EventBase constants](class.eventbase#eventbase.constants) .
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [EventBase::dispatch()](eventbase.dispatch) - Dispatch pending events
php None User-defined functions
----------------------
A function may be defined using syntax such as the following:
**Example #1 Pseudo code to demonstrate function uses**
```
<?php
function foo($arg_1, $arg_2, /* ..., */ $arg_n)
{
echo "Example function.\n";
return $retval;
}
?>
```
Any valid PHP code may appear inside a function, even other functions and [class](language.oop5.basic#language.oop5.basic.class) definitions.
Function names follow the same rules as other labels in PHP. A valid function name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: `^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$`.
**Tip**See also the [Userland Naming Guide](https://www.php.net/manual/en/userlandnaming.php).
Functions need not be defined before they are referenced, *except* when a function is conditionally defined as shown in the two examples below.
When a function is defined in a conditional manner such as the two examples shown. Its definition must be processed *prior* to being called.
**Example #2 Conditional functions**
```
<?php
$makefoo = true;
/* We can't call foo() from here
since it doesn't exist yet,
but we can call bar() */
bar();
if ($makefoo) {
function foo()
{
echo "I don't exist until program execution reaches me.\n";
}
}
/* Now we can safely call foo()
since $makefoo evaluated to true */
if ($makefoo) foo();
function bar()
{
echo "I exist immediately upon program start.\n";
}
?>
```
**Example #3 Functions within functions**
```
<?php
function foo()
{
function bar()
{
echo "I don't exist until foo() is called.\n";
}
}
/* We can't call bar() yet
since it doesn't exist. */
foo();
/* Now we can call bar(),
foo()'s processing has
made it accessible. */
bar();
?>
```
All functions and classes in PHP have the global scope - they can be called outside a function even if they were defined inside and vice versa.
PHP does not support function overloading, nor is it possible to undefine or redefine previously-declared functions.
> **Note**: Function names are case-insensitive for the ASCII characters `A` to `Z`, though it is usually good form to call functions as they appear in their declaration.
>
>
Both [variable number of arguments](functions.arguments#functions.variable-arg-list) and [default arguments](functions.arguments#functions.arguments.default) are supported in functions. See also the function references for [func\_num\_args()](function.func-num-args), [func\_get\_arg()](function.func-get-arg), and [func\_get\_args()](function.func-get-args) for more information.
It is possible to call recursive functions in PHP.
**Example #4 Recursive functions**
```
<?php
function recursion($a)
{
if ($a < 20) {
echo "$a\n";
recursion($a + 1);
}
}
?>
```
> **Note**: Recursive function/method calls with over 100-200 recursion levels can smash the stack and cause a termination of the current script. Especially, infinite recursion is considered a programming error.
>
>
php V8Js::executeString V8Js::executeString
===================
(PECL v8js >= 0.1.0)
V8Js::executeString — Execute a string as Javascript code
### Description
```
public V8Js::executeString(string $script, string $identifier = "V8Js::executeString()", int $flags = V8Js::FLAG_NONE): mixed
```
Compiles and executes the string passed with `script` as Javascript code.
### Parameters
`script`
The code string to be executed.
`identifier`
Identifier string for the executed code. Used for debugging.
`flags`
Execution flags. This value must be one of the `V8Js::FLAG_*` constants, defaulting to **`V8Js::FLAG_NONE`**.
* **`V8Js::FLAG_NONE`**: no flags
* **`V8Js::FLAG_FORCE_ARRAY`**: forces all Javascript objects passed to PHP to be associative arrays
### Return Values
Returns the last variable instantiated in the Javascript code converted to matching PHP variable type.
php dechex dechex
======
(PHP 4, PHP 5, PHP 7, PHP 8)
dechex — Decimal to hexadecimal
### Description
```
dechex(int $num): string
```
Returns a string containing a hexadecimal representation of the given unsigned `num` argument.
The largest number that can be converted is **`PHP_INT_MAX`** `* 2 + 1` (or `-1`): on 32-bit platforms, this will be `4294967295` in decimal, which results in **dechex()** returning `ffffffff`.
### Parameters
`num`
The decimal value to convert.
As PHP's int type is signed, but **dechex()** deals with unsigned integers, negative integers will be treated as though they were unsigned.
### Return Values
Hexadecimal string representation of `num`.
### Examples
**Example #1 **dechex()** example**
```
<?php
echo dechex(10) . "\n";
echo dechex(47);
?>
```
The above example will output:
```
a
2f
```
**Example #2 **dechex()** example with large integers**
```
<?php
// The output below assumes a 32-bit platform.
// Note that the output is the same for all values.
echo dechex(-1)."\n";
echo dechex(PHP_INT_MAX * 2 + 1)."\n";
echo dechex(pow(2, 32) - 1)."\n";
?>
```
The above example will output:
```
ffffffff
ffffffff
ffffffff
```
### See Also
* [hexdec()](function.hexdec) - Hexadecimal to decimal
* [decbin()](function.decbin) - Decimal to binary
* [decoct()](function.decoct) - Decimal to octal
* [base\_convert()](function.base-convert) - Convert a number between arbitrary bases
php SVMModel::load SVMModel::load
==============
(PECL svm >= 0.1.00.1.0)
SVMModel::load — Load a saved SVM Model
### Description
```
public SVMModel::load(string $filename): bool
```
Load a model file ready for classification or regression.
### Parameters
`filename`
The filename of the model.
### Return Values
Throws SVMException on error. Returns true on success.
### See Also
* [SVMModel::save()](svmmodel.save) - Save a model to a file
php array_replace array\_replace
==============
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
array\_replace — Replaces elements from passed arrays into the first array
### Description
```
array_replace(array $array, array ...$replacements): array
```
**array\_replace()** replaces the values of `array` with values having the same keys in each of the following arrays. If a key from the first array exists in the second array, its value will be replaced by the value from the second array. If the key exists in the second array, and not the first, it will be created in the first array. If a key only exists in the first array, it will be left as is. If several arrays are passed for replacement, they will be processed in order, the later arrays overwriting the previous values.
**array\_replace()** is not recursive : it will replace values in the first array by whatever type is in the second array.
### Parameters
`array`
The array in which elements are replaced.
`replacements`
Arrays from which elements will be extracted. Values from later arrays overwrite the previous values.
### Return Values
Returns an array.
### Examples
**Example #1 **array\_replace()** example**
```
<?php
$base = array("orange", "banana", "apple", "raspberry");
$replacements = array(0 => "pineapple", 4 => "cherry");
$replacements2 = array(0 => "grape");
$basket = array_replace($base, $replacements, $replacements2);
print_r($basket);
?>
```
The above example will output:
```
Array
(
[0] => grape
[1] => banana
[2] => apple
[3] => raspberry
[4] => cherry
)
```
### See Also
* [array\_replace\_recursive()](function.array-replace-recursive) - Replaces elements from passed arrays into the first array recursively
* [array\_merge()](function.array-merge) - Merge one or more arrays
php ImagickDraw::setClipUnits ImagickDraw::setClipUnits
=========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setClipUnits — Sets the interpretation of clip path units
### Description
```
public ImagickDraw::setClipUnits(int $clip_units): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Sets the interpretation of clip path units.
### Parameters
`clip_units`
the number of clip units
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::setClipUnits()** example**
```
<?php
function setClipUnits($strokeColor, $fillColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeOpacity(1);
$draw->setStrokeWidth(2);
$clipPathName = 'testClipPath';
$draw->setClipUnits(\Imagick::RESOLUTION_PIXELSPERINCH);
$draw->pushClipPath($clipPathName);
$draw->rectangle(0, 0, 250, 250);
$draw->popClipPath();
$draw->setClipPath($clipPathName);
//RESOLUTION_PIXELSPERINCH
//RESOLUTION_PIXELSPERCENTIMETER
$draw->rectangle(200, 200, 300, 300);
$imagick = new \Imagick();
$imagick->newImage(500, 500, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
php Ds\Sequence::set Ds\Sequence::set
================
(PECL ds >= 1.0.0)
Ds\Sequence::set — Updates a value at a given index
### Description
```
abstract public Ds\Sequence::set(int $index, mixed $value): void
```
Updates a value at a given index.
### Parameters
`index`
The index of the value to update.
`value`
The new value.
### Return Values
No value is returned.
### Errors/Exceptions
[OutOfRangeException](class.outofrangeexception) if the index is not valid.
### Examples
**Example #1 **Ds\Sequence::set()** example**
```
<?php
$sequence = new \Ds\Vector(["a", "b", "c"]);
$sequence->set(1, "_");
print_r($sequence);
?>
```
The above example will output something similar to:
```
Ds\Vector Object
(
[0] => a
[1] => _
[2] => c
)
```
**Example #2 **Ds\Sequence::set()** example using array syntax**
```
<?php
$sequence = new \Ds\Vector(["a", "b", "c"]);
$sequence[1] = "_";
print_r($sequence);
?>
```
The above example will output something similar to:
```
Ds\Vector Object
(
[0] => a
[1] => _
[2] => c
)
```
php Imagick::transposeImage Imagick::transposeImage
=======================
(PECL imagick 2, PECL imagick 3)
Imagick::transposeImage — Creates a vertical mirror image
### Description
```
public Imagick::transposeImage(): bool
```
Creates a vertical mirror image by reflecting the pixels around the central x-axis while rotating them 90-degrees. This method is available if Imagick has been compiled against ImageMagick version 6.2.9 or newer.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::transposeImage()****
```
<?php
function transposeImage($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->transposeImage();
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
### See Also
* [Imagick::transverseImage()](imagick.transverseimage) - Creates a horizontal mirror image
php SyncReaderWriter::writelock SyncReaderWriter::writelock
===========================
(PECL sync >= 1.0.0)
SyncReaderWriter::writelock — Waits for an exclusive write lock
### Description
```
public SyncReaderWriter::writelock(int $wait = -1): bool
```
Obtains an exclusive write lock on a [SyncReaderWriter](class.syncreaderwriter) object.
### Parameters
`wait`
The number of milliseconds to wait for a lock. A value of -1 is infinite.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **SyncReaderWriter::writelock()** example**
```
<?php
$readwrite = new SyncReaderWriter("FileCacheLock");
$readwrite->writelock();
/* ... */
$readwrite->writeunlock();
?>
```
### See Also
* [SyncReaderWriter::writeunlock()](syncreaderwriter.writeunlock) - Releases a write lock
php readline_callback_read_char readline\_callback\_read\_char
==============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
readline\_callback\_read\_char — Reads a character and informs the readline callback interface when a line is received
### Description
```
readline_callback_read_char(): void
```
Reads a character of user input. When a line is received, this function informs the readline callback interface installed using [readline\_callback\_handler\_install()](function.readline-callback-handler-install) that a line is ready for input.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Examples
See [readline\_callback\_handler\_install()](function.readline-callback-handler-install) for an example of how to use the readline callback interface.
### See Also
* [readline\_callback\_handler\_install()](function.readline-callback-handler-install) - Initializes the readline callback interface and terminal, prints the prompt and returns immediately
* [readline\_callback\_handler\_remove()](function.readline-callback-handler-remove) - Removes a previously installed callback handler and restores terminal settings
php PhpToken::isIgnorable PhpToken::isIgnorable
=====================
(PHP 8)
PhpToken::isIgnorable — Tells whether the token would be ignored by the PHP parser.
### Description
```
public PhpToken::isIgnorable(): bool
```
Tells whether the token would be ignored by the PHP parser.
### Parameters
This function has no parameters.
### Return Values
A boolean value whether the token would be ignored by the PHP parser (such as whitespace or comments).
### Examples
**Example #1 **PhpToken::isIgnorable()** example**
```
<?php
$echo = new PhpToken(T_ECHO, 'echo');
var_dump($echo->isIgnorable()); // -> bool(false)
$space = new PhpToken(T_WHITESPACE, ' ');
var_dump($space->isIgnorable()); // -> bool(true)
```
### See Also
* [PhpToken::tokenize()](phptoken.tokenize) - Splits given source into PHP tokens, represented by PhpToken objects.
| programming_docs |
php sodium_crypto_kx_secretkey sodium\_crypto\_kx\_secretkey
=============================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_kx\_secretkey — Extract the secret key from a crypto\_kx keypair.
### Description
```
sodium_crypto_kx_secretkey(string $key_pair): string
```
Extract the secret key from a crypto\_kx keypair.
### Parameters
`key_pair`
X25519 keypair, such as one generated by [sodium\_crypto\_kx\_keypair()](function.sodium-crypto-kx-keypair).
### Return Values
X25519 secret key.
php Imagick::getFont Imagick::getFont
================
(PECL imagick 2 >= 2.1.0, PECL imagick 3)
Imagick::getFont — Gets font
### Description
```
public Imagick::getFont(): string
```
Returns the objects font property. This method is available if Imagick has been compiled against ImageMagick version 6.3.7 or newer.
### Parameters
This function has no parameters.
### Return Values
Returns the string containing the font name or **`false`** if not font is set.
### See Also
* [Imagick::setFont()](imagick.setfont) - Sets font
* [ImagickDraw::setFont()](imagickdraw.setfont) - Sets the fully-specified font to use when annotating with text
* [ImagickDraw::getFont()](imagickdraw.getfont) - Returns the font
php The GearmanWorker class
The GearmanWorker class
=======================
Introduction
------------
(PECL gearman >= 0.5.0)
Class synopsis
--------------
class **GearmanWorker** { /\* Methods \*/
```
public addFunction(
string $function_name,
callable $function,
mixed &$context = ?,
int $timeout = ?
): bool
```
```
public addOptions(int $option): bool
```
```
public addServer(string $host = 127.0.0.1, int $port = 4730): bool
```
```
public addServers(string $servers = 127.0.0.1:4730): bool
```
```
public clone(): void
```
```
public __construct()
```
```
public echo(string $workload): bool
```
```
public error(): string
```
```
public getErrno(): int
```
```
public options(): int
```
```
public register(string $function_name, int $timeout = ?): bool
```
```
public removeOptions(int $option): bool
```
```
public returnCode(): int
```
```
public setId(string $id): bool
```
```
public setOptions(int $option): bool
```
```
public setTimeout(int $timeout): bool
```
```
public timeout(): int
```
```
public unregister(string $function_name): bool
```
```
public unregisterAll(): bool
```
```
public wait(): bool
```
```
public work(): bool
```
} Table of Contents
-----------------
* [GearmanWorker::addFunction](gearmanworker.addfunction) — Register and add callback function
* [GearmanWorker::addOptions](gearmanworker.addoptions) — Add worker options
* [GearmanWorker::addServer](gearmanworker.addserver) — Add a job server
* [GearmanWorker::addServers](gearmanworker.addservers) — Add job servers
* [GearmanWorker::clone](gearmanworker.clone) — Create a copy of the worker
* [GearmanWorker::\_\_construct](gearmanworker.construct) — Create a GearmanWorker instance
* [GearmanWorker::echo](gearmanworker.echo) — Test job server response
* [GearmanWorker::error](gearmanworker.error) — Get the last error encountered
* [GearmanWorker::getErrno](gearmanworker.geterrno) — Get errno
* [GearmanWorker::options](gearmanworker.options) — Get worker options
* [GearmanWorker::register](gearmanworker.register) — Register a function with the job server
* [GearmanWorker::removeOptions](gearmanworker.removeoptions) — Remove worker options
* [GearmanWorker::returnCode](gearmanworker.returncode) — Get last Gearman return code
* [GearmanWorker::setId](gearmanworker.setid) — Give the worker an identifier so it can be tracked when asking gearmand for the list of available workers
* [GearmanWorker::setOptions](gearmanworker.setoptions) — Set worker options
* [GearmanWorker::setTimeout](gearmanworker.settimeout) — Set socket I/O activity timeout
* [GearmanWorker::timeout](gearmanworker.timeout) — Get socket I/O activity timeout
* [GearmanWorker::unregister](gearmanworker.unregister) — Unregister a function name with the job servers
* [GearmanWorker::unregisterAll](gearmanworker.unregisterall) — Unregister all function names with the job servers
* [GearmanWorker::wait](gearmanworker.wait) — Wait for activity from one of the job servers
* [GearmanWorker::work](gearmanworker.work) — Wait for and perform jobs
php Ds\Sequence::last Ds\Sequence::last
=================
(PECL ds >= 1.0.0)
Ds\Sequence::last — Returns the last value
### Description
```
abstract public Ds\Sequence::last(): mixed
```
Returns the last value in the sequence.
### Parameters
This function has no parameters.
### Return Values
The last value in the sequence.
### Errors/Exceptions
[UnderflowException](class.underflowexception) if empty.
### Examples
**Example #1 **Ds\Sequence::last()** example**
```
<?php
$sequence = new \Ds\Vector([1, 2, 3]);
var_dump($sequence->last());
?>
```
The above example will output something similar to:
```
int(3)
```
php SolrQuery::getHighlightMaxAlternateFieldLength SolrQuery::getHighlightMaxAlternateFieldLength
==============================================
(PECL solr >= 0.9.2)
SolrQuery::getHighlightMaxAlternateFieldLength — Returns the maximum number of characters of the field to return
### Description
```
public SolrQuery::getHighlightMaxAlternateFieldLength(string $field_override = ?): int
```
Returns the maximum number of characters of the field to return
### Parameters
`field_override`
The name of the field
### Return Values
Returns an integer on success and **`null`** if not set.
php GearmanWorker::setOptions GearmanWorker::setOptions
=========================
(PECL gearman >= 0.5.0)
GearmanWorker::setOptions — Set worker options
### Description
```
public GearmanWorker::setOptions(int $option): bool
```
Sets one or more options to the supplied value.
### Parameters
`option`
The options to be set
### Return Values
Always returns **`true`**.
### See Also
* [GearmanWorker::options()](gearmanworker.options) - Get worker options
* [GearmanWorker::addOptions()](gearmanworker.addoptions) - Add worker options
* [GearmanWorker::removeOptions()](gearmanworker.removeoptions) - Remove worker options
* [GearmanClient::setOptions()](gearmanclient.setoptions) - Set client options
php Ds\Deque::jsonSerialize Ds\Deque::jsonSerialize
=======================
(PECL ds >= 1.0.0)
Ds\Deque::jsonSerialize — Returns a representation that can be converted to JSON
See [JsonSerializable::jsonSerialize()](jsonserializable.jsonserialize)
>
> **Note**:
>
>
> You should never need to call this directly.
>
>
php The Yar_Concurrent_Client class
The Yar\_Concurrent\_Client class
=================================
Introduction
------------
(No version information available, might only be in Git)
Class synopsis
--------------
class **Yar\_Concurrent\_Client** { /\* Properties \*/ static [$\_callstack](class.yar-concurrent-client#yar-concurrent-client.props.callstack);
static [$\_callback](class.yar-concurrent-client#yar-concurrent-client.props.callback);
static [$\_error\_callback](class.yar-concurrent-client#yar-concurrent-client.props.error-callback); /\* Methods \*/
```
public static call(
string $uri,
string $method,
array $parameters = ?,
callable $callback = ?,
callable $error_callback = ?,
array $options = ?
): int
```
```
public static loop(callable $callback = ?, callable $error_callback = ?): bool
```
```
public static reset(): bool
```
} Properties
----------
\_callstack \_callback \_error\_callback Table of Contents
-----------------
* [Yar\_Concurrent\_Client::call](yar-concurrent-client.call) — Register a concurrent call
* [Yar\_Concurrent\_Client::loop](yar-concurrent-client.loop) — Send all calls
* [Yar\_Concurrent\_Client::reset](yar-concurrent-client.reset) — Clean all registered calls
php None Literal types
-------------
Literal types are type which not only check the type of a value but also the value itself. PHP has support for two literal types: `false` as of PHP 8.0.0, and `true` as of PHP 8.2.0.
**Warning** Prior to PHP 8.2.0 the `false` type could only be used as part of a [union type](language.types.type-system#language.types.type-system.composite.union).
> **Note**: It is not possible to define custom literal types. Consider using an [enumerations](language.types.enumerations) instead.
>
>
php streamWrapper::stream_close streamWrapper::stream\_close
============================
(PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8)
streamWrapper::stream\_close — Close a resource
### Description
```
public streamWrapper::stream_close(): void
```
This method is called in response to [fclose()](function.fclose).
All resources that were locked, or allocated, by the wrapper should be released.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### See Also
* [fclose()](function.fclose) - Closes an open file pointer
* [streamWrapper::dir\_closedir()](streamwrapper.dir-closedir) - Close directory handle
php fdf_create fdf\_create
===========
(PHP 4, PHP 5 < 5.3.0, PECL fdf SVN)
fdf\_create — Create a new FDF document
### Description
```
fdf_create(): resource
```
Creates a new FDF document.
This function is needed if one would like to populate input fields in a PDF document with data.
### Parameters
This function has no parameters.
### Return Values
Returns a FDF document handle, or **`false`** on error.
### Examples
**Example #1 Populating a PDF document**
```
<?php
$outfdf = fdf_create();
fdf_set_value($outfdf, "volume", $volume, 0);
fdf_set_file($outfdf, "http:/testfdf/resultlabel.pdf");
fdf_save($outfdf, "outtest.fdf");
fdf_close($outfdf);
Header("Content-type: application/vnd.fdf");
$fp = fopen("outtest.fdf", "r");
fpassthru($fp);
unlink("outtest.fdf");
?>
```
### See Also
* [fdf\_close()](function.fdf-close) - Close an FDF document
* [fdf\_save()](function.fdf-save) - Save a FDF document
* [fdf\_open()](function.fdf-open) - Open a FDF document
php SolrModifiableParams::__construct SolrModifiableParams::\_\_construct
===================================
(PECL solr >= 0.9.2)
SolrModifiableParams::\_\_construct — Constructor
### Description
public **SolrModifiableParams::\_\_construct**() Constructor
### Parameters
This function has no parameters.
### Return Values
None
php virtual virtual
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
virtual — Perform an Apache sub-request
### Description
```
virtual(string $uri): bool
```
**virtual()** is an Apache-specific function which is similar to `<!--#include virtual...-->` in `mod_include`. It performs an Apache sub-request. It is useful for including CGI scripts or .shtml files, or anything else that you would parse through Apache. Note that for a CGI script, the script must generate valid CGI headers. At the minimum that means it must generate a `Content-Type` header.
To run the sub-request, all buffers are terminated and flushed to the browser, pending headers are sent too.
This function is supported when PHP is installed as an Apache module webserver.
### Parameters
`uri`
The file that the virtual command will be performed on.
### Return Values
Performs the virtual command on success, or returns **`false`** on failure.
### Examples
See [apache\_note()](function.apache-note) for an example.
### Notes
**Warning** The query string can be passed to the included file but [$\_GET](reserved.variables.get) is copied from the parent script and only [$\_SERVER['QUERY\_STRING']](reserved.variables.server) is filled with the passed query string. The query string may only be passed when using Apache 2. The requested file will not be listed in the Apache access log.
>
> **Note**:
>
>
> Environment variables set in the requested file are not visible to the calling script.
>
>
>
> **Note**:
>
>
> This function may be used on PHP files. However, it is typically better to use [include](function.include) or [require](function.require) for PHP files.
>
>
### See Also
* [apache\_note()](function.apache-note) - Get and set apache request notes
php fbird_service_attach fbird\_service\_attach
======================
(PHP 5, PHP 7 < 7.4.0)
fbird\_service\_attach — Alias of [ibase\_service\_attach()](function.ibase-service-attach)
### Description
This function is an alias of: [ibase\_service\_attach()](function.ibase-service-attach).
php eio_rename eio\_rename
===========
(PECL eio >= 0.0.1dev)
eio\_rename — Change the name or location of a file
### Description
```
eio_rename(
string $path,
string $new_path,
int $pri = EIO_PRI_DEFAULT,
callable $callback = NULL,
mixed $data = NULL
): resource
```
**eio\_rename()** renames or moves a file to new location.
### Parameters
`path`
Source path
`new_path`
Target path
`pri`
The request priority: **`EIO_PRI_DEFAULT`**, **`EIO_PRI_MIN`**, **`EIO_PRI_MAX`**, or **`null`**. If **`null`** passed, `pri` internally is set to **`EIO_PRI_DEFAULT`**.
`callback`
`callback` function is called when the request is done. It should match the following prototype:
```
void callback(mixed $data, int $result[, resource $req]);
```
`data`
is custom data passed to the request.
`result`
request-specific result value; basically, the value returned by corresponding system call.
`req`
is optional request resource which can be used with functions like [eio\_get\_last\_error()](function.eio-get-last-error)
`data`
Arbitrary variable passed to `callback`.
### Return Values
**eio\_rename()** returns request resource on success, or **`false`** on failure.
### Examples
**Example #1 **eio\_rename()** example**
```
<?php
$filename = dirname(__FILE__)."/eio-temp-file.dat";
touch($filename);
$new_filename = dirname(__FILE__)."/eio-temp-file-new.dat";
function my_rename_cb($data, $result) {
global $filename, $new_filename;
if ($result == 0 && !file_exists($filename) && file_exists($new_filename)) {
@unlink($new_filename);
echo "eio_rename_ok";
} else {
@unlink($filename);
}
}
eio_rename($filename, $new_filename, EIO_PRI_DEFAULT, "my_rename_cb", $filename);
eio_event_loop();
?>
```
The above example will output something similar to:
```
eio_rename_ok
```
php unserialize unserialize
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
unserialize — Creates a PHP value from a stored representation
### Description
```
unserialize(string $data, array $options = []): mixed
```
**unserialize()** takes a single serialized variable and converts it back into a PHP value.
**Warning** Do not pass untrusted user input to **unserialize()** regardless of the `options` value of `allowed_classes`. Unserialization can result in code being loaded and executed due to object instantiation and autoloading, and a malicious user may be able to exploit this. Use a safe, standard data interchange format such as JSON (via [json\_decode()](function.json-decode) and [json\_encode()](function.json-encode)) if you need to pass serialized data to the user.
If you need to unserialize externally-stored serialized data, consider using [hash\_hmac()](function.hash-hmac) for data validation. Make sure data is not modified by anyone but you.
### Parameters
`data`
The serialized string.
If the variable being unserialized is an object, after successfully reconstructing the object PHP will automatically attempt to call the [\_\_unserialize()](language.oop5.magic#object.unserialize) or [\_\_wakeup()](language.oop5.magic#object.wakeup) methods (if one exists).
>
> **Note**: **unserialize\_callback\_func directive**
>
>
>
> It's possible to set a callback-function which will be called, if an undefined class should be instantiated during unserializing. (to prevent getting an incomplete object "\_\_PHP\_Incomplete\_Class".) Use your php.ini, [ini\_set()](function.ini-set) or .htaccess to define [unserialize\_callback\_func](https://www.php.net/manual/en/var.configuration.php#ini.unserialize-callback-func). Everytime an undefined class should be instantiated, it'll be called. To disable this feature just empty this setting.
>
>
`options`
Any options to be provided to **unserialize()**, as an associative array.
**Valid options**| Name | Type | Description |
| --- | --- | --- |
| `allowed_classes` | [mixed](language.types.declarations#language.types.declarations.mixed) | Either an array of class names which should be accepted, **`false`** to accept no classes, or **`true`** to accept all classes. If this option is defined and **unserialize()** encounters an object of a class that isn't to be accepted, then the object will be instantiated as **\_\_PHP\_Incomplete\_Class** instead. Omitting this option is the same as defining it as **`true`**: PHP will attempt to instantiate objects of any class. |
| `max_depth` | int | The maximum depth of structures permitted during unserialization, and is intended to prevent stack overflows. The default depth limit is `4096` and can be disabled by setting `max_depth` to `0`. |
### Return Values
The converted value is returned, and can be a bool, int, float, string, array or object.
In case the passed string is not unserializeable, **`false`** is returned and **`E_NOTICE`** is issued.
### Errors/Exceptions
Objects may throw [Throwable](class.throwable)s in their unserialization handlers.
### Changelog
| Version | Description |
| --- | --- |
| 7.4.0 | Added the `max_depth` element of `options` to set the maximum depth of structures permitted during unserialization. |
| 7.1.0 | The `allowed_classes` element of `options`) is now strictly typed, i.e. if anything other than an array or a bool is given, **unserialize()** returns **`false`** and issues an **`E_WARNING`**. |
### Examples
**Example #1 **unserialize()** example**
```
<?php
// Here, we use unserialize() to load session data to the
// $session_data array from the string selected from a database.
// This example complements the one described with serialize().
$conn = odbc_connect("webdb", "php", "chicken");
$stmt = odbc_prepare($conn, "SELECT data FROM sessions WHERE id = ?");
$sqldata = array($_SERVER['PHP_AUTH_USER']);
if (!odbc_execute($stmt, $sqldata) || !odbc_fetch_into($stmt, $tmp)) {
// if the execute or fetch fails, initialize to empty array
$session_data = array();
} else {
// we should now have the serialized data in $tmp[0].
$session_data = unserialize($tmp[0]);
if (!is_array($session_data)) {
// something went wrong, initialize to empty array
$session_data = array();
}
}
?>
```
**Example #2 unserialize\_callback\_func example**
```
<?php
$serialized_object='O:1:"a":1:{s:5:"value";s:3:"100";}';
ini_set('unserialize_callback_func', 'mycallback'); // set your callback_function
function mycallback($classname)
{
// just include a file containing your class definition
// you get $classname to figure out which class definition is required
}
?>
```
### Notes
**Warning** **`false`** is returned both in the case of an error and if unserializing the serialized **`false`** value. It is possible to catch this special case by comparing `data` with `serialize(false)` or by catching the issued **`E_NOTICE`**.
### See Also
* [json\_encode()](function.json-encode) - Returns the JSON representation of a value
* [json\_decode()](function.json-decode) - Decodes a JSON string
* [hash\_hmac()](function.hash-hmac) - Generate a keyed hash value using the HMAC method
* [serialize()](function.serialize) - Generates a storable representation of a value
* [Autoloading Classes](language.oop5.autoload)
* [unserialize\_callback\_func](https://www.php.net/manual/en/var.configuration.php#ini.unserialize-callback-func)
* [unserialize\_max\_depth](https://www.php.net/manual/en/var.configuration.php#ini.unserialize-max-depth)
* [\_\_wakeup()](language.oop5.magic#object.wakeup)
* [\_\_serialize()](language.oop5.magic#object.serialize)
* [\_\_unserialize()](language.oop5.magic#object.unserialize)
| programming_docs |
php mysqli::$warning_count mysqli::$warning\_count
=======================
mysqli\_warning\_count
======================
(PHP 5, PHP 7, PHP 8)
mysqli::$warning\_count -- mysqli\_warning\_count — Returns the number of warnings from the last query for the given link
### Description
Object-oriented style
int [$mysqli->warning\_count](mysqli.warning-count); Procedural style
```
mysqli_warning_count(mysqli $mysql): int
```
Returns the number of warnings from the last query in the connection.
>
> **Note**:
>
>
> For retrieving warning messages you can use the SQL command `SHOW WARNINGS [limit row_count]`.
>
>
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
### Return Values
Number of warnings or zero if there are no warnings.
### Examples
**Example #1 $mysqli->warning\_count example**
Object-oriented style
```
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$mysqli->query("CREATE TABLE myCity LIKE City");
/* a remarkable city in Wales */
$query = "INSERT INTO myCity (CountryCode, Name) VALUES('GBR',
'Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch')";
$mysqli->query($query);
if ($mysqli->warning_count) {
if ($result = $mysqli->query("SHOW WARNINGS")) {
$row = $result->fetch_row();
printf("%s (%d): %s\n", $row[0], $row[1], $row[2]);
$result->close();
}
}
/* close connection */
$mysqli->close();
?>
```
Procedural style
```
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
mysqli_query($link, "CREATE TABLE myCity LIKE City");
/* a remarkable long city name in Wales */
$query = "INSERT INTO myCity (CountryCode, Name) VALUES('GBR',
'Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch')";
mysqli_query($link, $query);
if (mysqli_warning_count($link)) {
if ($result = mysqli_query($link, "SHOW WARNINGS")) {
$row = mysqli_fetch_row($result);
printf("%s (%d): %s\n", $row[0], $row[1], $row[2]);
mysqli_free_result($result);
}
}
/* close connection */
mysqli_close($link);
?>
```
The above examples will output:
```
Warning (1264): Data truncated for column 'Name' at row 1
```
### See Also
* [mysqli\_errno()](mysqli.errno) - Returns the error code for the most recent function call
* [mysqli\_error()](mysqli.error) - Returns a string description of the last error
* [mysqli\_sqlstate()](mysqli.sqlstate) - Returns the SQLSTATE error from previous MySQL operation
php mysqli::$connect_errno mysqli::$connect\_errno
=======================
mysqli\_connect\_errno
======================
(PHP 5, PHP 7, PHP 8)
mysqli::$connect\_errno -- mysqli\_connect\_errno — Returns the error code from last connect call
### Description
Object-oriented style
int [$mysqli->connect\_errno](mysqli.connect-errno); Procedural style
```
mysqli_connect_errno(): int
```
Returns the error code from the last connection attempt.
### Parameters
This function has no parameters.
### Return Values
An error code for the last connection attempt, if it failed. Zero means no error occurred.
### Examples
**Example #1 $mysqli->connect\_errno example**
Object-oriented style
```
<?php
mysqli_report(MYSQLI_REPORT_OFF);
/* @ is used to suppress warnings */
$mysqli = @new mysqli('localhost', 'fake_user', 'wrong_password', 'does_not_exist');
if ($mysqli->connect_errno) {
/* Use your preferred error logging method here */
error_log('Connection error: ' . $mysqli->connect_errno);
}
```
Procedural style
```
<?php
mysqli_report(MYSQLI_REPORT_OFF);
/* @ is used to suppress warnings */
$link = @mysqli_connect('localhost', 'fake_user', 'wrong_password', 'does_not_exist');
if (!$link) {
/* Use your preferred error logging method here */
error_log('Connection error: ' . mysqli_connect_errno());
}
```
### See Also
* [mysqli\_connect()](function.mysqli-connect) - Alias of mysqli::\_\_construct
* [mysqli\_connect\_error()](mysqli.connect-error) - Returns a description of the last connection error
* [mysqli\_errno()](mysqli.errno) - Returns the error code for the most recent function call
* [mysqli\_error()](mysqli.error) - Returns a string description of the last error
* [mysqli\_sqlstate()](mysqli.sqlstate) - Returns the SQLSTATE error from previous MySQL operation
php XMLWriter::startAttribute XMLWriter::startAttribute
=========================
xmlwriter\_start\_attribute
===========================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::startAttribute -- xmlwriter\_start\_attribute — Create start attribute
### Description
Object-oriented style
```
public XMLWriter::startAttribute(string $name): bool
```
Procedural style
```
xmlwriter_start_attribute(XMLWriter $writer, string $name): bool
```
Starts an attribute.
### Parameters
`writer`
Only for procedural calls. The [XMLWriter](class.xmlwriter) instance that is being modified. This object is returned from a call to [xmlwriter\_open\_uri()](xmlwriter.openuri) or [xmlwriter\_open\_memory()](xmlwriter.openmemory).
`name`
The attribute name.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `writer` expects an [XMLWriter](class.xmlwriter) instance now; previously, a resource was expected. |
### Examples
**Example #1 Basic **XMLWriter::startAttribute()** Usage**
```
<?php
$writer = new XMLWriter;
$writer->openURI('php://output');
$writer->startDocument('1.0', 'UTF-8');
$writer->startElement('element');
$writer->startAttribute('attribute');
$writer->text('value');
$writer->endAttribute();
$writer->endElement();
$writer->endDocument();
```
The above example will output something similar to:
```
<?xml version="1.0" encoding="UTF-8"?>
<element attribute="value"/>
```
### See Also
* [XMLWriter::startAttributeNs()](xmlwriter.startattributens) - Create start namespaced attribute
* [XMLWriter::endAttribute()](xmlwriter.endattribute) - End attribute
* [XMLWriter::writeAttribute()](xmlwriter.writeattribute) - Write full attribute
* [XMLWriter::writeAttributeNs()](xmlwriter.writeattributens) - Write full namespaced attribute
php socket_wsaprotocol_info_release socket\_wsaprotocol\_info\_release
==================================
(PHP 7 >= 7.3.0, PHP 8)
socket\_wsaprotocol\_info\_release — Releases an exported WSAPROTOCOL\_INFO Structure
### Description
```
socket_wsaprotocol_info_release(string $info_id): bool
```
Releases the shared memory corresponding to the given `info_id`.
> **Note**: This function is available only on Windows.
>
>
### Parameters
`info_id`
The ID which has been returned by a former call to [socket\_wsaprotocol\_info\_export()](function.socket-wsaprotocol-info-export).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [socket\_wsaprotocol\_info\_export()](function.socket-wsaprotocol-info-export) - Exports the WSAPROTOCOL\_INFO Structure
php natsort natsort
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
natsort — Sort an array using a "natural order" algorithm
### Description
```
natsort(array &$array): bool
```
This function implements a sort algorithm that orders alphanumeric strings in the way a human being would while maintaining key/value associations. This is described as a "natural ordering". An example of the difference between this algorithm and the regular computer string sorting algorithms (used in [sort()](function.sort)) can be seen in the example below.
>
> **Note**:
>
>
> If two members compare as equal, they retain their original order. Prior to PHP 8.0.0, their relative order in the sorted array was undefined.
>
>
>
> **Note**:
>
>
> Resets array's internal pointer to the first element.
>
>
### Parameters
`array`
The input array.
### Return Values
Always returns **`true`**.
### Examples
**Example #1 **natsort()** examples demonstrating basic usage**
```
<?php
$array1 = $array2 = array("img12.png", "img10.png", "img2.png", "img1.png");
asort($array1);
echo "Standard sorting\n";
print_r($array1);
natsort($array2);
echo "\nNatural order sorting\n";
print_r($array2);
?>
```
The above example will output:
```
Standard sorting
Array
(
[3] => img1.png
[1] => img10.png
[0] => img12.png
[2] => img2.png
)
Natural order sorting
Array
(
[3] => img1.png
[2] => img2.png
[1] => img10.png
[0] => img12.png
)
```
For more information see: Martin Pool's [» Natural Order String Comparison](https://github.com/sourcefrog/natsort) page.
**Example #2 **natsort()** examples demonstrating potential gotchas**
```
<?php
echo "Negative numbers\n";
$negative = array('-5','3','-2','0','-1000','9','1');
print_r($negative);
natsort($negative);
print_r($negative);
echo "Zero padding\n";
$zeros = array('09', '8', '10', '009', '011', '0');
print_r($zeros);
natsort($zeros);
print_r($zeros);
?>
```
The above example will output:
```
Negative numbers
Array
(
[0] => -5
[1] => 3
[2] => -2
[3] => 0
[4] => -1000
[5] => 9
[6] => 1
)
Array
(
[2] => -2
[0] => -5
[4] => -1000
[3] => 0
[6] => 1
[1] => 3
[5] => 9
)
Zero padding
Array
(
[0] => 09
[1] => 8
[2] => 10
[3] => 009
[4] => 011
[5] => 0
)
Array
(
[5] => 0
[1] => 8
[3] => 009
[0] => 09
[2] => 10
[4] => 011
)
```
### See Also
* [natcasesort()](function.natcasesort) - Sort an array using a case insensitive "natural order" algorithm
* The [comparison of array sorting functions](https://www.php.net/manual/en/array.sorting.php)
* [strnatcmp()](function.strnatcmp) - String comparisons using a "natural order" algorithm
* [strnatcasecmp()](function.strnatcasecmp) - Case insensitive string comparisons using a "natural order" algorithm
php Imagick::sharpenImage Imagick::sharpenImage
=====================
(PECL imagick 2, PECL imagick 3)
Imagick::sharpenImage — Sharpens an image
### Description
```
public Imagick::sharpenImage(float $radius, float $sigma, int $channel = Imagick::CHANNEL_DEFAULT): bool
```
Sharpens an image. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, the radius should be larger than sigma. Use a radius of 0 and **Imagick::sharpenImage()** selects a suitable radius for you.
### Parameters
`radius`
`sigma`
`channel`
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::sharpenImage()****
```
<?php
function sharpenImage($imagePath, $radius, $sigma, $channel) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->sharpenimage($radius, $sigma, $channel);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php ReflectionClass::getStartLine ReflectionClass::getStartLine
=============================
(PHP 5, PHP 7, PHP 8)
ReflectionClass::getStartLine — Gets starting line number
### Description
```
public ReflectionClass::getStartLine(): int|false
```
Get the starting line number.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
The starting line number, as an int, or **`false`** if unknown.
### See Also
* [ReflectionClass::getEndLine()](reflectionclass.getendline) - Gets end line
php GearmanWorker::unregister GearmanWorker::unregister
=========================
(PECL gearman >= 0.6.0)
GearmanWorker::unregister — Unregister a function name with the job servers
### Description
```
public GearmanWorker::unregister(string $function_name): bool
```
Unregisters a function name with the job servers ensuring that no more jobs (for that function) are sent to this worker.
### Parameters
`function_name`
The name of a function to register with the job server
### Return Values
A standard Gearman return value.
### See Also
* [GearmanWorker::register()](gearmanworker.register) - Register a function with the job server
* [GearmanWorker::unregisterAll()](gearmanworker.unregisterall) - Unregister all function names with the job servers
php xdiff_file_bdiff_size xdiff\_file\_bdiff\_size
========================
(PECL xdiff >= 1.5.0)
xdiff\_file\_bdiff\_size — Read a size of file created by applying a binary diff
### Description
```
xdiff_file_bdiff_size(string $file): int
```
Returns a size of a result file that would be created after applying binary patch from file `file` to the original file.
### Parameters
`file`
The path to the binary patch created by [xdiff\_string\_bdiff()](function.xdiff-string-bdiff) or [xdiff\_string\_rabdiff()](function.xdiff-string-rabdiff) function.
### Return Values
Returns the size of file that would be created.
### Examples
**Example #1 **xdiff\_file\_bdiff\_size()** example**
The following code applies reads a size of file that would be created after applying a binary diff.
```
<?php
$length = xdiff_string_bdiff_size('file.bdiff');
echo "Resulting file will be $length bytes long";
?>
```
### See Also
* [xdiff\_file\_bdiff()](function.xdiff-file-bdiff) - Make binary diff of two files
* [xdiff\_file\_rabdiff()](function.xdiff-file-rabdiff) - Make binary diff of two files using the Rabin's polynomial fingerprinting algorithm
* [xdiff\_file\_bpatch()](function.xdiff-file-bpatch) - Patch a file with a binary diff
php IntlChar::getPropertyEnum IntlChar::getPropertyEnum
=========================
(PHP 7, PHP 8)
IntlChar::getPropertyEnum — Get the property constant value for a given property name
### Description
```
public static IntlChar::getPropertyEnum(string $alias): int
```
Returns the property constant value for a given property name, as specified in the Unicode database file PropertyAliases.txt. Short, long, and any other variants are recognized.
In addition, this function maps the synthetic names "gcm" / "General\_Category\_Mask" to the property **`IntlChar::PROPERTY_GENERAL_CATEGORY_MASK`**. These names are not in PropertyAliases.txt.
This function complements [IntlChar::getPropertyName()](intlchar.getpropertyname).
### Parameters
`alias`
The property name to be matched. The name is compared using "loose matching" as described in PropertyAliases.txt.
### Return Values
Returns an `IntlChar::PROPERTY_` constant value, or **`IntlChar::PROPERTY_INVALID_CODE`** if the given name does not match any property.
### Examples
**Example #1 Testing different properties**
```
<?php
var_dump(IntlChar::getPropertyEnum('Bidi_Class') === IntlChar::PROPERTY_BIDI_CLASS);
var_dump(IntlChar::getPropertyEnum('script') === IntlChar::PROPERTY_SCRIPT);
var_dump(IntlChar::getPropertyEnum('IDEOGRAPHIC') === IntlChar::PROPERTY_IDEOGRAPHIC);
var_dump(IntlChar::getPropertyEnum('Some made-up string') === IntlChar::PROPERTY_INVALID_CODE);
?>
```
The above example will output:
```
bool(true)
bool(true)
bool(true)
bool(true)
```
### See Also
* [IntlChar::getPropertyName()](intlchar.getpropertyname) - Get the Unicode name for a property
php SolrQuery::getHighlightUsePhraseHighlighter SolrQuery::getHighlightUsePhraseHighlighter
===========================================
(PECL solr >= 0.9.2)
SolrQuery::getHighlightUsePhraseHighlighter — Returns the state of the hl.usePhraseHighlighter parameter
### Description
```
public SolrQuery::getHighlightUsePhraseHighlighter(): bool
```
Returns whether or not to use SpanScorer to highlight phrase terms only when they appear within the query phrase in the document.
### Parameters
This function has no parameters.
### Return Values
Returns a boolean on success and **`null`** if not set.
php xml_get_current_byte_index xml\_get\_current\_byte\_index
==============================
(PHP 4, PHP 5, PHP 7, PHP 8)
xml\_get\_current\_byte\_index — Get current byte index for an XML parser
### Description
```
xml_get_current_byte_index(XMLParser $parser): int
```
Gets the current byte index of the given XML parser.
### Parameters
`parser`
A reference to the XML parser to get byte index from.
### Return Values
This function returns **`false`** if `parser` does not refer to a valid parser, or else it returns which byte index the parser is currently at in its data buffer (starting at 0).
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `parser` expects an [XMLParser](class.xmlparser) instance now; previously, a resource was expected. |
### Notes
**Warning** This function returns byte index according to UTF-8 encoded text disregarding if input is in another encoding.
### See Also
* [xml\_get\_current\_column\_number()](function.xml-get-current-column-number) - Get current column number for an XML parser
* [xml\_get\_current\_line\_number()](function.xml-get-current-line-number) - Get current line number for an XML parser
php SolrClient::addDocument SolrClient::addDocument
=======================
(PECL solr >= 0.9.2)
SolrClient::addDocument — Adds a document to the index
### Description
```
public SolrClient::addDocument(SolrInputDocument $doc, bool $overwrite = true, int $commitWithin = 0): SolrUpdateResponse
```
This method adds a document to the index.
### Parameters
`doc`
The SolrInputDocument instance.
`overwrite`
Whether to overwrite existing document or not. If **`false`** there will be duplicates (several documents with the same ID).
**Warning** PECL Solr < 2.0 $allowDups was used instead of $overwrite, which does the same functionality with exact opposite bool flag.
$allowDups = false is the same as $overwrite = true
`commitWithin`
Number of milliseconds within which to auto commit this document. Available since Solr 1.4 . Default (0) means disabled.
When this value specified, it leaves the control of when to do the commit to Solr itself, optimizing number of commits to a minimum while still fulfilling the update latency requirements, and Solr will automatically do a commit when the oldest add in the buffer is due.
### Return Values
Returns a [SolrUpdateResponse](class.solrupdateresponse) object or throws an Exception on failure.
### Errors/Exceptions
Throws [SolrClientException](class.solrclientexception) if the client had failed, or there was a connection issue.
Throws [SolrServerException](class.solrserverexception) if the Solr Server had failed to process the request.
### Examples
**Example #1 **SolrClient::addDocument()** example**
```
<?php
$options = array
(
'hostname' => SOLR_SERVER_HOSTNAME,
'login' => SOLR_SERVER_USERNAME,
'password' => SOLR_SERVER_PASSWORD,
'port' => SOLR_SERVER_PORT,
);
$client = new SolrClient($options);
$doc = new SolrInputDocument();
$doc->addField('id', 334455);
$doc->addField('cat', 'Software');
$doc->addField('cat', 'Lucene');
$updateResponse = $client->addDocument($doc);
// you will have to commit changes to be written if you didn't use $commitWithin
$client->commit();
print_r($updateResponse->getResponse());
?>
```
The above example will output something similar to:
```
SolrObject Object
(
[responseHeader] => SolrObject Object
(
[status] => 0
[QTime] => 1
)
)
```
**Example #2 **SolrClient::addDocument()** example 2**
```
<?php
$options = array
(
'hostname' => SOLR_SERVER_HOSTNAME,
'login' => SOLR_SERVER_USERNAME,
'password' => SOLR_SERVER_PASSWORD,
'port' => SOLR_SERVER_PORT,
);
$client = new SolrClient($options);
$doc = new SolrInputDocument();
$doc->addField('id', 334455);
$doc->addField('cat', 'Software');
$doc->addField('cat', 'Lucene');
// No need to call commit() because $commitWithin is passed, so Solr Server will auto commit within 10 seconds
$updateResponse = $client->addDocument($doc, false, 10000);
print_r($updateResponse->getResponse());
?>
```
The above example will output something similar to:
```
SolrObject Object
(
[responseHeader] => SolrObject Object
(
[status] => 0
[QTime] => 1
)
)
```
### See Also
* [SolrClient::addDocuments()](solrclient.adddocuments) - Adds a collection of SolrInputDocument instances to the index
* [SolrClient::commit()](solrclient.commit) - Finalizes all add/deletes made to the index
| programming_docs |
php ibase_blob_info ibase\_blob\_info
=================
(PHP 5, PHP 7 < 7.4.0)
ibase\_blob\_info — Return blob length and other useful info
### Description
```
ibase_blob_info(resource $link_identifier, string $blob_id): array
```
```
ibase_blob_info(string $blob_id): array
```
Returns the BLOB length and other useful information.
### Parameters
`link_identifier`
An InterBase link identifier. If omitted, the last opened link is assumed.
`blob_id`
A BLOB id.
### Return Values
Returns an array containing information about a BLOB. The information returned consists of the length of the BLOB, the number of segments it contains, the size of the largest segment, and whether it is a stream BLOB or a segmented BLOB.
php Componere\Definition::addConstant Componere\Definition::addConstant
=================================
(Componere 2 >= 2.1.0)
Componere\Definition::addConstant — Add Constant
### Description
```
public Componere\Definition::addConstant(string $name, Componere\Value $value): Definition
```
Shall declare a class constant on the current Definition
### Parameters
`name`
The case sensitive name for the constant
`value`
The Value for the constant, must not be undefined or static
### Return Values
The current Definition
### Exceptions
**Warning** Shall throw [RuntimeException](class.runtimeexception) if Definition was registered
**Warning** Shall throw [RuntimeException](class.runtimeexception) if `name` is already declared as a constant
**Warning** Shall throw [RuntimeException](class.runtimeexception) if `value` is static
**Warning** Shall throw [RuntimeException](class.runtimeexception) if `value` is undefined
php Imagick::setSamplingFactors Imagick::setSamplingFactors
===========================
(PECL imagick 2, PECL imagick 3)
Imagick::setSamplingFactors — Sets the image sampling factors
### Description
```
public Imagick::setSamplingFactors(array $factors): bool
```
Sets the image sampling factors.
### Parameters
`factors`
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::setSamplingFactors()****
```
<?php
function setSamplingFactors($imagePath) {
$imagePath = "../imagick/images/FineDetail.png";
$imagick = new \Imagick(realpath($imagePath));
$imagick->setImageFormat('jpg');
$imagick->setSamplingFactors(array('2x2', '1x1', '1x1'));
$compressed = $imagick->getImageBlob();
$reopen = new \Imagick();
$reopen->readImageBlob($compressed);
$reopen->resizeImage(
$reopen->getImageWidth() * 4,
$reopen->getImageHeight() * 4,
\Imagick::FILTER_POINT,
1
);
header("Content-Type: image/jpg");
echo $reopen->getImageBlob();
}
?>
```
php strspn strspn
======
(PHP 4, PHP 5, PHP 7, PHP 8)
strspn — Finds the length of the initial segment of a string consisting entirely of characters contained within a given mask
### Description
```
strspn(
string $string,
string $characters,
int $offset = 0,
?int $length = null
): int
```
Finds the length of the initial segment of `string` that contains *only* characters from `characters`.
If `offset` and `length` are omitted, then all of `string` will be examined. If they are included, then the effect will be the same as calling `strspn(substr($string, $offset, $length),
$characters)` (see [substr](function.substr) for more information).
The line of code:
```
<?php
$var = strspn("42 is the answer to the 128th question.", "1234567890");
?>
```
will assign `2` to $var, because the string "42" is the initial segment of `string` that consists only of characters contained within "1234567890". ### Parameters
`string`
The string to examine.
`characters`
The list of allowable characters.
`offset`
The position in `string` to start searching.
If `offset` is given and is non-negative, then **strspn()** will begin examining `string` at the `offset`'th position. For instance, in the string '`abcdef`', the character at position `0` is '`a`', the character at position `2` is '`c`', and so forth.
If `offset` is given and is negative, then **strspn()** will begin examining `string` at the `offset`'th position from the end of `string`.
`length`
The length of the segment from `string` to examine.
If `length` is given and is non-negative, then `string` will be examined for `length` characters after the starting position.
If `length` is given and is negative, then `string` will be examined from the starting position up to `length` characters from the end of `string`.
### Return Values
Returns the length of the initial segment of `string` which consists entirely of characters in `characters`.
>
> **Note**:
>
>
> When a `offset` parameter is set, the returned length is counted starting from this position, not from the beginning of `string`.
>
>
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `length` is nullable now. |
### Examples
**Example #1 **strspn()** example**
```
<?php
// subject does not start with any characters from mask
var_dump(strspn("foo", "o"));
// examine two characters from subject starting at offset 1
var_dump(strspn("foo", "o", 1, 2));
// examine one character from subject starting at offset 1
var_dump(strspn("foo", "o", 1, 1));
?>
```
The above example will output:
```
int(0)
int(2)
int(1)
```
### Notes
> **Note**: This function is binary-safe.
>
>
### See Also
* [strcspn()](function.strcspn) - Find length of initial segment not matching mask
php Generator::key Generator::key
==============
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
Generator::key — Get the yielded key
### Description
```
public Generator::key(): mixed
```
Gets the key of the yielded value.
### Parameters
This function has no parameters.
### Return Values
Returns the yielded key.
### Examples
**Example #1 **Generator::key()** example**
```
<?php
function Gen()
{
yield 'key' => 'value';
}
$gen = Gen();
echo "{$gen->key()} => {$gen->current()}";
```
The above example will output:
```
key => value
```
php IntlChar::isblank IntlChar::isblank
=================
(PHP 7, PHP 8)
IntlChar::isblank — Check if code point is a "blank" or "horizontal space" character
### Description
```
public static IntlChar::isblank(int|string $codepoint): ?bool
```
Determines whether the specified code point is a "blank" or "horizontal space", a character that visibly separates words on a line.
The following are equivalent definitions:
* **`true`** for Unicode White\_Space characters except for "vertical space controls" where "vertical space controls" are the following characters: U+000A (LF) U+000B (VT) U+000C (FF) U+000D (CR) U+0085 (NEL) U+2028 (LS) U+2029 (PS)
* **`true`** for U+0009 (TAB) and characters with general category "Zs" (space separators) except Zero Width Space (ZWSP, U+200B).
### Parameters
`codepoint`
The int codepoint value (e.g. `0x2603` for *U+2603 SNOWMAN*), or the character encoded as a UTF-8 string (e.g. `"\u{2603}"`)
### Return Values
Returns **`true`** if `codepoint` is either a "blank" or "horizontal space" character, **`false`** if not. Returns **`null`** on failure.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::isblank("A"));
var_dump(IntlChar::isblank(" "));
var_dump(IntlChar::isblank("\t"));
?>
```
The above example will output:
```
bool(false)
bool(true)
bool(true)
```
### See Also
* [IntlChar::isspace()](intlchar.isspace) - Check if code point is a space character
* [IntlChar::isJavaSpaceChar()](intlchar.isjavaspacechar) - Check if code point is a space character according to Java
* [IntlChar::isUWhiteSpace()](intlchar.isuwhitespace) - Check if code point has the White\_Space Unicode property
* [IntlChar::isWhitespace()](intlchar.iswhitespace) - Check if code point is a whitespace character according to ICU
php ssh2_sftp_mkdir ssh2\_sftp\_mkdir
=================
(PECL ssh2 >= 0.9.0)
ssh2\_sftp\_mkdir — Create a directory
### Description
```
ssh2_sftp_mkdir(
resource $sftp,
string $dirname,
int $mode = 0777,
bool $recursive = false
): bool
```
Creates a directory on the remote file server with permissions set to `mode`.
This function is similar to using [mkdir()](function.mkdir) with the [ssh2.sftp://](https://www.php.net/manual/en/wrappers.ssh2.php) wrapper.
### Parameters
`sftp`
An SSH2 SFTP resource opened by [ssh2\_sftp()](function.ssh2-sftp).
`dirname`
Path of the new directory.
`mode`
Permissions on the new directory. The actual mode is affected by the current umask.
`recursive`
If `recursive` is **`true`** any parent directories required for `dirname` will be automatically created as well.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Creating a directory on a remote server**
```
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$sftp = ssh2_sftp($connection);
ssh2_sftp_mkdir($sftp, '/home/username/newdir');
/* Or: mkdir("ssh2.sftp://$sftp/home/username/newdir"); */
?>
```
### See Also
* [mkdir()](function.mkdir) - Makes directory
* [ssh2\_sftp\_rmdir()](function.ssh2-sftp-rmdir) - Remove a directory
php Phar::offsetSet Phar::offsetSet
===============
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
Phar::offsetSet — Set the contents of an internal file to those of an external file
### Description
```
public Phar::offsetSet(string $localName, resource|string $value): void
```
>
> **Note**:
>
>
> This method requires the php.ini setting `phar.readonly` to be set to `0` in order to work for [Phar](class.phar) objects. Otherwise, a [PharException](class.pharexception) will be thrown.
>
>
>
This is an implementation of the [ArrayAccess](class.arrayaccess) interface allowing direct manipulation of the contents of a Phar archive using array access brackets. offsetSet is used for modifying an existing file, or adding a new file to a Phar archive.
### Parameters
`localName`
The filename (relative path) to modify in a Phar.
`value`
Content of the file.
### Return Values
No return values.
### Errors/Exceptions
if [phar.readonly](https://www.php.net/manual/en/phar.configuration.php#ini.phar.readonly) is `1`, [BadMethodCallException](class.badmethodcallexception) is thrown, as modifying a Phar is only allowed when phar.readonly is set to `0`. Throws [PharException](class.pharexception) if there are any problems flushing changes made to the Phar archive to disk.
### Examples
**Example #1 A **Phar::offsetSet()** example**
offsetSet should not be accessed directly, but instead used via array access with the `[]` operator.
```
<?php
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
try {
// calls offsetSet
$p['file.txt'] = 'Hi there';
} catch (Exception $e) {
echo 'Could not modify file.txt:', $e;
}
?>
```
### Notes
> **Note**: [Phar::addFile()](phar.addfile), [Phar::addFromString()](phar.addfromstring) and **Phar::offsetSet()** save a new phar archive each time they are called. If performance is a concern, [Phar::buildFromDirectory()](phar.buildfromdirectory) or [Phar::buildFromIterator()](phar.buildfromiterator) should be used instead.
>
>
### See Also
* [Phar::offsetExists()](phar.offsetexists) - Determines whether a file exists in the phar
* [Phar::offsetGet()](phar.offsetget) - Gets a PharFileInfo object for a specific file
* [Phar::offsetUnset()](phar.offsetunset) - Remove a file from a phar
php stream_get_contents stream\_get\_contents
=====================
(PHP 5, PHP 7, PHP 8)
stream\_get\_contents — Reads remainder of a stream into a string
### Description
```
stream_get_contents(resource $stream, ?int $length = null, int $offset = -1): string|false
```
Identical to [file\_get\_contents()](function.file-get-contents), except that **stream\_get\_contents()** operates on an already open stream resource and returns the remaining contents in a string, up to `length` bytes and starting at the specified `offset`.
### Parameters
`stream` (resource) A stream resource (e.g. returned from [fopen()](function.fopen))
`length` (int) The maximum bytes to read. Defaults to **`null`** (read all the remaining buffer).
`offset` (int) Seek to the specified offset before reading. If this number is negative, no seeking will occur and reading will start from the current position.
### Return Values
Returns a string or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `length` is now nullable. |
### Examples
**Example #1 **stream\_get\_contents()** example**
```
<?php
if ($stream = fopen('http://www.example.com', 'r')) {
// print all the page starting at the offset 10
echo stream_get_contents($stream, -1, 10);
fclose($stream);
}
if ($stream = fopen('http://www.example.net', 'r')) {
// print the first 5 bytes
echo stream_get_contents($stream, 5);
fclose($stream);
}
?>
```
### Notes
> **Note**: This function is binary-safe.
>
>
### See Also
* [fgets()](function.fgets) - Gets line from file pointer
* [fread()](function.fread) - Binary-safe file read
* [fpassthru()](function.fpassthru) - Output all remaining data on a file pointer
php RegexIterator::getRegex RegexIterator::getRegex
=======================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
RegexIterator::getRegex — Returns current regular expression
### Description
```
public RegexIterator::getRegex(): string
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php The Phar class
The Phar class
==============
Introduction
------------
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
The Phar class provides a high-level interface to accessing and creating phar archives.
Class synopsis
--------------
class **Phar** extends [RecursiveDirectoryIterator](class.recursivedirectoryiterator) implements [Countable](class.countable), [ArrayAccess](class.arrayaccess) { /\* Inherited constants \*/ public const int [FilesystemIterator::CURRENT\_MODE\_MASK](class.filesystemiterator#filesystemiterator.constants.current-mode-mask);
public const int [FilesystemIterator::CURRENT\_AS\_PATHNAME](class.filesystemiterator#filesystemiterator.constants.current-as-pathname);
public const int [FilesystemIterator::CURRENT\_AS\_FILEINFO](class.filesystemiterator#filesystemiterator.constants.current-as-fileinfo);
public const int [FilesystemIterator::CURRENT\_AS\_SELF](class.filesystemiterator#filesystemiterator.constants.current-as-self);
public const int [FilesystemIterator::KEY\_MODE\_MASK](class.filesystemiterator#filesystemiterator.constants.key-mode-mask);
public const int [FilesystemIterator::KEY\_AS\_PATHNAME](class.filesystemiterator#filesystemiterator.constants.key-as-pathname);
public const int [FilesystemIterator::FOLLOW\_SYMLINKS](class.filesystemiterator#filesystemiterator.constants.follow-symlinks);
public const int [FilesystemIterator::KEY\_AS\_FILENAME](class.filesystemiterator#filesystemiterator.constants.key-as-filename);
public const int [FilesystemIterator::NEW\_CURRENT\_AND\_KEY](class.filesystemiterator#filesystemiterator.constants.new-current-and-key);
public const int [FilesystemIterator::OTHER\_MODE\_MASK](class.filesystemiterator#filesystemiterator.constants.other-mode-mask);
public const int [FilesystemIterator::SKIP\_DOTS](class.filesystemiterator#filesystemiterator.constants.skip-dots);
public const int [FilesystemIterator::UNIX\_PATHS](class.filesystemiterator#filesystemiterator.constants.unix-paths); /\* Methods \*/ public [\_\_construct](phar.construct)(string `$filename`, int `$flags` = FilesystemIterator::SKIP\_DOTS | FilesystemIterator::UNIX\_PATHS, ?string `$alias` = **`null`**)
```
public addEmptyDir(string $directory): void
```
```
public addFile(string $filename, ?string $localName = null): void
```
```
public addFromString(string $localName, string $contents): void
```
```
final public static apiVersion(): string
```
```
public buildFromDirectory(string $directory, string $pattern = ""): array
```
```
public buildFromIterator(Traversable $iterator, ?string $baseDirectory = null): array
```
```
final public static canCompress(int $compression = 0): bool
```
```
final public static canWrite(): bool
```
```
public compress(int $compression, ?string $extension = null): ?Phar
```
```
public compressFiles(int $compression): void
```
```
public convertToData(?int $format = null, ?int $compression = null, ?string $extension = null): ?PharData
```
```
public convertToExecutable(?int $format = null, ?int $compression = null, ?string $extension = null): ?Phar
```
```
public copy(string $from, string $to): bool
```
```
public count(int $mode = COUNT_NORMAL): int
```
```
final public static createDefaultStub(?string $index = null, ?string $webIndex = null): string
```
```
public decompress(?string $extension = null): ?Phar
```
```
public decompressFiles(): bool
```
```
public delMetadata(): bool
```
```
public delete(string $localName): bool
```
```
public extractTo(string $directory, array|string|null $files = null, bool $overwrite = false): bool
```
```
public getAlias(): ?string
```
```
public getMetadata(array $unserializeOptions = []): mixed
```
```
public getModified(): bool
```
```
public getPath(): string
```
```
public getSignature(): array|false
```
```
public getStub(): string
```
```
final public static getSupportedCompression(): array
```
```
final public static getSupportedSignatures(): array
```
```
public getVersion(): string
```
```
public hasMetadata(): bool
```
```
final public static interceptFileFuncs(): void
```
```
public isBuffering(): bool
```
```
public isCompressed(): int|false
```
```
public isFileFormat(int $format): bool
```
```
final public static isValidPharFilename(string $filename, bool $executable = true): bool
```
```
public isWritable(): bool
```
```
final public static loadPhar(string $filename, ?string $alias = null): bool
```
```
final public static mapPhar(?string $alias = null, int $offset = 0): bool
```
```
final public static mount(string $pharPath, string $externalPath): void
```
```
final public static mungServer(array $variables): void
```
```
public offsetExists(string $localName): bool
```
```
public offsetGet(string $localName): SplFileInfo
```
```
public offsetSet(string $localName, resource|string $value): void
```
```
public offsetUnset(string $localName): void
```
```
final public static running(bool $returnPhar = true): string
```
```
public setAlias(string $alias): bool
```
```
public setDefaultStub(?string $index = null, ?string $webIndex = null): bool
```
```
public setMetadata(mixed $metadata): void
```
```
public setSignatureAlgorithm(int $algo, ?string $privateKey = null): void
```
```
public setStub(string $stub, int $len = -1): bool
```
```
public startBuffering(): void
```
```
public stopBuffering(): void
```
```
final public static unlinkArchive(string $filename): bool
```
```
final public static webPhar(
?string $alias = null,
?string $index = null,
?string $fileNotFoundScript = null,
array $mimeTypes = [],
?callable $rewrite = null
): void
```
public [\_\_destruct](phar.destruct)() /\* Inherited methods \*/
```
public RecursiveDirectoryIterator::getChildren(): RecursiveDirectoryIterator
```
```
public RecursiveDirectoryIterator::getSubPath(): string
```
```
public RecursiveDirectoryIterator::getSubPathname(): string
```
```
public RecursiveDirectoryIterator::hasChildren(bool $allowLinks = false): bool
```
```
public RecursiveDirectoryIterator::key(): string
```
```
public RecursiveDirectoryIterator::next(): void
```
```
public RecursiveDirectoryIterator::rewind(): void
```
```
public FilesystemIterator::current(): string|SplFileInfo|FilesystemIterator
```
```
public FilesystemIterator::getFlags(): int
```
```
public FilesystemIterator::key(): string
```
```
public FilesystemIterator::next(): void
```
```
public FilesystemIterator::rewind(): void
```
```
public FilesystemIterator::setFlags(int $flags): void
```
```
public DirectoryIterator::current(): mixed
```
```
public DirectoryIterator::getATime(): int
```
```
public DirectoryIterator::getBasename(string $suffix = ""): string
```
```
public DirectoryIterator::getCTime(): int
```
```
public DirectoryIterator::getExtension(): string
```
```
public DirectoryIterator::getFilename(): string
```
```
public DirectoryIterator::getGroup(): int
```
```
public DirectoryIterator::getInode(): int
```
```
public DirectoryIterator::getMTime(): int
```
```
public DirectoryIterator::getOwner(): int
```
```
public DirectoryIterator::getPath(): string
```
```
public DirectoryIterator::getPathname(): string
```
```
public DirectoryIterator::getPerms(): int
```
```
public DirectoryIterator::getSize(): int
```
```
public DirectoryIterator::getType(): string
```
```
public DirectoryIterator::isDir(): bool
```
```
public DirectoryIterator::isDot(): bool
```
```
public DirectoryIterator::isExecutable(): bool
```
```
public DirectoryIterator::isFile(): bool
```
```
public DirectoryIterator::isLink(): bool
```
```
public DirectoryIterator::isReadable(): bool
```
```
public DirectoryIterator::isWritable(): bool
```
```
public DirectoryIterator::key(): mixed
```
```
public DirectoryIterator::next(): void
```
```
public DirectoryIterator::rewind(): void
```
```
public DirectoryIterator::seek(int $offset): void
```
```
public DirectoryIterator::__toString(): string
```
```
public DirectoryIterator::valid(): bool
```
```
public SplFileInfo::getATime(): int|false
```
```
public SplFileInfo::getBasename(string $suffix = ""): string
```
```
public SplFileInfo::getCTime(): int|false
```
```
public SplFileInfo::getExtension(): string
```
```
public SplFileInfo::getFileInfo(?string $class = null): SplFileInfo
```
```
public SplFileInfo::getFilename(): string
```
```
public SplFileInfo::getGroup(): int|false
```
```
public SplFileInfo::getInode(): int|false
```
```
public SplFileInfo::getLinkTarget(): string|false
```
```
public SplFileInfo::getMTime(): int|false
```
```
public SplFileInfo::getOwner(): int|false
```
```
public SplFileInfo::getPath(): string
```
```
public SplFileInfo::getPathInfo(?string $class = null): ?SplFileInfo
```
```
public SplFileInfo::getPathname(): string
```
```
public SplFileInfo::getPerms(): int|false
```
```
public SplFileInfo::getRealPath(): string|false
```
```
public SplFileInfo::getSize(): int|false
```
```
public SplFileInfo::getType(): string|false
```
```
public SplFileInfo::isDir(): bool
```
```
public SplFileInfo::isExecutable(): bool
```
```
public SplFileInfo::isFile(): bool
```
```
public SplFileInfo::isLink(): bool
```
```
public SplFileInfo::isReadable(): bool
```
```
public SplFileInfo::isWritable(): bool
```
```
public SplFileInfo::openFile(string $mode = "r", bool $useIncludePath = false, ?resource $context = null): SplFileObject
```
```
public SplFileInfo::setFileClass(string $class = SplFileObject::class): void
```
```
public SplFileInfo::setInfoClass(string $class = SplFileInfo::class): void
```
```
public SplFileInfo::__toString(): string
```
} Table of Contents
-----------------
* [Phar::addEmptyDir](phar.addemptydir) — Add an empty directory to the phar archive
* [Phar::addFile](phar.addfile) — Add a file from the filesystem to the phar archive
* [Phar::addFromString](phar.addfromstring) — Add a file from a string to the phar archive
* [Phar::apiVersion](phar.apiversion) — Returns the api version
* [Phar::buildFromDirectory](phar.buildfromdirectory) — Construct a phar archive from the files within a directory
* [Phar::buildFromIterator](phar.buildfromiterator) — Construct a phar archive from an iterator
* [Phar::canCompress](phar.cancompress) — Returns whether phar extension supports compression using either zlib or bzip2
* [Phar::canWrite](phar.canwrite) — Returns whether phar extension supports writing and creating phars
* [Phar::compress](phar.compress) — Compresses the entire Phar archive using Gzip or Bzip2 compression
* [Phar::compressFiles](phar.compressfiles) — Compresses all files in the current Phar archive
* [Phar::\_\_construct](phar.construct) — Construct a Phar archive object
* [Phar::convertToData](phar.converttodata) — Convert a phar archive to a non-executable tar or zip file
* [Phar::convertToExecutable](phar.converttoexecutable) — Convert a phar archive to another executable phar archive file format
* [Phar::copy](phar.copy) — Copy a file internal to the phar archive to another new file within the phar
* [Phar::count](phar.count) — Returns the number of entries (files) in the Phar archive
* [Phar::createDefaultStub](phar.createdefaultstub) — Create a phar-file format specific stub
* [Phar::decompress](phar.decompress) — Decompresses the entire Phar archive
* [Phar::decompressFiles](phar.decompressfiles) — Decompresses all files in the current Phar archive
* [Phar::delMetadata](phar.delmetadata) — Deletes the global metadata of the phar
* [Phar::delete](phar.delete) — Delete a file within a phar archive
* [Phar::\_\_destruct](phar.destruct) — Destructs a Phar archive object
* [Phar::extractTo](phar.extractto) — Extract the contents of a phar archive to a directory
* [Phar::getAlias](phar.getalias) — Get the alias for Phar
* [Phar::getMetadata](phar.getmetadata) — Returns phar archive meta-data
* [Phar::getModified](phar.getmodified) — Return whether phar was modified
* [Phar::getPath](phar.getpath) — Get the real path to the Phar archive on disk
* [Phar::getSignature](phar.getsignature) — Return MD5/SHA1/SHA256/SHA512/OpenSSL signature of a Phar archive
* [Phar::getStub](phar.getstub) — Return the PHP loader or bootstrap stub of a Phar archive
* [Phar::getSupportedCompression](phar.getsupportedcompression) — Return array of supported compression algorithms
* [Phar::getSupportedSignatures](phar.getsupportedsignatures) — Return array of supported signature types
* [Phar::getVersion](phar.getversion) — Return version info of Phar archive
* [Phar::hasMetadata](phar.hasmetadata) — Returns whether phar has global meta-data
* [Phar::interceptFileFuncs](phar.interceptfilefuncs) — Instructs phar to intercept fopen, file\_get\_contents, opendir, and all of the stat-related functions
* [Phar::isBuffering](phar.isbuffering) — Used to determine whether Phar write operations are being buffered, or are flushing directly to disk
* [Phar::isCompressed](phar.iscompressed) — Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)
* [Phar::isFileFormat](phar.isfileformat) — Returns true if the phar archive is based on the tar/phar/zip file format depending on the parameter
* [Phar::isValidPharFilename](phar.isvalidpharfilename) — Returns whether the given filename is a valid phar filename
* [Phar::isWritable](phar.iswritable) — Returns true if the phar archive can be modified
* [Phar::loadPhar](phar.loadphar) — Loads any phar archive with an alias
* [Phar::mapPhar](phar.mapphar) — Reads the currently executed file (a phar) and registers its manifest
* [Phar::mount](phar.mount) — Mount an external path or file to a virtual location within the phar archive
* [Phar::mungServer](phar.mungserver) — Defines a list of up to 4 $\_SERVER variables that should be modified for execution
* [Phar::offsetExists](phar.offsetexists) — Determines whether a file exists in the phar
* [Phar::offsetGet](phar.offsetget) — Gets a PharFileInfo object for a specific file
* [Phar::offsetSet](phar.offsetset) — Set the contents of an internal file to those of an external file
* [Phar::offsetUnset](phar.offsetunset) — Remove a file from a phar
* [Phar::running](phar.running) — Returns the full path on disk or full phar URL to the currently executing Phar archive
* [Phar::setAlias](phar.setalias) — Set the alias for the Phar archive
* [Phar::setDefaultStub](phar.setdefaultstub) — Used to set the PHP loader or bootstrap stub of a Phar archive to the default loader
* [Phar::setMetadata](phar.setmetadata) — Sets phar archive meta-data
* [Phar::setSignatureAlgorithm](phar.setsignaturealgorithm) — Set the signature algorithm for a phar and apply it
* [Phar::setStub](phar.setstub) — Used to set the PHP loader or bootstrap stub of a Phar archive
* [Phar::startBuffering](phar.startbuffering) — Start buffering Phar write operations, do not modify the Phar object on disk
* [Phar::stopBuffering](phar.stopbuffering) — Stop buffering write requests to the Phar archive, and save changes to disk
* [Phar::unlinkArchive](phar.unlinkarchive) — Completely remove a phar archive from disk and from memory
* [Phar::webPhar](phar.webphar) — Routes a request from a web browser to an internal file within the phar archive
| programming_docs |
php DateTime::__wakeup DateTime::\_\_wakeup
====================
DateTimeImmutable::\_\_wakeup
=============================
DateTimeInterface::\_\_wakeup
=============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
DateTime::\_\_wakeup -- DateTimeImmutable::\_\_wakeup -- DateTimeInterface::\_\_wakeup — The \_\_wakeup handler
### Description
```
public DateTime::__wakeup(): void
```
```
public DateTimeImmutable::__wakeup(): void
```
```
public DateTimeInterface::__wakeup(): void
```
The [\_\_wakeup()](language.oop5.magic#object.wakeup) handler.
### Parameters
This function has no parameters.
### Return Values
Initializes a DateTime object.
php SolrDocument::getField SolrDocument::getField
======================
(PECL solr >= 0.9.2)
SolrDocument::getField — Retrieves a field by name
### Description
```
public SolrDocument::getField(string $fieldName): SolrDocumentField
```
Retrieves a field by name.
### Parameters
`fieldName`
Name of the field.
### Return Values
Returns a SolrDocumentField on success and **`false`** on failure.
php gmp_random_range gmp\_random\_range
==================
(PHP 5 >= 5.6.3, PHP 7, PHP 8)
gmp\_random\_range — Random number
### Description
```
gmp_random_range(GMP|int|string $min, GMP|int|string $max): GMP
```
Generate a random number. The number will be between `min` and `max`.
`min` and `max` can both be negative but `min` must always be less than `max`.
### Parameters
`min`
A GMP number representing the lower bound for the random number
`max`
A GMP number representing the upper bound for the random number
### Return Values
A random GMP number.
### Examples
**Example #1 **gmp\_random\_range()** example**
```
<?php
$rand1 = gmp_random_range(0, 100); // random number between 0 and 100
$rand2 = gmp_random_range(-100, -10); // random number between -100 and -10
echo gmp_strval($rand1) . "\n";
echo gmp_strval($rand2) . "\n";
?>
```
The above example will output:
```
42
-67
```
php readline_clear_history readline\_clear\_history
========================
(PHP 4, PHP 5, PHP 7, PHP 8)
readline\_clear\_history — Clears the history
### Description
```
readline_clear_history(): bool
```
This function clears the entire command line history.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php The ZookeeperSessionException class
The ZookeeperSessionException class
===================================
Introduction
------------
(PECL zookeeper >= 0.3.0)
The ZooKeeper session exception handling class.
Class synopsis
--------------
class **ZookeeperSessionException** extends [ZookeeperException](class.zookeeperexception) { /\* Inherited properties \*/ protected string [$message](class.exception#exception.props.message) = "";
private string [$string](class.exception#exception.props.string) = "";
protected int [$code](class.exception#exception.props.code);
protected string [$file](class.exception#exception.props.file) = "";
protected int [$line](class.exception#exception.props.line);
private array [$trace](class.exception#exception.props.trace) = [];
private ?[Throwable](class.throwable) [$previous](class.exception#exception.props.previous) = null; /\* Inherited methods \*/
```
final public Exception::getMessage(): string
```
```
final public Exception::getPrevious(): ?Throwable
```
```
final public Exception::getCode(): int
```
```
final public Exception::getFile(): string
```
```
final public Exception::getLine(): int
```
```
final public Exception::getTrace(): array
```
```
final public Exception::getTraceAsString(): string
```
```
public Exception::__toString(): string
```
```
private Exception::__clone(): void
```
}
php None Array Operators
---------------
**Array Operators**| Example | Name | Result |
| --- | --- | --- |
| $a + $b | Union | Union of $a and $b. |
| $a == $b | Equality | **`true`** if $a and $b have the same key/value pairs. |
| $a === $b | Identity | **`true`** if $a and $b have the same key/value pairs in the same order and of the same types. |
| $a != $b | Inequality | **`true`** if $a is not equal to $b. |
| $a <> $b | Inequality | **`true`** if $a is not equal to $b. |
| $a !== $b | Non-identity | **`true`** if $a is not identical to $b. |
The `+` operator returns the right-hand array appended to the left-hand array; for keys that exist in both arrays, the elements from the left-hand array will be used, and the matching elements from the right-hand array will be ignored.
```
<?php
$a = array("a" => "apple", "b" => "banana");
$b = array("a" => "pear", "b" => "strawberry", "c" => "cherry");
$c = $a + $b; // Union of $a and $b
echo "Union of \$a and \$b: \n";
var_dump($c);
$c = $b + $a; // Union of $b and $a
echo "Union of \$b and \$a: \n";
var_dump($c);
$a += $b; // Union of $a += $b is $a and $b
echo "Union of \$a += \$b: \n";
var_dump($a);
?>
```
When executed, this script will print the following:
```
Union of $a and $b:
array(3) {
["a"]=>
string(5) "apple"
["b"]=>
string(6) "banana"
["c"]=>
string(6) "cherry"
}
Union of $b and $a:
array(3) {
["a"]=>
string(4) "pear"
["b"]=>
string(10) "strawberry"
["c"]=>
string(6) "cherry"
}
Union of $a += $b:
array(3) {
["a"]=>
string(5) "apple"
["b"]=>
string(6) "banana"
["c"]=>
string(6) "cherry"
}
```
Elements of arrays are equal for the comparison if they have the same key and value.
**Example #1 Comparing arrays**
```
<?php
$a = array("apple", "banana");
$b = array(1 => "banana", "0" => "apple");
var_dump($a == $b); // bool(true)
var_dump($a === $b); // bool(false)
?>
```
### See Also
* [Array type](language.types.array)
* [Array functions](https://www.php.net/manual/en/ref.array.php)
php strpbrk strpbrk
=======
(PHP 5, PHP 7, PHP 8)
strpbrk — Search a string for any of a set of characters
### Description
```
strpbrk(string $string, string $characters): string|false
```
**strpbrk()** searches the `string` string for a `characters`.
### Parameters
`string`
The string where `characters` is looked for.
`characters`
This parameter is case sensitive.
### Return Values
Returns a string starting from the character found, or **`false`** if it is not found.
### Examples
**Example #1 **strpbrk()** example**
```
<?php
$text = 'This is a Simple text.';
// this echoes "is is a Simple text." because 'i' is matched first
echo strpbrk($text, 'mi');
// this echoes "Simple text." because chars are case sensitive
echo strpbrk($text, 'S');
?>
```
### See Also
* [strpos()](function.strpos) - Find the position of the first occurrence of a substring in a string
* [strstr()](function.strstr) - Find the first occurrence of a string
* [preg\_match()](function.preg-match) - Perform a regular expression match
php ArrayObject::getIteratorClass ArrayObject::getIteratorClass
=============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
ArrayObject::getIteratorClass — Gets the iterator classname for the ArrayObject
### Description
```
public ArrayObject::getIteratorClass(): string
```
Gets the class name of the array iterator that is used by [ArrayObject::getIterator()](arrayobject.getiterator).
### Parameters
This function has no parameters.
### Return Values
Returns the iterator class name that is used to iterate over this object.
### Examples
**Example #1 **ArrayObject::getIteratorClass()** example**
```
<?php
// Custom ArrayIterator (inherits from ArrayIterator)
class MyArrayIterator extends ArrayIterator {
// custom implementation
}
// Array of available fruits
$fruits = array("lemons" => 1, "oranges" => 4, "bananas" => 5, "apples" => 10);
$fruitsArrayObject = new ArrayObject($fruits);
// Get the current class name
$className = $fruitsArrayObject->getIteratorClass();
var_dump($className);
// Set new classname
$fruitsArrayObject->setIteratorClass('MyArrayIterator');
// Get the new iterator classname
$className = $fruitsArrayObject->getIteratorClass();
var_dump($className);
?>
```
The above example will output:
```
string(13) "ArrayIterator"
string(15) "MyArrayIterator"
```
### See Also
* The [ArrayObject::setIteratorClass](arrayobject.setiteratorclass) method
php pg_lo_write pg\_lo\_write
=============
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg\_lo\_write — Write to a large object
### Description
```
pg_lo_write(PgSql\Lob $lob, string $data, ?int $length = null): int|false
```
**pg\_lo\_write()** writes data into a large object at the current seek position.
To use the large object interface, it is necessary to enclose it within a transaction block.
>
> **Note**:
>
>
> This function used to be called **pg\_lowrite()**.
>
>
### Parameters
`lob`
An [PgSql\Lob](class.pgsql-lob) instance, returned by [pg\_lo\_open()](function.pg-lo-open).
`data`
The data to be written to the large object. If `length` is an int and is less than the length of `data`, only `length` bytes will be written.
`length`
An optional maximum number of bytes to write. Must be greater than zero and no greater than the length of `data`. Defaults to the length of `data`.
### Return Values
The number of bytes written to the large object, or **`false`** on error.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `lob` parameter expects an [PgSql\Lob](class.pgsql-lob) instance now; previously, a [resource](language.types.resource) was expected. |
| 8.0.0 | `length` is now nullable. |
### Examples
**Example #1 **pg\_lo\_write()** example**
```
<?php
$doc_oid = 189762345;
$data = "This will overwrite the start of the large object.";
$database = pg_connect("dbname=jacarta");
pg_query($database, "begin");
$handle = pg_lo_open($database, $doc_oid, "w");
$data = pg_lo_write($handle, $data);
pg_query($database, "commit");
?>
```
### See Also
* [pg\_lo\_create()](function.pg-lo-create) - Create a large object
* [pg\_lo\_open()](function.pg-lo-open) - Open a large object
php ImagickDraw::setViewbox ImagickDraw::setViewbox
=======================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setViewbox — Sets the overall canvas size
### Description
```
public ImagickDraw::setViewbox(
int $x1,
int $y1,
int $x2,
int $y2
): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Sets the overall canvas size to be recorded with the drawing vector data. Usually this will be specified using the same size as the canvas image. When the vector data is saved to SVG or MVG formats, the viewbox is use to specify the size of the canvas image that a viewer will render the vector data on.
### Parameters
`x1`
left x coordinate
`y1`
left y coordinate
`x2`
right x coordinate
`y2`
right y coordinate
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::setViewBox()** example**
```
<?php
function setViewBox($strokeColor, $fillColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFontSize(72);
/*
Sets the overall canvas size to be recorded with the drawing vector data. Usually this will be specified using the same size as the canvas image. When the vector data is saved to SVG or MVG formats, the viewbox is use to specify the size of the canvas image that a viewer will render the vector data on.
*/
$draw->circle(250, 250, 250, 0);
$draw->setviewbox(0, 0, 200, 200);
$draw->circle(125, 250, 250, 250);
$draw->translate(250, 125);
$draw->circle(0, 0, 125, 0);
$imagick = new \Imagick();
$imagick->newImage(500, 500, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
php SolrPingResponse::__destruct SolrPingResponse::\_\_destruct
==============================
(PECL solr >= 0.9.2)
SolrPingResponse::\_\_destruct — Destructor
### Description
public **SolrPingResponse::\_\_destruct**() Destructor
### Parameters
This function has no parameters.
### Return Values
None
php array_intersect_assoc array\_intersect\_assoc
=======================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
array\_intersect\_assoc — Computes the intersection of arrays with additional index check
### Description
```
array_intersect_assoc(array $array, array ...$arrays): array
```
**array\_intersect\_assoc()** returns an array containing all the values of `array` that are present in all the arguments. Note that the keys are also used in the comparison unlike in [array\_intersect()](function.array-intersect).
### Parameters
`array`
The array with master values to check.
`arrays`
Arrays to compare values against.
### Return Values
Returns an associative array containing all the values in `array` that are present in all of the arguments.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function can now be called with only one parameter. Formerly, at least two parameters have been required. |
### Examples
**Example #1 **array\_intersect\_assoc()** example**
```
<?php
$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array2 = array("a" => "green", "b" => "yellow", "blue", "red");
$result_array = array_intersect_assoc($array1, $array2);
print_r($result_array);
?>
```
The above example will output:
```
Array
(
[a] => green
)
```
In our example you see that only the pair `"a" =>
"green"` is present in both arrays and thus is returned. The value `"red"` is not returned because in $array1 its key is `0` while the key of "red" in $array2 is `1`, and the key `"b"` is not returned because its values are different in each array.
The two values from the `key => value` pairs are considered equal only if `(string) $elem1 === (string) $elem2` . In other words a strict type check is executed so the string representation must be the same.
### See Also
* [array\_intersect()](function.array-intersect) - Computes the intersection of arrays
* [array\_uintersect\_assoc()](function.array-uintersect-assoc) - Computes the intersection of arrays with additional index check, compares data by a callback function
* [array\_intersect\_uassoc()](function.array-intersect-uassoc) - Computes the intersection of arrays with additional index check, compares indexes by a callback function
* [array\_uintersect\_uassoc()](function.array-uintersect-uassoc) - Computes the intersection of arrays with additional index check, compares data and indexes by separate callback functions
* [array\_diff()](function.array-diff) - Computes the difference of arrays
* [array\_diff\_assoc()](function.array-diff-assoc) - Computes the difference of arrays with additional index check
php dcgettext dcgettext
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
dcgettext — Overrides the domain for a single lookup
### Description
```
dcgettext(string $domain, string $message, int $category): string
```
This function allows you to override the current domain for a single message lookup.
### Parameters
`domain`
The domain
`message`
The message
`category`
The category
### Return Values
A string on success.
### See Also
* [gettext()](function.gettext) - Lookup a message in the current domain
php SolrQuery::setHighlightHighlightMultiTerm SolrQuery::setHighlightHighlightMultiTerm
=========================================
(PECL solr >= 0.9.2)
SolrQuery::setHighlightHighlightMultiTerm — Use SpanScorer to highlight phrase terms
### Description
```
public SolrQuery::setHighlightHighlightMultiTerm(bool $flag): SolrQuery
```
Use SpanScorer to highlight phrase terms only when they appear within the query phrase in the document.
### Parameters
`flag`
Whether or not to use SpanScorer to highlight phrase terms only when they appear within the query phrase in the document.
### Return Values
Returns the current SolrQuery object, if the return value is used.
php stats_rand_gen_exponential stats\_rand\_gen\_exponential
=============================
(PECL stats >= 1.0.0)
stats\_rand\_gen\_exponential — Generates a random deviate from the exponential distribution
### Description
```
stats_rand_gen_exponential(float $av): float
```
Returns a random deviate from the exponential distribution of which the scale is `av`.
### Parameters
`av`
The scale parameter
### Return Values
A random deviate
php mailparse_stream_encode mailparse\_stream\_encode
=========================
(PECL mailparse >= 0.9.0)
mailparse\_stream\_encode — Streams data from source file pointer, apply encoding and write to destfp
### Description
```
mailparse_stream_encode(resource $sourcefp, resource $destfp, string $encoding): bool
```
Streams data from the source file pointer, apply `encoding` and write to the destination file pointer.
### Parameters
`sourcefp`
A valid file handle. The file is streamed through the parser.
`destfp`
The destination file handle in which the encoded data will be written.
`encoding`
One of the character encodings supported by the [mbstring](https://www.php.net/manual/en/ref.mbstring.php) module.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **mailparse\_stream\_encode()** example**
```
<?php
// email.eml contents: hello, this is some text=hello.
$fp = fopen('email.eml', 'r');
$dest = tmpfile();
mailparse_stream_encode($fp, $dest, "quoted-printable");
rewind($dest);
// Display new file contents
fpassthru($dest);
?>
```
The above example will output:
```
hello, this is some text=3Dhello.
```
php ReflectionClassConstant::isPublic ReflectionClassConstant::isPublic
=================================
(PHP 7 >= 7.1.0, PHP 8)
ReflectionClassConstant::isPublic — Checks if class constant is public
### Description
```
public ReflectionClassConstant::isPublic(): bool
```
Checks if the class constant is public.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the class constant is public, otherwise **`false`**
### See Also
* [ReflectionClassConstant::isFinal()](reflectionclassconstant.isfinal) - Checks if class constant is final
* [ReflectionClassConstant::isPrivate()](reflectionclassconstant.isprivate) - Checks if class constant is private
* [ReflectionClassConstant::isProtected()](reflectionclassconstant.isprotected) - Checks if class constant is protected
php Constants
Constants
=========
Table of Contents
-----------------
* [Syntax](language.constants.syntax)
* [Predefined constants](language.constants.predefined)
* [Magic constants](language.constants.magic)
A constant is an identifier (name) for a simple value. As the name suggests, that value cannot change during the execution of the script (except for [magic constants](language.constants.magic), which aren't actually constants). Constants are case-sensitive. By convention, constant identifiers are always uppercase.
>
> **Note**:
>
>
> Prior to PHP 8.0.0, constants defined using the [define()](function.define) function may be case-insensitive.
>
>
The name of a constant follows the same rules as any label in PHP. A valid constant name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thusly: `^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$`
It is possible to [define()](function.define) constants with reserved or even invalid names, whose value can only be retrieved with the [constant()](function.constant) function. However, doing so is not recommended.
**Tip**See also the [Userland Naming Guide](https://www.php.net/manual/en/userlandnaming.php).
**Example #1 Valid and invalid constant names**
```
<?php
// Valid constant names
define("FOO", "something");
define("FOO2", "something else");
define("FOO_BAR", "something more");
// Invalid constant names
define("2FOO", "something");
// This is valid, but should be avoided:
// PHP may one day provide a magical constant
// that will break your script
define("__FOO__", "something");
?>
```
> **Note**: For our purposes here, a letter is a-z, A-Z, and the ASCII characters from 128 through 255 (0x80-0xff).
>
>
Like [superglobals](language.variables.predefined), the scope of a constant is global. Constants can be accessed from anywhere in a script without regard to scope. For more information on scope, read the manual section on [variable scope](language.variables.scope).
> **Note**: As of PHP 7.1.0, class constant may declare a visibility of protected or private, making them only available in the hierarchical scope of the class in which it is defined.
>
>
| programming_docs |
php The Worker class
The Worker class
================
Introduction
------------
(PECL pthreads >= 2.0.0)
Worker Threads have a persistent context, as such should be used over Threads in most cases.
When a Worker is started, the run method will be executed, but the Thread will not leave until one of the following conditions are met:
* the Worker goes out of scope (no more references remain)
* the programmer calls shutdown
* the script dies
This means the programmer can reuse the context throughout execution; placing objects on the stack of the Worker will cause the Worker to execute the stacked objects run method.
Class synopsis
--------------
class **Worker** extends [Thread](class.thread) implements [Traversable](class.traversable), [Countable](class.countable), [ArrayAccess](class.arrayaccess) { /\* Methods \*/
```
public collect(Callable $collector = ?): int
```
```
public getStacked(): int
```
```
public isShutdown(): bool
```
```
public shutdown(): bool
```
```
public stack(Threaded &$work): int
```
```
public unstack(): int
```
/\* Inherited methods \*/
```
public Thread::getCreatorId(): int
```
```
public static Thread::getCurrentThread(): Thread
```
```
public static Thread::getCurrentThreadId(): int
```
```
public Thread::getThreadId(): int
```
```
public Thread::isJoined(): bool
```
```
public Thread::isStarted(): bool
```
```
public Thread::join(): bool
```
```
public Thread::start(int $options = ?): bool
```
} Table of Contents
-----------------
* [Worker::collect](worker.collect) — Collect references to completed tasks
* [Worker::getStacked](worker.getstacked) — Gets the remaining stack size
* [Worker::isShutdown](worker.isshutdown) — State Detection
* [Worker::shutdown](worker.shutdown) — Shutdown the worker
* [Worker::stack](worker.stack) — Stacking work
* [Worker::unstack](worker.unstack) — Unstacking work
php GmagickDraw::getstrokecolor GmagickDraw::getstrokecolor
===========================
(PECL gmagick >= Unknown)
GmagickDraw::getstrokecolor — Returns the color used for stroking object outlines
### Description
```
public GmagickDraw::getstrokecolor(): GmagickPixel
```
Returns the color used for stroking object outlines.
### Parameters
This function has no parameters.
### Return Values
Returns an [GmagickPixel](class.gmagickpixel) object which describes the color.
php XMLWriter::__construct XMLWriter::\_\_construct
========================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::\_\_construct — Construct a new XMLWriter instance
### Description
public **XMLWriter::\_\_construct**() Constructs a new [XMLWriter](class.xmlwriter) instance.
### Parameters
This function has no parameters.
php IntlTimeZone::getGMT IntlTimeZone::getGMT
====================
intltz\_get\_gmt
================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlTimeZone::getGMT -- intltz\_get\_gmt — Create GMT (UTC) timezone
### Description
Object-oriented style (method):
```
public static IntlTimeZone::getGMT(): IntlTimeZone
```
Procedural style:
```
intltz_get_gmt(): IntlTimeZone
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php bzopen bzopen
======
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
bzopen — Opens a bzip2 compressed file
### Description
```
bzopen(string|resource $file, string $mode): resource|false
```
**bzopen()** opens a bzip2 (.bz2) file for reading or writing.
### Parameters
`file`
The name of the file to open, or an existing stream resource.
`mode`
The modes `'r'` (read), and `'w'` (write) are supported. Everything else will cause **bzopen()** to return **`false`**.
### Return Values
If the open fails, **bzopen()** returns **`false`**, otherwise it returns a pointer to the newly opened file.
### Examples
**Example #1 **bzopen()** example**
```
<?php
$file = "/tmp/foo.bz2";
$bz = bzopen($file, "r") or die("Couldn't open $file for reading");
bzclose($bz);
?>
```
### See Also
* [bzclose()](function.bzclose) - Close a bzip2 file
php PDOStatement::getAttribute PDOStatement::getAttribute
==========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.2.0)
PDOStatement::getAttribute — Retrieve a statement attribute
### Description
```
public PDOStatement::getAttribute(int $name): mixed
```
Gets an attribute of the statement. Currently, no generic attributes exist but only driver specific:
* `PDO::ATTR_CURSOR_NAME` (Firebird and ODBC specific): Get the name of cursor for `UPDATE ... WHERE CURRENT OF`.
Note that driver specific attributes *must not* be used with other drivers. ### Parameters
`name`
The attribute to query.
### Return Values
Returns the attribute value.
### See Also
* [PDO::getAttribute()](pdo.getattribute) - Retrieve a database connection attribute
* [PDO::setAttribute()](pdo.setattribute) - Set an attribute
* [PDOStatement::setAttribute()](pdostatement.setattribute) - Set a statement attribute
php ImagickDraw::line ImagickDraw::line
=================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::line — Draws a line
### Description
```
public ImagickDraw::line(
float $sx,
float $sy,
float $ex,
float $ey
): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Draws a line on the image using the current stroke color, stroke opacity, and stroke width.
### Parameters
`sx`
starting x coordinate
`sy`
starting y coordinate
`ex`
ending x coordinate
`ey`
ending y coordinate
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::line()** example**
```
<?php
function line($strokeColor, $fillColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFontSize(72);
$draw->line(125, 70, 100, 50);
$draw->line(350, 170, 100, 150);
$imagick = new \Imagick();
$imagick->newImage(500, 500, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
php array_key_first array\_key\_first
=================
(PHP 7 >= 7.3.0, PHP 8)
array\_key\_first — Gets the first key of an array
### Description
```
array_key_first(array $array): int|string|null
```
Get the first key of the given `array` without affecting the internal array pointer.
### Parameters
`array`
An array.
### Return Values
Returns the first key of `array` if the array is not empty; **`null`** otherwise.
### Examples
**Example #1 Basic **array\_key\_first()** Usage**
```
<?php
$array = ['a' => 1, 'b' => 2, 'c' => 3];
$firstKey = array_key_first($array);
var_dump($firstKey);
?>
```
The above example will output:
```
string(1) "a"
```
### Notes
**Tip** There are several ways to provide this functionality for versions prior to PHP 7.3.0. It is possible to use [array\_keys()](function.array-keys), but that may be rather inefficient. It is also possible to use [reset()](function.reset) and [key()](function.key), but that may change the internal array pointer. An efficient solution, which does not change the internal array pointer, written as polyfill:
```
<?php
if (!function_exists('array_key_first')) {
function array_key_first(array $arr) {
foreach($arr as $key => $unused) {
return $key;
}
return NULL;
}
}
?>
```
### See Also
* [array\_key\_last()](function.array-key-last) - Gets the last key of an array
* [reset()](function.reset) - Set the internal pointer of an array to its first element
php CURLFile::setMimeType CURLFile::setMimeType
=====================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
CURLFile::setMimeType — Set MIME type
### Description
```
public CURLFile::setMimeType(string $mime_type): void
```
### Parameters
`mime_type`
MIME type to be used in POST data.
### Return Values
No value is returned.
php InternalIterator::current InternalIterator::current
=========================
(PHP 8)
InternalIterator::current — Return the current element
### Description
```
public InternalIterator::current(): mixed
```
Returns the current element.
### Parameters
This function has no parameters.
### Return Values
Returns the current element.
php SplObjectStorage::serialize SplObjectStorage::serialize
===========================
(PHP 5 >= 5.2.2, PHP 7, PHP 8)
SplObjectStorage::serialize — Serializes the storage
### Description
```
public SplObjectStorage::serialize(): string
```
Returns a string representation of the storage.
### Parameters
This function has no parameters.
### Return Values
A string representing the storage.
### Examples
**Example #1 **SplObjectStorage::serialize()** example**
```
<?php
$s = new SplObjectStorage;
$o = new StdClass;
$s[$o] = "data";
echo $s->serialize()."\n";
?>
```
The above example will output something similar to:
```
x:i:1;O:8:"stdClass":0:{},s:4:"data";;m:a:0:{}
```
### See Also
* [SplObjectStorage::unserialize()](splobjectstorage.unserialize) - Unserializes a storage from its string representation
php pg_client_encoding pg\_client\_encoding
====================
(PHP 4 >= 4.0.3, PHP 5, PHP 7, PHP 8)
pg\_client\_encoding — Gets the client encoding
### Description
```
pg_client_encoding(?PgSql\Connection $connection = null): string
```
PostgreSQL supports automatic character set conversion between server and client for certain character sets. **pg\_client\_encoding()** returns the client encoding as a string. The returned string will be one of the standard PostgreSQL encoding identifiers.
>
> **Note**:
>
>
> This function requires PostgreSQL 7.0 or higher. If libpq is compiled without multibyte encoding support, **pg\_client\_encoding()** always returns `SQL_ASCII`. Supported encoding depends on PostgreSQL version. Refer to the PostgreSQL Documentation supported encodings.
>
> The function used to be called **pg\_clientencoding()**.
>
>
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance. When `connection` is **`null`**, the default connection is used. The default connection is the last connection made by [pg\_connect()](function.pg-connect) or [pg\_pconnect()](function.pg-pconnect).
**Warning**As of PHP 8.1.0, using the default connection is deprecated.
### Return Values
The client encoding.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. |
| 8.0.0 | `connection` is now nullable. |
### Examples
**Example #1 **pg\_client\_encoding()** example**
```
<?php
// Assume $conn is a connection to a ISO-8859-1 database
$encoding = pg_client_encoding($conn);
echo "Client encoding is: ", $encoding, "\n";
?>
```
The above example will output:
```
Client encoding is: ISO-8859-1
```
### See Also
* [pg\_set\_client\_encoding()](function.pg-set-client-encoding) - Set the client encoding
php taint taint
=====
(PECL taint >=0.1.0)
taint — Taint a string
### Description
```
taint(string &$string, string ...$strings): bool
```
Make a string tainted. This is used for testing purpose only.
### Parameters
`string`
`strings`
### Return Values
Return TRUE if the transformation is done. Always return TRUE if the taint extension is not enabled.
php session_gc session\_gc
===========
(PHP 7 >= 7.1.0, PHP 8)
session\_gc — Perform session data garbage collection
### Description
```
session_gc(): int|false
```
**session\_gc()** is used to perform session data GC(garbage collection). PHP does probability based session GC by default.
Probability based GC works somewhat but it has few problems. 1) Low traffic sites' session data may not be deleted within the preferred duration. 2) High traffic sites' GC may be too frequent GC. 3) GC is performed on the user's request and the user will experience a GC delay.
Therefore, it is recommended to execute GC periodically for production systems using, e.g., "cron" for UNIX-like systems. Make sure to disable probability based GC by setting [session.gc\_probability](https://www.php.net/manual/en/session.configuration.php#ini.session.gc-probability) to 0.
### Parameters
This function has no parameters.
### Return Values
**session\_gc()** returns number of deleted session data for success, **`false`** for failure.
Old save handlers do not return number of deleted session data, but only success/failure flag. If this is the case, number of deleted session data became 1 regardless of actually deleted data.
### Examples
**Example #1 **session\_gc()** example for task managers like cron**
```
<?php
// Note: This script should be executed by the same user of web server process.
// Need active session to initialize session data storage access.
session_start();
// Executes GC immediately
session_gc();
// Clean up session ID created by session_gc()
session_destroy();
?>
```
**Example #2 **session\_gc()** example for user accessible script**
```
<?php
// Note: session_gc() is recommended to be used by task manager script, but
// it may be used as follows.
// Used for last GC time check
$gc_time = '/tmp/php_session_last_gc';
$gc_period = 1800;
session_start();
// Execute GC only when GC period elapsed.
// i.e. Calling session_gc() every request is waste of resources.
if (file_exists($gc_time)) {
if (filemtime($gc_time) < time() - $gc_period) {
session_gc();
touch($gc_time);
}
} else {
touch($gc_time);
}
?>
```
### See Also
* [session\_start()](function.session-start) - Start new or resume existing session
* [session\_destroy()](function.session-destroy) - Destroys all data registered to a session
* [session.gc\_probability](https://www.php.net/manual/en/session.configuration.php#ini.session.gc-probability)
php odbc_tableprivileges odbc\_tableprivileges
=====================
(PHP 4, PHP 5, PHP 7, PHP 8)
odbc\_tableprivileges — Lists tables and the privileges associated with each table
### Description
```
odbc_tableprivileges(
resource $odbc,
?string $catalog,
string $schema,
string $table
): resource|false
```
Lists tables in the requested range and the privileges associated with each table.
### Parameters
`odbc`
The ODBC connection identifier, see [odbc\_connect()](function.odbc-connect) for details.
`catalog`
The catalog ('qualifier' in ODBC 2 parlance).
`schema`
The schema ('owner' in ODBC 2 parlance). This parameter accepts the following search patterns: `%` to match zero or more characters, and `_` to match a single character.
`table`
The name. This parameter accepts the following search patterns: `%` to match zero or more characters, and `_` to match a single character.
### Return Values
An ODBC result identifier or **`false`** on failure.
The result set has the following columns:
* `TABLE_CAT`
* `TABLE_SCHEM`
* `TABLE_NAME`
* `GRANTOR`
* `GRANTEE`
* `PRIVILEGE`
* `IS_GRANTABLE`
Drivers can report additional columns. The result set is ordered by `TABLE_CAT`, `TABLE_SCHEM`, `TABLE_NAME`, `PRIVILEGE` and `GRANTEE`.
### Examples
**Example #1 List Privileges of a Table**
```
<?php
$conn = odbc_connect($dsn, $user, $pass);
$privileges = odbc_tableprivileges($conn, 'SalesOrders', 'dbo', 'Orders');
while (($row = odbc_fetch_array($privileges))) {
print_r($row);
break; // further rows omitted for brevity
}
?>
```
The above example will output something similar to:
```
Array
(
[TABLE_CAT] => SalesOrders
[TABLE_SCHEM] => dbo
[TABLE_NAME] => Orders
[GRANTOR] => dbo
[GRANTEE] => dbo
[PRIVILEGE] => DELETE
[IS_GRANTABLE] => YES
)
```
### See Also
* [odbc\_tables()](function.odbc-tables) - Get the list of table names stored in a specific data source
php Imagick::floodFillPaintImage Imagick::floodFillPaintImage
============================
(PECL imagick 2 >= 2.3.0, PECL imagick 3)
Imagick::floodFillPaintImage — Changes the color value of any pixel that matches target
### Description
```
public Imagick::floodFillPaintImage(
mixed $fill,
float $fuzz,
mixed $target,
int $x,
int $y,
bool $invert,
int $channel = Imagick::CHANNEL_DEFAULT
): bool
```
Changes the color value of any pixel that matches target and is an immediate neighbor. This method is a replacement for deprecated [Imagick::paintFloodFillImage()](imagick.paintfloodfillimage). This method is available if Imagick has been compiled against ImageMagick version 6.3.8 or newer.
### Parameters
`fill`
ImagickPixel object or a string containing the fill color
`fuzz`
The amount of fuzz. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color.
`target`
ImagickPixel object or a string containing the target color to paint
`x`
X start position of the floodfill
`y`
Y start position of the floodfill
`invert`
If **`true`** paints any pixel that does not match the target color.
`channel`
Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel) using bitwise operators. Defaults to **`Imagick::CHANNEL_DEFAULT`**. Refer to this list of [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel)
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::floodfillPaintImage()** example**
```
<?php
/* Create new imagick object */
$im = new Imagick();
/* create red, green and blue images */
$im->newImage(100, 50, "red");
$im->newImage(100, 50, "green");
$im->newImage(100, 50, "blue");
/* Append the images into one */
$im->resetIterator();
$combined = $im->appendImages(true);
/* Save the intermediate image for comparison */
$combined->writeImage("floodfillpaint_intermediate.png");
/* The target pixel to paint */
$x = 1;
$y = 1;
/* Get the color we are painting */
$target = $combined->getImagePixelColor($x, $y);
/* Paints pixel in position 1,1 black and all neighboring
pixels that match the target color */
$combined->floodfillPaintImage("black", 1, $target, $x, $y, false);
/* Save the result */
$combined->writeImage("floodfillpaint_result.png");
?>
```
The above example will output something similar to:
php Imagick::setOption Imagick::setOption
==================
(PECL imagick 2, PECL imagick 3)
Imagick::setOption — Set an option
### Description
```
public Imagick::setOption(string $key, string $value): bool
```
Associates one or more options with the wand.
### Parameters
`key`
`value`
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 Attempt to reach '$extent' size**Imagick::setOption()****
```
<?php
function renderJPG($extent) {
$imagePath = $this->control->getImagePath();
$imagick = new \Imagick(realpath($imagePath));
$imagick->setImageFormat('jpg');
$imagick->setOption('jpeg:extent', $extent);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
**Example #2 **Imagick::setOption()****
```
<?php
function renderPNG($imagePath, $format) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->setImageFormat('png');
$imagick->setOption('png:format', $format);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
//Save as 64bit PNG.
renderPNG($imagePath, 'png64');
?>
```
**Example #3 **Imagick::setOption()****
```
<?php
function renderCustomBitDepthPNG() {
$imagePath = $this->control->getImagePath();
$imagick = new \Imagick(realpath($imagePath));
$imagick->setImageFormat('png');
$imagick->setOption('png:bit-depth', '16');
$imagick->setOption('png:color-type', 6);
header("Content-Type: image/png");
$crash = true;
if ($crash) {
echo $imagick->getImageBlob();
}
else {
$tempFilename = tempnam('./', 'imagick');
$imagick->writeimage(realpath($tempFilename));
echo file_get_contents($tempFilename);
}
}
?>
```
| programming_docs |
php xml_parser_free xml\_parser\_free
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
xml\_parser\_free — Free an XML parser
### Description
```
xml_parser_free(XMLParser $parser): bool
```
>
> **Note**:
>
>
> This function has no effect. Prior to PHP 8.0.0, this function was used to close the resource.
>
>
Frees the given XML `parser`.
**Caution** In addition to calling **xml\_parser\_free()** when the parsing is finished, prior to PHP 8.0.0, it was necessary to also explicitly unset the reference to `parser` to avoid memory leaks, if the parser resource is referenced from an object, and this object references that parser resource.
### Parameters
`parser`
A reference to the XML parser to free. ### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `parser` expects an [XMLParser](class.xmlparser) instance now; previously, a resource was expected. |
php mcrypt_enc_get_block_size mcrypt\_enc\_get\_block\_size
=============================
(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mcrypt\_enc\_get\_block\_size — Returns the blocksize of the opened algorithm
**Warning**This function has been *DEPRECATED* as of PHP 7.1.0 and *REMOVED* as of PHP 7.2.0. Relying on this function is highly discouraged.
### Description
```
mcrypt_enc_get_block_size(resource $td): int
```
Gets the blocksize of the opened algorithm.
### Parameters
`td`
The encryption descriptor.
### Return Values
Returns the block size of the specified algorithm in bytes.
php SolrInputDocument::addChildDocuments SolrInputDocument::addChildDocuments
====================================
(PECL solr >= 2.3.0)
SolrInputDocument::addChildDocuments — Adds an array of child documents
### Description
```
public SolrInputDocument::addChildDocuments(array &$docs): void
```
Adds an array of child documents to the current input document.
### Parameters
`docs`
An array of [SolrInputDocument](class.solrinputdocument) objects.
### Return Values
No value is returned.
### Errors/Exceptions
Throws [SolrIllegalArgumentException](class.solrillegalargumentexception) on failure.
Throws [SolrException](class.solrexception) on internal failure.
### Examples
**Example #1 **SolrInputDocument::addChildDocuments()** example**
```
<?php
include "bootstrap.php";
$options = array
(
'hostname' => SOLR_SERVER_HOSTNAME,
'login' => SOLR_SERVER_USERNAME,
'password' => SOLR_SERVER_PASSWORD,
'port' => SOLR_SERVER_PORT,
'path' => SOLR_SERVER_STORE_PATH,
);
$client = new SolrClient($options);
$product = new SolrInputDocument();
$product->addField('id', 'P-BLACK');
$product->addField('cat', 'tshirt');
$product->addField('cat', 'polo');
$product->addField('content_type', 'product');
$small = new SolrInputDocument();
$small->addField('id', 'TS-BLK-S');
$small->addField('content_type', 'sku');
$small->addField('size', 'S');
$small->addField('inventory', 100);
$medium = new SolrInputDocument();
$medium->addField('id', 'TS-BLK-M');
$medium->addField('content_type', 'sku');
$medium->addField('size', 'M');
$medium->addField('inventory', 200);
$large = new SolrInputDocument();
$large->addField('id', 'TS-BLK-L');
$large->addField('content_type', 'sku');
$large->addField('size', 'L');
$large->addField('inventory', 300);
// add child documents
$skus = [$small, $medium, $large];
$product->addChildDocuments($skus);
// add the product document block to the index
$updateResponse = $client->addDocument(
$product,
true, // overwrite if the document exists
10000 // commit within 10 seconds
);
print_r($updateResponse->getResponse());
```
The above example will output something similar to:
```
SolrObject Object
(
[responseHeader] => SolrObject Object
(
[status] => 0
[QTime] => 5
)
)
```
### See Also
* [SolrInputDocument::addChildDocument()](solrinputdocument.addchilddocument) - Adds a child document for block indexing
* [SolrInputDocument::hasChildDocuments()](solrinputdocument.haschilddocuments) - Returns true if the document has any child documents
* [SolrInputDocument::getChildDocuments()](solrinputdocument.getchilddocuments) - Returns an array of child documents (SolrInputDocument)
* [SolrInputDocument::getChildDocumentsCount()](solrinputdocument.getchilddocumentscount) - Returns the number of child documents
php posix_uname posix\_uname
============
(PHP 4, PHP 5, PHP 7, PHP 8)
posix\_uname — Get system name
### Description
```
posix_uname(): array|false
```
Gets information about the system.
Posix requires that assumptions must not be made about the format of the values, e.g. the assumption that a release may contain three digits or anything else returned by this function.
### Parameters
This function has no parameters.
### Return Values
Returns a hash of strings with information about the system. The indices of the hash are
* sysname - operating system name (e.g. Linux)
* nodename - system name (e.g. valiant)
* release - operating system release (e.g. 2.2.10)
* version - operating system version (e.g. #4 Tue Jul 20 17:01:36 MEST 1999)
* machine - system architecture (e.g. i586)
* domainname - DNS domainname (e.g. example.com)
domainname is a GNU extension and not part of POSIX.1, so this field is only available on GNU systems or when using the GNU libc.
The function returns **`false`** on failure.
### Examples
**Example #1 Example use of **posix\_uname()****
```
<?php
$uname=posix_uname();
print_r($uname);
?>
```
The above example will output something similar to:
```
Array
(
[sysname] => Linux
[nodename] => funbox
[release] => 2.6.20-15-server
[version] => #2 SMP Sun Apr 15 07:41:34 UTC 2007
[machine] => i686
)
```
php ParentIterator::accept ParentIterator::accept
======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
ParentIterator::accept — Determines acceptability
### Description
```
public ParentIterator::accept(): bool
```
Determines if the current element has children.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the current element is acceptable, otherwise **`false`**.
### See Also
* [ParentIterator::hasChildren()](parentiterator.haschildren) - Check whether the inner iterator's current element has children
* [FilterIterator::accept()](filteriterator.accept) - Check whether the current element of the iterator is acceptable
php XMLReader::setParserProperty XMLReader::setParserProperty
============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
XMLReader::setParserProperty — Set parser options
### Description
```
public XMLReader::setParserProperty(int $property, bool $value): bool
```
Set parser options. The options must be set after [XMLReader::open()](xmlreader.open) or [XMLReader::xml()](xmlreader.xml) are called and before the first [XMLReader::read()](xmlreader.read) call.
### Parameters
`property`
One of the [parser option constants](class.xmlreader#xmlreader.constants).
`value`
If set to **`true`** the option will be enabled otherwise will be disabled.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php posix_setrlimit posix\_setrlimit
================
(PHP 7, PHP 8)
posix\_setrlimit — Set system resource limits
### Description
```
posix_setrlimit(int $resource, int $soft_limit, int $hard_limit): bool
```
**posix\_setrlimit()** sets the soft and hard limits for a given system resource.
Each resource has an associated soft and hard limit. The soft limit is the value that the kernel enforces for the corresponding resource. The hard limit acts as a ceiling for the soft limit. An unprivileged process may only set its soft limit to a value from 0 to the hard limit, and irreversibly lower its hard limit.
### Parameters
`resource`
The [resource limit constant](https://www.php.net/manual/en/posix.constants.setrlimit.php) corresponding to the limit that is being set.
`soft_limit`
The soft limit, in whatever unit the resource limit requires, or **`POSIX_RLIMIT_INFINITY`**.
`hard_limit`
The hard limit, in whatever unit the resource limit requires, or **`POSIX_RLIMIT_INFINITY`**.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* man page SETRLIMIT(2)
* [posix\_getrlimit()](function.posix-getrlimit) - Return info about system resource limits
php mysqli_stmt::send_long_data mysqli\_stmt::send\_long\_data
==============================
mysqli\_stmt\_send\_long\_data
==============================
(PHP 5, PHP 7, PHP 8)
mysqli\_stmt::send\_long\_data -- mysqli\_stmt\_send\_long\_data — Send data in blocks
### Description
Object-oriented style
```
public mysqli_stmt::send_long_data(int $param_num, string $data): bool
```
Procedural style
```
mysqli_stmt_send_long_data(mysqli_stmt $statement, int $param_num, string $data): bool
```
Allows to send parameter data to the server in pieces (or chunks), e.g. if the size of a blob exceeds the size of `max_allowed_packet`. This function can be called multiple times to send the parts of a character or binary data value for a column, which must be one of the TEXT or BLOB datatypes.
### Parameters
`statement`
Procedural style only: A [mysqli\_stmt](class.mysqli-stmt) object returned by [mysqli\_stmt\_init()](mysqli.stmt-init).
`param_num`
Indicates which parameter to associate the data with. Parameters are numbered beginning with 0.
`data`
A string containing data to be sent.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Object-oriented style**
```
<?php
$stmt = $mysqli->prepare("INSERT INTO messages (message) VALUES (?)");
$null = NULL;
$stmt->bind_param("b", $null);
$fp = fopen("messages.txt", "r");
while (!feof($fp)) {
$stmt->send_long_data(0, fread($fp, 8192));
}
fclose($fp);
$stmt->execute();
?>
```
### See Also
* [mysqli\_prepare()](mysqli.prepare) - Prepares an SQL statement for execution
* [mysqli\_stmt\_bind\_param()](mysqli-stmt.bind-param) - Binds variables to a prepared statement as parameters
php imap_scan imap\_scan
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_scan — Alias of [imap\_listscan()](function.imap-listscan)
### Description
This function is an alias of: [imap\_listscan()](function.imap-listscan).
php stats_rand_gen_gamma stats\_rand\_gen\_gamma
=======================
(PECL stats >= 1.0.0)
stats\_rand\_gen\_gamma — Generates a random deviate from the gamma distribution
### Description
```
stats_rand_gen_gamma(float $a, float $r): float
```
Generates a random deviate from the gamma distribution whose density is (A\*\*R)/Gamma(R) \* X\*\*(R-1) \* Exp(-A\*X).
### Parameters
`a`
location parameter of Gamma distribution (`a` > 0).
`r`
shape parameter of Gamma distribution (`r` > 0).
### Return Values
A random deviate
php IntlCalendar::getMinimum IntlCalendar::getMinimum
========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::getMinimum — Get the global minimum value for a field
### Description
Object-oriented style
```
public IntlCalendar::getMinimum(int $field): int|false
```
Procedural style
```
intlcal_get_minimum(IntlCalendar $calendar, int $field): int|false
```
Gets the global minimum for a field, in this specific calendar. This value is smaller or equal to that returned by [IntlCalendar::getActualMinimum()](intlcalendar.getactualminimum), which is in its turn smaller or equal to that returned by [IntlCalendar::getGreatestMinimum()](intlcalendar.getgreatestminimum). For the Gregorian calendar, these three functions always return the same value (for each field).
### Parameters
`calendar`
An [IntlCalendar](class.intlcalendar) instance.
`field`
One of the [IntlCalendar](class.intlcalendar) date/time [field constants](class.intlcalendar#intlcalendar.constants). These are integer values between `0` and **`IntlCalendar::FIELD_COUNT`**.
### Return Values
An int representing a value for the given field in the fieldʼs unit or **`false`** on failure.
php ibase_blob_close ibase\_blob\_close
==================
(PHP 5, PHP 7 < 7.4.0)
ibase\_blob\_close — Close blob
### Description
```
ibase_blob_close(resource $blob_handle): mixed
```
This function closes a BLOB that has either been opened for reading by [ibase\_blob\_open()](function.ibase-blob-open) or has been opened for writing by [ibase\_blob\_create()](function.ibase-blob-create).
### Parameters
`blob_handle`
A BLOB handle opened with [ibase\_blob\_create()](function.ibase-blob-create) or [ibase\_blob\_open()](function.ibase-blob-open).
### Return Values
If the BLOB was being read, this function returns **`true`** on success, if the BLOB was being written to, this function returns a string containing the BLOB id that has been assigned to it by the database. On failure, this function returns **`false`**.
### See Also
* [ibase\_blob\_cancel()](function.ibase-blob-cancel) - Cancel creating blob
* [ibase\_blob\_open()](function.ibase-blob-open) - Open blob for retrieving data parts
php IntlDatePatternGenerator::create IntlDatePatternGenerator::create
================================
IntlDatePatternGenerator::\_\_construct
=======================================
(PHP 8 >= 8.1.0)
IntlDatePatternGenerator::create -- IntlDatePatternGenerator::\_\_construct — Creates a new IntlDatePatternGenerator instance
### Description
```
public static IntlDatePatternGenerator::create(?string $locale = null): ?IntlDatePatternGenerator
```
public **IntlDatePatternGenerator::\_\_construct**(?string `$locale` = **`null`**) Creates a new [IntlDatePatternGenerator](class.intldatepatterngenerator) instance.
### Parameters
`locale`
The locale. If **`null`** is passed, uses the ini setting [intl.default\_locale](https://www.php.net/manual/en/intl.configuration.php#ini.intl.default-locale).
### Return Values
Returns an [IntlDatePatternGenerator](class.intldatepatterngenerator) instance on success, or **`null`** on failure.
php uopz_restore uopz\_restore
=============
(PECL uopz 1 >= 1.0.3, PECL uopz 2)
uopz\_restore — Restore a previously backed up function
**Warning**This function has been *REMOVED* in PECL uopz 5.0.0.
### Description
```
uopz_restore(string $function): void
```
```
uopz_restore(string $class, string $function): void
```
Restore a previously backed up function
### Parameters
`class`
The name of the class containing the function to restore
`function`
The name of the function
### Return Values
### Examples
**Example #1 **uopz\_restore()** example**
```
<?php
uopz_backup("fgets");
uopz_function("fgets", function(){
return true;
});
var_dump(fgets());
uopz_restore('fgets');
fgets();
?>
```
The above example will output something similar to:
```
Warning: fgets() expects at least 1 parameter, 0 given in /path/to/script.php on line 8
```
php Gmagick::mapimage Gmagick::mapimage
=================
(PECL gmagick >= Unknown)
Gmagick::mapimage — Replaces the colors of an image with the closest color from a reference image
### Description
```
public Gmagick::mapimage(gmagick $gmagick, bool $dither): Gmagick
```
Replaces the colors of an image with the closest color from a reference image.
### Parameters
`gmagick`
The reference image.
`dither`
Set this integer value to something other than zero to dither the mapped image.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php bzdecompress bzdecompress
============
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
bzdecompress — Decompresses bzip2 encoded data
### Description
```
bzdecompress(string $data, bool $use_less_memory = false): string|int|false
```
**bzdecompress()** decompresses the given string containing bzip2 encoded data.
### Parameters
`data`
The string to decompress.
`use_less_memory`
If **`true`**, an alternative decompression algorithm will be used which uses less memory (the maximum memory requirement drops to around 2300K) but works at roughly half the speed.
See the [» bzip2 documentation](https://www.sourceware.org/bzip2/) for more information about this feature.
### Return Values
The decompressed string, or **`false`** or an error number if an error occurred.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | The type of `use_less_memory` has been changed from int to bool. Previously, the default value was `0`. |
### Examples
**Example #1 Decompressing a String**
```
<?php
$start_str = "This is not an honest face?";
$bzstr = bzcompress($start_str);
echo "Compressed String: ";
echo $bzstr;
echo "\n<br />\n";
$str = bzdecompress($bzstr);
echo "Decompressed String: ";
echo $str;
echo "\n<br />\n";
?>
```
### See Also
* [bzcompress()](function.bzcompress) - Compress a string into bzip2 encoded data
php RegexIterator::getFlags RegexIterator::getFlags
=======================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
RegexIterator::getFlags — Get flags
### Description
```
public RegexIterator::getFlags(): int
```
Returns the flags, see [RegexIterator::setFlags()](regexiterator.setflags) for a list of available flags.
### Parameters
This function has no parameters.
### Return Values
Returns the set flags.
### Examples
**Example #1 **RegexIterator::getFlags()** example**
```
<?php
$test = array ('str1' => 'test 1', 'teststr2' => 'another test', 'str3' => 'test 123');
$arrayIterator = new ArrayIterator($test);
$regexIterator = new RegexIterator($arrayIterator, '/^test/');
$regexIterator->setFlags(RegexIterator::USE_KEY);
if ($regexIterator->getFlags() & RegexIterator::USE_KEY) {
echo 'Filtering based on the array keys.';
} else {
echo 'Filtering based on the array values.';
}
?>
```
The above example will output:
```
Filtering based on the array keys.
```
### See Also
* [RegexIterator::setFlags()](regexiterator.setflags) - Sets the flags
php wddx_packet_start wddx\_packet\_start
===================
(PHP 4, PHP 5, PHP 7)
wddx\_packet\_start — Starts a new WDDX packet with structure inside it
**Warning**This function was *REMOVED* in PHP 7.4.0.
### Description
```
wddx_packet_start(string $comment = ?): resource
```
Start a new WDDX packet for incremental addition of variables. It automatically creates a structure definition inside the packet to contain the variables.
### Parameters
`comment`
An optional comment string.
### Return Values
Returns a packet ID for use in later functions, or **`false`** on error.
php Ds\Map::intersect Ds\Map::intersect
=================
(PECL ds >= 1.0.0)
Ds\Map::intersect — Creates a new map by intersecting keys with another map
### Description
```
public Ds\Map::intersect(Ds\Map $map): Ds\Map
```
Creates a new map containing the pairs of the current instance whose keys are also present in the given `map`. In other words, returns a copy of the current instance with all keys removed that are not also in the other `map`.
`A ∩ B = {x : x ∈ A ∧ x ∈ B}`
>
> **Note**:
>
>
> Values from the current instance will be kept.
>
>
### Parameters
`map`
The other map, containing the keys to intersect with.
### Return Values
The key intersection of the current instance and another `map`.
### See Also
* [» Intersection](https://en.wikipedia.org/wiki/Intersection_(set_theory)) on Wikipedia
### Examples
**Example #1 **Ds\Map::intersect()** example**
```
<?php
$a = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]);
$b = new \Ds\Map(["b" => 4, "c" => 5, "d" => 6]);
var_dump($a->intersect($b));
?>
```
The above example will output something similar to:
```
object(Ds\Map)#3 (2) {
[0]=>
object(Ds\Pair)#4 (2) {
["key"]=>
string(1) "b"
["value"]=>
int(2)
}
[1]=>
object(Ds\Pair)#5 (2) {
["key"]=>
string(1) "c"
["value"]=>
int(3)
}
}
```
| programming_docs |
php Yaf_Exception::getPrevious Yaf\_Exception::getPrevious
===========================
(Yaf >=1.0.0)
Yaf\_Exception::getPrevious — The getPrevious purpose
### Description
```
public Yaf_Exception::getPrevious(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php SplDoublyLinkedList::isEmpty SplDoublyLinkedList::isEmpty
============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplDoublyLinkedList::isEmpty — Checks whether the doubly linked list is empty
### Description
```
public SplDoublyLinkedList::isEmpty(): bool
```
### Parameters
This function has no parameters.
### Return Values
Returns whether the doubly linked list is empty.
php stats_cdf_poisson stats\_cdf\_poisson
===================
(PECL stats >= 1.0.0)
stats\_cdf\_poisson — Calculates any one parameter of the Poisson distribution given values for the others
### Description
```
stats_cdf_poisson(float $par1, float $par2, int $which): float
```
Returns the cumulative distribution function, its inverse, or one of its parameters, of the Poisson distribution. The kind of the return value and parameters (`par1` and `par2`) are determined by `which`.
The following table lists the return value and parameters by `which`. CDF, x, and lambda denotes cumulative distribution function, the value of the random variable, and the parameter of the Poisson distribution, respectively.
**Return value and parameters**| `which` | Return value | `par1` | `par2` |
| --- | --- | --- | --- |
| 1 | CDF | x | lambda |
| 2 | x | CDF | lambda |
| 3 | lambda | x | CDF |
### Parameters
`par1`
The first parameter
`par2`
The second parameter
`which`
The flag to determine what to be calculated
### Return Values
Returns CDF, x, or lambda, determined by `which`.
php PDO::getAttribute PDO::getAttribute
=================
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.2.0)
PDO::getAttribute — Retrieve a database connection attribute
### Description
```
public PDO::getAttribute(int $attribute): mixed
```
This function returns the value of a database connection attribute. To retrieve PDOStatement attributes, refer to [PDOStatement::getAttribute()](pdostatement.getattribute).
Note that some database/driver combinations may not support all of the database connection attributes.
### Parameters
`attribute`
One of the `PDO::ATTR_*` constants. The generic attributes that apply to database connections are as follows:
* `PDO::ATTR_AUTOCOMMIT`
* `PDO::ATTR_CASE`
* `PDO::ATTR_CLIENT_VERSION`
* `PDO::ATTR_CONNECTION_STATUS`
* `PDO::ATTR_DRIVER_NAME`
* `PDO::ATTR_ERRMODE`
* `PDO::ATTR_ORACLE_NULLS`
* `PDO::ATTR_PERSISTENT`
* `PDO::ATTR_PREFETCH`
* `PDO::ATTR_SERVER_INFO`
* `PDO::ATTR_SERVER_VERSION`
* `PDO::ATTR_TIMEOUT`
Some drivers may make use of additional driver specific attributes. Note that driver specific attributes *must not* be used with other drivers. ### Return Values
A successful call returns the value of the requested PDO attribute. An unsuccessful call returns `null`.
### Examples
**Example #1 Retrieving database connection attributes**
```
<?php
$conn = new PDO('odbc:sample', 'db2inst1', 'ibmdb2');
$attributes = array(
"AUTOCOMMIT", "ERRMODE", "CASE", "CLIENT_VERSION", "CONNECTION_STATUS",
"ORACLE_NULLS", "PERSISTENT", "PREFETCH", "SERVER_INFO", "SERVER_VERSION",
"TIMEOUT"
);
foreach ($attributes as $val) {
echo "PDO::ATTR_$val: ";
echo $conn->getAttribute(constant("PDO::ATTR_$val")) . "\n";
}
?>
```
### See Also
* [PDO::setAttribute()](pdo.setattribute) - Set an attribute
* [PDOStatement::getAttribute()](pdostatement.getattribute) - Retrieve a statement attribute
* [PDOStatement::setAttribute()](pdostatement.setattribute) - Set a statement attribute
php MultipleIterator::attachIterator MultipleIterator::attachIterator
================================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
MultipleIterator::attachIterator — Attaches iterator information
### Description
```
public MultipleIterator::attachIterator(Iterator $iterator, string|int|null $info = null): void
```
Attaches iterator information.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`iterator`
The new iterator to attach.
`info`
The associative information for the Iterator, which must be an int, a string, or **`null`**.
### Return Values
Description...
### Errors/Exceptions
An **IllegalValueException** if the `iterator` parameter is invalid, or if `info` is already associated information.
### See Also
* [MultipleIterator::\_\_construct()](multipleiterator.construct) - Constructs a new MultipleIterator
php SplFixedArray::offsetGet SplFixedArray::offsetGet
========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplFixedArray::offsetGet — Returns the value at the specified index
### Description
```
public SplFixedArray::offsetGet(int $index): mixed
```
Returns the value at the index `index`.
### Parameters
`index`
The index with the value.
### Return Values
The value at the specified `index`.
### Errors/Exceptions
Throws [RuntimeException](class.runtimeexception) when `index` is outside the defined size of the array or when `index` cannot be parsed as an integer.
php DOMDocument::relaxNGValidateSource DOMDocument::relaxNGValidateSource
==================================
(PHP 5, PHP 7, PHP 8)
DOMDocument::relaxNGValidateSource — Performs relaxNG validation on the document
### Description
```
public DOMDocument::relaxNGValidateSource(string $source): bool
```
Performs [» relaxNG](http://www.relaxng.org/) validation on the document based on the given RNG source.
### Parameters
`source`
A string containing the RNG schema.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [DOMDocument::relaxNGValidate()](domdocument.relaxngvalidate) - Performs relaxNG validation on the document
* [DOMDocument::schemaValidate()](domdocument.schemavalidate) - Validates a document based on a schema. Only XML Schema 1.0 is supported.
* [DOMDocument::schemaValidateSource()](domdocument.schemavalidatesource) - Validates a document based on a schema
* [DOMDocument::validate()](domdocument.validate) - Validates the document based on its DTD
php EventBuffer::searchEol EventBuffer::searchEol
======================
(PECL event >= 1.5.0)
EventBuffer::searchEol — Scans the buffer for an occurrence of an end of line
### Description
```
public EventBuffer::searchEol( int $start = -1 , int $eol_style = EventBuffer::EOL_ANY ): mixed
```
Scans the buffer for an occurrence of an end of line specified by `eol_style` parameter . It returns numeric position of the string, or **`false`** if the string was not found.
If the `start` argument is provided, it represents the position at which the search should begin; otherwise, the search is performed from the start of the string. If `end` argument provided, the search is performed between start and end buffer positions.
### Parameters
`start` Start search position.
`eol_style` One of [EventBuffer:EOL\_\* constants](class.eventbuffer#eventbuffer.constants) .
### Return Values
Returns numeric position of the first occurrence of end-of-line symbol in the buffer, or **`false`** if not found.
**Warning**This function may return Boolean **`false`**, but may also return a non-Boolean value which evaluates to **`false`**. Please read the section on [Booleans](language.types.boolean) for more information. Use [the === operator](language.operators.comparison) for testing the return value of this function.
### See Also
* [EventBuffer::search()](eventbuffer.search) - Scans the buffer for an occurrence of a string
php pg_result_error pg\_result\_error
=================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg\_result\_error — Get error message associated with result
### Description
```
pg_result_error(PgSql\Result $result): string|false
```
**pg\_result\_error()** returns any error message associated with the `result` instance. Therefore, the user has a better chance of getting the correct error message than with [pg\_last\_error()](function.pg-last-error).
The function [pg\_result\_error\_field()](function.pg-result-error-field) can give much greater detail on result errors than **pg\_result\_error()**.
Because [pg\_query()](function.pg-query) returns **`false`** if the query fails, you must use [pg\_send\_query()](function.pg-send-query) and [pg\_get\_result()](function.pg-get-result) to get the result handle.
### Parameters
`result`
An [PgSql\Result](class.pgsql-result) instance, returned by [pg\_query()](function.pg-query), [pg\_query\_params()](function.pg-query-params) or [pg\_execute()](function.pg-execute)(among others).
### Return Values
Returns a string. Returns empty string if there is no error. If there is an error associated with the `result` parameter, returns **`false`**.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `result` parameter expects an [PgSql\Result](class.pgsql-result) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **pg\_result\_error()** example**
```
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
if (!pg_connection_busy($dbconn)) {
pg_send_query($dbconn, "select * from doesnotexist;");
}
$res1 = pg_get_result($dbconn);
echo pg_result_error($res1);
?>
```
### See Also
* [pg\_result\_error\_field()](function.pg-result-error-field) - Returns an individual field of an error report
* [pg\_query()](function.pg-query) - Execute a query
* [pg\_send\_query()](function.pg-send-query) - Sends asynchronous query
* [pg\_get\_result()](function.pg-get-result) - Get asynchronous query result
* [pg\_last\_error()](function.pg-last-error) - Get the last error message string of a connection
* [pg\_last\_notice()](function.pg-last-notice) - Returns the last notice message from PostgreSQL server
php DOMXPath::evaluate DOMXPath::evaluate
==================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
DOMXPath::evaluate — Evaluates the given XPath expression and returns a typed result if possible
### Description
```
public DOMXPath::evaluate(string $expression, ?DOMNode $contextNode = null, bool $registerNodeNS = true): mixed
```
Executes the given XPath `expression` and returns a typed result if possible.
### Parameters
`expression`
The XPath expression to execute.
`contextNode`
The optional `contextNode` can be specified for doing relative XPath queries. By default, the queries are relative to the root element.
`registerNodeNS`
The optional `registerNodeNS` can be specified to disable automatic registration of the context node.
### Return Values
Returns a typed result if possible or a [DOMNodeList](class.domnodelist) containing all nodes matching the given XPath `expression`.
If the `expression` is malformed or the `contextNode` is invalid, **DOMXPath::evaluate()** returns **`false`**.
### Examples
**Example #1 Getting the count of all the english books**
```
<?php
$doc = new DOMDocument;
$doc->load('book.xml');
$xpath = new DOMXPath($doc);
$tbody = $doc->getElementsByTagName('tbody')->item(0);
// our query is relative to the tbody node
$query = 'count(row/entry[. = "en"])';
$entries = $xpath->evaluate($query, $tbody);
echo "There are $entries english books\n";
?>
```
The above example will output:
```
There are 2 english books
```
### See Also
* [DOMXPath::query()](domxpath.query) - Evaluates the given XPath expression
php Collator::__construct Collator::\_\_construct
=======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
Collator::\_\_construct — Create a collator
### Description
public **Collator::\_\_construct**(string `$locale`) Creates a new instance of [Collator](class.collator).
### Parameters
`locale`
The locale whose collation rules should be used. Special values for locales can be passed in - if an empty string is passed for the locale, the default locale's collation rules will be used. If `"root"` is passed, [» UCA](http://www.unicode.org/reports/tr10/) rules will be used.
The `locale` attribute is typically the most important attribute for correct sorting and matching, according to the user expectations in different countries and regions. The default [» UCA](http://www.unicode.org/reports/tr10/) ordering will only sort a few languages such as Dutch and Portuguese correctly ("correctly" meaning according to the normal expectations for users of the languages). Otherwise, you need to supply the locale to UCA in order to properly collate text for a given language. Thus a locale needs to be supplied so as to choose a collator that is correctly tailored for that locale. The choice of a locale will automatically preset the values for all of the attributes to something that is reasonable for that locale. Thus most of the time the other attributes do not need to be explicitly set. In some cases, the choice of locale will make a difference in string comparison performance and/or sort key length.
### Errors/Exceptions
Returns an "empty" object on error. Use [intl\_get\_error\_code()](function.intl-get-error-code) and/or [intl\_get\_error\_message()](function.intl-get-error-message) to know what happened.
### Examples
**Example #1 **Collator::\_\_construct()** example**
```
<?php
$coll = new Collator('en_CA');
?>
```
### See Also
* [Collator::create()](collator.create) - Create a collator
* [collator\_create()](collator.create) - Create a collator
php The GearmanException class
The GearmanException class
==========================
Introduction
------------
(PECL gearman >= 0.5.0)
Class synopsis
--------------
class **GearmanException** extends [Exception](class.exception) { /\* Inherited properties \*/ protected string [$message](class.exception#exception.props.message) = "";
private string [$string](class.exception#exception.props.string) = "";
protected int [$code](class.exception#exception.props.code);
protected string [$file](class.exception#exception.props.file) = "";
protected int [$line](class.exception#exception.props.line);
private array [$trace](class.exception#exception.props.trace) = [];
private ?[Throwable](class.throwable) [$previous](class.exception#exception.props.previous) = null; /\* Methods \*/ /\* Inherited methods \*/
```
final public Exception::getMessage(): string
```
```
final public Exception::getPrevious(): ?Throwable
```
```
final public Exception::getCode(): int
```
```
final public Exception::getFile(): string
```
```
final public Exception::getLine(): int
```
```
final public Exception::getTrace(): array
```
```
final public Exception::getTraceAsString(): string
```
```
public Exception::__toString(): string
```
```
private Exception::__clone(): void
```
}
php IntlTimeZone::getWindowsID IntlTimeZone::getWindowsID
==========================
intltz\_get\_windows\_id
========================
(PHP 7 >= 7.1.0, PHP 8)
IntlTimeZone::getWindowsID -- intltz\_get\_windows\_id — Translate a system timezone into a Windows timezone
### Description
Object-oriented style (method):
```
public static IntlTimeZone::getWindowsID(string $timezoneId): string|false
```
Procedural style:
```
intltz_get_windows_id(string $timezoneId): string|false
```
Translates a system timezone (e.g. "America/Los\_Angeles") into a Windows timezone (e.g. "Pacific Standard Time").
> **Note**: This function requires ICU version ≥ 52.
>
>
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`timezoneId`
### Return Values
Returns the Windows timezone or **`false`** on failure.
### See Also
* [IntlTimeZone::getIDForWindowsID()](intltimezone.getidforwindowsid) - Translate a Windows timezone into a system timezone
php Yaf_Plugin_Abstract::dispatchLoopShutdown Yaf\_Plugin\_Abstract::dispatchLoopShutdown
===========================================
(Yaf >=1.0.0)
Yaf\_Plugin\_Abstract::dispatchLoopShutdown — The dispatchLoopShutdown purpose
### Description
```
public Yaf_Plugin_Abstract::dispatchLoopShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void
```
This is the latest hook in Yaf plugin hook system, if a custom plugin implement this method, then it will be called after the dispatch loop finished.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`request`
`response`
### Return Values
### See Also
* [Yaf\_Plugin\_Abstract::routerStartup()](yaf-plugin-abstract.routerstartup) - RouterStartup hook
* [Yaf\_Plugin\_Abstract::routerShutdown()](yaf-plugin-abstract.routershutdown) - The routerShutdown purpose
* [Yaf\_Plugin\_Abstract::dispatchLoopStartup()](yaf-plugin-abstract.dispatchloopstartup) - Hook before dispatch loop
* [Yaf\_Plugin\_Abstract::preDispatch()](yaf-plugin-abstract.predispatch) - The preDispatch purpose
* [Yaf\_Plugin\_Abstract::postDispatch()](yaf-plugin-abstract.postdispatch) - The postDispatch purpose
php imap_gc imap\_gc
========
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
imap\_gc — Clears IMAP cache
### Description
```
imap_gc(IMAP\Connection $imap, int $flags): bool
```
Purges the cache of entries of a specific type.
### Parameters
`imap`
An [IMAP\Connection](class.imap-connection) instance.
`flags`
Specifies the cache to purge. It may one or a combination of the following constants: **`IMAP_GC_ELT`** (message cache elements), **`IMAP_GC_ENV`** (envelope and bodies), **`IMAP_GC_TEXTS`** (texts).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `imap` parameter expects an [IMAP\Connection](class.imap-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **imap\_gc()** example**
```
<?php
$mbox = imap_open("{imap.example.org:143}", "username", "password");
imap_gc($mbox, IMAP_GC_ELT);
?>
```
php opcache_compile_file opcache\_compile\_file
======================
(PHP 5 >= 5.5.5, PHP 7, PHP 8, PECL ZendOpcache > 7.0.2)
opcache\_compile\_file — Compiles and caches a PHP script without executing it
### Description
```
opcache_compile_file(string $filename): bool
```
This function compiles a PHP script and adds it to the opcode cache without executing it. This can be used to prime the cache after a Web server restart by pre-caching files that will be included in later requests.
### Parameters
`filename`
The path to the PHP script to be compiled.
### Return Values
Returns **`true`** if `filename` was compiled successfully or **`false`** on failure.
### Errors/Exceptions
If `filename` cannot be loaded or compiled, an error of level **`E_WARNING`** is generated. You may use [@](language.operators.errorcontrol) to suppress this warning.
### See Also
* [opcache\_invalidate()](function.opcache-invalidate) - Invalidates a cached script
php curl_multi_close curl\_multi\_close
==================
(PHP 5, PHP 7, PHP 8)
curl\_multi\_close — Close a set of cURL handles
### Description
```
curl_multi_close(CurlMultiHandle $multi_handle): void
```
>
> **Note**:
>
>
> This function has no effect. Prior to PHP 8.0.0, this function was used to close the resource.
>
>
Closes a set of cURL handles.
### Parameters
`multi_handle` A cURL multi handle returned by [curl\_multi\_init()](function.curl-multi-init).
### Return Values
No value is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `multi_handle` expects a [CurlMultiHandle](class.curlmultihandle) instance now; previously, a resource was expected. |
### Examples
**Example #1 **curl\_multi\_close()** example**
This example will create two cURL handles, add them to a multi handle, and process them asynchronously.
```
<?php
// create both cURL resources
$ch1 = curl_init();
$ch2 = curl_init();
// set URL and other appropriate options
curl_setopt($ch1, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/");
curl_setopt($ch2, CURLOPT_HEADER, 0);
//create the multiple cURL handle
$mh = curl_multi_init();
//add the two handles
curl_multi_add_handle($mh,$ch1);
curl_multi_add_handle($mh,$ch2);
//execute the multi handle
do {
$status = curl_multi_exec($mh, $active);
if ($active) {
curl_multi_select($mh);
}
} while ($active && $status == CURLM_OK);
//close the handles
curl_multi_remove_handle($mh, $ch1);
curl_close($ch1);
curl_multi_remove_handle($mh, $ch2);
curl_close($ch2);
curl_multi_close($mh);
?>
```
### See Also
* [curl\_multi\_init()](function.curl-multi-init) - Returns a new cURL multi handle
* [curl\_close()](function.curl-close) - Close a cURL session
| programming_docs |
php array_udiff_assoc array\_udiff\_assoc
===================
(PHP 5, PHP 7, PHP 8)
array\_udiff\_assoc — Computes the difference of arrays with additional index check, compares data by a callback function
### Description
```
array_udiff_assoc(array $array, array ...$arrays, callable $value_compare_func): array
```
Computes the difference of arrays with additional index check, compares data by a callback function.
> **Note**: Please note that this function only checks one dimension of a n-dimensional array. Of course you can check deeper dimensions by using, for example, `array_udiff_assoc($array1[0], $array2[0], "some_comparison_func");`.
>
>
### Parameters
`array`
The first array.
`arrays`
Arrays to compare against.
`value_compare_func`
The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
```
callback(mixed $a, mixed $b): int
```
### Return Values
**array\_udiff\_assoc()** returns an array containing all the values from `array` that are not present in any of the other arguments. Note that the keys are used in the comparison unlike [array\_diff()](function.array-diff) and [array\_udiff()](function.array-udiff). The comparison of arrays' data is performed by using an user-supplied callback. In this aspect the behaviour is opposite to the behaviour of [array\_diff\_assoc()](function.array-diff-assoc) which uses internal function for comparison.
### Examples
**Example #1 **array\_udiff\_assoc()** example**
```
<?php
class cr {
private $priv_member;
function __construct($val)
{
$this->priv_member = $val;
}
static function comp_func_cr($a, $b)
{
if ($a->priv_member === $b->priv_member) return 0;
return ($a->priv_member > $b->priv_member)? 1:-1;
}
}
$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),);
$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1=> new cr(4), 2 => new cr(-15),);
$result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr"));
print_r($result);
?>
```
The above example will output:
```
Array
(
[0.1] => cr Object
(
[priv_member:private] => 9
)
[0.5] => cr Object
(
[priv_member:private] => 12
)
[0] => cr Object
(
[priv_member:private] => 23
)
)
```
In our example above you see the `"1" => new cr(4)` pair is present in both arrays and thus it is not in the output from the function.
### See Also
* [array\_diff()](function.array-diff) - Computes the difference of arrays
* [array\_diff\_assoc()](function.array-diff-assoc) - Computes the difference of arrays with additional index check
* [array\_diff\_uassoc()](function.array-diff-uassoc) - Computes the difference of arrays with additional index check which is performed by a user supplied callback function
* [array\_udiff()](function.array-udiff) - Computes the difference of arrays by using a callback function for data comparison
* [array\_udiff\_uassoc()](function.array-udiff-uassoc) - Computes the difference of arrays with additional index check, compares data and indexes by a callback function
* [array\_intersect()](function.array-intersect) - Computes the intersection of arrays
* [array\_intersect\_assoc()](function.array-intersect-assoc) - Computes the intersection of arrays with additional index check
* [array\_uintersect()](function.array-uintersect) - Computes the intersection of arrays, compares data by a callback function
* [array\_uintersect\_assoc()](function.array-uintersect-assoc) - Computes the intersection of arrays with additional index check, compares data by a callback function
* [array\_uintersect\_uassoc()](function.array-uintersect-uassoc) - Computes the intersection of arrays with additional index check, compares data and indexes by separate callback functions
php The Yaf_Config_Simple class
The Yaf\_Config\_Simple class
=============================
Introduction
------------
(Yaf >=1.0.0)
Class synopsis
--------------
class **Yaf\_Config\_Simple** extends [Yaf\_Config\_Abstract](class.yaf-config-abstract) implements [Iterator](class.iterator), [ArrayAccess](class.arrayaccess), [Countable](class.countable) { /\* Properties \*/ protected [$\_readonly](class.yaf-config-simple#yaf-config-simple.props.readonly); /\* Methods \*/ public [\_\_construct](yaf-config-simple.construct)(array `$configs`, bool `$readonly` = false)
```
public count(): void
```
```
public current(): void
```
```
public __get(string $name = ?): void
```
```
public __isset(string $name): void
```
```
public key(): void
```
```
public next(): void
```
```
public offsetExists(string $name): void
```
```
public offsetGet(string $name): void
```
```
public offsetSet(string $name, string $value): void
```
```
public offsetUnset(string $name): void
```
```
public readonly(): void
```
```
public rewind(): void
```
```
public __set(string $name, string $value): void
```
```
public toArray(): array
```
```
public valid(): void
```
/\* Inherited methods \*/
```
abstract public Yaf_Config_Abstract::get(string $name, mixed $value): mixed
```
```
abstract public Yaf_Config_Abstract::readonly(): bool
```
```
abstract public Yaf_Config_Abstract::set(): Yaf_Config_Abstract
```
```
abstract public Yaf_Config_Abstract::toArray(): array
```
} Properties
----------
\_config \_readonly Table of Contents
-----------------
* [Yaf\_Config\_Simple::\_\_construct](yaf-config-simple.construct) — The \_\_construct purpose
* [Yaf\_Config\_Simple::count](yaf-config-simple.count) — The count purpose
* [Yaf\_Config\_Simple::current](yaf-config-simple.current) — The current purpose
* [Yaf\_Config\_Simple::\_\_get](yaf-config-simple.get) — The \_\_get purpose
* [Yaf\_Config\_Simple::\_\_isset](yaf-config-simple.isset) — The \_\_isset purpose
* [Yaf\_Config\_Simple::key](yaf-config-simple.key) — The key purpose
* [Yaf\_Config\_Simple::next](yaf-config-simple.next) — The next purpose
* [Yaf\_Config\_Simple::offsetExists](yaf-config-simple.offsetexists) — The offsetExists purpose
* [Yaf\_Config\_Simple::offsetGet](yaf-config-simple.offsetget) — The offsetGet purpose
* [Yaf\_Config\_Simple::offsetSet](yaf-config-simple.offsetset) — The offsetSet purpose
* [Yaf\_Config\_Simple::offsetUnset](yaf-config-simple.offsetunset) — The offsetUnset purpose
* [Yaf\_Config\_Simple::readonly](yaf-config-simple.readonly) — The readonly purpose
* [Yaf\_Config\_Simple::rewind](yaf-config-simple.rewind) — The rewind purpose
* [Yaf\_Config\_Simple::\_\_set](yaf-config-simple.set) — The \_\_set purpose
* [Yaf\_Config\_Simple::toArray](yaf-config-simple.toarray) — Returns a PHP array
* [Yaf\_Config\_Simple::valid](yaf-config-simple.valid) — The valid purpose
php hexdec hexdec
======
(PHP 4, PHP 5, PHP 7, PHP 8)
hexdec — Hexadecimal to decimal
### Description
```
hexdec(string $hex_string): int|float
```
Returns the decimal equivalent of the hexadecimal number represented by the `hex_string` argument. **hexdec()** converts a hexadecimal string to a decimal number.
**hexdec()** will ignore any non-hexadecimal characters it encounters. As of PHP 7.4.0 supplying any invalid characters is deprecated.
### Parameters
`hex_string`
The hexadecimal string to convert
### Return Values
The decimal representation of `hex_string`
### Changelog
| Version | Description |
| --- | --- |
| 7.4.0 | Passing invalid characters will now generate a deprecation notice. The result will still be computed as if the invalid characters did not exist. |
### Examples
**Example #1 **hexdec()** example**
```
<?php
var_dump(hexdec("See"));
var_dump(hexdec("ee"));
// both print "int(238)"
var_dump(hexdec("that")); // print "int(10)"
var_dump(hexdec("a0")); // print "int(160)"
?>
```
### Notes
>
> **Note**:
>
>
> The function can convert numbers that are too large to fit into the platforms int type, larger values are returned as float in that case.
>
>
### See Also
* [dechex()](function.dechex) - Decimal to hexadecimal
* [bindec()](function.bindec) - Binary to decimal
* [octdec()](function.octdec) - Octal to decimal
* [base\_convert()](function.base-convert) - Convert a number between arbitrary bases
php Spoofchecker::__construct Spoofchecker::\_\_construct
===========================
(No version information available, might only be in Git)
Spoofchecker::\_\_construct — Constructor
### Description
public **Spoofchecker::\_\_construct**() Creates new instance of Spoofchecker.
### Parameters
This function has no parameters.
php None Introduction
------------
Every single expression in PHP has one of the following built-in types depending on its value:
* null
* bool
* int
* float (floating-point number)
* string
* array
* object
* [callable](language.types.callable)
* resource
PHP is a dynamically typed language, which means that by default there is no need to specify the type of a variable, as this will be determined at runtime. However, it is possible to statically type some aspect of the language via the use of [type declarations](language.types.declarations).
Types restrict the kind of operations that can be performed on them. However, if an expression/variable is used in an operation which its type does not support, PHP will attempt to [type juggle](language.types.type-juggling) the value into a type that supports the operation. This process depends on the context in which the value is used. For more information, see the section on [Type Juggling](language.types.type-juggling).
**Tip** [The type comparison tables](https://www.php.net/manual/en/types.comparisons.php) may also be useful, as various examples of comparison between values of different types are present.
> **Note**: It is possible to force an expression to be evaluated to a certain type by using a [type cast](language.types.type-juggling#language.types.typecasting). A variable can also be type cast in-place by using the [settype()](function.settype) function on it.
>
>
To check the value and type of an [expression](language.expressions), use the [var\_dump()](function.var-dump) function. To retrieve the type of an [expression](language.expressions), use the [get\_debug\_type()](function.get-debug-type) function. However, to check if an expression is of a certain type use the `is_type` functions instead.
```
<?php
$a_bool = true; // a bool
$a_str = "foo"; // a string
$a_str2 = 'foo'; // a string
$an_int = 12; // an int
echo get_debug_type($a_bool), "\n";
echo get_debug_type($a_str), "\n";
// If this is an integer, increment it by four
if (is_int($an_int)) {
$an_int += 4;
}
var_dump($an_int);
// If $a_bool is a string, print it out
if (is_string($a_bool)) {
echo "String: $a_bool";
}
?>
```
Output of the above example in PHP 8:
```
bool
string
int(16)
```
> **Note**: Prior to PHP 8.0.0, where the [get\_debug\_type()](function.get-debug-type) is not available, the [gettype()](function.gettype) function can be used instead. However, it doesn't use the canonical type names.
>
>
php UConverter::getDestinationType UConverter::getDestinationType
==============================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
UConverter::getDestinationType — Get the destination converter type
### Description
```
public UConverter::getDestinationType(): int|false|null
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php Worker::stack Worker::stack
=============
(PECL pthreads >= 2.0.0)
Worker::stack — Stacking work
### Description
```
public Worker::stack(Threaded &$work): int
```
Appends the new work to the stack of the referenced worker.
### Parameters
`work`
A [Threaded](class.threaded) object to be executed by the worker.
### Return Values
The new size of the stack.
### Examples
**Example #1 Stacking a task for execution onto a worker**
```
<?php
$worker = new Worker();
$work = new class extends Threaded {};
var_dump($worker->stack($work));
```
The above example will output:
```
int(1)
```
php is_long is\_long
========
(PHP 4, PHP 5, PHP 7, PHP 8)
is\_long — Alias of [is\_int()](function.is-int)
### Description
This function is an alias of: [is\_int()](function.is-int).
php ctype_lower ctype\_lower
============
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
ctype\_lower — Check for lowercase character(s)
### Description
```
ctype_lower(mixed $text): bool
```
Checks if all of the characters in the provided string, `text`, are lowercase letters.
### Parameters
`text`
The tested string.
>
> **Note**:
>
>
> If an int between -128 and 255 inclusive is provided, it is interpreted as the ASCII value of a single character (negative values have 256 added in order to allow characters in the Extended ASCII range). Any other integer is interpreted as a string containing the decimal digits of the integer.
>
>
>
**Warning** As of PHP 8.1.0, passing a non-string argument is deprecated. In the future, the argument will be interpreted as a string instead of an ASCII codepoint. Depending on the intended behavior, the argument should either be cast to string or an explicit call to [chr()](function.chr) should be made.
### Return Values
Returns **`true`** if every character in `text` is a lowercase letter in the current locale. When called with an empty string the result will always be **`false`**.
### Examples
**Example #1 A **ctype\_lower()** example (using the default locale)**
```
<?php
$strings = array('aac123', 'qiutoas', 'QASsdks');
foreach ($strings as $testcase) {
if (ctype_lower($testcase)) {
echo "The string $testcase consists of all lowercase letters.\n";
} else {
echo "The string $testcase does not consist of all lowercase letters.\n";
}
}
?>
```
The above example will output:
```
The string aac123 does not consist of all lowercase letters.
The string qiutoas consists of all lowercase letters.
The string QASsdks does not consist of all lowercase letters.
```
### See Also
* [ctype\_alpha()](function.ctype-alpha) - Check for alphabetic character(s)
* [ctype\_upper()](function.ctype-upper) - Check for uppercase character(s)
* [setlocale()](function.setlocale) - Set locale information
php wincache_unlock wincache\_unlock
================
(PECL wincache >= 1.1.0)
wincache\_unlock — Releases an exclusive lock on a given key
### Description
```
wincache_unlock(string $key): bool
```
Releases an exclusive lock that was obtained on a given key by using [wincache\_lock()](function.wincache-lock). If any other process was blocked waiting for the lock on this key, that process will be able to obtain the lock.
**Warning** Using of the [wincache\_lock()](function.wincache-lock) and **wincache\_unlock()** can cause deadlocks when executing PHP scripts in a multi-process environment like FastCGI. Do not use these functions unless you are absolutely sure you need to use them. For the majority of the operations on the user cache it is not necessary to use these functions.
### Parameters
`key`
Name of the key in the cache to release the lock on.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Using **wincache\_unlock()****
```
<?php
$fp = fopen("/tmp/lock.txt", "r+");
if (wincache_lock(“lock_txt_lock”)) { // do an exclusive lock
ftruncate($fp, 0); // truncate file
fwrite($fp, "Write something here\n");
wincache_unlock(“lock_txt_lock”); // release the lock
} else {
echo "Couldn't get the lock!";
}
fclose($fp);
?>
```
### See Also
* [wincache\_lock()](function.wincache-lock) - Acquires an exclusive lock on a given key
* [wincache\_ucache\_set()](function.wincache-ucache-set) - Adds a variable in user cache and overwrites a variable if it already exists in the cache
* [wincache\_ucache\_get()](function.wincache-ucache-get) - Gets a variable stored in the user cache
* [wincache\_ucache\_delete()](function.wincache-ucache-delete) - Deletes variables from the user cache
* [wincache\_ucache\_clear()](function.wincache-ucache-clear) - Deletes entire content of the user cache
* [wincache\_ucache\_exists()](function.wincache-ucache-exists) - Checks if a variable exists in the user cache
* [wincache\_ucache\_meminfo()](function.wincache-ucache-meminfo) - Retrieves information about user cache memory usage
* [wincache\_ucache\_info()](function.wincache-ucache-info) - Retrieves information about data stored in the user cache
* [wincache\_scache\_info()](function.wincache-scache-info) - Retrieves information about files cached in the session cache
php SolrQuery::getTermsUpperBound SolrQuery::getTermsUpperBound
=============================
(PECL solr >= 0.9.2)
SolrQuery::getTermsUpperBound — Returns the term to stop at
### Description
```
public SolrQuery::getTermsUpperBound(): string
```
Returns the term to stop at
### Parameters
This function has no parameters.
### Return Values
Returns a string on success and **`null`** if not set.
php XSLTProcessor::hasExsltSupport XSLTProcessor::hasExsltSupport
==============================
(PHP 5 >= 5.0.4, PHP 7, PHP 8)
XSLTProcessor::hasExsltSupport — Determine if PHP has EXSLT support
### Description
```
public XSLTProcessor::hasExsltSupport(): bool
```
This method determines if PHP was built with the [» EXSLT library](http://xmlsoft.org/XSLT/EXSLT/index.html).
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Testing EXSLT support**
```
<?php
$proc = new XSLTProcessor;
if (!$proc->hasExsltSupport()) {
die('EXSLT support not available');
}
// do EXSLT stuff here ..
?>
```
php EventBufferEvent::getInput EventBufferEvent::getInput
==========================
(PECL event >= 1.2.6-beta)
EventBufferEvent::getInput — Returns underlying input buffer associated with current buffer event
### Description
```
public EventBufferEvent::getInput(): EventBuffer
```
Returns underlying input buffer associated with current buffer event. An input buffer is a storage for data to read.
Note, there is also `[input](class.eventbufferevent#eventbufferevent.props.input)` property of [EventBufferEvent](class.eventbufferevent) class.
### Parameters
This function has no parameters.
### Return Values
Returns instance of [EventBuffer](class.eventbuffer) input buffer associated with current buffer event.
### Examples
**Example #1 Buffer event's read callback**
```
<?php
function readcb($bev, $base) {
$input = $bev->input; //$bev->getInput();
while (($n = $input->remove($buf, 1024)) > 0) {
echo $buf;
}
}
?>
```
### See Also
* [EventBufferEvent::getOutput()](eventbufferevent.getoutput) - Returns underlying output buffer associated with current buffer event
php Yaf_Response_Abstract::setBody Yaf\_Response\_Abstract::setBody
================================
(Yaf >=1.0.0)
Yaf\_Response\_Abstract::setBody — Set content to response
### Description
```
public Yaf_Response_Abstract::setBody(string $content, string $key = ?): bool
```
Set content to response
### Parameters
`body`
content string
`key`
the content key, you can set a content with a key, if you don't specific, then Yaf\_Response\_Abstract::DEFAULT\_BODY will be used
>
> **Note**:
>
>
> this parameter is introduced as of 2.2.0
>
>
### Return Values
### Examples
**Example #1 **Yaf\_Response\_Abstract::setBody()**example**
```
<?php
$response = new Yaf_Response_Http();
$response->setBody("Hello")->setBody(" World", "footer");
print_r($response);
echo $response;
?>
```
The above example will output something similar to:
```
Yaf_Response_Http Object
(
[_header:protected] => Array
(
)
[_body:protected] => Array
(
[content] => Hello
[footer] => World
)
[_sendheader:protected] => 1
[_response_code:protected] => 200
)
Hello World
```
### See Also
* [Yaf\_Response\_Abstract::getBody()](yaf-response-abstract.getbody) - Retrieve a exists content
* [Yaf\_Response\_Abstract::appendBody()](yaf-response-abstract.appendbody) - Append to response body
* [Yaf\_Response\_Abstract::prependBody()](yaf-response-abstract.prependbody) - The prependBody purpose
* [Yaf\_Response\_Abstract::clearBody()](yaf-response-abstract.clearbody) - Discard all exists response body
| programming_docs |
php GearmanTask::uuid GearmanTask::uuid
=================
(PECL gearman <= 0.5.0)
GearmanTask::uuid — Get the unique identifier for a task (deprecated)
### Description
```
public GearmanTask::uuid(): string
```
Returns the unique identifier for this task. This is assigned by the [GearmanClient](class.gearmanclient), as opposed to the job handle which is set by the Gearman job server.
>
> **Note**:
>
>
> This method has been replaced by [GearmanTask::unique()](gearmantask.unique) in the 0.6.0 release of the Gearman extension.
>
>
### Parameters
This function has no parameters.
### Return Values
The unique identifier, or **`false`** if no identifier is assigned.
### See Also
* [GearmanClient::do()](gearmanclient.do) - Run a single task and return a result [deprecated]
* [GearmanClient::addTask()](gearmanclient.addtask) - Add a task to be run in parallel
php Ds\Vector::contains Ds\Vector::contains
===================
(PECL ds >= 1.0.0)
Ds\Vector::contains — Determines if the vector contains given values
### Description
```
public Ds\Vector::contains(mixed ...$values): bool
```
Determines if the vector contains all values.
### Parameters
`values`
Values to check.
### Return Values
**`false`** if any of the provided `values` are not in the vector, **`true`** otherwise.
### Examples
**Example #1 **Ds\Vector::contains()** example**
```
<?php
$vector = new \Ds\Vector(['a', 'b', 'c', 1, 2, 3]);
var_dump($vector->contains('a')); // true
var_dump($vector->contains('a', 'b')); // true
var_dump($vector->contains('c', 'd')); // false
var_dump($vector->contains(...['c', 'b', 'a'])); // true
// Always strict
var_dump($vector->contains(1)); // true
var_dump($vector->contains('1')); // false
var_dump($sequece->contains(...[])); // true
?>
```
The above example will output something similar to:
```
bool(true)
bool(true)
bool(false)
bool(true)
bool(true)
bool(false)
bool(true)
```
php Imagick::matteFloodfillImage Imagick::matteFloodfillImage
============================
(PECL imagick 2, PECL imagick 3)
Imagick::matteFloodfillImage — Changes the transparency value of a color
**Warning**This function has been *DEPRECATED* as of Imagick 3.4.4. Relying on this function is highly discouraged.
### Description
```
public Imagick::matteFloodfillImage(
float $alpha,
float $fuzz,
mixed $bordercolor,
int $x,
int $y
): bool
```
Changes the transparency value of any pixel that matches target and is an immediate neighbor. If the method **`FillToBorderMethod`** is specified, the transparency value is changed for any neighbor pixel that does not match the bordercolor member of image.
### Parameters
`alpha`
The level of transparency: 1.0 is fully opaque and 0.0 is fully transparent.
`fuzz`
The fuzz member of image defines how much tolerance is acceptable to consider two colors as the same.
`bordercolor`
An [ImagickPixel](class.imagickpixel) object or string representing the border color.
`x`
The starting x coordinate of the operation.
`y`
The starting y coordinate of the operation.
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Changelog
| Version | Description |
| --- | --- |
| PECL imagick 2.1.0 | Now allows a string representing the color as the third parameter. Previous versions allow only an [ImagickPixel](class.imagickpixel) object. |
php msg_receive msg\_receive
============
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
msg\_receive — Receive a message from a message queue
### Description
```
msg_receive(
SysvMessageQueue $queue,
int $desired_message_type,
int &$received_message_type,
int $max_message_size,
mixed &$message,
bool $unserialize = true,
int $flags = 0,
int &$error_code = null
): bool
```
**msg\_receive()** will receive the first message from the specified `queue` of the type specified by `desired_message_type`.
### Parameters
`queue`
The message queue.
`desired_message_type`
If `desired_message_type` is 0, the message from the front of the queue is returned. If `desired_message_type` is greater than 0, then the first message of that type is returned. If `desired_message_type` is less than 0, the first message on the queue with a type less than or equal to the absolute value of `desired_message_type` will be read. If no messages match the criteria, your script will wait until a suitable message arrives on the queue. You can prevent the script from blocking by specifying **`MSG_IPC_NOWAIT`** in the `flags` parameter.
`received_message_type`
The type of the message that was received will be stored in this parameter.
`max_message_size`
The maximum size of message to be accepted is specified by the `max_message_size`; if the message in the queue is larger than this size the function will fail (unless you set `flags` as described below).
`message`
The received message will be stored in `message`, unless there were errors receiving the message.
`unserialize`
If set to **`true`**, the message is treated as though it was serialized using the same mechanism as the session module. The message will be unserialized and then returned to your script. This allows you to easily receive arrays or complex object structures from other PHP scripts, or if you are using the WDDX serializer, from any WDDX compatible source.
If `unserialize` is **`false`**, the message will be returned as a binary-safe string.
`flags`
The optional `flags` allows you to pass flags to the low-level msgrcv system call. It defaults to 0, but you may specify one or more of the following values (by adding or ORing them together).
**Flag values for msg\_receive**| **`MSG_IPC_NOWAIT`** | If there are no messages of the `desired_message_type`, return immediately and do not wait. The function will fail and return an integer value corresponding to **`MSG_ENOMSG`**. |
| **`MSG_EXCEPT`** | Using this flag in combination with a `desired_message_type` greater than 0 will cause the function to receive the first message that is not equal to `desired_message_type`. |
| **`MSG_NOERROR`** | If the message is longer than `max_message_size`, setting this flag will truncate the message to `max_message_size` and will not signal an error. |
`error_code`
If the function fails, the optional `error_code` will be set to the value of the system errno variable.
### Return Values
Returns **`true`** on success or **`false`** on failure.
Upon successful completion the message queue data structure is updated as follows: `msg_lrpid` is set to the process-ID of the calling process, `msg_qnum` is decremented by 1 and `msg_rtime` is set to the current time.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `queue` expects a [SysvMessageQueue](class.sysvmessagequeue) instance now; previously, a resource was expected. |
### See Also
* [msg\_remove\_queue()](function.msg-remove-queue) - Destroy a message queue
* [msg\_send()](function.msg-send) - Send a message to a message queue
* [msg\_stat\_queue()](function.msg-stat-queue) - Returns information from the message queue data structure
* [msg\_set\_queue()](function.msg-set-queue) - Set information in the message queue data structure
php eio_lstat eio\_lstat
==========
(PECL eio >= 0.0.1dev)
eio\_lstat — Get file status
### Description
```
eio_lstat(
string $path,
int $pri,
callable $callback,
mixed $data = NULL
): resource
```
**eio\_lstat()** returns file status information in `result` argument of `callback`
### Parameters
`path`
The file path
`pri`
The request priority: **`EIO_PRI_DEFAULT`**, **`EIO_PRI_MIN`**, **`EIO_PRI_MAX`**, or **`null`**. If **`null`** passed, `pri` internally is set to **`EIO_PRI_DEFAULT`**.
`callback`
`callback` function is called when the request is done. It should match the following prototype:
```
void callback(mixed $data, int $result[, resource $req]);
```
`data`
is custom data passed to the request.
`result`
request-specific result value; basically, the value returned by corresponding system call.
`req`
is optional request resource which can be used with functions like [eio\_get\_last\_error()](function.eio-get-last-error)
`data`
Arbitrary variable passed to `callback`.
### Return Values
**eio\_lstat()** returns request resource on success or **`false`** on error.
### Examples
**Example #1 **eio\_lstat()** example**
```
<?php
$tmp_filename = dirname(__FILE__). "/eio-file.tmp";
touch($tmp_filename);
function my_res_cb($data, $result) {
var_dump($data);
var_dump($result);
}
function my_open_cb($data, $result) {
eio_close($result);
eio_event_loop();
@unlink($data);
}
eio_lstat($tmp_filename, EIO_PRI_DEFAULT, "my_res_cb", "eio_lstat");
eio_open($tmp_filename, EIO_O_RDONLY, NULL,
EIO_PRI_DEFAULT, "my_open_cb", $tmp_filename);
eio_event_loop();
?>
```
The above example will output something similar to:
```
string(9) "eio_lstat"
array(12) {
["st_dev"]=>
int(2050)
["st_ino"]=>
int(2099197)
["st_mode"]=>
int(33188)
["st_nlink"]=>
int(1)
["st_uid"]=>
int(1000)
["st_gid"]=>
int(100)
["st_rdev"]=>
int(0)
["st_blksize"]=>
int(4096)
["st_blocks"]=>
int(0)
["st_atime"]=>
int(1318235777)
["st_mtime"]=>
int(1318235777)
["st_ctime"]=>
int(1318235777)
}
```
### See Also
* [eio\_stat()](function.eio-stat) - Get file status
* [eio\_fstat()](function.eio-fstat) - Get file status
php SolrDocument::addField SolrDocument::addField
======================
(PECL solr >= 0.9.2)
SolrDocument::addField — Adds a field to the document
### Description
```
public SolrDocument::addField(string $fieldName, string $fieldValue): bool
```
This method adds a field to the SolrDocument instance.
### Parameters
`fieldName`
The name of the field
`fieldValue`
The value of the field.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php The JsonException class
The JsonException class
=======================
Introduction
------------
(PHP 7 >= 7.3.0, PHP 8)
Exception thrown if **`JSON_THROW_ON_ERROR`** option is set for [json\_encode()](function.json-encode) or [json\_decode()](function.json-decode). code contains the error type, for possible values see [json\_last\_error()](function.json-last-error).
Class synopsis
--------------
class **JsonException** extends [Exception](class.exception) { /\* Inherited properties \*/ protected string [$message](class.exception#exception.props.message) = "";
private string [$string](class.exception#exception.props.string) = "";
protected int [$code](class.exception#exception.props.code);
protected string [$file](class.exception#exception.props.file) = "";
protected int [$line](class.exception#exception.props.line);
private array [$trace](class.exception#exception.props.trace) = [];
private ?[Throwable](class.throwable) [$previous](class.exception#exception.props.previous) = null; /\* Inherited methods \*/
```
final public Exception::getMessage(): string
```
```
final public Exception::getPrevious(): ?Throwable
```
```
final public Exception::getCode(): int
```
```
final public Exception::getFile(): string
```
```
final public Exception::getLine(): int
```
```
final public Exception::getTrace(): array
```
```
final public Exception::getTraceAsString(): string
```
```
public Exception::__toString(): string
```
```
private Exception::__clone(): void
```
}
php mysqli_result::$lengths mysqli\_result::$lengths
========================
mysqli\_fetch\_lengths
======================
(PHP 5, PHP 7, PHP 8)
mysqli\_result::$lengths -- mysqli\_fetch\_lengths — Returns the lengths of the columns of the current row in the result set
### Description
Object-oriented style
?array [$mysqli\_result->lengths](mysqli-result.lengths); Procedural style
```
mysqli_fetch_lengths(mysqli_result $result): array|false
```
The **mysqli\_fetch\_lengths()** function returns an array containing the lengths of every column of the current row within the result set.
### Parameters
`result`
Procedural style only: A [mysqli\_result](class.mysqli-result) object returned by [mysqli\_query()](mysqli.query), [mysqli\_store\_result()](mysqli.store-result), [mysqli\_use\_result()](mysqli.use-result) or [mysqli\_stmt\_get\_result()](mysqli-stmt.get-result).
### Return Values
An array of integers representing the size of each column (not including any terminating null characters). **`false`** if an error occurred.
**mysqli\_fetch\_lengths()** is valid only for the current row of the result set. It returns **`false`** if you call it before calling mysqli\_fetch\_row/array/object or after retrieving all rows in the result.
### Examples
**Example #1 Object-oriented style**
```
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT * from Country ORDER BY Code LIMIT 1";
if ($result = $mysqli->query($query)) {
$row = $result->fetch_row();
/* display column lengths */
foreach ($result->lengths as $i => $val) {
printf("Field %2d has Length %2d\n", $i+1, $val);
}
$result->close();
}
/* close connection */
$mysqli->close();
?>
```
**Example #2 Procedural style**
```
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT * from Country ORDER BY Code LIMIT 1";
if ($result = mysqli_query($link, $query)) {
$row = mysqli_fetch_row($result);
/* display column lengths */
foreach (mysqli_fetch_lengths($result) as $i => $val) {
printf("Field %2d has Length %2d\n", $i+1, $val);
}
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
```
The above examples will output:
```
Field 1 has Length 3
Field 2 has Length 5
Field 3 has Length 13
Field 4 has Length 9
Field 5 has Length 6
Field 6 has Length 1
Field 7 has Length 6
Field 8 has Length 4
Field 9 has Length 6
Field 10 has Length 6
Field 11 has Length 5
Field 12 has Length 44
Field 13 has Length 7
Field 14 has Length 3
Field 15 has Length 2
```
php gnupg_setsignmode gnupg\_setsignmode
==================
(PECL gnupg >= 0.1)
gnupg\_setsignmode — Sets the mode for signing
### Description
```
gnupg_setsignmode(resource $identifier, int $signmode): bool
```
Sets the mode for signing.
### Parameters
`identifier`
The gnupg identifier, from a call to [gnupg\_init()](function.gnupg-init) or **gnupg**.
`sigmode`
The mode for signing.
`signmode` takes a constant indicating what type of signature should be produced. The possible values are **`GNUPG_SIG_MODE_NORMAL`**, **`GNUPG_SIG_MODE_DETACH`** and **`GNUPG_SIG_MODE_CLEAR`**. By default **`GNUPG_SIG_MODE_CLEAR`** is used.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Procedural **gnupg\_setsignmode()** example**
```
<?php
$res = gnupg_init();
gnupg_setsignmode($res,GNUPG_SIG_MODE_DETACH); // produce a detached signature
?>
```
**Example #2 OO **gnupg\_setsignmode()** example**
```
<?php
$gpg = new gnupg();
$gpg->setsignmode(gnupg::SIG_MODE_DETACH); // produce a detached signature
?>
```
php Imagick::getFormat Imagick::getFormat
==================
(PECL imagick 2, PECL imagick 3)
Imagick::getFormat — Returns the format of the Imagick object
### Description
```
public Imagick::getFormat(): string
```
Returns the format of the Imagick object.
### Parameters
This function has no parameters.
### Return Values
Returns the format of the image.
### Errors/Exceptions
Throws ImagickException on error.
php ImagickPixelIterator::setIteratorFirstRow ImagickPixelIterator::setIteratorFirstRow
=========================================
(PECL imagick 2, PECL imagick 3)
ImagickPixelIterator::setIteratorFirstRow — Sets the pixel iterator to the first pixel row
### Description
```
public ImagickPixelIterator::setIteratorFirstRow(): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Sets the pixel iterator to the first pixel row.
### Return Values
Returns **`true`** on success.
php syslog syslog
======
(PHP 4, PHP 5, PHP 7, PHP 8)
syslog — Generate a system log message
### Description
```
syslog(int $priority, string $message): bool
```
**syslog()** generates a log message that will be distributed by the system logger.
For information on setting up a user defined log handler, see the syslog.conf (5) Unix manual page. More information on the syslog facilities and option can be found in the man pages for syslog (3) on Unix machines.
### Parameters
`priority`
`priority` is a combination of the facility and the level. Possible values are:
****syslog()** Priorities (in descending order)**| Constant | Description |
| --- | --- |
| **`LOG_EMERG`** | system is unusable |
| **`LOG_ALERT`** | action must be taken immediately |
| **`LOG_CRIT`** | critical conditions |
| **`LOG_ERR`** | error conditions |
| **`LOG_WARNING`** | warning conditions |
| **`LOG_NOTICE`** | normal, but significant, condition |
| **`LOG_INFO`** | informational message |
| **`LOG_DEBUG`** | debug-level message |
`message`
The message to send.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Using **syslog()****
```
<?php
// open syslog, include the process ID and also send
// the log to standard error, and use a user defined
// logging mechanism
openlog("myScriptLog", LOG_PID | LOG_PERROR, LOG_LOCAL0);
// some code
if (authorized_client()) {
// do something
} else {
// unauthorized client!
// log the attempt
$access = date("Y/m/d H:i:s");
syslog(LOG_WARNING, "Unauthorized client: $access {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})");
}
closelog();
?>
```
### Notes
On Windows, the syslog service is emulated using the Event Log.
>
> **Note**:
>
>
> Use of `LOG_LOCAL0` through `LOG_LOCAL7` for the `facility` parameter of [openlog()](function.openlog) is not available in Windows.
>
>
### See Also
* [openlog()](function.openlog) - Open connection to system logger
* [closelog()](function.closelog) - Close connection to system logger
* [syslog.filter](https://www.php.net/manual/en/errorfunc.configuration.php#ini.syslog.filter) INI setting (starting with PHP 7.3)
php stats_dens_f stats\_dens\_f
==============
(PECL stats >= 1.0.0)
stats\_dens\_f — Probability density function of the F distribution
### Description
```
stats_dens_f(float $x, float $dfr1, float $dfr2): float
```
Returns the probability density at `x`, where the random variable follows the F distribution of which the degree of freedoms are `dfr1` and `dfr2`.
### Parameters
`x`
The value at which the probability density is calculated
`dfr1`
The degree of freedom of the distribution
`dfr2`
The degree of freedom of the distribution
### Return Values
The probability density at `x` or **`false`** for failure.
php pg_port pg\_port
========
(PHP 4, PHP 5, PHP 7, PHP 8)
pg\_port — Return the port number associated with the connection
### Description
```
pg_port(?PgSql\Connection $connection = null): string
```
**pg\_port()** returns the port number that the given PostgreSQL `connection` instance is connected to.
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance. When `connection` is **`null`**, the default connection is used. The default connection is the last connection made by [pg\_connect()](function.pg-connect) or [pg\_pconnect()](function.pg-pconnect).
**Warning**As of PHP 8.1.0, using the default connection is deprecated.
### Return Values
A string containing the port number of the database server the `connection` is to, or empty string on error.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. |
| 8.0.0 | `connection` is now nullable. |
### Examples
**Example #1 **pg\_port()** example**
```
<?php
$pgsql_conn = pg_connect("dbname=mark host=localhost");
if ($pgsql_conn) {
print "Successfully connected to port: " . pg_port($pgsql_conn) . "<br/>\n";
} else {
print pg_last_error($pgsql_conn);
exit;
}
?>
```
| programming_docs |
php PharFileInfo::__construct PharFileInfo::\_\_construct
===========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
PharFileInfo::\_\_construct — Construct a Phar entry object
### Description
public **PharFileInfo::\_\_construct**(string `$filename`) This should not be called directly. Instead, a PharFileInfo object is initialized by calling [Phar::offsetGet()](phar.offsetget) through array access.
### Parameters
`filename`
The full url to retrieve a file. If you wish to retrieve the information for the file `my/file.php` from the phar `boo.phar`, the entry should be `phar://boo.phar/my/file.php`.
### Errors/Exceptions
Throws [BadMethodCallException](class.badmethodcallexception) if [\_\_construct()](language.oop5.decon#object.construct) is called twice. Throws [UnexpectedValueException](class.unexpectedvalueexception) if the phar URL requested is malformed, the requested phar cannot be opened, or the file can't be found within the phar.
### Examples
**Example #1 A **PharFileInfo::\_\_construct()** example**
```
<?php
try {
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
$p['testfile.txt'] = "hi\nthere\ndude";
$file = $p['testfile.txt'];
foreach ($file as $line => $text) {
echo "line number $line: $text";
}
// this also works
$file = new PharFileInfo('phar:///path/to/my.phar/testfile.txt');
foreach ($file as $line => $text) {
echo "line number $line: $text";
}
} catch (Exception $e) {
echo 'Phar operations failed: ', $e;
}
?>
```
The above example will output:
```
line number 1: hi
line number 2: there
line number 3: dude
line number 1: hi
line number 2: there
line number 3: dude
```
php SQLite3::__construct SQLite3::\_\_construct
======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3::\_\_construct — Instantiates an SQLite3 object and opens an SQLite 3 database
### Description
public **SQLite3::\_\_construct**(string `$filename`, int `$flags` = SQLITE3\_OPEN\_READWRITE | SQLITE3\_OPEN\_CREATE, string `$encryptionKey` = "") Instantiates an SQLite3 object and opens a connection to an SQLite 3 database. If the build includes encryption, then it will attempt to use the key.
### Parameters
`filename`
Path to the SQLite database, or `:memory:` to use in-memory database. If `filename` is an empty string, then a private, temporary on-disk database will be created. This private database will be automatically deleted as soon as the database connection is closed.
`flags`
Optional flags used to determine how to open the SQLite database. By default, open uses `SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE`.
* `SQLITE3_OPEN_READONLY`: Open the database for reading only.
* `SQLITE3_OPEN_READWRITE`: Open the database for reading and writing.
* `SQLITE3_OPEN_CREATE`: Create the database if it does not exist.
`encryptionKey`
An optional encryption key used when encrypting and decrypting an SQLite database. If the SQLite encryption module is not installed, this parameter will have no effect.
### Errors/Exceptions
Throws an [Exception](class.exception) on failure.
### Changelog
| Version | Description |
| --- | --- |
| 7.0.10 | The `filename` can now be empty to use a private, temporary on-disk database. |
### Examples
**Example #1 **SQLite3::\_\_construct()** example**
```
<?php
$db = new SQLite3('mysqlitedb.db');
$db->exec('CREATE TABLE foo (bar TEXT)');
$db->exec("INSERT INTO foo (bar) VALUES ('This is a test')");
$result = $db->query('SELECT bar FROM foo');
var_dump($result->fetchArray());
?>
```
php Imagick::scaleImage Imagick::scaleImage
===================
(PECL imagick 2, PECL imagick 3)
Imagick::scaleImage — Scales the size of an image
### Description
```
public Imagick::scaleImage(
int $cols,
int $rows,
bool $bestfit = false,
bool $legacy = false
): bool
```
Scales the size of an image to the given dimensions. The other parameter will be calculated if 0 is passed as either param.
> **Note**: The behavior of the parameter `bestfit` changed in Imagick 3.0.0. Before this version given dimensions 400x400 an image of dimensions 200x150 would be left untouched. In Imagick 3.0.0 and later the image would be scaled up to size 400x300 as this is the "best fit" for the given dimensions. If `bestfit` parameter is used both width and height must be given.
>
>
### Parameters
`cols`
`rows`
`bestfit`
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Changelog
| Version | Description |
| --- | --- |
| PECL imagick 2.1.0 | Added optional fit parameter. This method now supports proportional scaling. Pass zero as either parameter for proportional scaling. |
### Examples
**Example #1 **Imagick::scaleImage()****
```
<?php
function scaleImage($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->scaleImage(150, 150, true);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php The EvWatcher class
The EvWatcher class
===================
Introduction
------------
(PECL ev >= 0.2.0)
**EvWatcher** is a base class for all watchers( [EvCheck](class.evcheck) , [EvChild](class.evchild) etc.). Since **EvWatcher** 's constructor is abstract , one can't(and don't need to) create EvWatcher objects directly.
Class synopsis
--------------
abstract class **EvWatcher** { /\* Properties \*/ public [$is\_active](class.evwatcher#evwatcher.props.is-active);
public [$data](class.evwatcher#evwatcher.props.data);
public [$is\_pending](class.evwatcher#evwatcher.props.is-pending);
public [$priority](class.evwatcher#evwatcher.props.priority); /\* Methods \*/ abstract public [\_\_construct](evwatcher.construct)()
```
public clear(): int
```
```
public feed( int $revents ): void
```
```
public getLoop(): EvLoop
```
```
public invoke( int $revents ): void
```
```
public keepalive( bool $value = ?): bool
```
```
public setCallback( callable $callback ): void
```
```
public start(): void
```
```
public stop(): void
```
} Properties
----------
is\_active *Readonly* . **`true`** if the watcher is active. **`false`** otherwise.
data User custom data associated with the watcher
is\_pending *Readonly* .**`true`** if the watcher is pending, i.e. it has outstanding events, but its callback has not yet been invoked. **`false`** otherwise. As long, as a watcher is pending(but not active), one must *not* change its priority.
priority int between **`Ev::MINPRI`** and **`Ev::MAXPRI`** . Pending watchers with higher priority will be invoked before watchers with lower priority, but priority will not keep watchers from being executed(except for [EvIdle](class.evidle) watchers). [EvIdle](class.evidle) watchers provide functionality to suppress invocation when higher priority events are pending.
Table of Contents
-----------------
* [EvWatcher::clear](evwatcher.clear) — Clear watcher pending status
* [EvWatcher::\_\_construct](evwatcher.construct) — Abstract constructor of a watcher object
* [EvWatcher::feed](evwatcher.feed) — Feeds the given revents set into the event loop
* [EvWatcher::getLoop](evwatcher.getloop) — Returns the loop responsible for the watcher
* [EvWatcher::invoke](evwatcher.invoke) — Invokes the watcher callback with the given received events bit mask
* [EvWatcher::keepalive](evwatcher.keepalive) — Configures whether to keep the loop from returning
* [EvWatcher::setCallback](evwatcher.setcallback) — Sets new callback for the watcher
* [EvWatcher::start](evwatcher.start) — Starts the watcher
* [EvWatcher::stop](evwatcher.stop) — Stops the watcher
php session_decode session\_decode
===============
(PHP 4, PHP 5, PHP 7, PHP 8)
session\_decode — Decodes session data from a session encoded string
### Description
```
session_decode(string $data): bool
```
**session\_decode()** decodes the serialized session data provided in `$data`, and populates the $\_SESSION superglobal with the result.
By default, the unserialization method used is internal to PHP, and is not the same as [unserialize()](function.unserialize). The serialization method can be set using [session.serialize\_handler](https://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler).
### Parameters
`data`
The encoded data to be stored.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [session\_encode()](function.session-encode) - Encodes the current session data as a session encoded string
* [session.serialize\_handler](https://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler)
php SolrInputDocument::__clone SolrInputDocument::\_\_clone
============================
(PECL solr >= 0.9.2)
SolrInputDocument::\_\_clone — Creates a copy of a SolrDocument
### Description
```
public SolrInputDocument::__clone(): void
```
Should not be called directly. It is used to create a deep copy of a SolrInputDocument.
### Parameters
This function has no parameters.
### Return Values
Creates a new SolrInputDocument instance.
php GmagickDraw::getstrokewidth GmagickDraw::getstrokewidth
===========================
(PECL gmagick >= Unknown)
GmagickDraw::getstrokewidth — Returns the width of the stroke used to draw object outlines
### Description
```
public GmagickDraw::getstrokewidth(): float
```
Returns the width of the stroke used to draw object outlines.
### Parameters
This function has no parameters.
### Return Values
Returns a float describing the stroke width.
php QuickHashIntHash::exists QuickHashIntHash::exists
========================
(PECL quickhash >= Unknown)
QuickHashIntHash::exists — This method checks whether a key is part of the hash
### Description
```
public QuickHashIntHash::exists(int $key): bool
```
This method checks whether an entry with the provided key exists in the hash.
### Parameters
`key`
The key of the entry to check for whether it exists in the hash.
### Return Values
Returns **`true`** when the entry was found, or **`false`** when the entry is not found.
### Examples
**Example #1 **QuickHashIntHash::exists()** example**
```
<?php
//generate 200000 elements
$array = range( 0, 199999 );
$existingEntries = array_rand( array_flip( $array ), 180000 );
$testForEntries = array_rand( array_flip( $array ), 1000 );
$foundCount = 0;
echo "Creating hash: ", microtime( true ), "\n";
$hash = new QuickHashIntHash( 100000 );
echo "Adding elements: ", microtime( true ), "\n";
foreach( $existingEntries as $key )
{
$hash->add( $key, 56 );
}
echo "Doing 1000 tests: ", microtime( true ), "\n";
foreach( $testForEntries as $key )
{
$foundCount += $hash->exists( $key );
}
echo "Done, $foundCount found: ", microtime( true ), "\n";
?>
```
The above example will output something similar to:
```
Creating hash: 1263588703.0748
Adding elements: 1263588703.0757
Doing 1000 tests: 1263588703.7851
Done, 898 found: 1263588703.7897
```
php SolrDisMaxQuery::removePhraseField SolrDisMaxQuery::removePhraseField
==================================
(No version information available, might only be in Git)
SolrDisMaxQuery::removePhraseField — Removes a Phrase Field (pf parameter)
### Description
```
public SolrDisMaxQuery::removePhraseField(string $field): SolrDisMaxQuery
```
Removes a Phrase Field (pf parameter) that was previously added using SolrDisMaxQuery::addPhraseField
### Parameters
`field`
Field Name
### Return Values
[SolrDisMaxQuery](class.solrdismaxquery)
### Examples
**Example #1 **SolrDisMaxQuery::removePhraseField()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery('lucene');
$dismaxQuery
->addPhraseField('first', 3, 1)
->addPhraseField('second', 4, 1)
->addPhraseField('cat', 55);
echo $dismaxQuery . PHP_EOL;
echo $dismaxQuery->removePhraseField('second');
?>
```
The above example will output something similar to:
```
q=lucene&defType=edismax&pf=first~1^3 second~1^4 cat^55
q=lucene&defType=edismax&pf=first~1^3 cat^55
```
### See Also
* [SolrDisMaxQuery::addPhraseField()](solrdismaxquery.addphrasefield) - Adds a Phrase Field (pf parameter)
* [SolrDisMaxQuery::setPhraseFields()](solrdismaxquery.setphrasefields) - Sets Phrase Fields and their boosts (and slops) using pf2 parameter
php sodium_crypto_sign sodium\_crypto\_sign
====================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_sign — Sign a message
### Description
```
sodium_crypto_sign(string $message, string $secret_key): string
```
Sign a message with a secret key, that can be verified by the corresponding public key. This function attaches the signature to the message. See [sodium\_crypto\_sign\_detached()](function.sodium-crypto-sign-detached) for detached signatures.
### Parameters
`message`
Message to sign.
`secret_key`
Secret key. See [sodium\_crypto\_sign\_secretkey()](function.sodium-crypto-sign-secretkey)
### Return Values
Signed message (not encrypted).
php mysqli_result::fetch_all mysqli\_result::fetch\_all
==========================
mysqli\_fetch\_all
==================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
mysqli\_result::fetch\_all -- mysqli\_fetch\_all — Fetch all result rows as an associative array, a numeric array, or both
### Description
Object-oriented style
```
public mysqli_result::fetch_all(int $mode = MYSQLI_NUM): array
```
Procedural style
```
mysqli_fetch_all(mysqli_result $result, int $mode = MYSQLI_NUM): array
```
Returns a two-dimensional array of all result rows as an associative array, a numeric array, or both.
>
> **Note**:
>
>
> Prior to PHP 8.1.0, available only with [mysqlnd](https://www.php.net/manual/en/book.mysqlnd.php).
>
>
### Parameters
`result`
Procedural style only: A [mysqli\_result](class.mysqli-result) object returned by [mysqli\_query()](mysqli.query), [mysqli\_store\_result()](mysqli.store-result), [mysqli\_use\_result()](mysqli.use-result) or [mysqli\_stmt\_get\_result()](mysqli-stmt.get-result).
`mode`
This optional parameter is a constant indicating what type of array should be produced from the current row data. The possible values for this parameter are the constants **`MYSQLI_ASSOC`**, **`MYSQLI_NUM`**, or **`MYSQLI_BOTH`**.
### Return Values
Returns an array of associative or numeric arrays holding result rows.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | Now also available when linking against libmysqlclient. |
### Examples
**Example #1 **mysqli\_result::fetch\_all()** example**
Object-oriented style
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
$result = $mysqli->query("SELECT Name, CountryCode FROM City ORDER BY ID LIMIT 3");
$rows = $result->fetch_all(MYSQLI_ASSOC);
foreach ($rows as $row) {
printf("%s (%s)\n", $row["Name"], $row["CountryCode"]);
}
```
Procedural style
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = mysqli_connect("localhost", "my_user", "my_password", "world");
$result = mysqli_query($mysqli, "SELECT Name, CountryCode FROM City ORDER BY ID LIMIT 3");
$rows = mysqli_fetch_all($result, MYSQLI_ASSOC);
foreach ($rows as $row) {
printf("%s (%s)\n", $row["Name"], $row["CountryCode"]);
}
```
The above examples will output:
```
Kabul (AFG)
Qandahar (AFG)
Herat (AFG)
```
### See Also
* [mysqli\_fetch\_array()](mysqli-result.fetch-array) - Fetch the next row of a result set as an associative, a numeric array, or both
* [mysqli\_fetch\_column()](mysqli-result.fetch-column) - Fetch a single column from the next row of a result set
* [mysqli\_query()](mysqli.query) - Performs a query on the database
php openssl_cipher_iv_length openssl\_cipher\_iv\_length
===========================
(PHP 5 >= 5.3.3, PHP 7, PHP 8)
openssl\_cipher\_iv\_length — Gets the cipher iv length
### Description
```
openssl_cipher_iv_length(string $cipher_algo): int|false
```
Gets the cipher initialization vector (iv) length.
### Parameters
`cipher_algo`
The cipher method, see [openssl\_get\_cipher\_methods()](function.openssl-get-cipher-methods) for a list of potential values.
### Return Values
Returns the cipher length on success, or **`false`** on failure.
### Errors/Exceptions
Emits an **`E_WARNING`** level error when the cipher algorithm is unknown.
### Examples
**Example #1 **openssl\_cipher\_iv\_length()** example**
```
<?php
$method = 'AES-128-CBC';
$ivlen = openssl_cipher_iv_length($method);
echo $ivlen;
?>
```
The above example will output something similar to:
```
16
```
php gettype gettype
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
gettype — Get the type of a variable
### Description
```
gettype(mixed $value): string
```
Returns the type of the PHP variable `value`. For type checking, use `is_*` functions.
### Parameters
`value`
The variable being type checked.
### Return Values
Possible values for the returned string are:
* `"boolean"`
* `"integer"`
* `"double"` (for historical reasons `"double"` is returned in case of a float, and not simply `"float"`)
* `"string"`
* `"array"`
* `"object"`
* `"resource"`
* `"resource (closed)"` as of PHP 7.2.0
* `"NULL"`
* `"unknown type"`
### Changelog
| Version | Description |
| --- | --- |
| 7.2.0 | Closed resources are now reported as `'resource (closed)'`. Previously the returned value for closed resources were `'unknown type'`. |
### Examples
**Example #1 **gettype()** example**
```
<?php
$data = array(1, 1., NULL, new stdClass, 'foo');
foreach ($data as $value) {
echo gettype($value), "\n";
}
?>
```
The above example will output something similar to:
```
integer
double
NULL
object
string
```
### See Also
* [get\_debug\_type()](function.get-debug-type) - Gets the type name of a variable in a way that is suitable for debugging
* [settype()](function.settype) - Set the type of a variable
* [get\_class()](function.get-class) - Returns the name of the class of an object
* [is\_array()](function.is-array) - Finds whether a variable is an array
* [is\_bool()](function.is-bool) - Finds out whether a variable is a boolean
* [is\_callable()](function.is-callable) - Verify that a value can be called as a function from the current scope.
* [is\_float()](function.is-float) - Finds whether the type of a variable is float
* [is\_int()](function.is-int) - Find whether the type of a variable is integer
* [is\_null()](function.is-null) - Finds whether a variable is null
* [is\_numeric()](function.is-numeric) - Finds whether a variable is a number or a numeric string
* [is\_object()](function.is-object) - Finds whether a variable is an object
* [is\_resource()](function.is-resource) - Finds whether a variable is a resource
* [is\_scalar()](function.is-scalar) - Finds whether a variable is a scalar
* [is\_string()](function.is-string) - Find whether the type of a variable is string
* [function\_exists()](function.function-exists) - Return true if the given function has been defined
* [method\_exists()](function.method-exists) - Checks if the class method exists
php imagefttext imagefttext
===========
(PHP 4 >= 4.0.7, PHP 5, PHP 7, PHP 8)
imagefttext — Write text to the image using fonts using FreeType 2
### Description
```
imagefttext(
GdImage $image,
float $size,
float $angle,
int $x,
int $y,
int $color,
string $font_filename,
string $text,
array $options = []
): array|false
```
>
> **Note**:
>
>
> Prior to PHP 8.0.0, **imagefttext()** was an extended variant of [imagettftext()](function.imagettftext) which additionally supported the `options`. As of PHP 8.0.0, [imagettftext()](function.imagettftext) is an alias of **imagefttext()**.
>
>
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`size`
The font size to use in points.
`angle`
The angle in degrees, with 0 degrees being left-to-right reading text. Higher values represent a counter-clockwise rotation. For example, a value of 90 would result in bottom-to-top reading text.
`x`
The coordinates given by `x` and `y` will define the basepoint of the first character (roughly the lower-left corner of the character). This is different from the [imagestring()](function.imagestring), where `x` and `y` define the upper-left corner of the first character. For example, "top left" is 0, 0.
`y`
The y-ordinate. This sets the position of the fonts baseline, not the very bottom of the character.
`color`
The index of the desired color for the text, see [imagecolorexact()](function.imagecolorexact).
`font_filename`
The path to the TrueType font you wish to use.
Depending on which version of the GD library PHP is using, *when `font_filename` does not begin with a leading `/` then `.ttf` will be appended* to the filename and the library will attempt to search for that filename along a library-defined font path.
In many cases where a font resides in the same directory as the script using it the following trick will alleviate any include problems.
```
<?php
// Set the environment variable for GD
putenv('GDFONTPATH=' . realpath('.'));
// Name the font to be used (note the lack of the .ttf extension)
$font = 'SomeFont';
?>
```
`text`
Text to be inserted into image.
`options`
**Possible array indexes for `options`**| Key | Type | Meaning |
| --- | --- | --- |
| `linespacing` | float | Defines drawing linespacing |
### Return Values
This function returns an array defining the four points of the box, starting in the lower left and moving counter-clockwise:
| | |
| --- | --- |
| 0 | lower left x-coordinate |
| 1 | lower left y-coordinate |
| 2 | lower right x-coordinate |
| 3 | lower right y-coordinate |
| 4 | upper right x-coordinate |
| 5 | upper right y-coordinate |
| 6 | upper left x-coordinate |
| 7 | upper left y-coordinate |
On failure, **`false`** is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 **imagefttext()** example**
```
<?php
// Create a 300x100 image
$im = imagecreatetruecolor(300, 100);
$red = imagecolorallocate($im, 0xFF, 0x00, 0x00);
$black = imagecolorallocate($im, 0x00, 0x00, 0x00);
// Make the background red
imagefilledrectangle($im, 0, 0, 299, 99, $red);
// Path to our ttf font file
$font_file = './arial.ttf';
// Draw the text 'PHP Manual' using font size 13
imagefttext($im, 13, 0, 105, 55, $black, $font_file, 'PHP Manual');
// Output image to the browser
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>
```
### Notes
> **Note**: This function is only available if PHP is compiled with freetype support (**--with-freetype-dir=DIR**)
>
>
### See Also
* [imageftbbox()](function.imageftbbox) - Give the bounding box of a text using fonts via freetype2
* [imagettftext()](function.imagettftext) - Write text to the image using TrueType fonts
| programming_docs |
php Ds\Map::ksort Ds\Map::ksort
=============
(PECL ds >= 1.0.0)
Ds\Map::ksort — Sorts the map in-place by key
### Description
```
public Ds\Map::ksort(callable $comparator = ?): void
```
Sorts the map in-place by key, using an optional `comparator` function.
### Parameters
`comparator`
The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
```
callback(mixed $a, mixed $b): int
```
**Caution** Returning *non-integer* values from the comparison function, such as float, will result in an internal cast to int of the callback's return value. So values such as 0.99 and 0.1 will both be cast to an integer value of 0, which will compare such values as equal.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Map::ksort()** example**
```
<?php
$map = new \Ds\Map(["b" => 2, "c" => 3, "a" => 1]);
$map->ksort();
print_r($map);
?>
```
The above example will output something similar to:
```
Ds\Map Object
(
[0] => Ds\Pair Object
(
[key] => a
[value] => 1
)
[1] => Ds\Pair Object
(
[key] => b
[value] => 2
)
[2] => Ds\Pair Object
(
[key] => c
[value] => 3
)
)
```
**Example #2 **Ds\Map::ksort()** example using a comparator**
```
<?php
$map = new \Ds\Map([1 => "x", 2 => "y", 0 => "z"]);
// Reverse
$map->ksort(function($a, $b) {
return $b <=> $a;
});
print_r($map);
?>
```
The above example will output something similar to:
```
Ds\Map Object
Ds\Map Object
(
[0] => Ds\Pair Object
(
[key] => 2
[value] => y
)
[1] => Ds\Pair Object
(
[key] => 1
[value] => x
)
[2] => Ds\Pair Object
(
[key] => 0
[value] => z
)
)
```
php GearmanClient::doHighBackground GearmanClient::doHighBackground
===============================
(PECL gearman >= 0.5.0)
GearmanClient::doHighBackground — Run a high priority task in the background
### Description
```
public GearmanClient::doHighBackground(string $function_name, string $workload, string $unique = ?): string
```
Runs a high priority task in the background, returning a job handle which can be used to get the status of the running task. High priority tasks take precedence over normal and low priority tasks in the job queue.
### Parameters
`function_name`
A registered function the worker is to execute
`workload`
Serialized data to be processed
`unique`
A unique ID used to identify a particular task
### Return Values
The job handle for the submitted task.
### See Also
* [GearmanClient::doNormal()](gearmanclient.donormal) - Run a single task and return a result
* [GearmanClient::doHigh()](gearmanclient.dohigh) - Run a single high priority task
* [GearmanClient::doLow()](gearmanclient.dolow) - Run a single low priority task
* [GearmanClient::doBackground()](gearmanclient.dobackground) - Run a task in the background
* [GearmanClient::doLowBackground()](gearmanclient.dolowbackground) - Run a low priority task in the background
php ZipArchive::setExternalAttributesName ZipArchive::setExternalAttributesName
=====================================
(PHP 5 >= 5.6.0, PHP 7, PHP 8, PECL zip >= 1.12.4)
ZipArchive::setExternalAttributesName — Set the external attributes of an entry defined by its name
### Description
```
public ZipArchive::setExternalAttributesName(
string $name,
int $opsys,
int $attr,
int $flags = 0
): bool
```
Set the external attributes of an entry defined by its name.
### Parameters
`name`
Name of the entry.
`opsys`
The operating system code defined by one of the ZipArchive::OPSYS\_ constants.
`attr`
The external attributes. Value depends on operating system.
`flags`
Optional flags. Currently unused.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
This example opens a ZIP file archive test.zip and add the file test.txt with its Unix rights as external attributes.
**Example #1 Archive a file, with its Unix rights**
```
<?php
$zip = new ZipArchive();
$stat = stat($filename='test.txt');
if (is_array($stat) && $zip->open('test.zip', ZipArchive::CREATE) === TRUE) {
$zip->addFile($filename);
$zip->setExternalAttributesName($filename, ZipArchive::OPSYS_UNIX, $stat['mode'] << 16);
$zip->close();
echo "Ok\n";
} else {
echo "KO\n";
}
?>
```
php Imagick::getResourceLimit Imagick::getResourceLimit
=========================
(PECL imagick 2, PECL imagick 3)
Imagick::getResourceLimit — Returns the specified resource limit
### Description
```
public static Imagick::getResourceLimit(int $type): int
```
Returns the specified resource limit.
### Parameters
`type`
One of the [resourcetype constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.resourcetypes). The unit depends on the type of the resource being limited.
### Return Values
Returns the specified resource limit in megabytes.
### Errors/Exceptions
Throws ImagickException on error.
### See Also
* [Imagick::setResourceLimit()](imagick.setresourcelimit) - Sets the limit for a particular resource
php SplFixedArray::next SplFixedArray::next
===================
(PHP 5 >= 5.3.0, PHP 7)
SplFixedArray::next — Move to next entry
### Description
```
public SplFixedArray::next(): void
```
Move the iterator to the next array entry.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php sodium_crypto_secretbox_open sodium\_crypto\_secretbox\_open
===============================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_secretbox\_open — Authenticated shared-key decryption
### Description
```
sodium_crypto_secretbox_open(string $ciphertext, string $nonce, string $key): string|false
```
Decrypt an encrypted message with a symmetric (shared) key.
### Parameters
`ciphertext`
Must be in the format provided by [sodium\_crypto\_secretbox()](function.sodium-crypto-secretbox) (ciphertext and tag, concatenated).
`nonce`
A number that must be only used once, per message. 24 bytes long. This is a large enough bound to generate randomly (i.e. [random\_bytes()](https://www.php.net/manual/en/function.random-bytes.php)).
`key`
Encryption key (256-bit).
### Return Values
The decrypted string on success or **`false`** on failure.
### Errors/Exceptions
* If `nonce` has a length of bytes different than [**`SODIUM_CRYPTO_SECRETBOX_NONCEBYTES`**](https://www.php.net/manual/en/sodium.constants.php#constant.sodium-crypto-secretbox-noncebytes) (24 bytes), a [SodiumException](class.sodiumexception) will be thrown.
* If `key` has a length of bytes different than [**`SODIUM_CRYPTO_SECRETBOX_KEYBYTES`**](https://www.php.net/manual/en/sodium.constants.php#constant.sodium-crypto-secretbox-keybytes) (32 bytes), a [SodiumException](class.sodiumexception) will be thrown.
### Examples
**Example #1 **sodium\_crypto\_secretbox\_open()** example**
```
<?php
// The $key must be kept confidential
$key = random_bytes(SODIUM_CRYPTO_SECRETBOX_KEYBYTES);
// Do not reuse $nonce with the same key
$nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
$ciphertext = sodium_crypto_secretbox('message to be encrypted', $nonce, $key);
// The same nouce and key are required to decrypt the $ciphertext
$plaintext = sodium_crypto_secretbox_open($ciphertext, $nonce, $key);
if ($plaintext !== false) {
echo $plaintext . PHP_EOL;
}
?>
```
The above example will output:
```
message to be encrypted
```
### See Also
* [sodium\_crypto\_secretbox()](function.sodium-crypto-secretbox) - Authenticated shared-key encryption
* [sodium\_crypto\_secretbox\_keygen()](function.sodium-crypto-secretbox-keygen) - Generate random key for sodium\_crypto\_secretbox
* [random\_bytes()](https://www.php.net/manual/en/function.random-bytes.php) - Get cryptographically secure random bytes
php SolrQuery::setMltMinTermFrequency SolrQuery::setMltMinTermFrequency
=================================
(PECL solr >= 0.9.2)
SolrQuery::setMltMinTermFrequency — Sets the frequency below which terms will be ignored in the source docs
### Description
```
public SolrQuery::setMltMinTermFrequency(int $minTermFrequency): SolrQuery
```
Sets the frequency below which terms will be ignored in the source docs
### Parameters
`minTermFrequency`
The frequency below which terms will be ignored in the source docs
### Return Values
Returns the current SolrQuery object, if the return value is used.
php EvFork::__construct EvFork::\_\_construct
=====================
(PECL ev >= 0.2.0)
EvFork::\_\_construct — Constructs the EvFork watcher object
### Description
public **EvFork::\_\_construct**( [callable](language.types.callable) `$callback` , [mixed](language.types.declarations#language.types.declarations.mixed) `$data` = **`null`** , int `$priority` = 0 ) Constructs the EvFork watcher object and starts the watcher automatically.
### Parameters
`callback` See [Watcher callbacks](https://www.php.net/manual/en/ev.watcher-callbacks.php) .
`data` Custom data associated with the watcher.
`priority` [Watcher priority](class.ev#ev.constants.watcher-pri)
### See Also
* [EvLoop::fork()](evloop.fork) - Creates EvFork watcher object associated with the current event loop instance
* [EvCheck](class.evcheck)
php openssl_private_encrypt openssl\_private\_encrypt
=========================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
openssl\_private\_encrypt — Encrypts data with private key
### Description
```
openssl_private_encrypt(
string $data,
string &$encrypted_data,
OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key,
int $padding = OPENSSL_PKCS1_PADDING
): bool
```
**openssl\_private\_encrypt()** encrypts `data` with private `private_key` and stores the result into `encrypted_data`. Encrypted data can be decrypted via [openssl\_public\_decrypt()](function.openssl-public-decrypt).
This function can be used e.g. to sign data (or its hash) to prove that it is not written by someone else.
### Parameters
`data`
`encrypted_data`
`private_key`
`padding`
`padding` can be one of **`OPENSSL_PKCS1_PADDING`**, **`OPENSSL_NO_PADDING`**.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `private_key` accepts an [OpenSSLAsymmetricKey](class.opensslasymmetrickey) or [OpenSSLCertificate](class.opensslcertificate) instance now; previously, a [resource](language.types.resource) of type `OpenSSL key` or `OpenSSL X.509` was accepted. |
### See Also
* [openssl\_public\_encrypt()](function.openssl-public-encrypt) - Encrypts data with public key
* [openssl\_public\_decrypt()](function.openssl-public-decrypt) - Decrypts data with public key
php ctype_graph ctype\_graph
============
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
ctype\_graph — Check for any printable character(s) except space
### Description
```
ctype_graph(mixed $text): bool
```
Checks if all of the characters in the provided string, `text`, creates visible output.
### Parameters
`text`
The tested string.
>
> **Note**:
>
>
> If an int between -128 and 255 inclusive is provided, it is interpreted as the ASCII value of a single character (negative values have 256 added in order to allow characters in the Extended ASCII range). Any other integer is interpreted as a string containing the decimal digits of the integer.
>
>
>
**Warning** As of PHP 8.1.0, passing a non-string argument is deprecated. In the future, the argument will be interpreted as a string instead of an ASCII codepoint. Depending on the intended behavior, the argument should either be cast to string or an explicit call to [chr()](function.chr) should be made.
### Return Values
Returns **`true`** if every character in `text` is printable and actually creates visible output (no white space), **`false`** otherwise. When called with an empty string the result will always be **`false`**.
### Examples
**Example #1 A **ctype\_graph()** example**
```
<?php
$strings = array('string1' => "asdf\n\r\t", 'string2' => 'arf12', 'string3' => 'LKA#@%.54');
foreach ($strings as $name => $testcase) {
if (ctype_graph($testcase)) {
echo "The string '$name' consists of all (visibly) printable characters.\n";
} else {
echo "The string '$name' does not consist of all (visibly) printable characters.\n";
}
}
?>
```
The above example will output:
```
The string 'string1' does not consist of all (visibly) printable characters.
The string 'string2' consists of all (visibly) printable characters.
The string 'string3' consists of all (visibly) printable characters.
```
### See Also
* [ctype\_alnum()](function.ctype-alnum) - Check for alphanumeric character(s)
* [ctype\_print()](function.ctype-print) - Check for printable character(s)
* [ctype\_punct()](function.ctype-punct) - Check for any printable character which is not whitespace or an alphanumeric character
php GmagickPixel::getcolor GmagickPixel::getcolor
======================
(PECL gmagick >= Unknown)
GmagickPixel::getcolor — Returns the color
### Description
```
public GmagickPixel::getcolor(bool $as_array = false, bool $normalize_array = false): mixed
```
Returns the color described by the [GmagickPixel](class.gmagickpixel) object, as a string or an array. If the color has an opacity channel set, this is provided as a fourth value in the list.
### Parameters
`as_array`
**`true`** to indicate return of array instead of string.
`normalize_array`
**`true`** to normalize the color values.
### Return Values
A string or an array of channel values, each normalized if **`true`** is given as `normalize_array`. Throws **GmagickPixelException** on error.
php fbird_backup fbird\_backup
=============
(PHP 5, PHP 7 < 7.4.0)
fbird\_backup — Alias of [ibase\_backup()](function.ibase-backup)
### Description
This function is an alias of: [ibase\_backup()](function.ibase-backup).
php Imagick::clipPathImage Imagick::clipPathImage
======================
(PECL imagick 2, PECL imagick 3)
Imagick::clipPathImage — Clips along the named paths from the 8BIM profile
### Description
```
public Imagick::clipPathImage(string $pathname, bool $inside): bool
```
Clips along the named paths from the 8BIM profile, if present. Later operations take effect inside the path. It may be a number if preceded with #, to work on a numbered path, e.g., "#1" to use the first path.
### Parameters
`pathname`
The name of the path
`inside`
If **`true`** later operations take effect inside clipping path. Otherwise later operations take effect outside clipping path.
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
php ob_get_flush ob\_get\_flush
==============
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
ob\_get\_flush — Flush the output buffer, return it as a string and turn off output buffering
### Description
```
ob_get_flush(): string|false
```
**ob\_get\_flush()** flushes the output buffer, return it as a string and turns off output buffering.
The output buffer must be started by [ob\_start()](function.ob-start) with [PHP\_OUTPUT\_HANDLER\_FLUSHABLE](https://www.php.net/manual/en/outcontrol.constants.php#constant.php-output-handler-flushable) flag. Otherwise **ob\_get\_flush()** will not work.
> **Note**: This function is similar to [ob\_end\_flush()](function.ob-end-flush), except that this function also returns the buffer as a string.
>
>
### Parameters
This function has no parameters.
### Return Values
Returns the output buffer or **`false`** if no buffering is active.
### Examples
**Example #1 **ob\_get\_flush()** example**
```
<?php
//using output_buffering=On
print_r(ob_list_handlers());
//save buffer in a file
$buffer = ob_get_flush();
file_put_contents('buffer.txt', $buffer);
print_r(ob_list_handlers());
?>
```
The above example will output:
```
Array
(
[0] => default output handler
)
Array
(
)
```
### See Also
* [ob\_end\_clean()](function.ob-end-clean) - Clean (erase) the output buffer and turn off output buffering
* [ob\_end\_flush()](function.ob-end-flush) - Flush (send) the output buffer and turn off output buffering
* [ob\_list\_handlers()](function.ob-list-handlers) - List all output handlers in use
php Ds\Vector::sum Ds\Vector::sum
==============
(PECL ds >= 1.0.0)
Ds\Vector::sum — Returns the sum of all values in the vector
### Description
```
public Ds\Vector::sum(): int|float
```
Returns the sum of all values in the vector.
>
> **Note**:
>
>
> Arrays and objects are considered equal to zero when calculating the sum.
>
>
### Parameters
This function has no parameters.
### Return Values
The sum of all the values in the vector as either a float or int depending on the values in the vector.
### Examples
**Example #1 **Ds\Vector::sum()** integer example**
```
<?php
$vector = new \Ds\Vector([1, 2, 3]);
var_dump($vector->sum());
?>
```
The above example will output something similar to:
```
int(6)
```
**Example #2 **Ds\Vector::sum()** float example**
```
<?php
$vector = new \Ds\Vector([1, 2.5, 3]);
var_dump($vector->sum());
?>
```
The above example will output something similar to:
```
float(6.5)
```
php ImagickKernel::fromMatrix ImagickKernel::fromMatrix
=========================
(PECL imagick >= 3.3.0)
ImagickKernel::fromMatrix — Description
### Description
```
public static ImagickKernel::fromMatrix(array $matrix, array $origin = ?): ImagickKernel
```
Create a kernel from an 2d matrix of values. Each value should either be a float (if the element should be used) or 'false' if the element should be skipped. For matrices that are odd sizes in both dimensions the origin pixel will default to the centre of the kernel. For all other kernel sizes the origin pixel must be specified.
### Parameters
`array`
A matrix (i.e. 2d array) of values that define the kernel. Each element should be either a float value, or FALSE if that element shouldn't be used by the kernel.
`array`
Which element of the kernel should be used as the origin pixel. e.g. For a 3x3 matrix specifying the origin as [2, 2] would specify that the bottom right element should be the origin pixel.
### Return Values
The generated ImagickKernel.
### Examples
**Example #1 **ImagickKernel::fromMatrix()****
```
<?php
function renderKernel(ImagickKernel $imagickKernel) {
$matrix = $imagickKernel->getMatrix();
$imageMargin = 20;
$tileSize = 20;
$tileSpace = 4;
$shadowSigma = 4;
$shadowDropX = 20;
$shadowDropY = 0;
$radius = ($tileSize / 2) * 0.9;
$rows = count($matrix);
$columns = count($matrix[0]);
$imagickDraw = new \ImagickDraw();
$imagickDraw->setFillColor('#afafaf');
$imagickDraw->setStrokeColor('none');
$imagickDraw->translate($imageMargin, $imageMargin);
$imagickDraw->push();
ksort($matrix);
foreach ($matrix as $row) {
ksort($row);
$imagickDraw->push();
foreach ($row as $cell) {
if ($cell !== false) {
$color = intval(255 * $cell);
$colorString = sprintf("rgb(%f, %f, %f)", $color, $color, $color);
$imagickDraw->setFillColor($colorString);
$imagickDraw->rectangle(0, 0, $tileSize, $tileSize);
}
$imagickDraw->translate(($tileSize + $tileSpace), 0);
}
$imagickDraw->pop();
$imagickDraw->translate(0, ($tileSize + $tileSpace));
}
$imagickDraw->pop();
$width = ($columns * $tileSize) + (($columns - 1) * $tileSpace);
$height = ($rows * $tileSize) + (($rows - 1) * $tileSpace);
$imagickDraw->push();
$imagickDraw->translate($width/2 , $height/2);
$imagickDraw->setFillColor('rgba(0, 0, 0, 0)');
$imagickDraw->setStrokeColor('white');
$imagickDraw->circle(0, 0, $radius - 1, 0);
$imagickDraw->setStrokeColor('black');
$imagickDraw->circle(0, 0, $radius, 0);
$imagickDraw->pop();
$canvasWidth = $width + (2 * $imageMargin);
$canvasHeight = $height + (2 * $imageMargin);
$kernel = new \Imagick();
$kernel->newPseudoImage(
$canvasWidth,
$canvasHeight,
'canvas:none'
);
$kernel->setImageFormat('png');
$kernel->drawImage($imagickDraw);
/* create drop shadow on it's own layer */
$canvas = $kernel->clone();
$canvas->setImageBackgroundColor(new \ImagickPixel('rgb(0, 0, 0)'));
$canvas->shadowImage(100, $shadowSigma, $shadowDropX, $shadowDropY);
$canvas->setImagePage($canvasWidth, $canvasHeight, -5, -5);
$canvas->cropImage($canvasWidth, $canvasHeight, 0, 0);
/* composite original text_layer onto shadow_layer */
$canvas->compositeImage($kernel, \Imagick::COMPOSITE_OVER, 0, 0);
$canvas->setImageFormat('png');
return $canvas;
}
function createFromMatrix() {
$matrix = [
[0.5, 0, 0.2],
[0, 1, 0],
[0.9, 0, false],
];
$kernel = \ImagickKernel::fromMatrix($matrix);
return $kernel;
}
function fromMatrix() {
$kernel = createFromMatrix();
$imagick = renderKernel($kernel);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
| programming_docs |
php curl_copy_handle curl\_copy\_handle
==================
(PHP 5, PHP 7, PHP 8)
curl\_copy\_handle — Copy a cURL handle along with all of its preferences
### Description
```
curl_copy_handle(CurlHandle $handle): CurlHandle|false
```
Copies a cURL handle keeping the same preferences.
### Parameters
`handle` A cURL handle returned by [curl\_init()](function.curl-init).
### Return Values
Returns a new cURL handle, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `handle` expects a [CurlHandle](class.curlhandle) instance now; previously, a resource was expected. |
| 8.0.0 | On success, this function returns a [CurlHandle](class.curlhandle) instance now; previously, a resource was returned. |
### Examples
**Example #1 Copying a cURL handle**
```
<?php
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, 'http://www.example.com/');
curl_setopt($ch, CURLOPT_HEADER, 0);
// copy the handle
$ch2 = curl_copy_handle($ch);
// grab URL (http://www.example.com/) and pass it to the browser
curl_exec($ch2);
// close cURL resources, and free up system resources
curl_close($ch2);
curl_close($ch);
?>
```
php The IMAP\Connection class
The IMAP\Connection class
=========================
Introduction
------------
(PHP 8 >= 8.1.0)
A fully opaque class which replaces a `imap` resource as of PHP 8.1.0.
Class synopsis
--------------
final class **IMAP\Connection** { }
php EvLoop::fork EvLoop::fork
============
(PECL ev >= 0.2.0)
EvLoop::fork — Creates EvFork watcher object associated with the current event loop instance
### Description
```
final public EvLoop::fork( callable $callback , mixed $data = null , int $priority = 0 ): EvFork
```
Creates EvFork watcher object associated with the current event loop instance
### Parameters
All parameters have the same meaning as for [EvFork::\_\_construct()](evfork.construct)
### Return Values
Returns EvFork object on success.
### See Also
* [EvFork::\_\_construct()](evfork.construct) - Constructs the EvFork watcher object
php sem_get sem\_get
========
(PHP 4, PHP 5, PHP 7, PHP 8)
sem\_get — Get a semaphore id
### Description
```
sem_get(
int $key,
int $max_acquire = 1,
int $permissions = 0666,
bool $auto_release = true
): SysvSemaphore|false
```
**sem\_get()** returns an id that can be used to access the System V semaphore with the given `key`.
A second call to **sem\_get()** for the same key will return a different semaphore identifier, but both identifiers access the same underlying semaphore.
If `key` is `0`, a new private semaphore is created for each call to **sem\_get()**.
### Parameters
`key`
`max_acquire`
The number of processes that can acquire the semaphore simultaneously is set to `max_acquire`.
`permissions`
The semaphore permissions. Actually this value is set only if the process finds it is the only process currently attached to the semaphore.
`auto_release`
Specifies if the semaphore should be automatically released on request shutdown.
### Return Values
Returns a positive semaphore identifier on success, or **`false`** on error.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | On success, this function returns a [SysvSemaphore](class.sysvsemaphore) instance now; previously, a resource was returned. |
| 8.0.0 | The type of `auto_release` has been changed from int to bool. |
### Notes
**Warning** When using **sem\_get()** to access a semaphore created outside PHP, note that the semaphore must have been created as a set of 3 semaphores (for example, by specifying 3 as the `nsems` parameter when calling the C `semget()` function), otherwise PHP will be unable to access the semaphore.
### See Also
* [sem\_acquire()](function.sem-acquire) - Acquire a semaphore
* [sem\_release()](function.sem-release) - Release a semaphore
* [ftok()](function.ftok) - Convert a pathname and a project identifier to a System V IPC key
php Yaf_Request_Simple::isXmlHttpRequest Yaf\_Request\_Simple::isXmlHttpRequest
======================================
(Yaf >=1.0.0)
Yaf\_Request\_Simple::isXmlHttpRequest — Determin if request is AJAX request
### Description
```
public Yaf_Request_Simple::isXmlHttpRequest(): void
```
### Parameters
This function has no parameters.
### Return Values
Always returns false for [Yaf\_Request\_Simple](class.yaf-request-simple)
### See Also
* [Yaf\_Request\_Abstract::isXmlHTTPRequest()](yaf-request-abstract.isxmlhttprequest) - Determine if request is AJAX request
* [Yaf\_Request\_Http::isXmlHTTPRequest()](yaf-request-http.isxmlhttprequest) - Determin if request is Ajax Request
php SolrDocument::__construct SolrDocument::\_\_construct
===========================
(PECL solr >= 0.9.2)
SolrDocument::\_\_construct — Constructor
### Description
public **SolrDocument::\_\_construct**() Constructor for SolrDocument
### Parameters
This function has no parameters.
### Return Values
php DOMNode::getLineNo DOMNode::getLineNo
==================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
DOMNode::getLineNo — Get line number for a node
### Description
```
public DOMNode::getLineNo(): int
```
Gets line number for where the node is defined.
### Parameters
This function has no parameters.
### Return Values
Always returns the line number where the node was defined in.
### Examples
**Example #1 **DOMNode::getLineNo()** example**
```
<?php
// XML dump for below example
$xml = <<<XML
<?xml version="1.0" encoding="utf-8"?>
<root>
<node />
</root>
XML;
// Create a new DOMDocument instance
$dom = new DOMDocument;
// Load the XML
$dom->loadXML($xml);
// Print where the line where the 'node' element was defined in
printf('The <node> tag is defined on line %d', $dom->getElementsByTagName('node')->item(0)->getLineNo());
?>
```
The above example will output:
```
The <node> tag is defined in line 3
```
php openssl_seal openssl\_seal
=============
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
openssl\_seal — Seal (encrypt) data
### Description
```
openssl_seal(
string $data,
string &$sealed_data,
array &$encrypted_keys,
array $public_key,
string $cipher_algo,
string &$iv = null
): int|false
```
**openssl\_seal()** seals (encrypts) `data` by using the given `cipher_algo` with a randomly generated secret key. The key is encrypted with each of the public keys associated with the identifiers in `public_key` and each encrypted key is returned in `encrypted_keys`. This means that one can send sealed data to multiple recipients (provided one has obtained their public keys). Each recipient must receive both the sealed data and the envelope key that was encrypted with the recipient's public key.
### Parameters
`data`
The data to seal.
`sealed_data`
The sealed data.
`encrypted_keys`
Array of encrypted keys.
`public_key`
Array of [OpenSSLAsymmetricKey](class.opensslasymmetrickey) instances containing public keys.
`cipher_algo`
The cipher method.
**Caution** The default value (`'RC4'`) is considered insecure. It is strongly recommended to explicitly specify a secure cipher method.
`iv`
The initialization vector.
### Return Values
Returns the length of the sealed data on success, or **`false`** on error. If successful the sealed data is returned in `sealed_data`, and the envelope keys in `encrypted_keys`.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `public_key` accepts an array of [OpenSSLAsymmetricKey](class.opensslasymmetrickey) instances now; previously, an array of [resource](language.types.resource)s of type `OpenSSL key` was accepted. |
| 8.0.0 | `cipher_algo` is no longer an optional parameter. |
| 8.0.0 | `iv` is nullable now. |
### Examples
**Example #1 **openssl\_seal()** example**
```
<?php
// $data is assumed to contain the data to be sealed
// fetch public keys for our recipients, and ready them
$fp = fopen("/src/openssl-0.9.6/demos/maurice/cert.pem", "r");
$cert = fread($fp, 8192);
fclose($fp);
$pk1 = openssl_get_publickey($cert);
// Repeat for second recipient
$fp = fopen("/src/openssl-0.9.6/demos/sign/cert.pem", "r");
$cert = fread($fp, 8192);
fclose($fp);
$pk2 = openssl_get_publickey($cert);
// seal message, only owners of $pk1 and $pk2 can decrypt $sealed with keys
// $ekeys[0] and $ekeys[1] respectively.
openssl_seal($data, $sealed, $ekeys, array($pk1, $pk2));
// free the keys from memory
openssl_free_key($pk1);
openssl_free_key($pk2);
?>
```
### See Also
* [openssl\_open()](function.openssl-open) - Open sealed data
php UConverter::getStandards UConverter::getStandards
========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
UConverter::getStandards — Get standards associated to converter names
### Description
```
public static UConverter::getStandards(): ?array
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php strncmp strncmp
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
strncmp — Binary safe string comparison of the first n characters
### Description
```
strncmp(string $string1, string $string2, int $length): int
```
This function is similar to [strcmp()](function.strcmp), with the difference that you can specify the (upper limit of the) number of characters from each string to be used in the comparison.
Note that this comparison is case sensitive.
### Parameters
`string1`
The first string.
`string2`
The second string.
`length`
Number of characters to use in the comparison.
### Return Values
Returns `-1` if `string1` is less than `string2`; `1` if `string1` is greater than `string2`, and `0` if they are equal.
### Changelog
| Version | Description |
| --- | --- |
| 8.2.0 | This function now returns `-1` or `1`, where it previously returned a negative or positive number. |
### Examples
**Example #1 **strncmp()** example**
```
<?php
$var1 = 'Hello John';
$var2 = 'Hello Doe';
if (strncmp($var1, $var2, 5) === 0) {
echo 'First 5 characters of $var1 and $var2 are equals in a case-sensitive string comparison';
}
?>
```
### See Also
* [strncasecmp()](function.strncasecmp) - Binary safe case-insensitive string comparison of the first n characters
* [preg\_match()](function.preg-match) - Perform a regular expression match
* [substr\_compare()](function.substr-compare) - Binary safe comparison of two strings from an offset, up to length characters
* [strcmp()](function.strcmp) - Binary safe string comparison
* [strstr()](function.strstr) - Find the first occurrence of a string
* [substr()](function.substr) - Return part of a string
php ibase_fetch_assoc ibase\_fetch\_assoc
===================
(PHP 5, PHP 7 < 7.4.0)
ibase\_fetch\_assoc — Fetch a result row from a query as an associative array
### Description
```
ibase_fetch_assoc(resource $result, int $fetch_flag = 0): array
```
Fetch a result row from a query as an associative array.
**ibase\_fetch\_assoc()** fetches one row of data from the `result`. If two or more columns of the result have the same field names, the last column will take precedence. To access the other column(s) of the same name, you either need to access the result with numeric indices by using [ibase\_fetch\_row()](function.ibase-fetch-row) or use alias names in your query.
### Parameters
`result`
The result handle.
`fetch_flag`
`fetch_flag` is a combination of the constants **`IBASE_TEXT`** and **`IBASE_UNIXTIME`** ORed together. Passing **`IBASE_TEXT`** will cause this function to return BLOB contents instead of BLOB ids. Passing **`IBASE_UNIXTIME`** will cause this function to return date/time values as Unix timestamps instead of as formatted strings.
### Return Values
Returns an associative array that corresponds to the fetched row. Subsequent calls will return the next row in the result set, or **`false`** if there are no more rows.
### See Also
* [ibase\_fetch\_row()](function.ibase-fetch-row) - Fetch a row from an InterBase database
* [ibase\_fetch\_object()](function.ibase-fetch-object) - Get an object from a InterBase database
php The SysvMessageQueue class
The SysvMessageQueue class
==========================
Introduction
------------
(PHP 8)
A fully opaque class which replaces a `sysvmsg queue` resource as of PHP 8.0.0.
Class synopsis
--------------
final class **SysvMessageQueue** { }
php EventBase::exit EventBase::exit
===============
(PECL event >= 1.2.6-beta)
EventBase::exit — Stop dispatching events
### Description
```
public EventBase::exit( float $timeout = ?): bool
```
Tells event base to stop optionally after given number of seconds.
### Parameters
`timeout` Optional number of seconds after which the event base should stop dispatching events.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [EventBase::stop()](eventbase.stop) - Tells event\_base to stop dispatching events
php ibase_prepare ibase\_prepare
==============
(PHP 5, PHP 7 < 7.4.0)
ibase\_prepare — Prepare a query for later binding of parameter placeholders and execution
### Description
```
ibase_prepare(string $query): resource
```
```
ibase_prepare(resource $link_identifier, string $query): resource
```
```
ibase_prepare(resource $link_identifier, string $trans, string $query): resource
```
Prepare a query for later binding of parameter placeholders and execution (via [ibase\_execute()](function.ibase-execute)).
### Parameters
`query`
An InterBase query.
`link_identifier`
An InterBase link identifier returned from [ibase\_connect()](function.ibase-connect). If omitted, the last opened link is assumed.
`trans`
An InterBase transaction handle the query should be associated with. If omitted, the default transaction of the connection is assumed.
### Return Values
Returns a prepared query handle, or **`false`** on error.
php Imagick::cropImage Imagick::cropImage
==================
(PECL imagick 2, PECL imagick 3)
Imagick::cropImage — Extracts a region of the image
### Description
```
public Imagick::cropImage(
int $width,
int $height,
int $x,
int $y
): bool
```
Extracts a region of the image.
### Parameters
`width`
The width of the crop
`height`
The height of the crop
`x`
The X coordinate of the cropped region's top left corner
`y`
The Y coordinate of the cropped region's top left corner
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::cropImage()****
```
<?php
function cropImage($imagePath, $startX, $startY, $width, $height) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->cropImage($width, $height, $startX, $startY);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php EventListener::getBase EventListener::getBase
======================
(PECL event >= 1.2.6-beta)
EventListener::getBase — Returns event base associated with the event listener
### Description
```
public EventListener::getBase(): void
```
Returns event base associated with the event listener.
### Parameters
This function has no parameters.
### Return Values
Returns event base associated with the event listener.
php fbird_blob_create fbird\_blob\_create
===================
(PHP 5, PHP 7 < 7.4.0)
fbird\_blob\_create — Alias of [ibase\_blob\_create()](function.ibase-blob-create)
### Description
This function is an alias of: [ibase\_blob\_create()](function.ibase-blob-create).
### See Also
* [fbird\_blob\_add()](function.fbird-blob-add) - Alias of ibase\_blob\_add
* [fbird\_blob\_cancel()](function.fbird-blob-cancel) - Cancel creating blob
* [fbird\_blob\_close()](function.fbird-blob-close) - Alias of ibase\_blob\_close
* [fbird\_blob\_import()](function.fbird-blob-import) - Alias of ibase\_blob\_import
php mcrypt_module_get_algo_block_size mcrypt\_module\_get\_algo\_block\_size
======================================
(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mcrypt\_module\_get\_algo\_block\_size — Returns the blocksize of the specified algorithm
**Warning**This function has been *DEPRECATED* as of PHP 7.1.0 and *REMOVED* as of PHP 7.2.0. Relying on this function is highly discouraged.
### Description
```
mcrypt_module_get_algo_block_size(string $algorithm, string $lib_dir = ?): int
```
Gets the blocksize of the specified algorithm.
### Parameters
`algorithm`
The algorithm name.
`lib_dir`
This optional parameter can contain the location where the mode module is on the system.
### Return Values
Returns the block size of the algorithm specified in bytes.
php SolrQuery::getFacetDateHardEnd SolrQuery::getFacetDateHardEnd
==============================
(PECL solr >= 0.9.2)
SolrQuery::getFacetDateHardEnd — Returns the value of the facet.date.hardend parameter
### Description
```
public SolrQuery::getFacetDateHardEnd(string $field_override = ?): string
```
Returns the value of the facet.date.hardend parameter. Accepts an optional field override
### Parameters
`field_override`
The name of the field
### Return Values
Returns a string on success and **`null`** if not set
php Ds\Sequence::get Ds\Sequence::get
================
(PECL ds >= 1.0.0)
Ds\Sequence::get — Returns the value at a given index
### Description
```
abstract public Ds\Sequence::get(int $index): mixed
```
Returns the value at a given index.
### Parameters
`index`
The index to access, starting at 0.
### Return Values
The value at the requested index.
### Errors/Exceptions
[OutOfRangeException](class.outofrangeexception) if the index is not valid.
### Examples
**Example #1 **Ds\Sequence::get()** example**
```
<?php
$sequence = new \Ds\Vector(["a", "b", "c"]);
var_dump($sequence->get(0));
var_dump($sequence->get(1));
var_dump($sequence->get(2));
?>
```
The above example will output something similar to:
```
string(1) "a"
string(1) "b"
string(1) "c"
```
**Example #2 **Ds\Sequence::get()** example using array syntax**
```
<?php
$sequence = new \Ds\Vector(["a", "b", "c"]);
var_dump($sequence[0]);
var_dump($sequence[1]);
var_dump($sequence[2]);
?>
```
The above example will output something similar to:
```
string(1) "a"
string(1) "b"
string(1) "c"
```
php ini_restore ini\_restore
============
(PHP 4, PHP 5, PHP 7, PHP 8)
ini\_restore — Restores the value of a configuration option
### Description
```
ini_restore(string $option): void
```
Restores a given configuration option to its original value.
### Parameters
`option`
The configuration option name.
### Return Values
No value is returned.
### Examples
**Example #1 **ini\_restore()** example**
```
<?php
$setting = 'html_errors';
echo 'Current value for \'' . $setting . '\': ' . ini_get($setting), PHP_EOL;
ini_set($setting, ini_get($setting) ? 0 : 1);
echo 'New value for \'' . $setting . '\': ' . ini_get($setting), PHP_EOL;
ini_restore($setting);
echo 'Original value for \'' . $setting . '\': ' . ini_get($setting), PHP_EOL;
?>
```
The above example will output:
```
Current value for 'html_errors': 1
New value for 'html_errors': 0
Original value for 'html_errors': 1
```
### See Also
* [ini\_get()](function.ini-get) - Gets the value of a configuration option
* [ini\_get\_all()](function.ini-get-all) - Gets all configuration options
* [ini\_set()](function.ini-set) - Sets the value of a configuration option
| programming_docs |
php svn_repos_recover svn\_repos\_recover
===================
(PECL svn >= 0.1.0)
svn\_repos\_recover — Run recovery procedures on the repository located at path
### Description
```
svn_repos_recover(string $path): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Run recovery procedures on the repository located at path.
### Notes
**Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
php The ZookeeperMarshallingException class
The ZookeeperMarshallingException class
=======================================
Introduction
------------
(PECL zookeeper >= 0.3.0)
The ZooKeeper exception (while marshalling or unmarshalling data) handling class.
Class synopsis
--------------
class **ZookeeperMarshallingException** extends [ZookeeperException](class.zookeeperexception) { /\* Inherited properties \*/ protected string [$message](class.exception#exception.props.message) = "";
private string [$string](class.exception#exception.props.string) = "";
protected int [$code](class.exception#exception.props.code);
protected string [$file](class.exception#exception.props.file) = "";
protected int [$line](class.exception#exception.props.line);
private array [$trace](class.exception#exception.props.trace) = [];
private ?[Throwable](class.throwable) [$previous](class.exception#exception.props.previous) = null; /\* Inherited methods \*/
```
final public Exception::getMessage(): string
```
```
final public Exception::getPrevious(): ?Throwable
```
```
final public Exception::getCode(): int
```
```
final public Exception::getFile(): string
```
```
final public Exception::getLine(): int
```
```
final public Exception::getTrace(): array
```
```
final public Exception::getTraceAsString(): string
```
```
public Exception::__toString(): string
```
```
private Exception::__clone(): void
```
}
php EventListener::enable EventListener::enable
=====================
(PECL event >= 1.2.6-beta)
EventListener::enable — Enables an event connect listener object
### Description
```
public EventListener::enable(): bool
```
Enables an event connect listener object
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [EventListener::disable()](eventlistener.disable) - Disables an event connect listener object
php SolrQuery::setHighlightMaxAlternateFieldLength SolrQuery::setHighlightMaxAlternateFieldLength
==============================================
(PECL solr >= 0.9.2)
SolrQuery::setHighlightMaxAlternateFieldLength — Sets the maximum number of characters of the field to return
### Description
```
public SolrQuery::setHighlightMaxAlternateFieldLength(int $fieldLength, string $field_override = ?): SolrQuery
```
If SolrQuery::setHighlightAlternateField() was passed the value **`true`**, this parameter specifies the maximum number of characters of the field to return
Any value less than or equal to 0 means unlimited.
### Parameters
`fieldLength`
The length of the field
`field_override`
The name of the field.
### Return Values
Returns the current SolrQuery object, if the return value is used.
php EventHttpRequest::getInputHeaders EventHttpRequest::getInputHeaders
=================================
(PECL event >= 1.4.0-beta)
EventHttpRequest::getInputHeaders — Returns associative array of the input headers
### Description
```
public EventHttpRequest::getInputHeaders(): array
```
Returns associative array of the input headers.
### Parameters
This function has no parameters.
### Return Values
Returns associative array of the input headers.
### See Also
* [EventHttpRequest::getOutputHeaders()](eventhttprequest.getoutputheaders) - Returns associative array of the output headers
php Directory::close Directory::close
================
(PHP 4, PHP 5, PHP 7, PHP 8)
Directory::close — Close directory handle
### Description
```
public Directory::close(): void
```
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | No parameter is accepted. Previously, a directory handle could be passed as argument. |
php pg_lo_import pg\_lo\_import
==============
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg\_lo\_import — Import a large object from file
### Description
```
pg_lo_import(PgSql\Connection $connection = ?, string $pathname, mixed $object_id = ?): int
```
**pg\_lo\_import()** creates a new large object in the database using a file on the filesystem as its data source.
To use the large object interface, it is necessary to enclose it within a transaction block.
>
> **Note**:
>
>
> This function used to be called **pg\_loimport()**.
>
>
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance. When `connection` is unspecified, the default connection is used. The default connection is the last connection made by [pg\_connect()](function.pg-connect) or [pg\_pconnect()](function.pg-pconnect).
**Warning**As of PHP 8.1.0, using the default connection is deprecated.
`pathname`
The full path and file name of the file on the client filesystem from which to read the large object data.
`object_id`
If an `object_id` is given the function will try to create a large object with this id, else a free object id is assigned by the server. The parameter relies on functionality that first appeared in PostgreSQL 8.1.
### Return Values
The OID of the newly created large object, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **pg\_lo\_import()** example**
```
<?php
$database = pg_connect("dbname=jacarta");
pg_query($database, "begin");
$oid = pg_lo_import($database, '/tmp/lob.dat');
pg_query($database, "commit");
?>
```
### See Also
* [pg\_lo\_export()](function.pg-lo-export) - Export a large object to file
* [pg\_lo\_open()](function.pg-lo-open) - Open a large object
php ImagickPixelIterator::newPixelRegionIterator ImagickPixelIterator::newPixelRegionIterator
============================================
(PECL imagick 2, PECL imagick 3)
ImagickPixelIterator::newPixelRegionIterator — Returns a new pixel iterator
### Description
```
public ImagickPixelIterator::newPixelRegionIterator(
Imagick $wand,
int $x,
int $y,
int $columns,
int $rows
): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Returns a new pixel iterator.
### Parameters
`wand`
`x`
`y`
`columns`
`rows`
### Return Values
Returns a new ImagickPixelIterator on success; on failure, throws ImagickPixelIteratorException.
php Locale::lookup Locale::lookup
==============
locale\_lookup
==============
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
Locale::lookup -- locale\_lookup — Searches the language tag list for the best match to the language
### Description
Object-oriented style
```
public static Locale::lookup(
array $languageTag,
string $locale,
bool $canonicalize = false,
?string $defaultLocale = null
): ?string
```
Procedural style
```
locale_lookup(
array $languageTag,
string $locale,
bool $canonicalize = false,
?string $defaultLocale = null
): ?string
```
Searches the items in `languageTag` for the best match to the language range specified in `locale` according to RFC 4647's lookup algorithm.
### Parameters
`languageTag`
An array containing a list of language tags to compare to `locale`. Maximum 100 items allowed.
`locale`
The locale to use as the language range when matching.
`canonicalize` If true, the arguments will be converted to canonical form before matching.
`defaultLocale`
The locale to use if no match is found.
### Return Values
The closest matching language tag or default value.
Returns **`null`** when the length of `locale` exceeds **`INTL_MAX_LOCALE_LEN`**.
### Changelog
| Version | Description |
| --- | --- |
| 7.4.0 | `defaultLocale` is nullable now. |
### Examples
**Example #1 **locale\_lookup()** example**
```
<?php
$arr = array(
'de-DEVA',
'de-DE-1996',
'de',
'de-De'
);
echo locale_lookup($arr, 'de-DE-1996-x-prv1-prv2', true, 'en_US');
?>
```
**Example #2 OO example**
```
<?php
$arr = array(
'de-DEVA',
'de-DE-1996',
'de',
'de-De'
);
echo Locale::lookup($arr, 'de-DE-1996-x-prv1-prv2', true, 'en_US');
?>
```
The above example will output:
```
de_de_1996
```
### See Also
* [locale\_filter\_matches()](locale.filtermatches) - Checks if a language tag filter matches with locale
php Gmagick::getversion Gmagick::getversion
===================
(PECL gmagick >= Unknown)
Gmagick::getversion — Returns the GraphicsMagick API version
### Description
```
public Gmagick::getversion(): array
```
Returns the GraphicsMagick API version as a string and as a number.
### Parameters
This function has no parameters.
### Return Values
Returns the GraphicsMagick API version as a string and as a number.
### Errors/Exceptions
Throws an **GmagickException** on error.
php SolrQuery::addExpandFilterQuery SolrQuery::addExpandFilterQuery
===============================
(PECL solr >= 2.2.0)
SolrQuery::addExpandFilterQuery — Overrides main filter query, determines which documents to include in the main group
### Description
```
public SolrQuery::addExpandFilterQuery(string $fq): SolrQuery
```
Overrides main filter query, determines which documents to include in the main group.
### Parameters
`fq`
### Return Values
[SolrQuery](class.solrquery)
### See Also
* [SolrQuery::setExpand()](solrquery.setexpand) - Enables/Disables the Expand Component
* [SolrQuery::addExpandSortField()](solrquery.addexpandsortfield) - Orders the documents within the expanded groups (expand.sort parameter)
* [SolrQuery::removeExpandSortField()](solrquery.removeexpandsortfield) - Removes an expand sort field from the expand.sort parameter
* [SolrQuery::setExpandRows()](solrquery.setexpandrows) - Sets the number of rows to display in each group (expand.rows). Server Default 5
* [SolrQuery::setExpandQuery()](solrquery.setexpandquery) - Sets the expand.q parameter
* [SolrQuery::removeExpandFilterQuery()](solrquery.removeexpandfilterquery) - Removes an expand filter query
php The MemcachedException class
The MemcachedException class
============================
Introduction
------------
(PECL memcached >= 0.1.0)
Class synopsis
--------------
class **MemcachedException** extends [RuntimeException](class.runtimeexception) { /\* Inherited properties \*/ protected string [$message](class.exception#exception.props.message) = "";
private string [$string](class.exception#exception.props.string) = "";
protected int [$code](class.exception#exception.props.code);
protected string [$file](class.exception#exception.props.file) = "";
protected int [$line](class.exception#exception.props.line);
private array [$trace](class.exception#exception.props.trace) = [];
private ?[Throwable](class.throwable) [$previous](class.exception#exception.props.previous) = null; /\* Inherited methods \*/
```
final public Exception::getMessage(): string
```
```
final public Exception::getPrevious(): ?Throwable
```
```
final public Exception::getCode(): int
```
```
final public Exception::getFile(): string
```
```
final public Exception::getLine(): int
```
```
final public Exception::getTrace(): array
```
```
final public Exception::getTraceAsString(): string
```
```
public Exception::__toString(): string
```
```
private Exception::__clone(): void
```
}
php DirectoryIterator::getGroup DirectoryIterator::getGroup
===========================
(PHP 5, PHP 7, PHP 8)
DirectoryIterator::getGroup — Get group for the current DirectoryIterator item
### Description
```
public DirectoryIterator::getGroup(): int
```
Get the group id of the file.
### Parameters
This function has no parameters.
### Return Values
Returns the group id of the current [DirectoryIterator](class.directoryiterator) item in numerical format.
### Examples
**Example #1 **DirectoryIterator::getGroup()** example**
```
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
$groupid = $iterator->getGroup();
echo 'Directory belongs to group id ' . $groupid . "\n";
print_r(posix_getgrgid($groupid));
?>
```
The above example will output something similar to:
```
Directory belongs to group id 42
Array
(
[name] => toons
[passwd] => x
[members] => Array
(
[0] => tom
[1] => jerry
)
[gid] => 42
)
```
### See Also
* [DirectoryIterator::getiNode()](directoryiterator.getinode) - Get inode for the current DirectoryIterator item
* [DirectoryIterator::getOwner()](directoryiterator.getowner) - Get owner of current DirectoryIterator item
* [DirectoryIterator::getPerms()](directoryiterator.getperms) - Get the permissions of current DirectoryIterator item
* [filegroup()](function.filegroup) - Gets file group
* [posix\_getgrgid()](function.posix-getgrgid) - Return info about a group by group id
php snmpwalk snmpwalk
========
(PHP 4, PHP 5, PHP 7, PHP 8)
snmpwalk — Fetch all the SNMP objects from an agent
### Description
```
snmpwalk(
string $hostname,
string $community,
array|string $object_id,
int $timeout = -1,
int $retries = -1
): array|false
```
**snmpwalk()** function is used to read all the values from an SNMP agent specified by the `hostname`.
### Parameters
`hostname`
The SNMP agent (server).
`community`
The read community.
`object_id`
If **`null`**, `object_id` is taken as the root of the SNMP objects tree and all objects under that tree are returned as an array.
If `object_id` is specified, all the SNMP objects below that `object_id` are returned.
`timeout`
The number of microseconds until the first timeout.
`retries`
The number of times to retry if timeouts occur.
### Return Values
Returns an array of SNMP object values starting from the `object_id` as root or **`false`** on error.
### Examples
**Example #1 **snmpwalk()** Example**
```
<?php
$a = snmpwalk("127.0.0.1", "public", "");
foreach ($a as $val) {
echo "$val\n";
}
?>
```
Above function call would return all the SNMP objects from the SNMP agent running on localhost. One can step through the values with a loop
### See Also
* [snmprealwalk()](function.snmprealwalk) - Return all objects including their respective object ID within the specified one
php curl_version curl\_version
=============
(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)
curl\_version — Gets cURL version information
### Description
```
curl_version(): array|false
```
Returns information about the cURL version.
### Parameters
This function has no parameters.
### Return Values
Returns an associative array with the following elements:
| Key | Value description |
| --- | --- |
| version\_number | cURL 24 bit version number |
| version | cURL version number, as a string |
| ssl\_version\_number | OpenSSL 24 bit version number |
| ssl\_version | OpenSSL version number, as a string |
| libz\_version | zlib version number, as a string |
| host | Information about the host where cURL was built |
| age | |
| features | A bitmask of the `CURL_VERSION_XXX` constants |
| protocols | An array of protocols names supported by cURL |
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | The optional `age` parameter has been removed. |
| 7.4.0 | The optional `age` parameter has been deprecated; if a value is passed, it is ignored. |
### Examples
**Example #1 **curl\_version()** example**
This example will check which features that's available in cURL build by using the `'features'` bitmask returned by **curl\_version()**.
```
<?php
// Get curl version array
$version = curl_version();
// These are the bitfields that can be used
// to check for features in the curl build
$bitfields = Array(
'CURL_VERSION_IPV6',
'CURL_VERSION_KERBEROS4',
'CURL_VERSION_SSL',
'CURL_VERSION_LIBZ'
);
foreach($bitfields as $feature)
{
echo $feature . ($version['features'] & constant($feature) ? ' matches' : ' does not match');
echo PHP_EOL;
}
?>
```
php stats_cdf_logistic stats\_cdf\_logistic
====================
(PECL stats >= 1.0.0)
stats\_cdf\_logistic — Calculates any one parameter of the logistic distribution given values for the others
### Description
```
stats_cdf_logistic(
float $par1,
float $par2,
float $par3,
int $which
): float
```
Returns the cumulative distribution function, its inverse, or one of its parameters, of the logistic distribution. The kind of the return value and parameters (`par1`, `par2`, and `par3`) are determined by `which`.
The following table lists the return value and parameters by `which`. CDF, x, mu, and s denotes cumulative distribution function, the value of the random variable, and the location and the scale parameter of the logistic distribution, respectively.
**Return value and parameters**| `which` | Return value | `par1` | `par2` | `par3` |
| --- | --- | --- | --- | --- |
| 1 | CDF | x | mu | s |
| 2 | x | CDF | mu | s |
| 3 | mu | x | CDF | s |
| 4 | s | x | CDF | mu |
### Parameters
`par1`
The first parameter
`par2`
The second parameter
`par3`
The third parameter
`which`
The flag to determine what to be calculated
### Return Values
Returns CDF, x, mu, or s, determined by `which`.
php bzwrite bzwrite
=======
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
bzwrite — Binary safe bzip2 file write
### Description
```
bzwrite(resource $bz, string $data, ?int $length = null): int|false
```
**bzwrite()** writes a string into the given bzip2 file stream.
### Parameters
`bz`
The file pointer. It must be valid and must point to a file successfully opened by [bzopen()](function.bzopen).
`data`
The written data.
`length`
If supplied, writing will stop after `length` (uncompressed) bytes have been written or the end of `data` is reached, whichever comes first.
### Return Values
Returns the number of bytes written, or **`false`** on error.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `length` is nullable now. |
### Examples
**Example #1 **bzwrite()** example**
```
<?php
$str = "uncompressed data";
$bz = bzopen("/tmp/foo.bz2", "w");
bzwrite($bz, $str, strlen($str));
bzclose($bz);
?>
```
### See Also
* [bzread()](function.bzread) - Binary safe bzip2 file read
* [bzopen()](function.bzopen) - Opens a bzip2 compressed file
php mb_strpos mb\_strpos
==========
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
mb\_strpos — Find position of first occurrence of string in a string
### Description
```
mb_strpos(
string $haystack,
string $needle,
int $offset = 0,
?string $encoding = null
): int|false
```
Finds position of the first occurrence of a string in a string.
Performs a multi-byte safe [strpos()](function.strpos) operation based on number of characters. The first character's position is 0, the second character position is 1, and so on.
### Parameters
`haystack`
The string being checked.
`needle`
The string to find in `haystack`. In contrast with [strpos()](function.strpos), numeric values are not applied as the ordinal value of a character.
`offset`
The search offset. If it is not specified, 0 is used. A negative offset counts from the end of the string.
`encoding`
The `encoding` parameter is the character encoding. If it is omitted or **`null`**, the internal character encoding value will be used.
### Return Values
Returns the numeric position of the first occurrence of `needle` in the `haystack` string. If `needle` is not found, it returns **`false`**.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `needle` now accepts an empty string. |
| 8.0.0 | `encoding` is nullable now. |
| 7.1.0 | Support for negative `offset`s has been added. |
### See Also
* [mb\_internal\_encoding()](function.mb-internal-encoding) - Set/Get internal character encoding
* [strpos()](function.strpos) - Find the position of the first occurrence of a substring in a string
| programming_docs |
php mysqli_result::data_seek mysqli\_result::data\_seek
==========================
mysqli\_data\_seek
==================
(PHP 5, PHP 7, PHP 8)
mysqli\_result::data\_seek -- mysqli\_data\_seek — Adjusts the result pointer to an arbitrary row in the result
### Description
Object-oriented style
```
public mysqli_result::data_seek(int $offset): bool
```
Procedural style
```
mysqli_data_seek(mysqli_result $result, int $offset): bool
```
The **mysqli\_data\_seek()** function seeks to an arbitrary result pointer specified by the `offset` in the result set.
### Parameters
`result`
Procedural style only: A [mysqli\_result](class.mysqli-result) object returned by [mysqli\_query()](mysqli.query), [mysqli\_store\_result()](mysqli.store-result), [mysqli\_use\_result()](mysqli.use-result) or [mysqli\_stmt\_get\_result()](mysqli-stmt.get-result).
`offset`
The row offset. Must be between zero and the total number of rows minus one (0..[mysqli\_num\_rows()](mysqli-result.num-rows) - 1).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **mysqli::data\_seek()** example**
Object-oriented style
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
$result = $mysqli->query($query);
/* Seek to row no. 401 */
$result->data_seek(400);
/* Fetch single row */
$row = $result->fetch_row();
printf("City: %s Countrycode: %s\n", $row[0], $row[1]);
```
Procedural style
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
$result = mysqli_query($link, $query);
/* Seek to row no. 401 */
mysqli_data_seek($result, 400);
/* Fetch single row */
$row = mysqli_fetch_row($result);
printf ("City: %s Countrycode: %s\n", $row[0], $row[1]);
```
The above examples will output:
```
City: Benin City Countrycode: NGA
```
**Example #2 Adjusting the result pointer when iterating**
This function can be useful when iterating over the result set to impose a custom order or rewind the result set when iterating multiple times.
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
$query = "SELECT Name, CountryCode FROM City ORDER BY Name LIMIT 15,4";
$result = $mysqli->query($query);
/* Iterate the result set in reverse order */
for ($row_no = $result->num_rows - 1; $row_no >= 0; $row_no--) {
$result->data_seek($row_no);
/* Fetch single row */
$row = $result->fetch_row();
printf("City: %s Countrycode: %s\n", $row[0], $row[1]);
}
/* Reset pointer to the beginning of the result set */
$result->data_seek(0);
print "\n";
/* Iterate the same result set again */
while ($row = $result->fetch_row()) {
printf("City: %s Countrycode: %s\n", $row[0], $row[1]);
}
```
The above examples will output:
```
City: Acmbaro Countrycode: MEX
City: Abuja Countrycode: NGA
City: Abu Dhabi Countrycode: ARE
City: Abottabad Countrycode: PAK
City: Abottabad Countrycode: PAK
City: Abu Dhabi Countrycode: ARE
City: Abuja Countrycode: NGA
City: Acmbaro Countrycode: MEX
```
### Notes
>
> **Note**:
>
>
> This function can only be used with buffered results attained from the use of the [mysqli\_store\_result()](mysqli.store-result), [mysqli\_query()](mysqli.query) or [mysqli\_stmt\_get\_result()](mysqli-stmt.get-result) functions.
>
>
### See Also
* [mysqli\_store\_result()](mysqli.store-result) - Transfers a result set from the last query
* [mysqli\_fetch\_row()](mysqli-result.fetch-row) - Fetch the next row of a result set as an enumerated array
* [mysqli\_fetch\_array()](mysqli-result.fetch-array) - Fetch the next row of a result set as an associative, a numeric array, or both
* [mysqli\_fetch\_assoc()](mysqli-result.fetch-assoc) - Fetch the next row of a result set as an associative array
* [mysqli\_fetch\_object()](mysqli-result.fetch-object) - Fetch the next row of a result set as an object
* [mysqli\_query()](mysqli.query) - Performs a query on the database
* [mysqli\_num\_rows()](mysqli-result.num-rows) - Gets the number of rows in the result set
php XMLWriter::writeRaw XMLWriter::writeRaw
===================
xmlwriter\_write\_raw
=====================
(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL xmlwriter >= 2.0.4)
XMLWriter::writeRaw -- xmlwriter\_write\_raw — Write a raw XML text
### Description
Object-oriented style
```
public XMLWriter::writeRaw(string $content): bool
```
Procedural style
```
xmlwriter_write_raw(XMLWriter $writer, string $content): bool
```
Writes a raw xml text.
### Parameters
`writer`
Only for procedural calls. The [XMLWriter](class.xmlwriter) instance that is being modified. This object is returned from a call to [xmlwriter\_open\_uri()](xmlwriter.openuri) or [xmlwriter\_open\_memory()](xmlwriter.openmemory).
`content`
The text string to write.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `writer` expects an [XMLWriter](class.xmlwriter) instance now; previously, a resource was expected. |
### See Also
* [XMLWriter::text()](xmlwriter.text) - Write text
php spl_autoload_unregister spl\_autoload\_unregister
=========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
spl\_autoload\_unregister — Unregister given function as \_\_autoload() implementation
### Description
```
spl_autoload_unregister(callable $callback): bool
```
Removes a function from the autoload queue. If the queue is activated and empty after removing the given function then it will be deactivated.
When this function results in the queue being deactivated, any \_\_autoload function that previously existed will not be reactivated.
### Parameters
`callback`
The autoload function being unregistered.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php Yaf_Controller_Abstract::render Yaf\_Controller\_Abstract::render
=================================
(Yaf >=1.0.0)
Yaf\_Controller\_Abstract::render — Render view template
### Description
```
protected Yaf_Controller_Abstract::render(string $tpl, array $parameters = ?): string
```
### Parameters
`tpl`
`parameters`
### Return Values
php SoapVar::__construct SoapVar::\_\_construct
======================
(PHP 5, PHP 7, PHP 8)
SoapVar::\_\_construct — SoapVar constructor
### Description
public **SoapVar::\_\_construct**(
[mixed](language.types.declarations#language.types.declarations.mixed) `$data`,
?int `$encoding`,
?string `$typeName` = **`null`**,
?string `$typeNamespace` = **`null`**,
?string `$nodeName` = **`null`**,
?string `$nodeNamespace` = **`null`**
) Constructs a new [SoapVar](class.soapvar) object.
### Parameters
`data`
The data to pass or return.
`encoding`
The encoding ID, one of the `XSD_...` constants.
`type_name`
The type name.
`type_namespace`
The type namespace.
`node_name`
The XML node name.
`node_namespace`
The XML node namespace.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.3 | `typeName`, `typeNamespace`, `nodeName`,and `nodeNamespace` are nullable now. |
### Examples
**Example #1 **SoapVar::\_\_construct()** example**
```
<?php
class SOAPStruct {
function SOAPStruct($s, $i, $f)
{
$this->varString = $s;
$this->varInt = $i;
$this->varFloat = $f;
}
}
$client = new SoapClient(null, array('location' => "http://localhost/soap.php",
'uri' => "http://test-uri/"));
$struct = new SOAPStruct('arg', 34, 325.325);
$soapstruct = new SoapVar($struct, SOAP_ENC_OBJECT, "SOAPStruct", "http://soapinterop.org/xsd");
$client->echoStruct(new SoapParam($soapstruct, "inputStruct"));
?>
```
### See Also
* [SoapClient::\_\_soapCall()](soapclient.soapcall) - Calls a SOAP function
* [SoapParam::\_\_construct()](soapparam.construct) - SoapParam constructor
php streamWrapper::mkdir streamWrapper::mkdir
====================
(PHP 5, PHP 7, PHP 8)
streamWrapper::mkdir — Create a directory
### Description
```
public streamWrapper::mkdir(string $path, int $mode, int $options): bool
```
This method is called in response to [mkdir()](function.mkdir).
>
> **Note**:
>
>
> In order for the appropriate error message to be returned this method should *not* be defined if the wrapper does not support creating directories.
>
>
### Parameters
`path`
Directory which should be created.
`mode`
The value passed to [mkdir()](function.mkdir).
`options`
A bitwise mask of values, such as **`STREAM_MKDIR_RECURSIVE`**.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
Emits **`E_WARNING`** if call to this method fails (i.e. not implemented).
### Notes
>
> **Note**:
>
>
> The streamWrapper::$context property is updated if a valid context is passed to the caller function.
>
>
>
### See Also
* [mkdir()](function.mkdir) - Makes directory
* [streamwrapper::rmdir()](streamwrapper.rmdir) - Removes a directory
php Gmagick::getimagefilename Gmagick::getimagefilename
=========================
(PECL gmagick >= Unknown)
Gmagick::getimagefilename — Returns the filename of a particular image in a sequence
### Description
```
public Gmagick::getimagefilename(): string
```
Returns the filename of a particular image in a sequence
### Parameters
This function has no parameters.
### Return Values
Returns a string with the filename of the image
### Errors/Exceptions
Throws an **GmagickException** on error.
php DirectoryIterator::getInode DirectoryIterator::getInode
===========================
(PHP 5, PHP 7, PHP 8)
DirectoryIterator::getInode — Get inode for the current DirectoryIterator item
### Description
```
public DirectoryIterator::getInode(): int
```
Get the inode number for the current [DirectoryIterator](class.directoryiterator) item.
### Parameters
This function has no parameters.
### Return Values
Returns the inode number for the file.
### Examples
**Example #1 **DirectoryIterator::getInode()** example**
This example displays the inode number for the directory containing the script.
```
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
echo $iterator->getInode();
?>
```
### See Also
* [DirectoryIterator::getGroup()](directoryiterator.getgroup) - Get group for the current DirectoryIterator item
* [DirectoryIterator::getOwner()](directoryiterator.getowner) - Get owner of current DirectoryIterator item
* [DirectoryIterator::getPerms()](directoryiterator.getperms) - Get the permissions of current DirectoryIterator item
* [fileinode()](function.fileinode) - Gets file inode
php ReflectionAttribute::__construct ReflectionAttribute::\_\_construct
==================================
(PHP 8)
ReflectionAttribute::\_\_construct — Private constructor to disallow direct instantiation
### Description
private **ReflectionAttribute::\_\_construct**() ### Parameters
This function has no parameters.
php mysqli::kill mysqli::kill
============
mysqli\_kill
============
(PHP 5, PHP 7, PHP 8)
mysqli::kill -- mysqli\_kill — Asks the server to kill a MySQL thread
### Description
Object-oriented style
```
public mysqli::kill(int $process_id): bool
```
Procedural style
```
mysqli_kill(mysqli $mysql, int $process_id): bool
```
This function is used to ask the server to kill a MySQL thread specified by the `process_id` parameter. This value must be retrieved by calling the [mysqli\_thread\_id()](mysqli.thread-id) function.
To stop a running query you should use the SQL command `KILL QUERY processid`.
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **mysqli::kill()** example**
Object-oriented style
```
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* determine our thread id */
$thread_id = $mysqli->thread_id;
/* Kill connection */
$mysqli->kill($thread_id);
/* This should produce an error */
if (!$mysqli->query("CREATE TABLE myCity LIKE City")) {
printf("Error: %s\n", $mysqli->error);
exit;
}
/* close connection */
$mysqli->close();
?>
```
Procedural style
```
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* determine our thread id */
$thread_id = mysqli_thread_id($link);
/* Kill connection */
mysqli_kill($link, $thread_id);
/* This should produce an error */
if (!mysqli_query($link, "CREATE TABLE myCity LIKE City")) {
printf("Error: %s\n", mysqli_error($link));
exit;
}
/* close connection */
mysqli_close($link);
?>
```
The above examples will output:
```
Error: MySQL server has gone away
```
### See Also
* [mysqli\_thread\_id()](mysqli.thread-id) - Returns the thread ID for the current connection
php odbc_num_fields odbc\_num\_fields
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
odbc\_num\_fields — Number of columns in a result
### Description
```
odbc_num_fields(resource $statement): int
```
Gets the number of fields (columns) in an ODBC result.
### Parameters
`statement`
The result identifier returned by [odbc\_exec()](function.odbc-exec).
### Return Values
Returns the number of fields, or -1 on error.
php radius_put_vendor_addr radius\_put\_vendor\_addr
=========================
(PECL radius >= 1.1.0)
radius\_put\_vendor\_addr — Attaches a vendor specific IP address attribute
### Description
```
radius_put_vendor_addr(
resource $radius_handle,
int $vendor,
int $type,
string $addr
): bool
```
Attaches an IP address vendor specific attribute to the current RADIUS request.
>
> **Note**:
>
>
> A request must be created via [radius\_create\_request()](function.radius-create-request) before this function can be called.
>
>
>
### Parameters
`radius_handle`
The RADIUS resource.
`vendor`
The vendor ID.
`type`
The attribute type.
`addr`
An IPv4 address in string form, such as `10.0.0.1`.
`options`
A bitmask of the attribute options. The available options include [**`RADIUS_OPTION_TAGGED`**](https://www.php.net/manual/en/radius.constants.options.php#constant.radius-option-tagged) and [**`RADIUS_OPTION_SALT`**](https://www.php.net/manual/en/radius.constants.options.php#constant.radius-option-salt).
`tag`
The attribute tag. This parameter is ignored unless the [**`RADIUS_OPTION_TAGGED`**](https://www.php.net/manual/en/radius.constants.options.php#constant.radius-option-tagged) option is set.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| PECL radius 1.3.0 | The `options` and `tag` parameters were added. |
php The SyncSemaphore class
The SyncSemaphore class
=======================
Introduction
------------
(PECL sync >= 1.0.0)
A cross-platform, native implementation of named and unnamed semaphore objects.
A semaphore restricts access to a limited resource to a limited number of instances. Semaphores differ from mutexes in that they can allow more than one instance to access a resource at one time while a mutex only allows one instance at a time.
Class synopsis
--------------
class **SyncSemaphore** { /\* Methods \*/
```
public __construct(string $name = ?, int $initialval = 1, bool $autounlock = true)
```
```
public lock(int $wait = -1): bool
```
```
public unlock(int &$prevcount = ?): bool
```
} Table of Contents
-----------------
* [SyncSemaphore::\_\_construct](syncsemaphore.construct) — Constructs a new SyncSemaphore object
* [SyncSemaphore::lock](syncsemaphore.lock) — Decreases the count of the semaphore or waits
* [SyncSemaphore::unlock](syncsemaphore.unlock) — Increases the count of the semaphore
php EvIo::createStopped EvIo::createStopped
===================
(PECL ev >= 0.2.0)
EvIo::createStopped — Create stopped EvIo watcher object
### Description
```
final public static EvIo::createStopped(
mixed $fd ,
int $events ,
callable $callback ,
mixed $data = null ,
int $priority = 0
): EvIo
```
The same as [EvIo::\_\_construct()](evio.construct) , but doesn't start the watcher automatically.
### Parameters
`fd` The same as for [EvIo::\_\_construct()](evio.construct)
`events` The same as for [EvIo::\_\_construct()](evio.construct)
`callback` See [Watcher callbacks](https://www.php.net/manual/en/ev.watcher-callbacks.php) .
`data` Custom data associated with the watcher.
`priority` [Watcher priority](class.ev#ev.constants.watcher-pri)
### Return Values
Returns EvIo object on success.
### See Also
* [EvIo::\_\_construct()](evio.construct) - Constructs EvIo watcher object
* [EvLoop::io()](evloop.io) - Create EvIo watcher object associated with the current event loop instance
php IntlCalendar::fieldDifference IntlCalendar::fieldDifference
=============================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::fieldDifference — Calculate difference between given time and this objectʼs time
### Description
Object-oriented style
```
public IntlCalendar::fieldDifference(float $timestamp, int $field): int|false
```
Procedural style
```
intlcal_field_difference(IntlCalendar $calendar, float $timestamp, int $field): int|false
```
Return the difference between the given time and the time this object is set to, with respect to the quantity specified the `field` parameter.
This method is meant to be called successively, first with the most significant field of interest down to the least significant field. To this end, as a side effect, this calendarʼs value for the field specified is advanced by the amount returned.
### Parameters
`calendar`
An [IntlCalendar](class.intlcalendar) instance.
`timestamp`
The time against which to compare the quantity represented by the `field`. For the result to be positive, the time given for this parameter must be ahead of the time of the object the method is being invoked on.
`field`
The field that represents the quantity being compared.
One of the [IntlCalendar](class.intlcalendar) date/time [field constants](class.intlcalendar#intlcalendar.constants). These are integer values between `0` and **`IntlCalendar::FIELD_COUNT`**.
### Return Values
Returns a (signed) difference of time in the unit associated with the specified field or **`false`** on failure.
### Examples
**Example #1 **IntlCalendar::fieldDifference()****
```
<?php
ini_set('date.timezone', 'Europe/Lisbon');
ini_set('intl.default_locale', 'fr_FR');
$cal1 = IntlCalendar::fromDateTime('2012-02-29 09:00:11');
$cal2 = IntlCalendar::fromDateTime('2013-03-01 09:19:29');
$time = $cal2->getTime();
echo "Time before: ", IntlDateFormatter::formatObject($cal1), "\n";
printf(
"The difference in time is %d year(s), %d month(s), "
. "%d day(s), %d hour(s) and %d minute(s)\n",
$cal1->fieldDifference($time, IntlCalendar::FIELD_YEAR),
$cal1->fieldDifference($time, IntlCalendar::FIELD_MONTH),
$cal1->fieldDifference($time, IntlCalendar::FIELD_DAY_OF_MONTH),
$cal1->fieldDifference($time, IntlCalendar::FIELD_HOUR_OF_DAY),
$cal1->fieldDifference($time, IntlCalendar::FIELD_MINUTE)
);
//now it was advanced to the target time, exception for the seconds,
//for which we did not measure the difference
echo "Time after: ", IntlDateFormatter::formatObject($cal1), "\n";
```
The above example will output:
```
Time before: 29 févr. 2012 09:00:11
The difference in time is 1 year(s), 0 month(s), 1 day(s), 0 hour(s) and 19 minute(s)
Time after: 1 mars 2013 09:19:11
```
| programming_docs |
php xdiff_string_patch_binary xdiff\_string\_patch\_binary
============================
(PECL xdiff >= 0.2.0)
xdiff\_string\_patch\_binary — Alias of [xdiff\_string\_bpatch()](function.xdiff-string-bpatch)
### Description
```
xdiff_string_patch_binary(string $str, string $patch): string
```
Patches a string `str` with a binary `patch`. This function accepts patches created both via [xdiff\_string\_bdiff()](function.xdiff-string-bdiff) and [xdiff\_string\_rabdiff()](function.xdiff-string-rabdiff) functions or their file counterparts.
Starting with version 1.5.0 this function is an alias of [xdiff\_string\_bpatch()](function.xdiff-string-bpatch).
### Parameters
`str`
The original binary string.
`patch`
The binary patch string.
### Return Values
Returns the patched string, or **`false`** on error.
### See Also
* [xdiff\_string\_bpatch()](function.xdiff-string-bpatch) - Patch a string with a binary diff
* [xdiff\_string\_bdiff()](function.xdiff-string-bdiff) - Make binary diff of two strings
* [xdiff\_string\_rabdiff()](function.xdiff-string-rabdiff) - Make binary diff of two strings using the Rabin's polynomial fingerprinting algorithm
php gmp_random_seed gmp\_random\_seed
=================
(PHP 7, PHP 8)
gmp\_random\_seed — Sets the RNG seed
### Description
```
gmp_random_seed(GMP|int|string $seed): void
```
### Parameters
`seed`
The seed to be set for the [gmp\_random()](function.gmp-random), [gmp\_random\_bits()](function.gmp-random-bits), and [gmp\_random\_range()](function.gmp-random-range) functions.
A [GMP](class.gmp) object, an int or a numeric string.
### Return Values
No value is returned.
### Errors/Exceptions
Throws a [ValueError](class.valueerror) if `seed` is invalid.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | If `seed` is invalid, **gmp\_random\_seed()** now throws a [ValueError](class.valueerror). Previously it emitted an **`E_WARNING`** and returned **`false`**. |
### Examples
**Example #1 **gmp\_random\_seed()** example**
```
<?php
// set the seed
gmp_random_seed(100);
var_dump(gmp_strval(gmp_random(1)));
// set the seed to something else
gmp_random_seed(gmp_init(-100));
var_dump(gmp_strval(gmp_random_bits(10)));
// set the seed to something invalid
var_dump(gmp_random_seed('not a number'));
```
The above example will output:
```
string(20) "15370156633245019617"
string(3) "683"
Warning: gmp_random_seed(): Unable to convert variable to GMP - string is not an integer in %s on line %d
bool(false)
```
### See Also
* [gmp\_init()](function.gmp-init) - Create GMP number
* [gmp\_random()](function.gmp-random) - Random number
* [gmp\_random\_bits()](function.gmp-random-bits) - Random number
* [gmp\_random\_range()](function.gmp-random-range) - Random number
php The QuickHashIntSet class
The QuickHashIntSet class
=========================
Introduction
------------
(PECL quickhash >= Unknown)
This class wraps around a set containing integer numbers.
Sets can also be iterated over with [`foreach`](control-structures.foreach) as the [Iterator](class.iterator) interface is implemented as well. The order of which elements are returned in is not guaranteed.
Class synopsis
--------------
class **QuickHashIntSet** { /\* Constants \*/ const int [CHECK\_FOR\_DUPES](class.quickhashintset#quickhashintset.constants.check-for-dupes) = 1;
const int [DO\_NOT\_USE\_ZEND\_ALLOC](class.quickhashintset#quickhashintset.constants.do-not-use-zend-alloc) = 2;
const int [HASHER\_NO\_HASH](class.quickhashintset#quickhashintset.constants.hasher-no-hash) = 256;
const int [HASHER\_JENKINS1](class.quickhashintset#quickhashintset.constants.hasher-jenkins1) = 512;
const int [HASHER\_JENKINS2](class.quickhashintset#quickhashintset.constants.hasher-jenkins2) = 1024; /\* Methods \*/
```
public add(int $key): bool
```
```
public __construct(int $size, int $options = ?)
```
```
public delete(int $key): bool
```
```
public exists(int $key): bool
```
```
publicgetSize(): int
```
```
public static loadFromFile(string $filename, int $size = ?, int $options = ?): QuickHashIntSet
```
```
public static loadFromString(string $contents, int $size = ?, int $options = ?): QuickHashIntSet
```
```
public saveToFile(string $filename): void
```
```
public saveToString(): string
```
} Predefined Constants
--------------------
**`QuickHashIntSet::CHECK_FOR_DUPES`** If enabled, adding duplicate elements to a set (through either [QuickHashIntSet::add()](quickhashintset.add) or [QuickHashIntSet::loadFromFile()](quickhashintset.loadfromfile)) will result in those elements to be dropped from the set. This will take up extra time, so only used when it is required.
**`QuickHashIntSet::DO_NOT_USE_ZEND_ALLOC`** Disables the use of PHP's internal memory manager for internal set structures. With this option enabled, internal allocations will not count towards the [memory\_limit](https://www.php.net/manual/en/ini.core.php#ini.memory-limit) settings.
**`QuickHashIntSet::HASHER_NO_HASH`** Selects to not use a hashing function, but merely use a modulo to find the bucket list index. This is not faster than normal hashing, and gives more collisions.
**`QuickHashIntSet::HASHER_JENKINS1`** This is the default hashing function to turn the integer hashes into bucket list indexes.
**`QuickHashIntSet::HASHER_JENKINS2`** Selects a variant hashing algorithm.
Table of Contents
-----------------
* [QuickHashIntSet::add](quickhashintset.add) — This method adds a new entry to the set
* [QuickHashIntSet::\_\_construct](quickhashintset.construct) — Creates a new QuickHashIntSet object
* [QuickHashIntSet::delete](quickhashintset.delete) — This method deletes an entry from the set
* [QuickHashIntSet::exists](quickhashintset.exists) — This method checks whether a key is part of the set
* [QuickHashIntSet::getSize](quickhashintset.getsize) — Returns the number of elements in the set
* [QuickHashIntSet::loadFromFile](quickhashintset.loadfromfile) — This factory method creates a set from a file
* [QuickHashIntSet::loadFromString](quickhashintset.loadfromstring) — This factory method creates a set from a string
* [QuickHashIntSet::saveToFile](quickhashintset.savetofile) — This method stores an in-memory set to disk
* [QuickHashIntSet::saveToString](quickhashintset.savetostring) — This method returns a serialized version of the set
php pcntl_strerror pcntl\_strerror
===============
(PHP 5 >= 5.3.4, PHP 7, PHP 8)
pcntl\_strerror — Retrieve the system error message associated with the given errno
### Description
```
pcntl_strerror(int $error_code): string
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`error_code`
### Return Values
Returns error description.
### See Also
* [pcntl\_get\_last\_error()](function.pcntl-get-last-error) - Retrieve the error number set by the last pcntl function which failed
php ZipArchive::deleteName ZipArchive::deleteName
======================
(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.5.0)
ZipArchive::deleteName — Delete an entry in the archive using its name
### Description
```
public ZipArchive::deleteName(string $name): bool
```
Delete an entry in the archive using its name.
### Parameters
`name`
Name of the entry to delete.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Deleting a file and directory from an archive, using names**
```
<?php
$zip = new ZipArchive;
if ($zip->open('test1.zip') === TRUE) {
$zip->deleteName('testfromfile.php');
$zip->deleteName('testDir/');
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
```
php ReflectionClass::isCloneable ReflectionClass::isCloneable
============================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
ReflectionClass::isCloneable — Returns whether this class is cloneable
### Description
```
public ReflectionClass::isCloneable(): bool
```
Returns whether this class is cloneable.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the class is cloneable, **`false`** otherwise.
### Examples
**Example #1 Basic usage of **ReflectionClass::isCloneable()****
```
<?php
class NotCloneable {
public $var1;
private function __clone() {
}
}
class Cloneable {
public $var1;
}
$notCloneable = new ReflectionClass('NotCloneable');
$cloneable = new ReflectionClass('Cloneable');
var_dump($notCloneable->isCloneable());
var_dump($cloneable->isCloneable());
?>
```
The above example will output:
```
bool(false)
bool(true)
```
php pspell_config_data_dir pspell\_config\_data\_dir
=========================
(PHP 5, PHP 7, PHP 8)
pspell\_config\_data\_dir — Location of language data files
### Description
```
pspell_config_data_dir(PSpell\Config $config, string $directory): bool
```
**Warning**This function is currently not documented; only its argument list is available.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `config` parameter expects an [PSpell\Config](class.pspell-config) instance now; previously, a [resource](language.types.resource) was expected. |
php fdf_set_target_frame fdf\_set\_target\_frame
=======================
(PHP 4 >= 4.3.0, PHP 5 < 5.3.0, PECL fdf SVN)
fdf\_set\_target\_frame — Set target frame for form display
### Description
```
fdf_set_target_frame(resource $fdf_document, string $frame_name): bool
```
Sets the target frame to display a result PDF defined with **fdf\_save\_file()** in.
### Parameters
`fdf_document`
The FDF document handle, returned by [fdf\_create()](function.fdf-create), [fdf\_open()](function.fdf-open) or [fdf\_open\_string()](function.fdf-open-string).
`frame_name`
The frame name, as a string.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* **fdf\_save\_file()**
php DOMElement::hasAttributeNS DOMElement::hasAttributeNS
==========================
(PHP 5, PHP 7, PHP 8)
DOMElement::hasAttributeNS — Checks to see if attribute exists
### Description
```
public DOMElement::hasAttributeNS(?string $namespace, string $localName): bool
```
Indicates whether attribute in namespace `namespace` named `localName` exists as a member of the element.
### Parameters
`namespace`
The namespace URI.
`localName`
The local name.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [DOMElement::hasAttribute()](domelement.hasattribute) - Checks to see if attribute exists
* [DOMElement::getAttributeNS()](domelement.getattributens) - Returns value of attribute
* [DOMElement::setAttributeNS()](domelement.setattributens) - Adds new attribute
* [DOMElement::removeAttributeNS()](domelement.removeattributens) - Removes attribute
php ArrayIterator::natsort ArrayIterator::natsort
======================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
ArrayIterator::natsort — Sort entries naturally
### Description
```
public ArrayIterator::natsort(): bool
```
Sort the entries by values using a "natural order" algorithm.
>
> **Note**:
>
>
> If two members compare as equal, they retain their original order. Prior to PHP 8.0.0, their relative order in the sorted array was undefined.
>
>
### Parameters
This function has no parameters.
### Return Values
Always returns **`true`**.
### See Also
* [ArrayIterator::asort()](arrayiterator.asort) - Sort entries by values
* [ArrayIterator::ksort()](arrayiterator.ksort) - Sort entries by keys
* **ArrayIterator::natsort()**
* [ArrayIterator::uasort()](arrayiterator.uasort) - Sort with a user-defined comparison function and maintain index association
* [ArrayIterator::uksort()](arrayiterator.uksort) - Sort by keys using a user-defined comparison function
* [natsort()](function.natsort) - Sort an array using a "natural order" algorithm
php openssl_pkey_derive openssl\_pkey\_derive
=====================
(PHP 7 >= 7.3.0, PHP 8)
openssl\_pkey\_derive — Computes shared secret for public value of remote and local DH or ECDH key
### Description
```
openssl_pkey_derive(OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $public_key, OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key, int $key_length = 0): string|false
```
**openssl\_pkey\_derive()** takes a set of a `public_key` and `private_key` and derives a shared secret, for either DH or EC keys.
### Parameters
`public_key`
`public_key` is the public key for the derivation. See [Public/Private Key parameters](https://www.php.net/manual/en/openssl.certparams.php) for a list of valid values.
`private_key`
`private_key` is the private key for the derivation. See [Public/Private Key parameters](https://www.php.net/manual/en/openssl.certparams.php) for a list of valid values.
`key_length`
If not zero, will set the desired length of the derived secret.
### Return Values
The derived secret on success or **`false`** on failure.
### Examples
**Example #1 **openssl\_pkey\_derive()** example**
```
<?php
// Load in private key
$priv = openssl_pkey_get_private("-----BEGIN PRIVATE KEY-----
MIICJgIBADCCARcGCSqGSIb3DQEDATCCAQgCggEBAJLxRCaZ933uW+AXmabHFDDy
upojBIRlbmQLJZfigDaSA1f9YOTsIv+WwVFTX/J1mtCyx9uBcz0Nt2kmVwxWuc2f
VtCEMPsmLsVXX7xRUFLpyX1Y1IYGBVXQOoOvLWYQjpZgnx47Pkh1Ok1+smffztfC
0DCNt4KorWrbsPcmqBejXHN79KvWFjZmXOksRiNu/Bn76RiqvofC4z8Ri3kHXQG2
197JGZzzFXHadGC3xbkg8UxsNbYhVMKbm0iANfafUH7/hoS9UjAVQYtvwe7YNiW/
HnyfVCrKwcc7sadd8Iphh+3lf5P1AhaQEAMytanrzq9RDXKBxuvpSJifRYasZYsC
AQIEggEEAoIBAGwAYC2E81Y1U2Aox0U7u1+vBcbht/OO87tutMvc4NTLf6NLPHsW
cPqBixs+3rSn4fADzAIvdLBmogjtiIZoB6qyHrllF/2xwTVGEeYaZIupQH3bMK2b
6eUvnpuu4Ytksiz6VpXBBRMrIsj3frM+zUtnq8vKUr+TbjV2qyKR8l3eNDwzqz30
dlbKh9kIhZafclHfRVfyp+fVSKPfgrRAcLUgAbsVjOjPeJ90xQ4DTMZ6vjiv6tHM
hkSjJIcGhRtSBzVF/cT38GyCeTmiIA/dRz2d70lWrqDQCdp9ArijgnpjNKAAulSY
CirnMsGZTDGmLOHg4xOZ5FEAzZI2sFNLlcw=
-----END PRIVATE KEY-----
");
// Load in public key
$pub = openssl_pkey_get_public("-----BEGIN PUBLIC KEY-----
MIICJDCCARcGCSqGSIb3DQEDATCCAQgCggEBAJLxRCaZ933uW+AXmabHFDDyupoj
BIRlbmQLJZfigDaSA1f9YOTsIv+WwVFTX/J1mtCyx9uBcz0Nt2kmVwxWuc2fVtCE
MPsmLsVXX7xRUFLpyX1Y1IYGBVXQOoOvLWYQjpZgnx47Pkh1Ok1+smffztfC0DCN
t4KorWrbsPcmqBejXHN79KvWFjZmXOksRiNu/Bn76RiqvofC4z8Ri3kHXQG2197J
GZzzFXHadGC3xbkg8UxsNbYhVMKbm0iANfafUH7/hoS9UjAVQYtvwe7YNiW/Hnyf
VCrKwcc7sadd8Iphh+3lf5P1AhaQEAMytanrzq9RDXKBxuvpSJifRYasZYsCAQID
ggEFAAKCAQAiCSBpxvGgsTorxAWtcAlSmzAJnJxFgSPef0g7OjhESytnc8G2QYmx
ovMt5KVergcitztWh08hZQUdAYm4rI+zMlAFDdN8LWwBT/mGKSzRkWeprd8E7mvy
ucqC1YXCMqmIwPySvLQUB/Dl8kgau7BLAnIJm8VP+MVrn8g9gghD0qRCgPgtEaDV
vocfgnOU43rhKnIgO0cHOKtw2qybSFB8QuZrYugq4j8Bwkrzh6rdMMeyMl/ej5Aj
c0wamOzuBDtXt0T9+Fx3khHaowjCc7xJZRgZCxg43SbqMWJ9lUg94I7+LTX61Gyv
dtlkbGbtoDOnxeNnN93gwQZngGYZYciu
-----END PUBLIC KEY-----
");
// Outputs the hex version of the derived key
echo bin2hex(openssl_pkey_derive($pub,$priv));
```
php IntlChar::charFromName IntlChar::charFromName
======================
(PHP 7, PHP 8)
IntlChar::charFromName — Find Unicode character by name and return its code point value
### Description
```
public static IntlChar::charFromName(string $name, int $type = IntlChar::UNICODE_CHAR_NAME): ?int
```
Finds a Unicode character by its name and returns its code point value.
The name is matched exactly and completely. If the name does not correspond to a code point, **`null`** is returned.
A Unicode 1.0 name is matched only if it differs from the modern name. Unicode names are all uppercase. Extended names are lowercase followed by an uppercase hexadecimal number, and within angle brackets.
### Parameters
`name`
Full name of the Unicode character.
`type`
Which set of names to use for the lookup. Can be any of these constants:
* **`IntlChar::UNICODE_CHAR_NAME`** (default)
* **`IntlChar::UNICODE_10_CHAR_NAME`**
* **`IntlChar::EXTENDED_CHAR_NAME`**
* **`IntlChar::CHAR_NAME_ALIAS`**
* **`IntlChar::CHAR_NAME_CHOICE_COUNT`**
### Return Values
The Unicode value of the code point with the given name (as an int), or **`null`** if there is no such code point.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::charFromName("LATIN CAPITAL LETTER A"));
var_dump(IntlChar::charFromName("SNOWMAN"));
var_dump(IntlChar::charFromName("RECYCLING SYMBOL FOR TYPE-1 PLASTICS"));
var_dump(IntlChar::charFromName("A RANDOM STRING WHICH DOESN'T CORRESPOND TO ANY UNICODE CHARACTER"));
?>
```
The above example will output:
```
int(65)
int(9731)
int(9843)
NULL
```
### See Also
* [IntlChar::charName()](intlchar.charname) - Retrieve the name of a Unicode character
* [IntlChar::enumCharNames()](intlchar.enumcharnames) - Enumerate all assigned Unicode characters within a range
php EventUtil::__construct EventUtil::\_\_construct
========================
(PECL event >= 1.2.6-beta)
EventUtil::\_\_construct — The abstract constructor
### Description
```
abstract public EventUtil::__construct()
```
[EventUtil](class.eventutil) is a singleton. Therefore the constructor is abstract, and it is impossible to create objects based on this class.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php None Declaring Attribute Classes
---------------------------
While not strictly required it is recommended to create an actual class for every attribute. In the most simple case only an empty class is needed with the `#[Attribute]` attribute declared that can be imported from the global namespace with a use statement.
**Example #1 Simple Attribute Class**
```
<?php
namespace Example;
use Attribute;
#[Attribute]
class MyAttribute
{
}
```
To restrict the type of declaration an attribute can be assigned to, a bitmask can be passed as the first argument to the `#[Attribute]` declaration.
**Example #2 Using target specification to restrict where attributes can be used**
```
<?php
namespace Example;
use Attribute;
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_FUNCTION)]
class MyAttribute
{
}
```
Declaring **MyAttribute** on another type will now throw an exception during the call to [ReflectionAttribute::newInstance()](reflectionattribute.newinstance)
The following targets can be specified:
* **`Attribute::TARGET_CLASS`**
* **`Attribute::TARGET_FUNCTION`**
* **`Attribute::TARGET_METHOD`**
* **`Attribute::TARGET_PROPERTY`**
* **`Attribute::TARGET_CLASS_CONSTANT`**
* **`Attribute::TARGET_PARAMETER`**
* **`Attribute::TARGET_ALL`**
By default an attribute can only be used once per declaration. If the attribute should be repeatable on declarations it must be specified as part of the bitmask to the `#[Attribute]` declaration.
**Example #3 Using IS\_REPEATABLE to allow attribute on a declaration multiple times**
```
<?php
namespace Example;
use Attribute;
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_FUNCTION | Attribute::IS_REPEATABLE)]
class MyAttribute
{
}
```
php PDOStatement::errorCode PDOStatement::errorCode
=======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0)
PDOStatement::errorCode — Fetch the SQLSTATE associated with the last operation on the statement handle
### Description
```
public PDOStatement::errorCode(): ?string
```
### Parameters
This function has no parameters.
### Return Values
Identical to [PDO::errorCode()](pdo.errorcode), except that **PDOStatement::errorCode()** only retrieves error codes for operations performed with PDOStatement objects.
### Examples
**Example #1 Retrieving an SQLSTATE code**
```
<?php
/* Provoke an error -- the BONES table does not exist */
$err = $dbh->prepare('SELECT skull FROM bones');
$err->execute();
echo "\nPDOStatement::errorCode(): ";
print $err->errorCode();
?>
```
The above example will output:
```
PDOStatement::errorCode(): 42S02
```
### See Also
* [PDO::errorCode()](pdo.errorcode) - Fetch the SQLSTATE associated with the last operation on the database handle
* [PDO::errorInfo()](pdo.errorinfo) - Fetch extended error information associated with the last operation on the database handle
* [PDOStatement::errorInfo()](pdostatement.errorinfo) - Fetch extended error information associated with the last operation on the statement handle
| programming_docs |
php mysqli::get_connection_stats mysqli::get\_connection\_stats
==============================
mysqli\_get\_connection\_stats
==============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
mysqli::get\_connection\_stats -- mysqli\_get\_connection\_stats — Returns statistics about the client connection
### Description
Object-oriented style
```
public mysqli::get_connection_stats(): array
```
Procedural style
```
mysqli_get_connection_stats(mysqli $mysql): array
```
Returns statistics about the client connection.
>
> **Note**:
>
>
> Available only with [mysqlnd](https://www.php.net/manual/en/book.mysqlnd.php).
>
>
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
### Return Values
Returns an array with connection stats.
### Examples
**Example #1 A **mysqli\_get\_connection\_stats()** example**
```
<?php
$link = mysqli_connect();
print_r(mysqli_get_connection_stats($link));
?>
```
The above example will output something similar to:
```
Array
(
[bytes_sent] => 43
[bytes_received] => 80
[packets_sent] => 1
[packets_received] => 2
[protocol_overhead_in] => 8
[protocol_overhead_out] => 4
[bytes_received_ok_packet] => 11
[bytes_received_eof_packet] => 0
[bytes_received_rset_header_packet] => 0
[bytes_received_rset_field_meta_packet] => 0
[bytes_received_rset_row_packet] => 0
[bytes_received_prepare_response_packet] => 0
[bytes_received_change_user_packet] => 0
[packets_sent_command] => 0
[packets_received_ok] => 1
[packets_received_eof] => 0
[packets_received_rset_header] => 0
[packets_received_rset_field_meta] => 0
[packets_received_rset_row] => 0
[packets_received_prepare_response] => 0
[packets_received_change_user] => 0
[result_set_queries] => 0
[non_result_set_queries] => 0
[no_index_used] => 0
[bad_index_used] => 0
[slow_queries] => 0
[buffered_sets] => 0
[unbuffered_sets] => 0
[ps_buffered_sets] => 0
[ps_unbuffered_sets] => 0
[flushed_normal_sets] => 0
[flushed_ps_sets] => 0
[ps_prepared_never_executed] => 0
[ps_prepared_once_executed] => 0
[rows_fetched_from_server_normal] => 0
[rows_fetched_from_server_ps] => 0
[rows_buffered_from_client_normal] => 0
[rows_buffered_from_client_ps] => 0
[rows_fetched_from_client_normal_buffered] => 0
[rows_fetched_from_client_normal_unbuffered] => 0
[rows_fetched_from_client_ps_buffered] => 0
[rows_fetched_from_client_ps_unbuffered] => 0
[rows_fetched_from_client_ps_cursor] => 0
[rows_skipped_normal] => 0
[rows_skipped_ps] => 0
[copy_on_write_saved] => 0
[copy_on_write_performed] => 0
[command_buffer_too_small] => 0
[connect_success] => 1
[connect_failure] => 0
[connection_reused] => 0
[reconnect] => 0
[pconnect_success] => 0
[active_connections] => 1
[active_persistent_connections] => 0
[explicit_close] => 0
[implicit_close] => 0
[disconnect_close] => 0
[in_middle_of_command_close] => 0
[explicit_free_result] => 0
[implicit_free_result] => 0
[explicit_stmt_close] => 0
[implicit_stmt_close] => 0
[mem_emalloc_count] => 0
[mem_emalloc_ammount] => 0
[mem_ecalloc_count] => 0
[mem_ecalloc_ammount] => 0
[mem_erealloc_count] => 0
[mem_erealloc_ammount] => 0
[mem_efree_count] => 0
[mem_malloc_count] => 0
[mem_malloc_ammount] => 0
[mem_calloc_count] => 0
[mem_calloc_ammount] => 0
[mem_realloc_count] => 0
[mem_realloc_ammount] => 0
[mem_free_count] => 0
[proto_text_fetched_null] => 0
[proto_text_fetched_bit] => 0
[proto_text_fetched_tinyint] => 0
[proto_text_fetched_short] => 0
[proto_text_fetched_int24] => 0
[proto_text_fetched_int] => 0
[proto_text_fetched_bigint] => 0
[proto_text_fetched_decimal] => 0
[proto_text_fetched_float] => 0
[proto_text_fetched_double] => 0
[proto_text_fetched_date] => 0
[proto_text_fetched_year] => 0
[proto_text_fetched_time] => 0
[proto_text_fetched_datetime] => 0
[proto_text_fetched_timestamp] => 0
[proto_text_fetched_string] => 0
[proto_text_fetched_blob] => 0
[proto_text_fetched_enum] => 0
[proto_text_fetched_set] => 0
[proto_text_fetched_geometry] => 0
[proto_text_fetched_other] => 0
[proto_binary_fetched_null] => 0
[proto_binary_fetched_bit] => 0
[proto_binary_fetched_tinyint] => 0
[proto_binary_fetched_short] => 0
[proto_binary_fetched_int24] => 0
[proto_binary_fetched_int] => 0
[proto_binary_fetched_bigint] => 0
[proto_binary_fetched_decimal] => 0
[proto_binary_fetched_float] => 0
[proto_binary_fetched_double] => 0
[proto_binary_fetched_date] => 0
[proto_binary_fetched_year] => 0
[proto_binary_fetched_time] => 0
[proto_binary_fetched_datetime] => 0
[proto_binary_fetched_timestamp] => 0
[proto_binary_fetched_string] => 0
[proto_binary_fetched_blob] => 0
[proto_binary_fetched_enum] => 0
[proto_binary_fetched_set] => 0
[proto_binary_fetched_geometry] => 0
[proto_binary_fetched_other] => 0
)
```
### See Also
* [Stats description](https://www.php.net/manual/en/mysqlnd.stats.php)
php Yaf_Request_Abstract::getLanguage Yaf\_Request\_Abstract::getLanguage
===================================
(Yaf >=1.0.0)
Yaf\_Request\_Abstract::getLanguage — Retrieve client's preferred language
### Description
```
public Yaf_Request_Abstract::getLanguage(): void
```
### Parameters
This function has no parameters.
### Return Values
Returns a string
php SimpleXMLElement::getDocNamespaces SimpleXMLElement::getDocNamespaces
==================================
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
SimpleXMLElement::getDocNamespaces — Returns namespaces declared in document
### Description
```
public SimpleXMLElement::getDocNamespaces(bool $recursive = false, bool $fromRoot = true): array|false
```
Returns namespaces declared in document
### Parameters
`recursive`
If specified, returns all namespaces declared in parent and child nodes. Otherwise, returns only namespaces declared in root node.
`fromRoot`
Allows you to recursively check namespaces under a child node instead of from the root of the XML doc.
### Return Values
The `getDocNamespaces` method returns an array of namespace names with their associated URIs.
### Examples
**Example #1 Get document namespaces**
```
<?php
$xml = <<<XML
<?xml version="1.0" standalone="yes"?>
<people xmlns:p="http://example.org/ns">
<p:person id="1">John Doe</p:person>
<p:person id="2">Susie Q. Public</p:person>
</people>
XML;
$sxe = new SimpleXMLElement($xml);
$namespaces = $sxe->getDocNamespaces();
var_dump($namespaces);
?>
```
The above example will output:
```
array(1) {
["p"]=>
string(21) "http://example.org/ns"
}
```
**Example #2 Working with multiple namespaces**
```
<?php
$xml = <<<XML
<?xml version="1.0" standalone="yes"?>
<people xmlns:p="http://example.org/ns" xmlns:t="http://example.org/test">
<p:person t:id="1">John Doe</p:person>
<p:person t:id="2" a:addr="123 Street" xmlns:a="http://example.org/addr">
Susie Q. Public
</p:person>
</people>
XML;
$sxe = new SimpleXMLElement($xml);
$namespaces = $sxe->getDocNamespaces(TRUE);
var_dump($namespaces);
?>
```
The above example will output:
```
array(3) {
["p"]=>
string(21) "http://example.org/ns"
["t"]=>
string(23) "http://example.org/test"
["a"]=>
string(23) "http://example.org/addr"
}
```
### See Also
* [SimpleXMLElement::getNamespaces()](simplexmlelement.getnamespaces) - Returns namespaces used in document
* [SimpleXMLElement::registerXPathNamespace()](simplexmlelement.registerxpathnamespace) - Creates a prefix/ns context for the next XPath query
php Ds\Map::reversed Ds\Map::reversed
================
(PECL ds >= 1.0.0)
Ds\Map::reversed — Returns a reversed copy
### Description
```
public Ds\Map::reversed(): Ds\Map
```
Returns a reversed copy of the map.
### Parameters
This function has no parameters.
### Return Values
A reversed copy of the map.
>
> **Note**:
>
>
> The current instance is not affected.
>
>
### Examples
**Example #1 **Ds\Map::reversed()** example**
```
<?php
$map = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]);
print_r($map->reversed());
?>
```
The above example will output something similar to:
```
Ds\Map Object
(
[0] => Ds\Pair Object
(
[key] => c
[value] => 3
)
[1] => Ds\Pair Object
(
[key] => b
[value] => 2
)
[2] => Ds\Pair Object
(
[key] => a
[value] => 1
)
)
```
php Yaf_Dispatcher::setDefaultModule Yaf\_Dispatcher::setDefaultModule
=================================
(Yaf >=1.0.0)
Yaf\_Dispatcher::setDefaultModule — Change default module name
### Description
```
public Yaf_Dispatcher::setDefaultModule(string $module): Yaf_Dispatcher
```
### Parameters
`module`
### Return Values
php Ds\Set::copy Ds\Set::copy
============
(PECL ds >= 1.0.0)
Ds\Set::copy — Returns a shallow copy of the set
### Description
```
public Ds\Set::copy(): Ds\Set
```
Returns a shallow copy of the set.
### Parameters
This function has no parameters.
### Return Values
Returns a shallow copy of the set.
### Examples
**Example #1 **Ds\Set::copy()** example**
```
<?php
$a = new \Ds\Set([1, 2, 3]);
$b = $a->copy();
// Updating the copy doesn't affect the original
$b->add(4);
print_r($a);
print_r($b);
?>
```
The above example will output something similar to:
```
Ds\Set Object
(
[0] => 1
[1] => 2
[2] => 3
)
Ds\Set Object
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
)
```
php hash_hmac hash\_hmac
==========
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL hash >= 1.1)
hash\_hmac — Generate a keyed hash value using the HMAC method
### Description
```
hash_hmac(
string $algo,
string $data,
string $key,
bool $binary = false
): string
```
### Parameters
`algo`
Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..) See [hash\_hmac\_algos()](function.hash-hmac-algos) for a list of supported algorithms.
`data`
Message to be hashed.
`key`
Shared secret key used for generating the HMAC variant of the message digest.
`binary`
When set to **`true`**, outputs raw binary data. **`false`** outputs lowercase hexits.
### Return Values
Returns a string containing the calculated message digest as lowercase hexits unless `binary` is set to true in which case the raw binary representation of the message digest is returned.
### Errors/Exceptions
Throws a [ValueError](class.valueerror) exception if `algo` is unknown or is a non-cryptographic hash function.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Now throws a [ValueError](class.valueerror) exception if `algo` is unknown or is a non-cryptographic hash function; previously, **`false`** was returned instead. |
| 7.2.0 | Usage of non-cryptographic hash functions (adler32, crc32, crc32b, fnv132, fnv1a32, fnv164, fnv1a64, joaat) was disabled. |
### Examples
**Example #1 **hash\_hmac()** example**
```
<?php
echo hash_hmac('ripemd160', 'The quick brown fox jumped over the lazy dog.', 'secret');
?>
```
The above example will output:
```
b8e7ae12510bdfb1812e463a7f086122cf37e4f7
```
### See Also
* [hash()](function.hash) - Generate a hash value (message digest)
* [hash\_hmac\_algos()](function.hash-hmac-algos) - Return a list of registered hashing algorithms suitable for hash\_hmac
* [hash\_init()](function.hash-init) - Initialize an incremental hashing context
* [hash\_hmac\_file()](function.hash-hmac-file) - Generate a keyed hash value using the HMAC method and the contents of a given file
php soundex soundex
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
soundex — Calculate the soundex key of a string
### Description
```
soundex(string $string): string
```
Calculates the soundex key of `string`.
Soundex keys have the property that words pronounced similarly produce the same soundex key, and can thus be used to simplify searches in databases where you know the pronunciation but not the spelling.
This particular soundex function is one described by Donald Knuth in "The Art Of Computer Programming, vol. 3: Sorting And Searching", Addison-Wesley (1973), pp. 391-392.
### Parameters
`string`
The input string.
### Return Values
Returns the soundex key as a string with four characters. If at least one letter is contained in `string`, the returned string starts with a letter. Otherwise `"0000"` is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Prior to this version, calling the function with an empty string returned **`false`** for no particular reason. |
### Examples
**Example #1 Soundex Examples**
```
<?php
soundex("Euler") == soundex("Ellery"); // E460
soundex("Gauss") == soundex("Ghosh"); // G200
soundex("Hilbert") == soundex("Heilbronn"); // H416
soundex("Knuth") == soundex("Kant"); // K530
soundex("Lloyd") == soundex("Ladd"); // L300
soundex("Lukasiewicz") == soundex("Lissajous"); // L222
?>
```
### See Also
* [levenshtein()](function.levenshtein) - Calculate Levenshtein distance between two strings
* [metaphone()](function.metaphone) - Calculate the metaphone key of a string
* [similar\_text()](function.similar-text) - Calculate the similarity between two strings
php imageellipse imageellipse
============
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
imageellipse — Draw an ellipse
### Description
```
imageellipse(
GdImage $image,
int $center_x,
int $center_y,
int $width,
int $height,
int $color
): bool
```
Draws an ellipse centered at the specified coordinates.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`center_x`
x-coordinate of the center.
`center_y`
y-coordinate of the center.
`width`
The ellipse width.
`height`
The ellipse height.
`color`
The color of the ellipse. A color identifier created with [imagecolorallocate()](function.imagecolorallocate).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 **imageellipse()** example**
```
<?php
// Create a blank image.
$image = imagecreatetruecolor(400, 300);
// Select the background color.
$bg = imagecolorallocate($image, 0, 0, 0);
// Fill the background with the color selected above.
imagefill($image, 0, 0, $bg);
// Choose a color for the ellipse.
$col_ellipse = imagecolorallocate($image, 255, 255, 255);
// Draw the ellipse.
imageellipse($image, 200, 150, 300, 200, $col_ellipse);
// Output the image.
header("Content-type: image/png");
imagepng($image);
?>
```
The above example will output something similar to:
### Notes
>
> **Note**:
>
>
> **imageellipse()** ignores [imagesetthickness()](function.imagesetthickness).
>
>
### See Also
* [imagefilledellipse()](function.imagefilledellipse) - Draw a filled ellipse
* [imagearc()](function.imagearc) - Draws an arc
php wincache_fcache_meminfo wincache\_fcache\_meminfo
=========================
(PECL wincache >= 1.0.0)
wincache\_fcache\_meminfo — Retrieves information about file cache memory usage
### Description
```
wincache_fcache_meminfo(): array|false
```
Retrieves information about memory usage by file cache.
### Parameters
This function has no parameters.
### Return Values
Array of meta data about file cache memory usage or **`false`** on failure
The array returned by this function contains the following elements:
* `memory_total` - amount of memory in bytes allocated for the file cache
* `memory_free` - amount of free memory in bytes available for the file cache
* `num_used_blks` - number of memory blocks used by the file cache
* `num_free_blks` - number of free memory blocks available for the file cache
* `memory_overhead` - amount of memory in bytes used for the file cache internal structures
### Examples
**Example #1 A **wincache\_fcache\_meminfo()** example**
```
<pre>
<?php
print_r(wincache_fcache_meminfo());
?>
</pre>
```
The above example will output:
```
Array
(
[memory_total] => 134217728
[memory_free] => 131339120
[num_used_blks] => 361
[num_free_blks] => 3
[memory_overhead] => 5856
)
```
### See Also
* [wincache\_fcache\_fileinfo()](function.wincache-fcache-fileinfo) - Retrieves information about files cached in the file cache
* [wincache\_ocache\_fileinfo()](function.wincache-ocache-fileinfo) - Retrieves information about files cached in the opcode cache
* [wincache\_ocache\_meminfo()](function.wincache-ocache-meminfo) - Retrieves information about opcode cache memory usage
* [wincache\_rplist\_fileinfo()](function.wincache-rplist-fileinfo) - Retrieves information about resolve file path cache
* [wincache\_rplist\_meminfo()](function.wincache-rplist-meminfo) - Retrieves information about memory usage by the resolve file path cache
* [wincache\_refresh\_if\_changed()](function.wincache-refresh-if-changed) - Refreshes the cache entries for the cached files
* [wincache\_ucache\_meminfo()](function.wincache-ucache-meminfo) - Retrieves information about user cache memory usage
* [wincache\_ucache\_info()](function.wincache-ucache-info) - Retrieves information about data stored in the user cache
* [wincache\_scache\_info()](function.wincache-scache-info) - Retrieves information about files cached in the session cache
* [wincache\_scache\_meminfo()](function.wincache-scache-meminfo) - Retrieves information about session cache memory usage
php iptcembed iptcembed
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
iptcembed — Embeds binary IPTC data into a JPEG image
### Description
```
iptcembed(string $iptc_data, string $filename, int $spool = 0): string|bool
```
Embeds binary IPTC data into a JPEG image.
### Parameters
`iptc_data`
The data to be written.
`filename`
Path to the JPEG image.
`spool`
Spool flag. If the spool flag is less than 2 then the JPEG will be returned as a string. Otherwise the JPEG will be printed to STDOUT.
### Return Values
If `spool` is less than 2, the JPEG will be returned, or **`false`** on failure. Otherwise returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Embedding IPTC data into a JPEG**
```
<?php
// iptc_make_tag() function by Thies C. Arntzen
function iptc_make_tag($rec, $data, $value)
{
$length = strlen($value);
$retval = chr(0x1C) . chr($rec) . chr($data);
if($length < 0x8000)
{
$retval .= chr($length >> 8) . chr($length & 0xFF);
}
else
{
$retval .= chr(0x80) .
chr(0x04) .
chr(($length >> 24) & 0xFF) .
chr(($length >> 16) & 0xFF) .
chr(($length >> 8) & 0xFF) .
chr($length & 0xFF);
}
return $retval . $value;
}
// Path to jpeg file
$path = './phplogo.jpg';
// Set the IPTC tags
$iptc = array(
'2#120' => 'Test image',
'2#116' => 'Copyright 2008-2009, The PHP Group'
);
// Convert the IPTC tags into binary code
$data = '';
foreach($iptc as $tag => $string)
{
$tag = substr($tag, 2);
$data .= iptc_make_tag(2, $tag, $string);
}
// Embed the IPTC data
$content = iptcembed($data, $path);
// Write the new image data out to the file.
$fp = fopen($path, "wb");
fwrite($fp, $content);
fclose($fp);
?>
```
### Notes
>
> **Note**:
>
>
> This function does not require the GD image library.
>
>
>
| programming_docs |
php Gmagick::setimageiterations Gmagick::setimageiterations
===========================
(PECL gmagick >= Unknown)
Gmagick::setimageiterations — Sets the image iterations
### Description
```
public Gmagick::setimageiterations(int $iterations): Gmagick
```
Sets the image iterations.
### Parameters
`iterations`
The image delay in 1/100th of a second.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php XMLWriter::text XMLWriter::text
===============
xmlwriter\_text
===============
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::text -- xmlwriter\_text — Write text
### Description
Object-oriented style
```
public XMLWriter::text(string $content): bool
```
Procedural style
```
xmlwriter_text(XMLWriter $writer, string $content): bool
```
Writes a text.
### Parameters
`writer`
Only for procedural calls. The [XMLWriter](class.xmlwriter) instance that is being modified. This object is returned from a call to [xmlwriter\_open\_uri()](xmlwriter.openuri) or [xmlwriter\_open\_memory()](xmlwriter.openmemory).
`content`
The contents of the text. The characters `<`, `>`, `&` and `"` are written as entity references (i.e. `<`, `>`, `&` and `"`, respectively). All other characters including `'` are written literally. To write the special XML characters literally, or to write literal entity references, [xmlwriter\_write\_raw()](xmlwriter.writeraw) has to be used.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `writer` expects an [XMLWriter](class.xmlwriter) instance now; previously, a resource was expected. |
php Componere\Patch::revert Componere\Patch::revert
=======================
(Componere 2 >= 2.1.0)
Componere\Patch::revert — Reversal
### Description
```
public Componere\Patch::revert(): void
```
Shall revert the current patch
php Parle\Lexer::getToken Parle\Lexer::getToken
=====================
(PECL parle >= 0.5.1)
Parle\Lexer::getToken — Retrieve the current token
### Description
```
public Parle\Lexer::getToken(): Parle\Token
```
Retrieve the current token.
### Parameters
This function has no parameters.
### Return Values
Returns an instance of [Parle\Token](class.parle-token).
php GearmanClient::setOptions GearmanClient::setOptions
=========================
(PECL gearman >= 0.5.0)
GearmanClient::setOptions — Set client options
### Description
```
public GearmanClient::setOptions(int $options): bool
```
Sets one or more client options.
### Parameters
`options`
The options to be set
### Return Values
Always returns **`true`**.
php ssh2_publickey_init ssh2\_publickey\_init
=====================
(PECL ssh2 >= 0.10)
ssh2\_publickey\_init — Initialize Publickey subsystem
### Description
```
ssh2_publickey_init(resource $session): resource|false
```
Request the Publickey subsystem from an already connected SSH2 server.
The publickey subsystem allows an already connected and authenticated client to manage the list of authorized public keys stored on the target server in an implementation agnostic manner. If the remote server does not support the publickey subsystem, the **ssh2\_publickey\_init()** function will return **`false`**.
### Parameters
`session`
### Return Values
Returns an `SSH2 Publickey Subsystem` resource for use with all other ssh2\_publickey\_\*() methods or **`false`** on failure.
### Notes
> **Note**: The public key subsystem is used for managing public keys on a server to which the client is *already* authenticated. To authenticate to a remote system using public key authentication, use the [ssh2\_auth\_pubkey\_file()](function.ssh2-auth-pubkey-file) function instead.
>
>
### See Also
* [ssh2\_publickey\_add()](function.ssh2-publickey-add) - Add an authorized publickey
* [ssh2\_publickey\_remove()](function.ssh2-publickey-remove) - Remove an authorized publickey
* [ssh2\_publickey\_list()](function.ssh2-publickey-list) - List currently authorized publickeys
php DateTimeZone::getName DateTimeZone::getName
=====================
timezone\_name\_get
===================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
DateTimeZone::getName -- timezone\_name\_get — Returns the name of the timezone
### Description
Object-oriented style
```
public DateTimeZone::getName(): string
```
Procedural style
```
timezone_name_get(DateTimeZone $object): string
```
Returns the name of the timezone.
### Parameters
`object`
The [DateTimeZone](class.datetimezone) for which to get a name.
### Return Values
Depending on zone type, UTC offset (type 1), timezone abbreviation (type 2), and timezone identifiers as published in the IANA timezone database (type 3), the descriptor string to create a new [DateTimeZone](class.datetimezone) object with the same offset and/or rules. For example `02:00`, `CEST`, or one of the timezone names in the [list of timezones](https://www.php.net/manual/en/timezones.php).
php EvChild::__construct EvChild::\_\_construct
======================
(PECL ev >= 0.2.0)
EvChild::\_\_construct — Constructs the EvChild watcher object
### Description
public **EvChild::\_\_construct**(
int `$pid` ,
bool `$trace` ,
[callable](language.types.callable) `$callback` ,
[mixed](language.types.declarations#language.types.declarations.mixed) `$data` = **`null`** ,
int `$priority` = 0
) Constructs the [EvChild](class.evchild) watcher object.
Call the callback when a status change for process ID `pid` (or any *PID* if `pid` is **`0`** ) has been received(a status change happens when the process terminates or is killed, or, when `trace` is **`true`**, additionally when it is stopped or continued). In other words, when the process receives a **`SIGCHLD`** , *Ev* will fetch the outstanding exit/wait status for all changed/zombie children and call the callback.
It is valid to install a child watcher after an [EvChild](class.evchild) has exited but before the event loop has started its next iteration. For example, first one calls `fork` , then the new child process might exit, and only then an [EvChild](class.evchild) watcher is installed in the parent for the new *PID* .
You can access both exit/tracing status and `pid` by using the rstatus and rpid properties of the watcher object.
The number of *PID* watchers per *PID* is unlimited. All of them will be called.
The [EvChild::createStopped()](evchild.createstopped) method doesn't start(activate) the newly created watcher.
### Parameters
`pid` Wait for status changes of process PID(or any process if PID is specified as **`0`** ).
`trace` If **`false`**, only activate the watcher when the process terminates. Otherwise(**`true`**) additionally activate the watcher when the process is stopped or continued.
`callback` See [Watcher callbacks](https://www.php.net/manual/en/ev.watcher-callbacks.php) .
`data` Custom data associated with the watcher.
`priority` [Watcher priority](class.ev#ev.constants.watcher-pri)
### See Also
* [EvLoop::child()](evloop.child) - Creates EvChild object associated with the current event loop
php Phar::compressFiles Phar::compressFiles
===================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
Phar::compressFiles — Compresses all files in the current Phar archive
### Description
```
public Phar::compressFiles(int $compression): void
```
>
> **Note**:
>
>
> This method requires the php.ini setting `phar.readonly` to be set to `0` in order to work for [Phar](class.phar) objects. Otherwise, a [PharException](class.pharexception) will be thrown.
>
>
>
For tar-based phar archives, this method throws a [BadMethodCallException](class.badmethodcallexception), as compression of individual files within a tar archive is not supported by the file format. Use [Phar::compress()](phar.compress) to compress an entire tar-based phar archive.
For Zip-based and phar-based phar archives, this method compresses all files in the Phar archive using the specified compression. The [zlib](https://www.php.net/manual/en/ref.zlib.php) or [bzip2](https://www.php.net/manual/en/ref.bzip2.php) extensions must be enabled to take advantage of this feature. In addition, if any files are already compressed using bzip2/zlib compression, the respective extension must be enabled in order to decompress the files prior to re-compressing. As with all functionality that modifies the contents of a phar, the [phar.readonly](https://www.php.net/manual/en/phar.configuration.php#ini.phar.readonly) INI variable must be off in order to succeed.
### Parameters
`compression`
Compression must be one of `Phar::GZ`, `Phar::BZ2` to add compression, or `Phar::NONE` to remove compression.
### Return Values
No value is returned.
### Errors/Exceptions
Throws [BadMethodCallException](class.badmethodcallexception) if the [phar.readonly](https://www.php.net/manual/en/phar.configuration.php#ini.phar.readonly) INI variable is on, the [zlib](https://www.php.net/manual/en/ref.zlib.php) extension is not available, or if any files are compressed using bzip2 compression and the [bzip2](https://www.php.net/manual/en/ref.bzip2.php) extension is not enabled.
### Examples
**Example #1 A **Phar::compressFiles()** example**
```
<?php
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
$p['myfile.txt'] = 'hi';
$p['myfile2.txt'] = 'hi';
foreach ($p as $file) {
var_dump($file->getFileName());
var_dump($file->isCompressed());
var_dump($file->isCompressed(Phar::BZ2));
var_dump($file->isCompressed(Phar::GZ));
}
$p->compressFiles(Phar::GZ);
foreach ($p as $file) {
var_dump($file->getFileName());
var_dump($file->isCompressed());
var_dump($file->isCompressed(Phar::BZ2));
var_dump($file->isCompressed(Phar::GZ));
}
?>
```
The above example will output:
```
string(10) "myfile.txt"
bool(false)
bool(false)
bool(false)
string(11) "myfile2.txt"
bool(false)
bool(false)
bool(false)
string(10) "myfile.txt"
int(4096)
bool(false)
bool(true)
string(11) "myfile2.txt"
int(4096)
bool(false)
bool(true)
```
### See Also
* [PharFileInfo::getCompressedSize()](pharfileinfo.getcompressedsize) - Returns the actual size of the file (with compression) inside the Phar archive
* [PharFileInfo::isCompressed()](pharfileinfo.iscompressed) - Returns whether the entry is compressed
* [PharFileInfo::compress()](pharfileinfo.compress) - Compresses the current Phar entry with either zlib or bzip2 compression
* [PharFileInfo::decompress()](pharfileinfo.decompress) - Decompresses the current Phar entry within the phar
* [Phar::canCompress()](phar.cancompress) - Returns whether phar extension supports compression using either zlib or bzip2
* [Phar::isCompressed()](phar.iscompressed) - Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)
* [Phar::decompressFiles()](phar.decompressfiles) - Decompresses all files in the current Phar archive
* [Phar::getSupportedCompression()](phar.getsupportedcompression) - Return array of supported compression algorithms
* [Phar::compress()](phar.compress) - Compresses the entire Phar archive using Gzip or Bzip2 compression
* [Phar::decompress()](phar.decompress) - Decompresses the entire Phar archive
php proc_get_status proc\_get\_status
=================
(PHP 5, PHP 7, PHP 8)
proc\_get\_status — Get information about a process opened by [proc\_open()](function.proc-open)
### Description
```
proc_get_status(resource $process): array
```
**proc\_get\_status()** fetches data about a process opened using [proc\_open()](function.proc-open).
### Parameters
`process`
The [proc\_open()](function.proc-open) resource that will be evaluated.
### Return Values
An array of collected information. The returned array contains the following elements:
| element | type | description |
| --- | --- | --- |
| command | string | The command string that was passed to [proc\_open()](function.proc-open). |
| pid | int | process id |
| running | bool | **`true`** if the process is still running, **`false`** if it has terminated. |
| signaled | bool | **`true`** if the child process has been terminated by an uncaught signal. Always set to **`false`** on Windows. |
| stopped | bool | **`true`** if the child process has been stopped by a signal. Always set to **`false`** on Windows. |
| exitcode | int | The exit code returned by the process (which is only meaningful if `running` is **`false`**). Only first call of this function return real value, next calls return `-1`. |
| termsig | int | The number of the signal that caused the child process to terminate its execution (only meaningful if `signaled` is **`true`**). |
| stopsig | int | The number of the signal that caused the child process to stop its execution (only meaningful if `stopped` is **`true`**). |
### See Also
* [proc\_open()](function.proc-open) - Execute a command and open file pointers for input/output
php Imagick::sampleImage Imagick::sampleImage
====================
(PECL imagick 2, PECL imagick 3)
Imagick::sampleImage — Scales an image with pixel sampling
### Description
```
public Imagick::sampleImage(int $columns, int $rows): bool
```
Scales an image to the desired dimensions with pixel sampling. Unlike other scaling methods, this method does not introduce any additional color into the scaled image.
### Parameters
`columns`
`rows`
### Return Values
Returns **`true`** on success.
php openssl_free_key openssl\_free\_key
==================
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
openssl\_free\_key — Free key resource
**Warning**This function has been *DEPRECATED* as of PHP 8.0.0. Relying on this function is highly discouraged.
### Description
```
openssl_free_key(OpenSSLAsymmetricKey $key): void
```
**openssl\_free\_key()** frees the key associated with the specified `key` from memory.
### Parameters
`key`
### Return Values
No value is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function is now deprecated as it doesn't have an effect anymore. |
| 8.0.0 | `key` accepts an [OpenSSLAsymmetricKey](class.opensslasymmetrickey) now; previously, a [resource](language.types.resource) of type `OpenSSL key` was accepted. |
php DOMNode::lookupPrefix DOMNode::lookupPrefix
=====================
(PHP 5, PHP 7, PHP 8)
DOMNode::lookupPrefix — Gets the namespace prefix of the node based on the namespace URI
### Description
```
public DOMNode::lookupPrefix(string $namespace): ?string
```
Gets the namespace prefix of the node based on the namespace URI.
### Parameters
`namespace`
The namespace URI.
### Return Values
The prefix of the namespace.
### See Also
* [DOMNode::lookupNamespaceUri()](domnode.lookupnamespaceuri) - Gets the namespace URI of the node based on the prefix
php dio_fcntl dio\_fcntl
==========
(PHP 4 >= 4.2.0, PHP 5 < 5.1.0)
dio\_fcntl — Performs a c library fcntl on fd
### Description
```
dio_fcntl(resource $fd, int $cmd, mixed $args = ?): mixed
```
The **dio\_fcntl()** function performs the operation specified by `cmd` on the file descriptor `fd`. Some commands require additional arguments `args` to be supplied.
### Parameters
`fd`
The file descriptor returned by [dio\_open()](function.dio-open).
`cmd`
Can be one of the following operations:
* **`F_SETLK`** - Lock is set or cleared. If the lock is held by someone else **dio\_fcntl()** returns -1.
* **`F_SETLKW`** - like **`F_SETLK`**, but in case the lock is held by someone else, **dio\_fcntl()** waits until the lock is released.
* **`F_GETLK`** - **dio\_fcntl()** returns an associative array (as described below) if someone else prevents lock. If there is no obstruction key "type" will set to **`F_UNLCK`**.
* **`F_DUPFD`** - finds the lowest numbered available file descriptor greater than or equal to `args` and returns them.
* **`F_SETFL`** - Sets the file descriptors flags to the value specified by `args`, which can be **`O_APPEND`**, **`O_NONBLOCK`** or **`O_ASYNC`**. To use **`O_ASYNC`** you will need to use the [PCNTL](https://www.php.net/manual/en/ref.pcntl.php) extension.
`args`
`args` is an associative array, when `cmd` is **`F_SETLK`** or **`F_SETLLW`**, with the following keys:
* `start` - offset where lock begins
* `length` - size of locked area. zero means to end of file
* `whence` - Where l\_start is relative to: can be **`SEEK_SET`**, **`SEEK_END`** and **`SEEK_CUR`**
* `type` - type of lock: can be **`F_RDLCK`** (read lock), **`F_WRLCK`** (write lock) or **`F_UNLCK`** (unlock)
### Return Values
Returns the result of the C call.
### Examples
**Example #1 Setting and clearing a lock**
```
<?php
$fd = dio_open('/dev/ttyS0', O_RDWR);
if (dio_fcntl($fd, F_SETLK, Array("type"=>F_WRLCK)) == -1) {
// the file descriptor appears locked
echo "The lock can not be cleared. It is held by someone else.";
} else {
echo "Lock successfully set/cleared";
}
dio_close($fd);
?>
```
### Notes
> **Note**: This function is not implemented on Windows platforms.
>
>
php openssl_pbkdf2 openssl\_pbkdf2
===============
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
openssl\_pbkdf2 — Generates a PKCS5 v2 PBKDF2 string
### Description
```
openssl_pbkdf2(
string $password,
string $salt,
int $key_length,
int $iterations,
string $digest_algo = "sha1"
): string|false
```
**openssl\_pbkdf2()** computes PBKDF2 (Password-Based Key Derivation Function 2), a key derivation function defined in PKCS5 v2.
### Parameters
`password`
Password from which the derived key is generated.
`salt`
PBKDF2 recommends a crytographic salt of at least 64 bits (8 bytes).
`key_length`
Length of desired output key.
`iterations`
The number of iterations desired. [» NIST recommends at least 10,000](https://pages.nist.gov/800-63-3/sp800-63b.html#sec5).
`digest_algo`
Optional hash or digest algorithm from [openssl\_get\_md\_methods()](function.openssl-get-md-methods). Defaults to SHA-1.
### Return Values
Returns raw binary string or **`false`** on failure.
### Examples
**Example #1 openssl\_pbkdf2() example**
```
<?php
$password = 'yOuR-pAs5w0rd-hERe';
$salt = openssl_random_pseudo_bytes(12);
$keyLength = 40;
$iterations = 10000;
$generated_key = openssl_pbkdf2($password, $salt, $keyLength, $iterations, 'sha256');
echo bin2hex($generated_key)."\n";
echo base64_encode($generated_key)."\n";
?>
```
### See Also
* [hash\_pbkdf2()](function.hash-pbkdf2) - Generate a PBKDF2 key derivation of a supplied password
* [openssl\_get\_md\_methods()](function.openssl-get-md-methods) - Gets available digest methods
php SyncSharedMemory::read SyncSharedMemory::read
======================
(PECL sync >= 1.1.0)
SyncSharedMemory::read — Copy data from named shared memory
### Description
```
public SyncSharedMemory::read(int $start = 0, int $length = ?)
```
Copies data from named shared memory.
### Parameters
`start`
The start/offset, in bytes, to begin reading.
>
> **Note**:
>
>
> If the value is negative, the starting position will begin at the specified number of bytes from the end of the shared memory segment.
>
>
`length`
The number of bytes to read.
>
> **Note**:
>
>
> If unspecified, reading will stop at the end of the shared memory segment.
>
> If the value is negative, reading will stop the specified number of bytes from the end of the shared memory segment.
>
>
### Return Values
A string containing the data read from shared memory.
### Examples
**Example #1 [SyncSharedMemory::\_\_construct()](syncsharedmemory.construct) example**
```
<?php
// You will probably need to protect shared memory with other synchronization objects.
// Shared memory goes away when the last reference to it disappears.
$mem = new SyncSharedMemory("AppReportName", 1024);
if ($mem->first())
{
// Do first time initialization work here.
}
$result = $mem->write("report.txt");
$result = $mem->read(3, -4);
var_dump($result);
?>
```
The above example will output something similar to:
```
string(3) "ort"
```
### See Also
* [SyncSharedMemory::\_\_construct()](syncsharedmemory.construct) - Constructs a new SyncSharedMemory object
* [SyncSharedMemory::first()](syncsharedmemory.first) - Check to see if the object is the first instance system-wide of named shared memory
* [SyncSharedMemory::write()](syncsharedmemory.write) - Copy data to named shared memory
* **SyncSharedMemory::read()**
| programming_docs |
php pg_last_oid pg\_last\_oid
=============
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg\_last\_oid — Returns the last row's OID
### Description
```
pg_last_oid(PgSql\Result $result): string|int|false
```
**pg\_last\_oid()** is used to retrieve the OID assigned to an inserted row.
OID field became an optional field from PostgreSQL 7.2 and will not be present by default in PostgreSQL 8.1. When the OID field is not present in a table, the programmer must use [pg\_result\_status()](function.pg-result-status) to check for successful insertion.
To get the value of a `SERIAL` field in an inserted row, it is necessary to use the PostgreSQL `CURRVAL` function, naming the sequence whose last value is required. If the name of the sequence is unknown, the `pg_get_serial_sequence` PostgreSQL 8.0 function is necessary.
PostgreSQL 8.1 has a function `LASTVAL` that returns the value of the most recently used sequence in the session. This avoids the need for naming the sequence, table or column altogether.
>
> **Note**:
>
>
> This function used to be called **pg\_getlastoid()**.
>
>
### Parameters
`result`
An [PgSql\Result](class.pgsql-result) instance, returned by [pg\_query()](function.pg-query), [pg\_query\_params()](function.pg-query-params) or [pg\_execute()](function.pg-execute)(among others).
### Return Values
An int or string containing the OID assigned to the most recently inserted row in the specified `connection`, or **`false`** on error or no available OID.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `result` parameter expects an [PgSql\Result](class.pgsql-result) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **pg\_last\_oid()** example**
```
<?php
// Connect to the database
pg_connect("dbname=mark host=localhost");
// Create a sample table
pg_query("CREATE TABLE test (a INTEGER) WITH OIDS");
// Insert some data into it
$res = pg_query("INSERT INTO test VALUES (1)");
$oid = pg_last_oid($res);
?>
```
### See Also
* [pg\_query()](function.pg-query) - Execute a query
* [pg\_result\_status()](function.pg-result-status) - Get status of query result
php Imagick::setGravity Imagick::setGravity
===================
(PECL imagick 2 >= 2.2.0, PECL imagick 3)
Imagick::setGravity — Sets the gravity
### Description
```
public Imagick::setGravity(int $gravity): bool
```
Sets the global gravity property for the Imagick object. This method is available if Imagick has been compiled against ImageMagick version 6.4.0 or newer.
### Parameters
`gravity`
The gravity property. Refer to the list of [gravity constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.gravity).
### Return Values
No value is returned.
php sodium_crypto_core_ristretto255_sub sodium\_crypto\_core\_ristretto255\_sub
=======================================
(PHP 8 >= 8.1.0)
sodium\_crypto\_core\_ristretto255\_sub — Subtracts an element
### Description
```
sodium_crypto_core_ristretto255_sub(string $p, string $q): string
```
Subtracts an element `q` from `p`. Available as of libsodium 1.0.18.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`p`
An element.
`q`
An element.
### Return Values
Returns a 32-byte random string.
### Examples
**Example #1 **sodium\_crypto\_core\_ristretto255\_sub()** example**
```
<?php
$foo = sodium_crypto_core_ristretto255_random();
$bar = sodium_crypto_core_ristretto255_random();
$value = sodium_crypto_core_ristretto255_add($foo, $bar);
$value = sodium_crypto_core_ristretto255_sub($value, $bar);
var_dump(hash_equals($foo, $value));
?>
```
The above example will output:
```
bool(true)
```
### See Also
* [sodium\_crypto\_core\_ristretto255\_random()](function.sodium-crypto-core-ristretto255-random) - Generates a random key
* [sodium\_crypto\_core\_ristretto255\_add()](function.sodium-crypto-core-ristretto255-add) - Adds an element
php SolrQuery::setMltMinDocFrequency SolrQuery::setMltMinDocFrequency
================================
(PECL solr >= 0.9.2)
SolrQuery::setMltMinDocFrequency — Sets the mltMinDoc frequency
### Description
```
public SolrQuery::setMltMinDocFrequency(int $minDocFrequency): SolrQuery
```
The frequency at which words will be ignored which do not occur in at least this many docs.
### Parameters
`minDocFrequency`
Sets the frequency at which words will be ignored which do not occur in at least this many docs.
### Return Values
Returns the current SolrQuery object, if the return value is used.
php V8JsException::getJsFileName V8JsException::getJsFileName
============================
(PECL v8js >= 0.1.0)
V8JsException::getJsFileName — The getJsFileName purpose
### Description
```
final public V8JsException::getJsFileName(): string
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php Gmagick::annotateimage Gmagick::annotateimage
======================
(PECL gmagick >= Unknown)
Gmagick::annotateimage — Annotates an image with text
### Description
```
public Gmagick::annotateimage(
GmagickDraw $GmagickDraw,
float $x,
float $y,
float $angle,
string $text
): Gmagick
```
Annotates an image with text.
### Parameters
`GmagickDraw`
The [GmagickDraw](class.gmagickdraw) object that contains settings for drawing the text.
`x`
Horizontal offset in pixels to the left of text.
`y`
Vertical offset in pixels to the baseline of text.
`angle`
The angle at which to write the text.
`text`
The string to draw.
### Return Values
The [Gmagick](class.gmagick) object with annotation made.
### Errors/Exceptions
Throws an **GmagickException** on error.
php GearmanClient::doStatus GearmanClient::doStatus
=======================
(PECL gearman >= 0.5.0)
GearmanClient::doStatus — Get the status for the running task
### Description
```
public GearmanClient::doStatus(): array
```
Returns the status for the running task. This should be used between repeated [GearmanClient::doNormal()](gearmanclient.donormal) calls.
### Parameters
This function has no parameters.
### Return Values
An array representing the percentage completion given as a fraction, with the first element the numerator and the second element the denomintor.
### Examples
**Example #1 Get the status of a long running job**
The worker in this example has an artificial delay added during processing of the string to be reversed. After each delay it calls [GearmanJob::status()](gearmanjob.status) which the client then picks up.
```
<?php
echo "Starting\n";
# Create our client object.
$gmclient= new GearmanClient();
# Add default server (localhost).
$gmclient->addServer();
echo "Sending job\n";
# Send reverse job
do
{
$result = $gmclient->doNormal("reverse", "Hello!");
# Check for various return packets and errors.
switch($gmclient->returnCode())
{
case GEARMAN_WORK_DATA:
break;
case GEARMAN_WORK_STATUS:
# get the current job status
list($numerator, $denominator)= $gmclient->doStatus();
echo "Status: $numerator/$denominator complete\n";
break;
case GEARMAN_WORK_FAIL:
echo "Failed\n";
exit;
case GEARMAN_SUCCESS:
break;
default:
echo "RET: " . $gmclient->returnCode() . "\n";
exit;
}
}
while($gmclient->returnCode() != GEARMAN_SUCCESS);
echo "Success: $result\n";
?>
```
The above example will output something similar to:
```
Starting
Sending job
Status: 1/6 complete
Status: 2/6 complete
Status: 3/6 complete
Status: 4/6 complete
Status: 5/6 complete
Status: 6/6 complete
Success: !olleH
```
### See Also
* [GearmanClient::doNormal()](gearmanclient.donormal) - Run a single task and return a result
* [GearmanJob::status()](gearmanjob.status) - Send status (deprecated)
php __autoload \_\_autoload
============
(PHP 5, PHP 7)
\_\_autoload — Attempt to load undefined class
**Warning**This function has been *DEPRECATED* as of PHP 7.2.0, and *REMOVED* as of PHP 8.0.0. Relying on this function is highly discouraged.
### Description
```
__autoload(string $class): void
```
You can define this function to enable [classes autoloading](language.oop5.autoload).
### Parameters
`class`
Name of the class to load
### Return Values
No value is returned.
### See Also
* [spl\_autoload\_register()](function.spl-autoload-register) - Register given function as \_\_autoload() implementation
php QuickHashIntSet::getSize QuickHashIntSet::getSize
========================
(PECL quickhash >= Unknown)
QuickHashIntSet::getSize — Returns the number of elements in the set
### Description
```
publicQuickHashIntSet::getSize(): int
```
Returns the number of elements in the set.
### Parameters
This function has no parameters.
### Return Values
The number of elements in the set.
### Examples
**Example #1 **QuickHashIntSet::getSize()** example**
```
<?php
$set = new QuickHashIntSet( 8 );
var_dump( $set->add( 2 ) );
var_dump( $set->add( 3 ) );
var_dump( $set->getSize() );
?>
```
The above example will output something similar to:
```
bool(true)
bool(true)
int(2)
```
php closedir closedir
========
(PHP 4, PHP 5, PHP 7, PHP 8)
closedir — Close directory handle
### Description
```
closedir(?resource $dir_handle = null): void
```
Closes the directory stream indicated by `dir_handle`. The stream must have previously been opened by [opendir()](function.opendir).
### Parameters
`dir_handle`
The directory handle resource previously opened with [opendir()](function.opendir). If the directory handle is not specified, the last link opened by [opendir()](function.opendir) is assumed.
### Return Values
No value is returned.
### Examples
**Example #1 **closedir()** example**
```
<?php
$dir = "/etc/php5/";
// Open a known directory, read directory into variable and then close
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
$directory = readdir($dh);
closedir($dh);
}
}
?>
```
php Ds\Map::values Ds\Map::values
==============
(PECL ds >= 1.0.0)
Ds\Map::values — Returns a sequence of the map's values
### Description
```
public Ds\Map::values(): Ds\Sequence
```
Returns a sequence containing all the values of the map, in the same order.
### Parameters
This function has no parameters.
### Return Values
A **Ds\Sequence** containing all the values of the map.
### Examples
**Example #1 **Ds\Map::values()** example**
```
<?php
$map = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]);
var_dump($map->values());
?>
```
The above example will output something similar to:
```
object(Ds\Vector)#2 (3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
```
php wddx_add_vars wddx\_add\_vars
===============
(PHP 4, PHP 5, PHP 7)
wddx\_add\_vars — Add variables to a WDDX packet with the specified ID
**Warning**This function was *REMOVED* in PHP 7.4.0.
### Description
```
wddx_add_vars(resource $packet_id, mixed $var_name, mixed ...$var_names): bool
```
Serializes the passed variables and add the result to the given packet.
### Parameters
This function takes a variable number of parameters.
`packet_id`
A WDDX packet, returned by [wddx\_packet\_start()](function.wddx-packet-start).
`var_name`
Can be either a string naming a variable or an array containing strings naming the variables or another array, etc.
`var_names`
### Return Values
Returns **`true`** on success or **`false`** on failure.
php SolrDisMaxQuery::setUserFields SolrDisMaxQuery::setUserFields
==============================
(No version information available, might only be in Git)
SolrDisMaxQuery::setUserFields — Sets User Fields parameter (uf)
### Description
```
public SolrDisMaxQuery::setUserFields(string $fields): SolrDisMaxQuery
```
Sets User Fields parameter (uf)
User Fields: Specifies which schema fields the end user shall be allowed to query.
### Parameters
`fields`
Fields names separated by space
This parameter supports wildcards.
### Return Values
[SolrDisMaxQuery](class.solrdismaxquery)
### Examples
**Example #1 **SolrDisMaxQuery::setUserFields()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery('lucene');
$dismaxQuery->setUserFields('field1 field2 *_txt');
echo $dismaxQuery.PHP_EOL;
?>
```
The above example will output something similar to:
```
q=lucene&defType=edismax&uf=field1 field2 *_txt
```
### See Also
* [SolrDisMaxQuery::addUserField()](solrdismaxquery.adduserfield) - Adds a field to User Fields Parameter (uf)
* [SolrDisMaxQuery::removeUserField()](solrdismaxquery.removeuserfield) - Removes a field from The User Fields Parameter (uf)
php Yaf_Config_Simple::key Yaf\_Config\_Simple::key
========================
(Yaf >=1.0.0)
Yaf\_Config\_Simple::key — The key purpose
### Description
```
public Yaf_Config_Simple::key(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php Ds\PriorityQueue::count Ds\PriorityQueue::count
=======================
(PECL ds >= 1.0.0)
Ds\PriorityQueue::count — Returns the number of values in the queue
See [Countable::count()](countable.count)
php Ds\Vector::apply Ds\Vector::apply
================
(PECL ds >= 1.0.0)
Ds\Vector::apply — Updates all values by applying a callback function to each value
### Description
```
public Ds\Vector::apply(callable $callback): void
```
Updates all values by applying a `callback` function to each value in the vector.
### Parameters
`callback`
```
callback(mixed $value): mixed
```
A [callable](language.types.callable) to apply to each value in the vector.
The callback should return what the value should be replaced by.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Vector::apply()** example**
```
<?php
$vector = new \Ds\Vector([1, 2, 3]);
$vector->apply(function($value) { return $value * 2; });
print_r($vector);
?>
```
The above example will output something similar to:
```
Ds\Vector Object
(
[0] => 2
[1] => 4
[2] => 6
)
```
php Memcached::flush Memcached::flush
================
(PECL memcached >= 0.1.0)
Memcached::flush — Invalidate all items in the cache
### Description
```
public Memcached::flush(int $delay = 0): bool
```
**Memcached::flush()** invalidates all existing cache items immediately (by default) or after the `delay` specified. After invalidation none of the items will be returned in response to a retrieval command (unless it's stored again under the same key after **Memcached::flush()** has invalidated the items). The flush does not actually free all the memory taken up by the existing items; that will happen gradually as new items are stored.
### Parameters
`delay`
Number of seconds to wait before invalidating the items.
### Return Values
Returns **`true`** on success or **`false`** on failure. Use [Memcached::getResultCode()](memcached.getresultcode) if necessary.
### Examples
**Example #1 **Memcached::flush()** example**
```
<?php
$m = new Memcached();
$m->addServer('localhost', 11211);
/* flush all items in 10 seconds */
$m->flush(10);
?>
```
php SolrInputDocument::getFieldNames SolrInputDocument::getFieldNames
================================
(PECL solr >= 0.9.2)
SolrInputDocument::getFieldNames — Returns an array containing all the fields in the document
### Description
```
public SolrInputDocument::getFieldNames(): array
```
Returns an array containing all the fields in the document.
### Parameters
This function has no parameters.
### Return Values
Returns an array on success and **`false`** on failure.
php ldap_unbind ldap\_unbind
============
(PHP 4, PHP 5, PHP 7, PHP 8)
ldap\_unbind — Unbind from LDAP directory
### Description
```
ldap_unbind(LDAP\Connection $ldap): bool
```
Unbinds from the LDAP directory.
### Parameters
`ldap`
An [LDAP\Connection](class.ldap-connection) instance, returned by [ldap\_connect()](function.ldap-connect).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `ldap` parameter expects an [LDAP\Connection](class.ldap-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### See Also
* [ldap\_bind()](function.ldap-bind) - Bind to LDAP directory
php IntlChar::isgraph IntlChar::isgraph
=================
(PHP 7, PHP 8)
IntlChar::isgraph — Check if code point is a graphic character
### Description
```
public static IntlChar::isgraph(int|string $codepoint): ?bool
```
Determines whether the specified code point is a "graphic" character (printable, excluding spaces).
**`true`** for all characters except those with general categories "Cc" (control codes), "Cf" (format controls), "Cs" (surrogates), "Cn" (unassigned), and "Z" (separators).
### Parameters
`codepoint`
The int codepoint value (e.g. `0x2603` for *U+2603 SNOWMAN*), or the character encoded as a UTF-8 string (e.g. `"\u{2603}"`)
### Return Values
Returns **`true`** if `codepoint` is a "graphic" character, **`false`** if not. Returns **`null`** on failure.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::isgraph("A"));
var_dump(IntlChar::isgraph("1"));
var_dump(IntlChar::isgraph("\u{2603}"));
var_dump(IntlChar::isgraph("\n"));
?>
```
The above example will output:
```
bool(true)
bool(true)
bool(true)
bool(false)
```
php The SplTempFileObject class
The SplTempFileObject class
===========================
Introduction
------------
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
The SplTempFileObject class offers an object-oriented interface for a temporary file.
Class synopsis
--------------
class **SplTempFileObject** extends [SplFileObject](class.splfileobject) { /\* Inherited constants \*/ public const int [SplFileObject::DROP\_NEW\_LINE](class.splfileobject#splfileobject.constants.drop-new-line);
public const int [SplFileObject::READ\_AHEAD](class.splfileobject#splfileobject.constants.read-ahead);
public const int [SplFileObject::SKIP\_EMPTY](class.splfileobject#splfileobject.constants.skip-empty);
public const int [SplFileObject::READ\_CSV](class.splfileobject#splfileobject.constants.read-csv); /\* Methods \*/ public [\_\_construct](spltempfileobject.construct)(int `$maxMemory` = 2 \* 1024 \* 1024) /\* Inherited methods \*/
```
public SplFileObject::current(): string|array|false
```
```
public SplFileObject::eof(): bool
```
```
public SplFileObject::fflush(): bool
```
```
public SplFileObject::fgetc(): string|false
```
```
public SplFileObject::fgetcsv(string $separator = ",", string $enclosure = "\"", string $escape = "\\"): array|false
```
```
public SplFileObject::fgets(): string
```
```
public SplFileObject::fgetss(string $allowable_tags = ?): string
```
```
public SplFileObject::flock(int $operation, int &$wouldBlock = null): bool
```
```
public SplFileObject::fpassthru(): int
```
```
public SplFileObject::fputcsv(
array $fields,
string $separator = ",",
string $enclosure = "\"",
string $escape = "\\",
string $eol = "\n"
): int|false
```
```
public SplFileObject::fread(int $length): string|false
```
```
public SplFileObject::fscanf(string $format, mixed &...$vars): array|int|null
```
```
public SplFileObject::fseek(int $offset, int $whence = SEEK_SET): int
```
```
public SplFileObject::fstat(): array
```
```
public SplFileObject::ftell(): int|false
```
```
public SplFileObject::ftruncate(int $size): bool
```
```
public SplFileObject::fwrite(string $data, int $length = 0): int|false
```
```
public SplFileObject::getChildren(): null
```
```
public SplFileObject::getCsvControl(): array
```
```
public SplFileObject::getFlags(): int
```
```
public SplFileObject::getMaxLineLen(): int
```
```
public SplFileObject::hasChildren(): false
```
```
public SplFileObject::key(): int
```
```
public SplFileObject::next(): void
```
```
public SplFileObject::rewind(): void
```
```
public SplFileObject::seek(int $line): void
```
```
public SplFileObject::setCsvControl(string $separator = ",", string $enclosure = "\"", string $escape = "\\"): void
```
```
public SplFileObject::setFlags(int $flags): void
```
```
public SplFileObject::setMaxLineLen(int $maxLength): void
```
```
public SplFileObject::valid(): bool
```
```
public SplFileInfo::getATime(): int|false
```
```
public SplFileInfo::getBasename(string $suffix = ""): string
```
```
public SplFileInfo::getCTime(): int|false
```
```
public SplFileInfo::getExtension(): string
```
```
public SplFileInfo::getFileInfo(?string $class = null): SplFileInfo
```
```
public SplFileInfo::getFilename(): string
```
```
public SplFileInfo::getGroup(): int|false
```
```
public SplFileInfo::getInode(): int|false
```
```
public SplFileInfo::getLinkTarget(): string|false
```
```
public SplFileInfo::getMTime(): int|false
```
```
public SplFileInfo::getOwner(): int|false
```
```
public SplFileInfo::getPath(): string
```
```
public SplFileInfo::getPathInfo(?string $class = null): ?SplFileInfo
```
```
public SplFileInfo::getPathname(): string
```
```
public SplFileInfo::getPerms(): int|false
```
```
public SplFileInfo::getRealPath(): string|false
```
```
public SplFileInfo::getSize(): int|false
```
```
public SplFileInfo::getType(): string|false
```
```
public SplFileInfo::isDir(): bool
```
```
public SplFileInfo::isExecutable(): bool
```
```
public SplFileInfo::isFile(): bool
```
```
public SplFileInfo::isLink(): bool
```
```
public SplFileInfo::isReadable(): bool
```
```
public SplFileInfo::isWritable(): bool
```
```
public SplFileInfo::openFile(string $mode = "r", bool $useIncludePath = false, ?resource $context = null): SplFileObject
```
```
public SplFileInfo::setFileClass(string $class = SplFileObject::class): void
```
```
public SplFileInfo::setInfoClass(string $class = SplFileInfo::class): void
```
```
public SplFileInfo::__toString(): string
```
} Table of Contents
-----------------
* [SplTempFileObject::\_\_construct](spltempfileobject.construct) — Construct a new temporary file object
| programming_docs |
php Memcached::getResultMessage Memcached::getResultMessage
===========================
(PECL memcached >= 1.0.0)
Memcached::getResultMessage — Return the message describing the result of the last operation
### Description
```
public Memcached::getResultMessage(): string
```
**Memcached::getResultMessage()** returns a string that describes the result code of the last executed Memcached method.
### Parameters
This function has no parameters.
### Return Values
Message describing the result of the last Memcached operation.
### Examples
**Example #1 **Memcached::getResultMessage()** example**
```
<?php
$m = new Memcached();
$m->addServer('localhost', 11211);
$m->add('foo', 'bar'); // first time should succeed
$m->add('foo', 'bar');
echo $m->getResultMessage(),"\n";
?>
```
The above example will output:
```
NOT STORED
```
php wincache_rplist_fileinfo wincache\_rplist\_fileinfo
==========================
(PECL wincache >= 1.0.0)
wincache\_rplist\_fileinfo — Retrieves information about resolve file path cache
### Description
```
wincache_rplist_fileinfo(bool $summaryonly = false): array|false
```
Retrieves information about cached mappings between relative file paths and corresponding absolute file paths.
### Parameters
`summaryonly`
### Return Values
Array of meta data about the resolve file path cache or **`false`** on failure
The array returned by this function contains the following elements:
* `total_file_count` - total number of file path mappings stored in the cache
* `rplist_entries` - an array that contains the information about all the cached file paths:
+ `resolve_path` - path to a file
+ `subkey_data` - corresponding absolute path to a file
### Examples
**Example #1 A **wincache\_rplist\_fileinfo()** example**
```
<pre>
<?php
print_r(wincache_rplist_fileinfo());
?>
</pre>
```
The above example will output:
```
Array
(
[total_file_count] => 5
[rplist_entries] => Array
(
[1] => Array
(
[resolve_path] => checkcache.php
[subkey_data] => c:\inetpub\wwwroot|c:\inetpub\wwwroot\checkcache.php
)
[2] => Array (...iterates for each cached file)
)
)
```
### See Also
* [wincache\_fcache\_meminfo()](function.wincache-fcache-meminfo) - Retrieves information about file cache memory usage
* [wincache\_fcache\_fileinfo()](function.wincache-fcache-fileinfo) - Retrieves information about files cached in the file cache
* [wincache\_ocache\_fileinfo()](function.wincache-ocache-fileinfo) - Retrieves information about files cached in the opcode cache
* [wincache\_ocache\_meminfo()](function.wincache-ocache-meminfo) - Retrieves information about opcode cache memory usage
* [wincache\_rplist\_meminfo()](function.wincache-rplist-meminfo) - Retrieves information about memory usage by the resolve file path cache
* [wincache\_refresh\_if\_changed()](function.wincache-refresh-if-changed) - Refreshes the cache entries for the cached files
* [wincache\_ucache\_meminfo()](function.wincache-ucache-meminfo) - Retrieves information about user cache memory usage
* [wincache\_ucache\_info()](function.wincache-ucache-info) - Retrieves information about data stored in the user cache
* [wincache\_scache\_info()](function.wincache-scache-info) - Retrieves information about files cached in the session cache
* [wincache\_scache\_meminfo()](function.wincache-scache-meminfo) - Retrieves information about session cache memory usage
php memory_get_usage memory\_get\_usage
==================
(PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8)
memory\_get\_usage — Returns the amount of memory allocated to PHP
### Description
```
memory_get_usage(bool $real_usage = false): int
```
Returns the amount of memory, in bytes, that's currently being allocated to your PHP script.
### Parameters
`real_usage`
Set this to **`true`** to get total memory allocated from system, including unused pages. If not set or **`false`** only the used memory is reported.
>
> **Note**:
>
>
> PHP does not track memory that is not allocated by `emalloc()`
>
>
### Return Values
Returns the memory amount in bytes.
### Examples
**Example #1 A **memory\_get\_usage()** example**
```
<?php
// This is only an example, the numbers below will
// differ depending on your system
echo memory_get_usage() . "\n"; // 36640
$a = str_repeat("Hello", 4242);
echo memory_get_usage() . "\n"; // 57960
unset($a);
echo memory_get_usage() . "\n"; // 36744
?>
```
### See Also
* [memory\_get\_peak\_usage()](function.memory-get-peak-usage) - Returns the peak of memory allocated by PHP
* [memory\_limit](https://www.php.net/manual/en/ini.core.php#ini.memory-limit)
php MultipleIterator::containsIterator MultipleIterator::containsIterator
==================================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
MultipleIterator::containsIterator — Checks if an iterator is attached
### Description
```
public MultipleIterator::containsIterator(Iterator $iterator): bool
```
Checks if an iterator is attached or not.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`iterator`
The iterator to check.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [MultipleIterator::valid()](multipleiterator.valid) - Checks the validity of sub iterators
php pg_fetch_row pg\_fetch\_row
==============
(PHP 4, PHP 5, PHP 7, PHP 8)
pg\_fetch\_row — Get a row as an enumerated array
### Description
```
pg_fetch_row(PgSql\Result $result, ?int $row = null, int $mode = PGSQL_NUM): array|false
```
**pg\_fetch\_row()** fetches one row of data from the result associated with the specified `result` instance.
> **Note**: This function sets NULL fields to the PHP **`null`** value.
>
>
### Parameters
`result`
An [PgSql\Result](class.pgsql-result) instance, returned by [pg\_query()](function.pg-query), [pg\_query\_params()](function.pg-query-params) or [pg\_execute()](function.pg-execute)(among others).
`row`
Row number in result to fetch. Rows are numbered from 0 upwards. If omitted or **`null`**, the next row is fetched.
`mode`
An optional parameter that controls how the returned array is indexed. `mode` is a constant and can take the following values: **`PGSQL_ASSOC`**, **`PGSQL_NUM`** and **`PGSQL_BOTH`**. Using **`PGSQL_NUM`**, the function will return an array with numerical indices, using **`PGSQL_ASSOC`** it will return only associative indices while **`PGSQL_BOTH`** will return both numerical and associative indices.
### Return Values
An array, indexed from 0 upwards, with each value represented as a string. Database `NULL` values are returned as **`null`**.
**`false`** is returned if `row` exceeds the number of rows in the set, there are no more rows, or on any other error.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `result` parameter expects an [PgSql\Result](class.pgsql-result) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **pg\_fetch\_row()** example**
```
<?php
$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "An error occurred.\n";
exit;
}
$result = pg_query($conn, "SELECT author, email FROM authors");
if (!$result) {
echo "An error occurred.\n";
exit;
}
while ($row = pg_fetch_row($result)) {
echo "Author: $row[0] E-mail: $row[1]";
echo "<br />\n";
}
?>
```
### See Also
* [pg\_query()](function.pg-query) - Execute a query
* [pg\_fetch\_array()](function.pg-fetch-array) - Fetch a row as an array
* [pg\_fetch\_object()](function.pg-fetch-object) - Fetch a row as an object
* [pg\_fetch\_result()](function.pg-fetch-result) - Returns values from a result instance
php snmp2_get snmp2\_get
==========
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
snmp2\_get — Fetch an SNMP object
### Description
```
snmp2_get(
string $hostname,
string $community,
array|string $object_id,
int $timeout = -1,
int $retries = -1
): mixed
```
The **snmp2\_get()** function is used to read the value of an SNMP object specified by the `object_id`.
### Parameters
`hostname`
The SNMP agent.
`community`
The read community.
`object_id`
The SNMP object.
`timeout`
The number of microseconds until the first timeout.
`retries`
The number of times to retry if timeouts occur.
### Return Values
Returns SNMP object value on success or **`false`** on error.
### Examples
**Example #1 Using **snmp2\_get()****
```
<?php
$syscontact = snmp2_get("127.0.0.1", "public", "system.SysContact.0");
?>
```
### See Also
* [snmp2\_set()](function.snmp2-set) - Set the value of an SNMP object
php UConverter::getAvailable UConverter::getAvailable
========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
UConverter::getAvailable — Get the available canonical converter names
### Description
```
public static UConverter::getAvailable(): array
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php localeconv localeconv
==========
(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)
localeconv — Get numeric formatting information
### Description
```
localeconv(): array
```
Returns an associative array containing localized numeric and monetary formatting information.
### Parameters
This function has no parameters.
### Return Values
**localeconv()** returns data based upon the current locale as set by [setlocale()](function.setlocale). The associative array that is returned contains the following fields:
| Array element | Description |
| --- | --- |
| decimal\_point | Decimal point character |
| thousands\_sep | Thousands separator |
| grouping | Array containing numeric groupings |
| int\_curr\_symbol | International currency symbol (i.e. USD) |
| currency\_symbol | Local currency symbol (i.e. $) |
| mon\_decimal\_point | Monetary decimal point character |
| mon\_thousands\_sep | Monetary thousands separator |
| mon\_grouping | Array containing monetary groupings |
| positive\_sign | Sign for positive values |
| negative\_sign | Sign for negative values |
| int\_frac\_digits | International fractional digits |
| frac\_digits | Local fractional digits |
| p\_cs\_precedes | **`true`** if currency\_symbol precedes a positive value, **`false`** if it succeeds one |
| p\_sep\_by\_space | **`true`** if a space separates currency\_symbol from a positive value, **`false`** otherwise |
| n\_cs\_precedes | **`true`** if currency\_symbol precedes a negative value, **`false`** if it succeeds one |
| n\_sep\_by\_space | **`true`** if a space separates currency\_symbol from a negative value, **`false`** otherwise |
| p\_sign\_posn | * 0 - Parentheses surround the quantity and currency\_symbol
* 1 - The sign string precedes the quantity and currency\_symbol
* 2 - The sign string succeeds the quantity and currency\_symbol
* 3 - The sign string immediately precedes the currency\_symbol
* 4 - The sign string immediately succeeds the currency\_symbol
|
| n\_sign\_posn | * 0 - Parentheses surround the quantity and currency\_symbol
* 1 - The sign string precedes the quantity and currency\_symbol
* 2 - The sign string succeeds the quantity and currency\_symbol
* 3 - The sign string immediately precedes the currency\_symbol
* 4 - The sign string immediately succeeds the currency\_symbol
|
The `p_sign_posn`, and `n_sign_posn` contain a string of formatting options. Each number representing one of the above listed conditions.
The grouping fields contain arrays that define the way numbers should be grouped. For example, the monetary grouping field for the nl\_NL locale (in UTF-8 mode with the euro sign), would contain a 2 item array with the values 3 and 3. The higher the index in the array, the farther left the grouping is. If an array element is equal to **`CHAR_MAX`**, no further grouping is done. If an array element is equal to 0, the previous element should be used.
### Examples
**Example #1 **localeconv()** example**
```
<?php
if (false !== setlocale(LC_ALL, 'nl_NL.UTF-8@euro')) {
$locale_info = localeconv();
print_r($locale_info);
}
?>
```
The above example will output:
```
Array
(
[decimal_point] => .
[thousands_sep] =>
[int_curr_symbol] => EUR
[currency_symbol] => €
[mon_decimal_point] => ,
[mon_thousands_sep] =>
[positive_sign] =>
[negative_sign] => -
[int_frac_digits] => 2
[frac_digits] => 2
[p_cs_precedes] => 1
[p_sep_by_space] => 1
[n_cs_precedes] => 1
[n_sep_by_space] => 1
[p_sign_posn] => 1
[n_sign_posn] => 2
[grouping] => Array
(
)
[mon_grouping] => Array
(
[0] => 3
[1] => 3
)
)
```
### See Also
* [setlocale()](function.setlocale) - Set locale information
php svn_fs_dir_entries svn\_fs\_dir\_entries
=====================
(PECL svn >= 0.1.0)
svn\_fs\_dir\_entries — Enumerates the directory entries under path; returns a hash of dir names to file type
### Description
```
svn_fs_dir_entries(resource $fsroot, string $path): array
```
**Warning**This function is currently not documented; only its argument list is available.
Enumerates the directory entries under path; returns a hash of dir names to file type
### Notes
**Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
php snmp3_get snmp3\_get
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
snmp3\_get — Fetch an SNMP object
### Description
```
snmp3_get(
string $hostname,
string $security_name,
string $security_level,
string $auth_protocol,
string $auth_passphrase,
string $privacy_protocol,
string $privacy_passphrase,
array|string $object_id,
int $timeout = -1,
int $retries = -1
): mixed
```
The **snmp3\_get()** function is used to read the value of an SNMP object specified by the `object_id`.
### Parameters
`hostname`
The hostname of the SNMP agent (server).
`security_name`
the security name, usually some kind of username
`security_level`
the security level (noAuthNoPriv|authNoPriv|authPriv)
`auth_protocol`
the authentication protocol (`"MD5"`, `"SHA"`, `"SHA256"`, or `"SHA512"`)
`auth_passphrase`
the authentication pass phrase
`privacy_protocol`
the privacy protocol (DES or AES)
`privacy_passphrase`
the privacy pass phrase
`object_id`
The SNMP object id.
`timeout`
The number of microseconds until the first timeout.
`retries`
The number of times to retry if timeouts occur.
### Return Values
Returns SNMP object value on success or **`false`** on error.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `auth_protocol` now accepts `"SHA256"` and `"SHA512"` when supported by libnetsnmp. |
### Examples
**Example #1 Using **snmp3\_get()****
```
<?php
$nameOfSecondInterface = snmp3_get('localhost', 'james', 'authPriv', 'SHA', 'secret007', 'AES', 'secret007', 'IF-MIB::ifName.2');
?>
```
### See Also
* [snmp3\_set()](function.snmp3-set) - Set the value of an SNMP object
php The Yaf_Exception_LoadFailed_Action class
The Yaf\_Exception\_LoadFailed\_Action class
============================================
Introduction
------------
(Yaf >=1.0.0)
Class synopsis
--------------
class **Yaf\_Exception\_LoadFailed\_Action** extends [Yaf\_Exception\_LoadFailed](class.yaf-exception-loadfailed) { /\* Properties \*/ /\* Methods \*/ /\* Inherited methods \*/
```
public Yaf_Exception::getPrevious(): void
```
}
php XMLWriter::writePi XMLWriter::writePi
==================
xmlwriter\_write\_pi
====================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::writePi -- xmlwriter\_write\_pi — Writes a PI
### Description
Object-oriented style
```
public XMLWriter::writePi(string $target, string $content): bool
```
Procedural style
```
xmlwriter_write_pi(XMLWriter $writer, string $target, string $content): bool
```
Writes a processing instruction.
### Parameters
`writer`
Only for procedural calls. The [XMLWriter](class.xmlwriter) instance that is being modified. This object is returned from a call to [xmlwriter\_open\_uri()](xmlwriter.openuri) or [xmlwriter\_open\_memory()](xmlwriter.openmemory).
`target`
The target of the processing instruction.
`content`
The content of the processing instruction.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `writer` expects an [XMLWriter](class.xmlwriter) instance now; previously, a resource was expected. |
### See Also
* [XMLWriter::startPi()](xmlwriter.startpi) - Create start PI tag
* [XMLWriter::endPi()](xmlwriter.endpi) - End current PI
php Memcached::fetch Memcached::fetch
================
(PECL memcached >= 0.1.0)
Memcached::fetch — Fetch the next result
### Description
```
public Memcached::fetch(): array
```
**Memcached::fetch()** retrieves the next result from the last request.
### Parameters
This function has no parameters.
### Return Values
Returns the next result or **`false`** otherwise. The [Memcached::getResultCode()](memcached.getresultcode) will return **`Memcached::RES_END`** if result set is exhausted.
### Examples
**Example #1 **Memcached::fetch()** example**
```
<?php
$m = new Memcached();
$m->addServer('localhost', 11211);
$m->set('int', 99);
$m->set('string', 'a simple string');
$m->set('array', array(11, 12));
$m->getDelayed(array('int', 'array'), true);
while ($result = $m->fetch()) {
var_dump($result);
}
?>
```
The above example will output something similar to:
```
array(3) {
["key"]=>
string(3) "int"
"value"]=>
int(99)
["cas"]=>
float(2363)
}
array(3) {
["key"]=>
string(5) "array"
["value"]=>
array(2) {
[0]=>
int(11)
[1]=>
int(12)
}
["cas"]=>
float(2365)
}
```
### See Also
* [Memcached::fetchAll()](memcached.fetchall) - Fetch all the remaining results
* [Memcached::getDelayed()](memcached.getdelayed) - Request multiple items
php mysqli::real_connect mysqli::real\_connect
=====================
mysqli\_real\_connect
=====================
(PHP 5, PHP 7, PHP 8)
mysqli::real\_connect -- mysqli\_real\_connect — Opens a connection to a mysql server
### Description
Object-oriented style
```
public mysqli::real_connect(
string $host = ?,
string $username = ?,
string $passwd = ?,
string $dbname = ?,
int $port = ?,
string $socket = ?,
int $flags = ?
): bool
```
Procedural style
```
mysqli_real_connect(
mysqli $link,
string $host = ?,
string $username = ?,
string $passwd = ?,
string $dbname = ?,
int $port = ?,
string $socket = ?,
int $flags = ?
): bool
```
Establish a connection to a MySQL database engine.
This function differs from [mysqli\_connect()](function.mysqli-connect):
* **mysqli\_real\_connect()** needs a valid object which has to be created by function [mysqli\_init()](mysqli.init).
* With the [mysqli\_options()](mysqli.options) function you can set various options for connection.
* There is a `flags` parameter.
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
`host`
Can be either a host name or an IP address. Passing the **`null`** value or the string "localhost" to this parameter, the local host is assumed. When possible, pipes will be used instead of the TCP/IP protocol.
`username`
The MySQL user name.
`passwd`
If provided or **`null`**, the MySQL server will attempt to authenticate the user against those user records which have no password only. This allows one username to be used with different permissions (depending on if a password as provided or not).
`dbname`
If provided will specify the default database to be used when performing queries.
`port`
Specifies the port number to attempt to connect to the MySQL server.
`socket`
Specifies the socket or named pipe that should be used.
>
> **Note**:
>
>
> Specifying the `socket` parameter will not explicitly determine the type of connection to be used when connecting to the MySQL server. How the connection is made to the MySQL database is determined by the `host` parameter.
>
>
`flags`
With the parameter `flags` you can set different connection options:
**Supported flags**| Name | Description |
| --- | --- |
| **`MYSQLI_CLIENT_COMPRESS`** | Use compression protocol |
| **`MYSQLI_CLIENT_FOUND_ROWS`** | return number of matched rows, not the number of affected rows |
| **`MYSQLI_CLIENT_IGNORE_SPACE`** | Allow spaces after function names. Makes all function names reserved words. |
| **`MYSQLI_CLIENT_INTERACTIVE`** | Allow `interactive_timeout` seconds (instead of `wait_timeout` seconds) of inactivity before closing the connection |
| **`MYSQLI_CLIENT_SSL`** | Use SSL (encryption) |
| **`MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT`** | Like **`MYSQLI_CLIENT_SSL`**, but disables validation of the provided SSL certificate. This is only for installations using MySQL Native Driver and MySQL 5.6 or later. |
>
> **Note**:
>
>
> For security reasons the **`MULTI_STATEMENT`** flag is not supported in PHP. If you want to execute multiple queries use the [mysqli\_multi\_query()](mysqli.multi-query) function.
>
>
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **mysqli::real\_connect()** example**
Object-oriented style
```
<?php
$mysqli = mysqli_init();
if (!$mysqli) {
die('mysqli_init failed');
}
if (!$mysqli->options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
die('Setting MYSQLI_INIT_COMMAND failed');
}
if (!$mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 5)) {
die('Setting MYSQLI_OPT_CONNECT_TIMEOUT failed');
}
if (!$mysqli->real_connect('localhost', 'my_user', 'my_password', 'my_db')) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
echo 'Success... ' . $mysqli->host_info . "\n";
$mysqli->close();
?>
```
Object-oriented style when extending mysqli class
```
<?php
class foo_mysqli extends mysqli {
public function __construct($host, $user, $pass, $db) {
parent::init();
if (!parent::options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
die('Setting MYSQLI_INIT_COMMAND failed');
}
if (!parent::options(MYSQLI_OPT_CONNECT_TIMEOUT, 5)) {
die('Setting MYSQLI_OPT_CONNECT_TIMEOUT failed');
}
if (!parent::real_connect($host, $user, $pass, $db)) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
}
}
$db = new foo_mysqli('localhost', 'my_user', 'my_password', 'my_db');
echo 'Success... ' . $db->host_info . "\n";
$db->close();
?>
```
Procedural style
```
<?php
$link = mysqli_init();
if (!$link) {
die('mysqli_init failed');
}
if (!mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
die('Setting MYSQLI_INIT_COMMAND failed');
}
if (!mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 5)) {
die('Setting MYSQLI_OPT_CONNECT_TIMEOUT failed');
}
if (!mysqli_real_connect($link, 'localhost', 'my_user', 'my_password', 'my_db')) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
echo 'Success... ' . mysqli_get_host_info($link) . "\n";
mysqli_close($link);
?>
```
The above examples will output:
```
Success... MySQL host info: localhost via TCP/IP
```
### Notes
>
> **Note**:
>
>
> MySQLnd always assumes the server default charset. This charset is sent during connection hand-shake/authentication, which mysqlnd will use.
>
>
> Libmysqlclient uses the default charset set in the my.cnf or by an explicit call to [mysqli\_options()](mysqli.options) prior to calling **mysqli\_real\_connect()**, but after [mysqli\_init()](mysqli.init).
>
>
>
### See Also
* [mysqli\_connect()](function.mysqli-connect) - Alias of mysqli::\_\_construct
* [mysqli\_init()](mysqli.init) - Initializes MySQLi and returns an object for use with mysqli\_real\_connect()
* [mysqli\_options()](mysqli.options) - Set options
* [mysqli\_ssl\_set()](mysqli.ssl-set) - Used for establishing secure connections using SSL
* [mysqli\_close()](mysqli.close) - Closes a previously opened database connection
| programming_docs |
php Memcached::decrementByKey Memcached::decrementByKey
=========================
(PECL memcached >= 2.0.0)
Memcached::decrementByKey — Decrement numeric item's value, stored on a specific server
### Description
```
public Memcached::decrementByKey(
string $server_key,
string $key,
int $offset = 1,
int $initial_value = 0,
int $expiry = 0
): int|false
```
**Memcached::decrementByKey()** decrements a numeric item's value by the specified `offset`. If the item's value is not numeric, an error will result. If the operation would decrease the value below 0, the new value will be 0. **Memcached::decrementByKey()** will set the item to the `initial_value` parameter if the key doesn't exist.
### Parameters
`server_key`
The key identifying the server to store the value on or retrieve it from. Instead of hashing on the actual key for the item, we hash on the server key when deciding which memcached server to talk to. This allows related items to be grouped together on a single server for efficiency with multi operations.
`key`
The key of the item to decrement.
`offset`
The amount by which to decrement the item's value.
`initial_value`
The value to set the item to if it doesn't currently exist.
`expiry`
The expiry time to set on the item.
### Return Values
Returns item's new value on success or **`false`** on failure.
### See Also
* [Memcached::decrement()](memcached.decrement) - Decrement numeric item's value
* [Memcached::increment()](memcached.increment) - Increment numeric item's value
* [Memcached::incrementByKey()](memcached.incrementbykey) - Increment numeric item's value, stored on a specific server
php SVMModel::getLabels SVMModel::getLabels
===================
(PECL svm >= 0.1.5)
SVMModel::getLabels — Get the labels the model was trained on
### Description
```
public SVMModel::getLabels(): array
```
Return an array of labels that the model was trained on. For regression and one class models an empty array is returned.
### Parameters
This function has no parameters.
### Return Values
Return an array of labels
### See Also
* [SVMModel::getNrClass()](svmmodel.getnrclass) - Returns the number of classes the model was trained with
php SessionHandlerInterface::gc SessionHandlerInterface::gc
===========================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
SessionHandlerInterface::gc — Cleanup old sessions
### Description
```
public SessionHandlerInterface::gc(int $max_lifetime): int|false
```
Cleans up expired sessions. Called by [session\_start()](function.session-start), based on [session.gc\_divisor](https://www.php.net/manual/en/session.configuration.php#ini.session.gc-divisor), [session.gc\_probability](https://www.php.net/manual/en/session.configuration.php#ini.session.gc-probability) and [session.gc\_maxlifetime](https://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime) settings.
### Parameters
`max_lifetime`
Sessions that have not updated for the last `max_lifetime` seconds will be removed.
### Return Values
Returns the number of deleted sessions on success, or **`false`** on failure. Note this value is returned internally to PHP for processing.
### Changelog
| Version | Description |
| --- | --- |
| 7.1.0 | Prior to this version, the function returned **`true`** on success. |
php ibase_blob_create ibase\_blob\_create
===================
(PHP 5, PHP 7 < 7.4.0)
ibase\_blob\_create — Create a new blob for adding data
### Description
```
ibase_blob_create(resource $link_identifier = null): resource|false
```
**ibase\_blob\_create()** creates a new BLOB for filling with data.
### Parameters
`link_identifier`
An InterBase link identifier. If omitted, the last opened link is assumed.
### Return Values
Returns a BLOB handle for later use with [ibase\_blob\_add()](function.ibase-blob-add) or **`false`** on failure.
### See Also
* [ibase\_blob\_add()](function.ibase-blob-add) - Add data into a newly created blob
* [ibase\_blob\_cancel()](function.ibase-blob-cancel) - Cancel creating blob
* [ibase\_blob\_close()](function.ibase-blob-close) - Close blob
* [ibase\_blob\_import()](function.ibase-blob-import) - Create blob, copy file in it, and close it
php Imagick::getImageGreenPrimary Imagick::getImageGreenPrimary
=============================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageGreenPrimary — Returns the chromaticy green primary point
### Description
```
public Imagick::getImageGreenPrimary(): array
```
Returns the chromaticity green primary point. Returns an array with the keys "x" and "y".
### Parameters
This function has no parameters.
### Return Values
Returns an array with the keys "x" and "y" on success, throws an ImagickException on failure.
### Errors/Exceptions
Throws ImagickException on error.
php ezmlm_hash ezmlm\_hash
===========
(PHP 4 >= 4.0.2, PHP 5, PHP 7)
ezmlm\_hash — Calculate the hash value needed by EZMLM
**Warning**This function has been *DEPRECATED* as of PHP 7.4.0, and *REMOVED* as of PHP 8.0.0. Relying on this function is highly discouraged.
### Description
```
ezmlm_hash(string $addr): int
```
**ezmlm\_hash()** calculates the hash value needed when keeping EZMLM mailing lists in a MySQL database.
### Parameters
`addr`
The email address that's being hashed.
### Return Values
The hash value of `addr`.
### Examples
**Example #1 Calculating the hash and subscribing a user**
```
<?php
$user = "[email protected]";
$hash = ezmlm_hash($user);
$query = sprintf("INSERT INTO sample VALUES (%s, '%s')", $hash, $user);
$db->query($query); // using PHPLIB db interface
?>
```
php sodium_crypto_shorthash sodium\_crypto\_shorthash
=========================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_shorthash — Compute a short hash of a message and key
### Description
```
sodium_crypto_shorthash(string $message, string $key): string
```
**sodium\_crypto\_shorthash()** wraps a hash function called SipHash-2-4, which is ideal for implementing hash tables that are not susceptible to hash collision denial of service attacks (Hash-DoS).
SipHash-2-4 isn't a general purpose cryptographic hash function.
### Parameters
`message`
The message to hash.
`key`
The hash key.
### Return Values
php Gmagick::cropthumbnailimage Gmagick::cropthumbnailimage
===========================
(PECL gmagick >= Unknown)
Gmagick::cropthumbnailimage — Creates a crop thumbnail
### Description
```
public Gmagick::cropthumbnailimage(int $width, int $height): Gmagick
```
Creates a fixed size thumbnail by first scaling the image down and cropping a specified area from the center.
### Parameters
`width`
The width of the thumbnail.
`height`
The Height of the thumbnail.
### Return Values
The cropped [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php chunk_split chunk\_split
============
(PHP 4, PHP 5, PHP 7, PHP 8)
chunk\_split — Split a string into smaller chunks
### Description
```
chunk_split(string $string, int $length = 76, string $separator = "\r\n"): string
```
Can be used to split a string into smaller chunks which is useful for e.g. converting [base64\_encode()](function.base64-encode) output to match RFC 2045 semantics. It inserts `separator` every `length` characters.
### Parameters
`string`
The string to be chunked.
`length`
The chunk length.
`separator`
The line ending sequence.
### Return Values
Returns the chunked string.
### Examples
**Example #1 **chunk\_split()** example**
```
<?php
// format $data using RFC 2045 semantics
$new_string = chunk_split(base64_encode($data));
?>
```
### See Also
* [str\_split()](function.str-split) - Convert a string to an array
* [explode()](function.explode) - Split a string by a string
* [wordwrap()](function.wordwrap) - Wraps a string to a given number of characters
* [» RFC 2045](http://www.faqs.org/rfcs/rfc2045)
php SolrDisMaxQuery::removeBigramPhraseField SolrDisMaxQuery::removeBigramPhraseField
========================================
(No version information available, might only be in Git)
SolrDisMaxQuery::removeBigramPhraseField — Removes phrase bigram field (pf2 parameter)
### Description
```
public SolrDisMaxQuery::removeBigramPhraseField(string $field): SolrDisMaxQuery
```
Removes a Bigram Phrase Field (pf2 parameter) that was previously added using [SolrDisMaxQuery::addBigramPhraseField()](solrdismaxquery.addbigramphrasefield)
### Parameters
`field`
The Field Name
### Return Values
[SolrDisMaxQuery](class.solrdismaxquery)
### Examples
**Example #1 **SolrDisMaxQuery::removeBigramPhraseField()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery("lucene");
$dismaxQuery
->addBigramPhraseField('cat', 2, 5.1)
->addBigramPhraseField('feature', 4.5)
;
echo $dismaxQuery.PHP_EOL;
// remove cat from pf2
$dismaxQuery
->removeBigramPhraseField('cat');
echo $dismaxQuery.PHP_EOL;
?>
```
The above example will output something similar to:
```
q=lucene&defType=edismax&pf2=cat~5.1^2 feature^4.5
q=lucene&defType=edismax&pf2=feature^4.5
```
### See Also
* [SolrDisMaxQuery::addBigramPhraseField()](solrdismaxquery.addbigramphrasefield) - Adds a Phrase Bigram Field (pf2 parameter)
* [SolrDisMaxQuery::setBigramPhraseFields()](solrdismaxquery.setbigramphrasefields) - Sets Bigram Phrase Fields and their boosts (and slops) using pf2 parameter
* [SolrDisMaxQuery::setBigramPhraseSlop()](solrdismaxquery.setbigramphraseslop) - Sets Bigram Phrase Slop (ps2 parameter)
php mysqli_stmt::close mysqli\_stmt::close
===================
mysqli\_stmt\_close
===================
(PHP 5, PHP 7, PHP 8)
mysqli\_stmt::close -- mysqli\_stmt\_close — Closes a prepared statement
### Description
Object-oriented style
```
public mysqli_stmt::close(): bool
```
Procedural style
```
mysqli_stmt_close(mysqli_stmt $statement): bool
```
Closes a prepared statement. **mysqli\_stmt\_close()** also deallocates the statement handle. If the current statement has pending or unread results, this function cancels them so that the next query can be executed.
### Parameters
`statement`
Procedural style only: A [mysqli\_stmt](class.mysqli-stmt) object returned by [mysqli\_stmt\_init()](mysqli.stmt-init).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [mysqli\_prepare()](mysqli.prepare) - Prepares an SQL statement for execution
php ibase_free_event_handler ibase\_free\_event\_handler
===========================
(PHP 5, PHP 7 < 7.4.0)
ibase\_free\_event\_handler — Cancels a registered event handler
### Description
```
ibase_free_event_handler(resource $event): bool
```
This function causes the registered event handler specified by `event` to be cancelled. The callback function will no longer be called for the events it was registered to handle.
### Parameters
`event`
An event resource, created by [ibase\_set\_event\_handler()](function.ibase-set-event-handler).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [ibase\_set\_event\_handler()](function.ibase-set-event-handler) - Register a callback function to be called when events are posted
php mail mail
====
(PHP 4, PHP 5, PHP 7, PHP 8)
mail — Send mail
### Description
```
mail(
string $to,
string $subject,
string $message,
array|string $additional_headers = [],
string $additional_params = ""
): bool
```
Sends an email.
### Parameters
`to`
Receiver, or receivers of the mail.
The formatting of this string must comply with [» RFC 2822](http://www.faqs.org/rfcs/rfc2822). Some examples are:
* [email protected]
* [email protected], [email protected]
* User <[email protected]>
* User <[email protected]>, Another User <[email protected]>
`subject`
Subject of the email to be sent.
**Caution** Subject must satisfy [» RFC 2047](http://www.faqs.org/rfcs/rfc2047).
`message`
Message to be sent.
Each line should be separated with a CRLF (\r\n). Lines should not be larger than 70 characters.
**Caution** (Windows only) When PHP is talking to a SMTP server directly, if a full stop is found on the start of a line, it is removed. To counter-act this, replace these occurrences with a double dot.
```
<?php
$text = str_replace("\n.", "\n..", $text);
?>
```
`additional_headers` (optional) String or array to be inserted at the end of the email header.
This is typically used to add extra headers (From, Cc, and Bcc). Multiple extra headers should be separated with a CRLF (\r\n). If outside data are used to compose this header, the data should be sanitized so that no unwanted headers could be injected.
If an array is passed, its keys are the header names and its values are the respective header values.
>
> **Note**:
>
>
> Before PHP 5.4.42 and 5.5.27, repectively, `additional_headers` did not have mail header injection protection. Therefore, users must make sure specified headers are safe and contains headers only. i.e. Never start mail body by putting multiple newlines.
>
>
>
> **Note**:
>
>
> When sending mail, the mail *must* contain a `From` header. This can be set with the `additional_headers` parameter, or a default can be set in php.ini.
>
> Failing to do this will result in an error message similar to `Warning: mail(): "sendmail_from" not
> set in php.ini or custom "From:" header missing`. The `From` header sets also `Return-Path` when sending directly via SMTP (Windows only).
>
>
>
> **Note**:
>
>
> If messages are not received, try using a LF (\n) only. Some Unix mail transfer agents (most notably [» qmail](http://cr.yp.to/qmail.html)) replace LF by CRLF automatically (which leads to doubling CR if CRLF is used). This should be a last resort, as it does not comply with [» RFC 2822](http://www.faqs.org/rfcs/rfc2822).
>
>
`additional_params` (optional) The `additional_params` parameter can be used to pass additional flags as command line options to the program configured to be used when sending mail, as defined by the `sendmail_path` configuration setting. For example, this can be used to set the envelope sender address when using sendmail with the `-f` sendmail option.
This parameter is escaped by [escapeshellcmd()](function.escapeshellcmd) internally to prevent command execution. [escapeshellcmd()](function.escapeshellcmd) prevents command execution, but allows to add additional parameters. For security reasons, it is recommended for the user to sanitize this parameter to avoid adding unwanted parameters to the shell command.
Since [escapeshellcmd()](function.escapeshellcmd) is applied automatically, some characters that are allowed as email addresses by internet RFCs cannot be used. **mail()** can not allow such characters, so in programs where the use of such characters is required, alternative means of sending emails (such as using a framework or a library) is recommended.
The user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a 'X-Warning' header from being added to the message when the envelope sender (-f) is set using this method. For sendmail users, this file is /etc/mail/trusted-users.
### Return Values
Returns **`true`** if the mail was successfully accepted for delivery, **`false`** otherwise.
It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination.
### Changelog
| Version | Description |
| --- | --- |
| 7.2.0 | The `additional_headers` parameter now also accepts an array. |
### Examples
**Example #1 Sending mail.**
Using **mail()** to send a simple email:
```
<?php
// The message
$message = "Line 1\r\nLine 2\r\nLine 3";
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70, "\r\n");
// Send
mail('[email protected]', 'My Subject', $message);
?>
```
**Example #2 Sending mail with extra headers.**
The addition of basic headers, telling the MUA the From and Reply-To addresses:
```
<?php
$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
```
**Example #3 Sending mail with extra headers as array**
This example sends the same mail as the example immediately above, but passes the additional headers as array (available as of PHP 7.2.0).
```
<?php
$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = array(
'From' => '[email protected]',
'Reply-To' => '[email protected]',
'X-Mailer' => 'PHP/' . phpversion()
);
mail($to, $subject, $message, $headers);
?>
```
**Example #4 Sending mail with an additional command line parameter.**
The `additional_params` parameter can be used to pass an additional parameter to the program configured to use when sending mail using the `sendmail_path`.
```
<?php
mail('[email protected]', 'the subject', 'the message', null,
'[email protected]');
?>
```
**Example #5 Sending HTML email**
It is also possible to send HTML email with **mail()**.
```
<?php
// Multiple recipients
$to = '[email protected], [email protected]'; // note the comma
// Subject
$subject = 'Birthday Reminders for August';
// Message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Johny</td><td>10th</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
// Additional headers
$headers[] = 'To: Mary <[email protected]>, Kelly <[email protected]>';
$headers[] = 'From: Birthday Reminder <[email protected]>';
$headers[] = 'Cc: [email protected]';
$headers[] = 'Bcc: [email protected]';
// Mail it
mail($to, $subject, $message, implode("\r\n", $headers));
?>
```
>
> **Note**:
>
>
> If intending to send HTML or otherwise Complex mails, it is recommended to use the PEAR package [» PEAR::Mail\_Mime](https://pear.php.net/package/Mail_Mime).
>
>
### Notes
>
> **Note**:
>
>
> The SMTP implementation (Windows only) of **mail()** differs in many ways from the sendmail implementation. First, it doesn't use a local binary for composing messages but only operates on direct sockets which means a `MTA` is needed listening on a network socket (which can either on the localhost or a remote machine).
>
> Second, the custom headers like `From:`, `Cc:`, `Bcc:` and `Date:` are *not* interpreted by the `MTA` in the first place, but are parsed by PHP.
>
> As such, the `to` parameter should not be an address in the form of "Something <[email protected]>". The mail command may not parse this properly while talking with the MTA.
>
>
>
> **Note**:
>
>
> It is worth noting that the **mail()** function is not suitable for larger volumes of email in a loop. This function opens and closes an SMTP socket for each email, which is not very efficient.
>
> For the sending of large amounts of email, see the [» PEAR::Mail](https://pear.php.net/package/Mail), and [» PEAR::Mail\_Queue](https://pear.php.net/package/Mail_Queue) packages.
>
>
>
> **Note**:
>
>
> The following RFCs may be useful: [» RFC 1896](http://www.faqs.org/rfcs/rfc1896), [» RFC 2045](http://www.faqs.org/rfcs/rfc2045), [» RFC 2046](http://www.faqs.org/rfcs/rfc2046), [» RFC 2047](http://www.faqs.org/rfcs/rfc2047), [» RFC 2048](http://www.faqs.org/rfcs/rfc2048), [» RFC 2049](http://www.faqs.org/rfcs/rfc2049), and [» RFC 2822](http://www.faqs.org/rfcs/rfc2822).
>
>
### See Also
* [mb\_send\_mail()](function.mb-send-mail) - Send encoded mail
* [imap\_mail()](function.imap-mail) - Send an email message
* [» PEAR::Mail](https://pear.php.net/package/Mail)
* [» PEAR::Mail\_Mime](https://pear.php.net/package/Mail_Mime)
| programming_docs |
php Locale::canonicalize Locale::canonicalize
====================
locale\_canonicalize
====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
Locale::canonicalize -- locale\_canonicalize — Canonicalize the locale string
### Description
```
public static Locale::canonicalize(string $locale): ?string
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`locale`
### Return Values
Canonicalized locale string.
Returns **`null`** when the length of `locale` exceeds **`INTL_MAX_LOCALE_LEN`**.
php Phar::setMetadata Phar::setMetadata
=================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
Phar::setMetadata — Sets phar archive meta-data
### Description
```
public Phar::setMetadata(mixed $metadata): void
```
>
> **Note**:
>
>
> This method requires the php.ini setting `phar.readonly` to be set to `0` in order to work for [Phar](class.phar) objects. Otherwise, a [PharException](class.pharexception) will be thrown.
>
>
>
**Phar::setMetadata()** should be used to store customized data that describes something about the phar archive as a complete entity. [PharFileInfo::setMetadata()](pharfileinfo.setmetadata) should be used for file-specific meta-data. Meta-data can slow down the performance of loading a phar archive if the data is large.
Some possible uses for meta-data include specifying which file within the archive should be used to bootstrap the archive, or the location of a file manifest like [» PEAR](https://pear.php.net/)'s package.xml file. However, any useful data that describes the phar archive may be stored.
### Parameters
`metadata`
Any PHP variable containing information to store that describes the phar archive
### Return Values
No value is returned.
### Examples
**Example #1 A **Phar::setMetadata()** example**
```
<?php
// make sure it doesn't exist
@unlink('brandnewphar.phar');
try {
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
$p['file.php'] = '<?php echo "hello"';
$p->setMetadata(array('bootstrap' => 'file.php'));
var_dump($p->getMetadata());
} catch (Exception $e) {
echo 'Could not create and/or modify phar:', $e;
}
?>
```
The above example will output:
```
array(1) {
["bootstrap"]=>
string(8) "file.php"
}
```
### See Also
* [Phar::getMetadata()](phar.getmetadata) - Returns phar archive meta-data
* [Phar::delMetadata()](phar.delmetadata) - Deletes the global metadata of the phar
* [Phar::hasMetadata()](phar.hasmetadata) - Returns whether phar has global meta-data
php SolrQuery::setHighlightAlternateField SolrQuery::setHighlightAlternateField
=====================================
(PECL solr >= 0.9.2)
SolrQuery::setHighlightAlternateField — Specifies the backup field to use
### Description
```
public SolrQuery::setHighlightAlternateField(string $field, string $field_override = ?): SolrQuery
```
If a snippet cannot be generated because there were no matching terms, one can specify a field to use as the backup or default summary
### Parameters
`field`
The name of the backup field
`field_override`
The name of the field we are overriding this setting for.
### Return Values
Returns the current SolrQuery object, if the return value is used.
php RecursiveTreeIterator::endChildren RecursiveTreeIterator::endChildren
==================================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
RecursiveTreeIterator::endChildren — End children
### Description
```
public RecursiveTreeIterator::endChildren(): void
```
Called when end recursing one level.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php Yaf_Session::__set Yaf\_Session::\_\_set
=====================
(Yaf >=1.0.0)
Yaf\_Session::\_\_set — The \_\_set purpose
### Description
```
public Yaf_Session::__set(string $name, string $value): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`name`
`value`
### Return Values
php Gmagick::getimagesignature Gmagick::getimagesignature
==========================
(PECL gmagick >= Unknown)
Gmagick::getimagesignature — Generates an SHA-256 message digest
### Description
```
public Gmagick::getimagesignature(): string
```
Generates an SHA-256 message digest for the image pixel stream.
### Parameters
This function has no parameters.
### Return Values
Returns a string containing the SHA-256 hash of the file.
### Errors/Exceptions
Throws an **GmagickException** on error.
php Ds\Deque::last Ds\Deque::last
==============
(PECL ds >= 1.0.0)
Ds\Deque::last — Returns the last value
### Description
```
public Ds\Deque::last(): mixed
```
Returns the last value in the deque.
### Parameters
This function has no parameters.
### Return Values
The last value in the deque.
### Errors/Exceptions
[UnderflowException](class.underflowexception) if empty.
### Examples
**Example #1 **Ds\Deque::last()** example**
```
<?php
$deque = new \Ds\Deque([1, 2, 3]);
var_dump($deque->last());
?>
```
The above example will output something similar to:
```
int(3)
```
php Yaf_Config_Simple::offsetSet Yaf\_Config\_Simple::offsetSet
==============================
(Yaf >=1.0.0)
Yaf\_Config\_Simple::offsetSet — The offsetSet purpose
### Description
```
public Yaf_Config_Simple::offsetSet(string $name, string $value): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`name`
`value`
### Return Values
php posix_setpgid posix\_setpgid
==============
(PHP 4, PHP 5, PHP 7, PHP 8)
posix\_setpgid — Set process group id for job control
### Description
```
posix_setpgid(int $process_id, int $process_group_id): bool
```
Let the process `process_id` join the process group `process_group_id`.
### Parameters
`process_id`
The process id.
`process_group_id`
The process group id.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* See POSIX.1 and the setsid(2) manual page on the POSIX system for more information on process groups and job control.
php ftp_chmod ftp\_chmod
==========
(PHP 5, PHP 7, PHP 8)
ftp\_chmod — Set permissions on a file via FTP
### Description
```
ftp_chmod(FTP\Connection $ftp, int $permissions, string $filename): int|false
```
Sets the permissions on the specified remote file to `permissions`.
### Parameters
`ftp`
An [FTP\Connection](class.ftp-connection) instance.
`permissions`
The new permissions, given as an *octal* value.
`filename`
The remote file.
### Return Values
Returns the new file permissions on success or **`false`** on error.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `ftp` parameter expects an [FTP\Connection](class.ftp-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **ftp\_chmod()** example**
```
<?php
$file = 'public_html/index.php';
// set up basic connection
$ftp = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($ftp, $ftp_user_name, $ftp_user_pass);
// try to chmod $file to 644
if (ftp_chmod($ftp, 0644, $file) !== false) {
echo "$file chmoded successfully to 644\n";
} else {
echo "could not chmod $file\n";
}
// close the connection
ftp_close($ftp);
?>
```
### See Also
* [chmod()](function.chmod) - Changes file mode
php imap_check imap\_check
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_check — Check current mailbox
### Description
```
imap_check(IMAP\Connection $imap): stdClass|false
```
Checks information about the current mailbox.
### Parameters
`imap`
An [IMAP\Connection](class.imap-connection) instance.
### Return Values
Returns the information in an object with following properties:
* **`Date`** - current system time formatted according to [» RFC2822](http://www.faqs.org/rfcs/rfc2822)
* **`Driver`** - protocol used to access this mailbox: POP3, IMAP, NNTP
* **`Mailbox`** - the mailbox name
* **`Nmsgs`** - number of messages in the mailbox
* **`Recent`** - number of recent messages in the mailbox
Returns **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `imap` parameter expects an [IMAP\Connection](class.imap-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **imap\_check()** example**
```
<?php
$imap = imap_check($imap_stream);
var_dump($imap);
?>
```
The above example will output something similar to:
```
object(stdClass)(5) {
["Date"]=>
string(37) "Wed, 10 Dec 2003 17:56:54 +0100 (CET)"
["Driver"]=>
string(4) "imap"
["Mailbox"]=>
string(54)
"{www.example.com:143/imap/user="[email protected]"}INBOX"
["Nmsgs"]=>
int(1)
["Recent"]=>
int(0)
}
```
php CachingIterator::getCache CachingIterator::getCache
=========================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
CachingIterator::getCache — Retrieve the contents of the cache
### Description
```
public CachingIterator::getCache(): array
```
Retrieve the contents of the cache.
>
> **Note**:
>
>
> The **`CachingIterator::FULL_CACHE`** flag must be being used.
>
>
### Parameters
This function has no parameters.
### Return Values
An array containing the cache items.
### Errors/Exceptions
Throws a [BadMethodCallException](class.badmethodcallexception) when the **`CachingIterator::FULL_CACHE`** flag is not being used.
### Examples
**Example #1 **CachingIterator::getCache()** example**
```
<?php
$iterator = new ArrayIterator(array(1, 2, 3));
$cache = new CachingIterator($iterator, CachingIterator::FULL_CACHE);
$cache->next();
$cache->next();
var_dump($cache->getCache());
$cache->next();
var_dump($cache->getCache());
?>
```
The above example will output:
```
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
```
php GearmanClient::setStatusCallback GearmanClient::setStatusCallback
================================
(PECL gearman >= 0.5.0)
GearmanClient::setStatusCallback — Set a callback for collecting task status
### Description
```
public GearmanClient::setStatusCallback(callable $callback): bool
```
Sets a callback function used for getting updated status information from a worker. The function should accept a single argument, a [GearmanTask](class.gearmantask) object.
### Parameters
`callback`
A function to call
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [GearmanClient::setDataCallback()](gearmanclient.setdatacallback) - Callback function when there is a data packet for a task
* [GearmanClient::setCompleteCallback()](gearmanclient.setcompletecallback) - Set a function to be called on task completion
* [GearmanClient::setCreatedCallback()](gearmanclient.setcreatedcallback) - Set a callback for when a task is queued
* [GearmanClient::setExceptionCallback()](gearmanclient.setexceptioncallback) - Set a callback for worker exceptions
* [GearmanClient::setFailCallback()](gearmanclient.setfailcallback) - Set callback for job failure
* [GearmanClient::setWarningCallback()](gearmanclient.setwarningcallback) - Set a callback for worker warnings
* [GearmanClient::setWorkloadCallback()](gearmanclient.setworkloadcallback) - Set a callback for accepting incremental data updates
php date_sub date\_sub
=========
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
date\_sub — Alias of [DateTime::sub()](datetime.sub)
### Description
This function is an alias of: [DateTime::sub()](datetime.sub)
### See Also
* [DateTimeImmutable::sub()](datetimeimmutable.sub) - Subtracts an amount of days, months, years, hours, minutes and seconds
* [DateTime::sub()](datetime.sub) - Subtracts an amount of days, months, years, hours, minutes and seconds from a DateTime object
php fbird_fetch_assoc fbird\_fetch\_assoc
===================
(PHP 5, PHP 7 < 7.4.0)
fbird\_fetch\_assoc — Alias of [ibase\_fetch\_assoc()](function.ibase-fetch-assoc)
### Description
This function is an alias of: [ibase\_fetch\_assoc()](function.ibase-fetch-assoc).
### See Also
* [fbird\_fetch\_row()](function.fbird-fetch-row) - Alias of ibase\_fetch\_row
* [fbird\_fetch\_object()](function.fbird-fetch-object) - Alias of ibase\_fetch\_object
php posix_getgrnam posix\_getgrnam
===============
(PHP 4, PHP 5, PHP 7, PHP 8)
posix\_getgrnam — Return info about a group by name
### Description
```
posix_getgrnam(string $name): array|false
```
Gets information about a group provided its name.
### Parameters
`name`
The name of the group
### Return Values
Returns an array on success, or **`false`** on failure. The array elements returned are:
**The group information array**| Element | Description |
| --- | --- |
| name | The name element contains the name of the group. This is a short, usually less than 16 character "handle" of the group, not the real, full name. This should be the same as the `name` parameter used when calling the function, and hence redundant. |
| passwd | The passwd element contains the group's password in an encrypted format. Often, for example on a system employing "shadow" passwords, an asterisk is returned instead. |
| gid | Group ID of the group in numeric form. |
| members | This consists of an array of string's for all the members in the group. |
### Examples
**Example #1 Example use of **posix\_getgrnam()****
```
<?php
$groupinfo = posix_getgrnam("toons");
print_r($groupinfo);
?>
```
The above example will output something similar to:
```
Array
(
[name] => toons
[passwd] => x
[members] => Array
(
[0] => tom
[1] => jerry
)
[gid] => 42
)
```
### See Also
* [posix\_getegid()](function.posix-getegid) - Return the effective group ID of the current process
* [posix\_getgrgid()](function.posix-getgrgid) - Return info about a group by group id
* [filegroup()](function.filegroup) - Gets file group
* [stat()](function.stat) - Gives information about a file
* POSIX man page GETGRNAM(3)
php stat stat
====
(PHP 4, PHP 5, PHP 7, PHP 8)
stat — Gives information about a file
### Description
```
stat(string $filename): array|false
```
Gathers the statistics of the file named by `filename`. If `filename` is a symbolic link, statistics are from the file itself, not the symlink. Prior to PHP 7.4.0, on Windows NTS builds the `size`, `atime`, `mtime` and `ctime` statistics have been from the symlink, in this case.
[lstat()](function.lstat) is identical to **stat()** except it would instead be based off the symlinks status.
### Parameters
`filename`
Path to the file.
### Return Values
****stat()** and [fstat()](function.fstat) result format**| Numeric | Associative | Description |
| --- | --- | --- |
| 0 | dev | device number \*\*\* |
| 1 | ino | inode number \*\*\*\* |
| 2 | mode | inode protection mode \*\*\*\*\* |
| 3 | nlink | number of links |
| 4 | uid | userid of owner \* |
| 5 | gid | groupid of owner \* |
| 6 | rdev | device type, if inode device |
| 7 | size | size in bytes |
| 8 | atime | time of last access (Unix timestamp) |
| 9 | mtime | time of last modification (Unix timestamp) |
| 10 | ctime | time of last inode change (Unix timestamp) |
| 11 | blksize | blocksize of filesystem IO \*\* |
| 12 | blocks | number of 512-byte blocks allocated \*\* |
\* On Windows this will always be `0`.
\*\* Only valid on systems supporting the st\_blksize type - other systems (e.g. Windows) return `-1`.
\*\*\* On Windows, as of PHP 7.4.0, this is the serial number of the volume that contains the file, which is a 64-bit *unsigned* integer, so may overflow. Previously, it was the numeric representation of the drive letter (e.g. `2` for `C:`) for **stat()**, and `0` for [lstat()](function.lstat).
\*\*\*\* On Windows, as of PHP 7.4.0, this is the identifier associated with the file, which is a 64-bit *unsigned* integer, so may overflow. Previously, it was always `0`.
\*\*\*\*\* On Windows, the writable permission bit is set according to the read-only file attribute, and the same value is reported for all users, group and owner. The ACL is not taken into account, contrary to [is\_writable()](function.is-writable).
The value of `mode` contains information read by several functions. When written in octal, starting from the right, the first three digits are returned by [chmod()](function.chmod). The next digit is ignored by PHP. The next two digits indicate the file type:
**`mode` file types**| `mode` in octal | Meaning |
| --- | --- |
| **`0140000`** | socket |
| **`0120000`** | link |
| **`0100000`** | regular file |
| **`0060000`** | block device |
| **`0040000`** | directory |
| **`0020000`** | character device |
| **`0010000`** | fifo |
So for example a regular file could be **`0100644`** and a directory could be **`0040755`**. In case of error, **stat()** returns **`false`**.
> **Note**: Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB.
>
>
### Errors/Exceptions
Upon failure, an **`E_WARNING`** is emitted.
### Changelog
| Version | Description |
| --- | --- |
| 7.4.0 | On Windows, the device number is now the serial number of the volume that contains the file, and the inode number is the identifier associated with the file. |
| 7.4.0 | The `size`, `atime`, `mtime` and `ctime` statistics of symlinks are always those of the target. This was previously not the case for NTS builds on Windows. |
### Examples
**Example #1 **stat()** example**
```
<?php
/* Get file stat */
$stat = stat('C:\php\php.exe');
/*
* Print file access time, this is the same
* as calling fileatime()
*/
echo 'Access time: ' . $stat['atime'];
/*
* Print file modification time, this is the
* same as calling filemtime()
*/
echo 'Modification time: ' . $stat['mtime'];
/* Print the device number */
echo 'Device number: ' . $stat['dev'];
?>
```
**Example #2 Using **stat()** information together with [touch()](function.touch)**
```
<?php
/* Get file stat */
$stat = stat('C:\php\php.exe');
/* Did we failed to get stat information? */
if (!$stat) {
echo 'stat() call failed...';
} else {
/*
* We want the access time to be 1 week
* after the current access time.
*/
$atime = $stat['atime'] + 604800;
/* Touch the file */
if (!touch('some_file.txt', time(), $atime)) {
echo 'Failed to touch file...';
} else {
echo 'touch() returned success...';
}
}
?>
```
### Notes
>
> **Note**:
>
>
> Note that time resolution may differ from one file system to another.
>
>
>
> **Note**: The results of this function are cached. See [clearstatcache()](function.clearstatcache) for more details.
>
>
**Tip**As of PHP 5.0.0, this function can also be used with *some* URL wrappers. Refer to [Supported Protocols and Wrappers](https://www.php.net/manual/en/wrappers.php) to determine which wrappers support **stat()** family of functionality.
### See Also
* [lstat()](function.lstat) - Gives information about a file or symbolic link
* [fstat()](function.fstat) - Gets information about a file using an open file pointer
* [filemtime()](function.filemtime) - Gets file modification time
* [filegroup()](function.filegroup) - Gets file group
* [SplFileInfo](class.splfileinfo)
| programming_docs |
php ImagickPixelIterator::__construct ImagickPixelIterator::\_\_construct
===================================
(PECL imagick 2, PECL imagick 3)
ImagickPixelIterator::\_\_construct — The ImagickPixelIterator constructor
### Description
```
public ImagickPixelIterator::__construct(Imagick $wand)
```
**Warning**This function is currently not documented; only its argument list is available.
The ImagickPixelIterator constructor
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **ImagickPixelIterator::construct()****
```
<?php
function construct($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imageIterator = new \ImagickPixelIterator($imagick);
/* Loop through pixel rows */
foreach ($imageIterator as $pixels) {
/* Loop through the pixels in the row (columns) */
foreach ($pixels as $column => $pixel) {
/** @var $pixel \ImagickPixel */
if ($column % 2) {
/* Paint every second pixel black*/
$pixel->setColor("rgba(0, 0, 0, 0)");
}
}
/* Sync the iterator, this is important to do on each iteration */
$imageIterator->syncIterator();
}
header("Content-Type: image/jpg");
echo $imagick;
}
?>
```
php SolrQuery::setHighlightRequireFieldMatch SolrQuery::setHighlightRequireFieldMatch
========================================
(PECL solr >= 0.9.2)
SolrQuery::setHighlightRequireFieldMatch — Require field matching during highlighting
### Description
```
public SolrQuery::setHighlightRequireFieldMatch(bool $flag): SolrQuery
```
If **`true`**, then a field will only be highlighted if the query matched in this particular field.
This will only work if SolrQuery::setHighlightUsePhraseHighlighter() was set to **`true`**
### Parameters
`flag`
**`true`** or **`false`**
### Return Values
Returns the current SolrQuery object, if the return value is used.
php getmypid getmypid
========
(PHP 4, PHP 5, PHP 7, PHP 8)
getmypid — Gets PHP's process ID
### Description
```
getmypid(): int|false
```
Gets the current PHP process ID.
### Parameters
This function has no parameters.
### Return Values
Returns the current PHP process ID, or **`false`** on error.
### Notes
**Warning** Process IDs are not unique, thus they are a weak entropy source. We recommend against relying on pids in security-dependent contexts.
### See Also
* [getmygid()](function.getmygid) - Get PHP script owner's GID
* [getmyuid()](function.getmyuid) - Gets PHP script owner's UID
* [get\_current\_user()](function.get-current-user) - Gets the name of the owner of the current PHP script
* [getmyinode()](function.getmyinode) - Gets the inode of the current script
* [getlastmod()](function.getlastmod) - Gets time of last page modification
php GearmanWorker::register GearmanWorker::register
=======================
(PECL gearman >= 0.6.0)
GearmanWorker::register — Register a function with the job server
### Description
```
public GearmanWorker::register(string $function_name, int $timeout = ?): bool
```
Registers a function name with the job server with an optional timeout. The timeout specifies how many seconds the server will wait before marking a job as failed. If the timeout is set to zero, there is no timeout.
### Parameters
`function_name`
The name of a function to register with the job server
`timeout`
An interval of time in seconds
### Return Values
A standard Gearman return value.
### See Also
* [GearmanWorker::unregister()](gearmanworker.unregister) - Unregister a function name with the job servers
* [GearmanWorker::unregisterAll()](gearmanworker.unregisterall) - Unregister all function names with the job servers
php IntlChar::charDigitValue IntlChar::charDigitValue
========================
(PHP 7, PHP 8)
IntlChar::charDigitValue — Get the decimal digit value of a decimal digit character
### Description
```
public static IntlChar::charDigitValue(int|string $codepoint): ?int
```
Returns the decimal digit value of a decimal digit character.
Such characters have the general category "Nd" (decimal digit numbers) and a Numeric\_Type of Decimal.
### Parameters
`codepoint`
The int codepoint value (e.g. `0x2603` for *U+2603 SNOWMAN*), or the character encoded as a UTF-8 string (e.g. `"\u{2603}"`)
### Return Values
The decimal digit value of `codepoint`, or `-1` if it is not a decimal digit character. Returns **`null`** on failure.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::charDigitValue("1"));
var_dump(IntlChar::charDigitValue("\u{0662}"));
var_dump(IntlChar::charDigitValue("\u{0E53}"));
?>
```
The above example will output:
```
int(1)
int(2)
int(3)
```
### See Also
* [IntlChar::getNumericValue()](intlchar.getnumericvalue) - Get the numeric value for a Unicode code point
php Yar_Client::setOpt Yar\_Client::setOpt
===================
(PECL yar >= 1.0.0)
Yar\_Client::setOpt — Set calling contexts
### Description
```
public Yar_Client::setOpt(int $name, mixed $value): Yar_Client|false
```
### Parameters
`name`
it can be: YAR\_OPT\_PACKAGER, YAR\_OPT\_PERSISTENT (Need server support), YAR\_OPT\_TIMEOUT, YAR\_OPT\_CONNECT\_TIMEOUT YAR\_OPT\_HEADER (Since 2.0.4)
`value`
### Return Values
Returns $this on success or **`false`** on failure.
### Examples
**Example #1 **Yar\_Client::setOpt()** example**
```
<?php
$cient = new Yar_Client("http://host/api/");
//Set timeout to 1s
$client->SetOpt(YAR_OPT_CONNECT_TIMEOUT, 1000);
//Set packager to JSON
$client->SetOpt(YAR_OPT_PACKAGER, "json");
//Set Custom headers
$client->SetOpt(YAR_OPT_HEADER, array("hr1: val1", "hd2: val2"));
/* call remote service */
$result = $client->some_method("parameter");
?>
```
The above example will output something similar to:
### See Also
* [Yar\_Client::\_\_call()](yar-client.call) - Call service
php EventBase::reInit EventBase::reInit
=================
(PECL event >= 1.2.6-beta)
EventBase::reInit — Re-initialize event base(after a fork)
### Description
```
public EventBase::reInit(): bool
```
Re-initialize event base. Should be called after a fork.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php Imagick::chopImage Imagick::chopImage
==================
(PECL imagick 2, PECL imagick 3)
Imagick::chopImage — Removes a region of an image and trims
### Description
```
public Imagick::chopImage(
int $width,
int $height,
int $x,
int $y
): bool
```
Removes a region of an image and collapses the image to occupy the removed portion.
### Parameters
`width`
Width of the chopped area
`height`
Height of the chopped area
`x`
X origo of the chopped area
`y`
Y origo of the chopped area
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 Using **Imagick::chopImage()**:**
Example of using Imagick::chopImage
```
<?php
/* Create some objects */
$image = new Imagick();
$pixel = new ImagickPixel( 'gray' );
/* New image */
$image->newImage(400, 200, $pixel);
/* Chop image */
$image->chopImage(200, 200, 0, 0);
/* Give image a format */
$image->setImageFormat('png');
/* Output the image with headers */
header('Content-type: image/png');
echo $image;
?>
```
### See Also
* [Imagick::cropImage()](imagick.cropimage) - Extracts a region of the image
php pg_escape_identifier pg\_escape\_identifier
======================
(PHP 5 >= 5.4.4, PHP 7, PHP 8)
pg\_escape\_identifier — Escape a identifier for insertion into a text field
### Description
```
pg_escape_identifier(PgSql\Connection $connection = ?, string $data): string
```
**pg\_escape\_identifier()** escapes a identifier (e.g. table, field names) for querying the database. It returns an escaped identifier string for PostgreSQL server. **pg\_escape\_identifier()** adds double quotes before and after data. Users should not add double quotes. Use of this function is recommended for identifier parameters in query. For SQL literals (i.e. parameters except bytea), [pg\_escape\_literal()](function.pg-escape-literal) or [pg\_escape\_string()](function.pg-escape-string) must be used. For bytea type fields, [pg\_escape\_bytea()](function.pg-escape-bytea) must be used instead.
>
> **Note**:
>
>
> This function has internal escape code and can also be used with PostgreSQL 8.4 or less.
>
>
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance. When `connection` is unspecified, the default connection is used. The default connection is the last connection made by [pg\_connect()](function.pg-connect) or [pg\_pconnect()](function.pg-pconnect).
**Warning**As of PHP 8.1.0, using the default connection is deprecated.
`data`
A string containing text to be escaped.
### Return Values
A string containing the escaped data.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **pg\_escape\_identifier()** example**
```
<?php
// Connect to the database
$dbconn = pg_connect('dbname=foo');
// Escape the table name data
$escaped = pg_escape_identifier($table_name);
// Select rows from $table_name
pg_query("SELECT * FROM {$escaped};");
?>
```
### See Also
* [pg\_escape\_literal()](function.pg-escape-literal) - Escape a literal for insertion into a text field
* [pg\_escape\_bytea()](function.pg-escape-bytea) - Escape a string for insertion into a bytea field
* [pg\_escape\_string()](function.pg-escape-string) - Escape a string for query
php imagecreatefrombmp imagecreatefrombmp
==================
(PHP 7 >= 7.2.0, PHP 8)
imagecreatefrombmp — Create a new image from file or URL
### Description
```
imagecreatefrombmp(string $filename): GdImage|false
```
**imagecreatefrombmp()** returns an image identifier representing the image obtained from the given filename.
**Tip**A URL can be used as a filename with this function if the [fopen wrappers](https://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen) have been enabled. See [fopen()](function.fopen) for more details on how to specify the filename. See the [Supported Protocols and Wrappers](https://www.php.net/manual/en/wrappers.php) for links to information about what abilities the various wrappers have, notes on their usage, and information on any predefined variables they may provide.
### Parameters
`filename`
Path to the BMP image.
### Return Values
Returns an image object on success, **`false`** on errors.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | On success, this function returns a [GDImage](class.gdimage) instance now; previously, a resource was returned. |
### Examples
**Example #1 Convert an BMP image to a PNG image using **imagecreatefrombmp()****
```
<?php
// Load the BMP file
$im = imagecreatefrombmp('./example.bmp');
// Convert it to a PNG file with default settings
imagepng($im, './example.png');
imagedestroy($im);
?>
```
php SessionIdInterface::create_sid SessionIdInterface::create\_sid
===============================
(PHP 5 >= 5.5.1, PHP 7, PHP 8)
SessionIdInterface::create\_sid — Create session ID
### Description
```
public SessionIdInterface::create_sid(): string
```
Creates a new session ID.This function is automatically executed when a new session ID needs to be created.
### Parameters
This function has no parameters.
### Return Values
The new session ID. Note that this value is returned internally to PHP for processing.
### See Also
* [SessionHandler::create\_sid()](sessionhandler.create-sid) - Return a new session ID
php Imagick::getImageSignature Imagick::getImageSignature
==========================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageSignature — Generates an SHA-256 message digest
### Description
```
public Imagick::getImageSignature(): string
```
Generates an SHA-256 message digest for the image pixel stream.
### Parameters
This function has no parameters.
### Return Values
Returns a string containing the SHA-256 hash of the file.
### Errors/Exceptions
Throws ImagickException on error.
php Gmagick::equalizeimage Gmagick::equalizeimage
======================
(PECL gmagick >= Unknown)
Gmagick::equalizeimage — Equalizes the image histogram
### Description
```
public Gmagick::equalizeimage(): Gmagick
```
Equalizes the image histogram.
### Parameters
This function has no parameters.
### Return Values
The equalized [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php RecursiveTreeIterator::valid RecursiveTreeIterator::valid
============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
RecursiveTreeIterator::valid — Check validity
### Description
```
public RecursiveTreeIterator::valid(): bool
```
Check whether the current position is valid.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the current position is valid, otherwise **`false`**
php EventBase::getTimeOfDayCached EventBase::getTimeOfDayCached
=============================
(PECL event >= 1.2.6-beta)
EventBase::getTimeOfDayCached — Returns the current event base time
### Description
```
public EventBase::getTimeOfDayCached(): float
```
On success returns the current time(as returned by `gettimeofday()` ), looking at the cached value in *base* if possible, and calling `gettimeofday()` or `clock_gettime()` as appropriate if there is no cached time.
### Parameters
This function has no parameters.
### Return Values
Returns the current *event base* time. On failure returns **`null`**.
php mcrypt_enc_is_block_mode mcrypt\_enc\_is\_block\_mode
============================
(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mcrypt\_enc\_is\_block\_mode — Checks whether the opened mode outputs blocks
**Warning**This function has been *DEPRECATED* as of PHP 7.1.0 and *REMOVED* as of PHP 7.2.0. Relying on this function is highly discouraged.
### Description
```
mcrypt_enc_is_block_mode(resource $td): bool
```
Tells whether the opened mode outputs blocks (e.g. **`true`** for cbc and ecb, and **`false`** for cfb and stream).
### Parameters
`td`
The encryption descriptor.
### Return Values
Returns **`true`** if the mode outputs blocks of bytes, or **`false`** if it outputs just bytes.
php SplDoublyLinkedList::offsetGet SplDoublyLinkedList::offsetGet
==============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplDoublyLinkedList::offsetGet — Returns the value at the specified $index
### Description
```
public SplDoublyLinkedList::offsetGet(int $index): mixed
```
### Parameters
`index`
The index with the value.
### Return Values
The value at the specified `index`.
### Errors/Exceptions
Throws [OutOfRangeException](class.outofrangeexception) when `index` is out of bounds or when `index` cannot be parsed as an integer.
php XMLReader::expand XMLReader::expand
=================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
XMLReader::expand — Returns a copy of the current node as a DOM object
### Description
```
public XMLReader::expand(?DOMNode $baseNode = null): DOMNode|false
```
This method copies the current node and returns the appropriate DOM object.
### Parameters
`baseNode`
A [DOMNode](class.domnode) defining the target [DOMDocument](class.domdocument) for the created DOM object.
### Return Values
The resulting [DOMNode](class.domnode) or **`false`** on error.
php FilterIterator::valid FilterIterator::valid
=====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
FilterIterator::valid — Check whether the current element is valid
### Description
```
public FilterIterator::valid(): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Checks whether the current element is valid.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the current element is valid, otherwise **`false`**
php SQLite3::setAuthorizer SQLite3::setAuthorizer
======================
(PHP 8)
SQLite3::setAuthorizer — Configures a callback to be used as an authorizer to limit what a statement can do
### Description
```
public SQLite3::setAuthorizer(?callable $callback): bool
```
Sets a callback that will be called by SQLite every time an action is performed (reading, deleting, updating, etc.). This is used when preparing a SQL statement from an untrusted source to ensure that the SQL statements do not try to access data they are not allowed to see, or that they do not try to execute malicious statements that damage the database. For example, an application may allow a user to enter arbitrary SQL queries for evaluation by a database. But the application does not want the user to be able to make arbitrary changes to the database. An authorizer could then be put in place while the user-entered SQL is being prepared that disallows everything except SELECT statements.
The authorizer callback may be called multiple times for each statement prepared by SQLite. A `SELECT` or `UPDATE` query will call the authorizer for every column that would be read or updated.
The authorizer is called with up to five parameters. The first parameter is always given, and is an int (action code) matching a constant from `SQLite3`. The other parameters are only passed for some actions. The following table describes the second and third parameters according to the action:
**List of action codes and parameters**| Action | Second parameter | Third parameter |
| --- | --- | --- |
| **`SQLite3::CREATE_INDEX`** | Index Name | Table Name |
| **`SQLite3::CREATE_TABLE`** | Table Name | **`null`** |
| **`SQLite3::CREATE_TEMP_INDEX`** | Index Name | Table Name |
| **`SQLite3::CREATE_TEMP_TABLE`** | Table Name | **`null`** |
| **`SQLite3::CREATE_TEMP_TRIGGER`** | Trigger Name | Table Name |
| **`SQLite3::CREATE_TEMP_VIEW`** | View Name | **`null`** |
| **`SQLite3::CREATE_TRIGGER`** | Trigger Name | Table Name |
| **`SQLite3::CREATE_VIEW`** | View Name | **`null`** |
| **`SQLite3::DELETE`** | Table Name | **`null`** |
| **`SQLite3::DROP_INDEX`** | Index Name | Table Name |
| **`SQLite3::DROP_TABLE`** | Table Name | **`null`** |
| **`SQLite3::DROP_TEMP_INDEX`** | Index Name | Table Name |
| **`SQLite3::DROP_TEMP_TABLE`** | Table Name | **`null`** |
| **`SQLite3::DROP_TEMP_TRIGGER`** | Trigger Name | Table Name |
| **`SQLite3::DROP_TEMP_VIEW`** | View Name | **`null`** |
| **`SQLite3::DROP_TRIGGER`** | Trigger Name | Table Name |
| **`SQLite3::DROP_VIEW`** | View Name | **`null`** |
| **`SQLite3::INSERT`** | Table Name | **`null`** |
| **`SQLite3::PRAGMA`** | Pragma Name | First argument passed to the pragma, or **`null`** |
| **`SQLite3::READ`** | Table Name | Column Name |
| **`SQLite3::SELECT`** | **`null`** | **`null`** |
| **`SQLite3::TRANSACTION`** | Operation | **`null`** |
| **`SQLite3::UPDATE`** | Table Name | Column Name |
| **`SQLite3::ATTACH`** | Filename | **`null`** |
| **`SQLite3::DETACH`** | Database Name | **`null`** |
| **`SQLite3::ALTER_TABLE`** | Database Name | Table Name |
| **`SQLite3::REINDEX`** | Index Name | **`null`** |
| **`SQLite3::ANALYZE`** | Table Name | **`null`** |
| **`SQLite3::CREATE_VTABLE`** | Table Name | Module Name |
| **`SQLite3::DROP_VTABLE`** | Table Name | Module Name |
| **`SQLite3::FUNCTION`** | **`null`** | Function Name |
| **`SQLite3::SAVEPOINT`** | Operation | Savepoint Name |
| **`SQLite3::RECURSIVE`** | **`null`** | **`null`** |
The 4th parameter will be the name of the database (`"main"`, `"temp"`, etc.) if applicable.
The 5th parameter to the authorizer callback is the name of the inner-most trigger or view that is responsible for the access attempt or **`null`** if this access attempt is directly from top-level SQL code.
When the callback returns **`SQLite3::OK`**, that means the operation requested is accepted. When the callback returns **`SQLite3::DENY`**, the call that triggered the authorizer will fail with an error message explaining that access is denied.
If the action code is **`SQLite3::READ`** and the callback returns **`SQLite3::IGNORE`** then the prepared statement is constructed to substitute a **`null`** value in place of the table column that would have been read if **`SQLite3::OK`** had been returned. The **`SQLite3::IGNORE`** return can be used to deny an untrusted user access to individual columns of a table.
When a table is referenced by a `SELECT` but no column values are extracted from that table (for example in a query like `"SELECT count(*) FROM
table"`) then the **`SQLite3::READ`** authorizer callback is invoked once for that table with a column name that is an empty string.
If the action code is **`SQLite3::DELETE`** and the callback returns **`SQLite3::IGNORE`** then the DELETE operation proceeds but the truncate optimization is disabled and all rows are deleted individually.
Only a single authorizer can be in place on a database connection at a time. Each call to **SQLite3::setAuthorizer()** overrides the previous call. Disable the authorizer by installing a **`null`** callback. The authorizer is disabled by default.
The authorizer callback must not do anything that will modify the database connection that invoked the authorizer callback.
Note that the authorizer is only called when a statement is prepared, not when it's executed.
More details can be found in the [» SQLite3 documentation](http://sqlite.org/c3ref/set_authorizer.html).
### Parameters
`callback`
The [callable](language.types.callable) to be called.
If **`null`** is passed instead, this will disable the current authorizer callback.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
This method doesn't throw any error, but if an authorizer is enabled and returns an invalid value, the statement preparation will throw an error (or exception, depending on the use of the [SQLite3::enableExceptions()](sqlite3.enableexceptions) method).
### Examples
**Example #1 **SQLite3::setAuthorizer()** example**
This only allows access to reading, and only some columns of the `users` table will be returned. Other columns will be replaced with **`null`**.
```
<?php
$db = new SQLite3('data.sqlite');
$db->exec('CREATE TABLE users (id, name, password);');
$db->exec('INSERT INTO users VALUES (1, \'Pauline\', \'Snails4eva\');');
$allowed_columns = ['id', 'name'];
$db->setAuthorizer(function (int $action, ...$args) use ($allowed_columns) {
if ($action === SQLite3::READ) {
list($table, $column) = $args;
if ($table === 'users' && in_array($column, $allowed_columns) {
return SQLite3::OK;
}
return SQLite3::IGNORE;
}
return SQLite3::DENY;
});
print_r($db->querySingle('SELECT * FROM users WHERE id = 1;'));
```
The above example will output:
```
Array
(
[id] => 1
[name] => Pauline
[password] =>
)
```
| programming_docs |
php SplFileObject::getCurrentLine SplFileObject::getCurrentLine
=============================
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
SplFileObject::getCurrentLine — Alias of [SplFileObject::fgets()](splfileobject.fgets)
### Description
This method is an alias of: [SplFileObject::fgets()](splfileobject.fgets).
php None What References Are Not
-----------------------
As said before, references are not pointers. That means, the following construct won't do what you expect:
```
<?php
function foo(&$var)
{
$var =& $GLOBALS["baz"];
}
foo($bar);
?>
```
What happens is that $var in foo will be bound with $bar in the caller, but then re-bound with [$GLOBALS["baz"]](reserved.variables.globals). There's no way to bind $bar in the calling scope to something else using the reference mechanism, since $bar is not available in the function foo (it is represented by $var, but $var has only variable contents and not name-to-value binding in the calling symbol table). You can use [returning references](language.references.return) to reference variables selected by the function.
php Event::addSignal Event::addSignal
================
(PECL event >= 1.2.6-beta)
Event::addSignal — Alias of [Event::add()](event.add)
### Description
This method is an alias of: [Event::add()](event.add)
php ReflectionClass::isAnonymous ReflectionClass::isAnonymous
============================
(PHP 7, PHP 8)
ReflectionClass::isAnonymous — Checks if class is anonymous
### Description
```
public ReflectionClass::isAnonymous(): bool
```
Checks if a class is an anonymous class.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **ReflectionClass::isAnonymous()** example**
```
<?php
class TestClass {}
$anonClass = new class {};
$normalClass = new ReflectionClass('TestClass');
$anonClass = new ReflectionClass($anonClass);
var_dump($normalClass->isAnonymous());
var_dump($anonClass->isAnonymous());
?>
```
The above example will output:
```
bool(false)
bool(true)
```
### See Also
* [ReflectionClass::isFinal()](reflectionclass.isfinal) - Checks if class is final
php spl_autoload_functions spl\_autoload\_functions
========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
spl\_autoload\_functions — Return all registered \_\_autoload() functions
### Description
```
spl_autoload_functions(): array
```
Get all registered \_\_autoload() functions.
### Parameters
This function has no parameters.
### Return Values
An array of all registered \_\_autoload functions. If the autoload queue is not activated then the return value is **`false`**. If no function is registered the return value will be an empty array.
php ctype_xdigit ctype\_xdigit
=============
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
ctype\_xdigit — Check for character(s) representing a hexadecimal digit
### Description
```
ctype_xdigit(mixed $text): bool
```
Checks if all of the characters in the provided string, `text`, are hexadecimal 'digits'.
### Parameters
`text`
The tested string.
>
> **Note**:
>
>
> If an int between -128 and 255 inclusive is provided, it is interpreted as the ASCII value of a single character (negative values have 256 added in order to allow characters in the Extended ASCII range). Any other integer is interpreted as a string containing the decimal digits of the integer.
>
>
>
**Warning** As of PHP 8.1.0, passing a non-string argument is deprecated. In the future, the argument will be interpreted as a string instead of an ASCII codepoint. Depending on the intended behavior, the argument should either be cast to string or an explicit call to [chr()](function.chr) should be made.
### Return Values
Returns **`true`** if every character in `text` is a hexadecimal 'digit', that is a decimal digit or a character from `[A-Fa-f]` , **`false`** otherwise. When called with an empty string the result will always be **`false`**.
### Examples
**Example #1 A **ctype\_xdigit()** example**
```
<?php
$strings = array('AB10BC99', 'AR1012', 'ab12bc99');
foreach ($strings as $testcase) {
if (ctype_xdigit($testcase)) {
echo "The string $testcase consists of all hexadecimal digits.\n";
} else {
echo "The string $testcase does not consist of all hexadecimal digits.\n";
}
}
?>
```
The above example will output:
```
The string AB10BC99 consists of all hexadecimal digits.
The string AR1012 does not consist of all hexadecimal digits.
The string ab12bc99 consists of all hexadecimal digits.
```
### See Also
* [ctype\_digit()](function.ctype-digit) - Check for numeric character(s)
php EventHttpConnection::getPeer EventHttpConnection::getPeer
============================
(PECL event >= 1.2.6-beta)
EventHttpConnection::getPeer — Gets the remote address and port associated with the connection
### Description
```
public EventHttpConnection::getPeer( string &$address , int &$port ): void
```
Gets the remote address and port associated with the connection
### Parameters
`address` Address of the peer.
`port` Port of the peer.
### Return Values
No value is returned.
php array_reverse array\_reverse
==============
(PHP 4, PHP 5, PHP 7, PHP 8)
array\_reverse — Return an array with elements in reverse order
### Description
```
array_reverse(array $array, bool $preserve_keys = false): array
```
Takes an input `array` and returns a new array with the order of the elements reversed.
### Parameters
`array`
The input array.
`preserve_keys`
If set to **`true`** numeric keys are preserved. Non-numeric keys are not affected by this setting and will always be preserved.
### Return Values
Returns the reversed array.
### Examples
**Example #1 **array\_reverse()** example**
```
<?php
$input = array("php", 4.0, array("green", "red"));
$reversed = array_reverse($input);
$preserved = array_reverse($input, true);
print_r($input);
print_r($reversed);
print_r($preserved);
?>
```
The above example will output:
```
Array
(
[0] => php
[1] => 4
[2] => Array
(
[0] => green
[1] => red
)
)
Array
(
[0] => Array
(
[0] => green
[1] => red
)
[1] => 4
[2] => php
)
Array
(
[2] => Array
(
[0] => green
[1] => red
)
[1] => 4
[0] => php
)
```
### See Also
* [array\_flip()](function.array-flip) - Exchanges all keys with their associated values in an array
php ReflectionClass::getTraitAliases ReflectionClass::getTraitAliases
================================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
ReflectionClass::getTraitAliases — Returns an array of trait aliases
### Description
```
public ReflectionClass::getTraitAliases(): array
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
Returns an array with new method names in keys and original names (in the format `"TraitName::original"`) in values. Returns **`null`** in case of an error.
php Ds\Deque::toArray Ds\Deque::toArray
=================
(PECL ds >= 1.0.0)
Ds\Deque::toArray — Converts the deque to an array
### Description
```
public Ds\Deque::toArray(): array
```
Converts the deque to an array.
>
> **Note**:
>
>
> Casting to an array is not supported yet.
>
>
### Parameters
This function has no parameters.
### Return Values
An array containing all the values in the same order as the deque.
### Examples
**Example #1 **Ds\Deque::toArray()** example**
```
<?php
$deque = new \Ds\Deque([1, 2, 3]);
var_dump($deque->toArray());
?>
```
The above example will output something similar to:
```
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
```
php EvChild::set EvChild::set
============
(PECL ev >= 0.2.0)
EvChild::set — Configures the watcher
### Description
```
public EvChild::set( int $pid , bool $trace ): void
```
### Parameters
`pid` The same as for [EvChild::\_\_construct()](evchild.construct)
`trace` The same as for [EvChild::\_\_construct()](evchild.construct)
### Return Values
No value is returned.
### See Also
* [EvChild::\_\_construct()](evchild.construct) - Constructs the EvChild watcher object
php OAuth::disableSSLChecks OAuth::disableSSLChecks
=======================
(PECL OAuth >= 0.99.5)
OAuth::disableSSLChecks — Turn off SSL checks
### Description
```
public OAuth::disableSSLChecks(): bool
```
Turns off the usual SSL peer certificate and host checks, this is not for production environments. Alternatively, the `sslChecks` member can be set to **`false`** to turn SSL checks off.
### Parameters
This function has no parameters.
### Return Values
**`true`**
### Changelog
| Version | Description |
| --- | --- |
| PECL oauth 0.99.8 | The `sslChecks` member was added |
### See Also
* [OAuth::enableSSLChecks()](oauth.enablesslchecks) - Turn on SSL checks
php ReflectionGenerator::__construct ReflectionGenerator::\_\_construct
==================================
(PHP 7, PHP 8)
ReflectionGenerator::\_\_construct — Constructs a ReflectionGenerator object
### Description
public **ReflectionGenerator::\_\_construct**([Generator](class.generator) `$generator`) Constructs a [ReflectionGenerator](class.reflectiongenerator) object.
### Parameters
`generator`
A generator object.
### Examples
**Example #1 **ReflectionGenerator::\_\_construct()** example**
```
<?php
function gen()
{
yield 1;
}
$gen = gen();
$reflectionGen = new ReflectionGenerator($gen);
echo <<< output
{$reflectionGen->getFunction()->name}
Line: {$reflectionGen->getExecutingLine()}
File: {$reflectionGen->getExecutingFile()}
output;
```
The above example will output something similar to:
```
gen
Line: 5
File: /path/to/file/example.php
```
### See Also
* [ReflectionGenerator::getFunction()](reflectiongenerator.getfunction) - Gets the function name of the generator
* [ReflectionGenerator::getExecutingLine()](reflectiongenerator.getexecutingline) - Gets the currently executing line of the generator
* [ReflectionGenerator::getExecutingFile()](reflectiongenerator.getexecutingfile) - Gets the file name of the currently executing generator
php geoip_db_filename geoip\_db\_filename
===================
(PECL geoip >= 1.0.1)
geoip\_db\_filename — Returns the filename of the corresponding GeoIP Database
### Description
```
geoip_db_filename(int $database): string
```
The **geoip\_db\_filename()** function returns the filename of the corresponding GeoIP Database.
It does not indicate if the file exists or not on disk, only where the library is looking for the database.
### Parameters
`database`
The database type as an integer. You can use the [various constants](https://www.php.net/manual/en/geoip.constants.php) defined with this extension (ie: GEOIP\_\*\_EDITION).
### Return Values
Returns the filename of the corresponding database, or **`null`** on error.
### Examples
**Example #1 A **geoip\_db\_filename()** example**
This will output the filename of the corresponding database.
```
<?php
print geoip_db_filename(GEOIP_COUNTRY_EDITION);
?>
```
The above example will output:
```
/usr/share/GeoIP/GeoIP.dat
```
php inflate_get_status inflate\_get\_status
====================
(PHP 7 >= 7.2.0, PHP 8)
inflate\_get\_status — Get decompression status
### Description
```
inflate_get_status(InflateContext $context): int
```
Usually returns either **`ZLIB_OK`** or **`ZLIB_STREAM_END`**.
### Parameters
`context`
### Return Values
Returns decompression status or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `context` expects an [InflateContext](class.inflatecontext) instance now; previously, a resource was expected. |
php Yaf_Response_Abstract::__toString Yaf\_Response\_Abstract::\_\_toString
=====================================
(Yaf >=1.0.0)
Yaf\_Response\_Abstract::\_\_toString — Retrieve all bodys as string
### Description
```
private Yaf_Response_Abstract::__toString(): string
```
### Parameters
This function has no parameters.
### Return Values
php radius_auth_open radius\_auth\_open
==================
(PECL radius >= 1.1.0)
radius\_auth\_open — Creates a Radius handle for authentication
### Description
```
radius_auth_open(): resource
```
### Parameters
This function has no parameters.
### Return Values
Returns a handle on success, **`false`** on error. This function only fails if insufficient memory is available.
### Examples
**Example #1 **radius\_auth\_open()** example**
```
<?php
$radh = radius_auth_open()
or die ("Could not create handle");
echo "Handle successfully created";
?>
```
php The SVM class
The SVM class
=============
Introduction
------------
(PECL svm >= 0.1.0)
Class synopsis
--------------
class **SVM** { /\* Constants \*/ const int [C\_SVC](class.svm#svm.constants.c-svc) = 0;
const int [NU\_SVC](class.svm#svm.constants.nu-svc) = 1;
const int [ONE\_CLASS](class.svm#svm.constants.one-class) = 2;
const int [EPSILON\_SVR](class.svm#svm.constants.epsilon-svr) = 3;
const int [NU\_SVR](class.svm#svm.constants.nu-svr) = 4;
const int [KERNEL\_LINEAR](class.svm#svm.constants.kernel-linear) = 0;
const int [KERNEL\_POLY](class.svm#svm.constants.kernel-poly) = 1;
const int [KERNEL\_RBF](class.svm#svm.constants.kernel-rbf) = 2;
const int [KERNEL\_SIGMOID](class.svm#svm.constants.kernel-sigmoid) = 3;
const int [KERNEL\_PRECOMPUTED](class.svm#svm.constants.kernel-precomputed) = 4;
const int [OPT\_TYPE](class.svm#svm.constants.opt-type) = 101;
const int [OPT\_KERNEL\_TYPE](class.svm#svm.constants.opt-kernel-type) = 102;
const int [OPT\_DEGREE](class.svm#svm.constants.opt-degree) = 103;
const int [OPT\_SHRINKING](class.svm#svm.constants.opt-shrinking) = 104;
const int [OPT\_PROPABILITY](class.svm#svm.constants.opt-propability) = 105;
const int [OPT\_GAMMA](class.svm#svm.constants.opt-gamma) = 201;
const int [OPT\_NU](class.svm#svm.constants.opt-nu) = 202;
const int [OPT\_EPS](class.svm#svm.constants.opt-eps) = 203;
const int [OPT\_P](class.svm#svm.constants.opt-p) = 204;
const int [OPT\_COEF\_ZERO](class.svm#svm.constants.opt-coef-zero) = 205;
const int [OPT\_C](class.svm#svm.constants.opt-c) = 206;
const int [OPT\_CACHE\_SIZE](class.svm#svm.constants.opt-cache-size) = 207; /\* Methods \*/ public [\_\_construct](svm.construct)()
```
public svm::crossvalidate(array $problem, int $number_of_folds): float
```
```
public getOptions(): array
```
```
public setOptions(array $params): bool
```
```
public svm::train(array $problem, array $weights = ?): SVMModel
```
} Predefined Constants
--------------------
SVM Constants
-------------
**`SVM::C_SVC`** The basic C\_SVC SVM type. The default, and a good starting point
**`SVM::NU_SVC`** The NU\_SVC type uses a different, more flexible, error weighting
**`SVM::ONE_CLASS`** One class SVM type. Train just on a single class, using outliers as negative examples
**`SVM::EPSILON_SVR`** A SVM type for regression (predicting a value rather than just a class)
**`SVM::NU_SVR`** A NU style SVM regression type
**`SVM::KERNEL_LINEAR`** A very simple kernel, can work well on large document classification problems
**`SVM::KERNEL_POLY`** A polynomial kernel
**`SVM::KERNEL_RBF`** The common Gaussian RBD kernel. Handles non-linear problems well and is a good default for classification
**`SVM::KERNEL_SIGMOID`** A kernel based on the sigmoid function. Using this makes the SVM very similar to a two layer sigmoid based neural network
**`SVM::KERNEL_PRECOMPUTED`** A precomputed kernel - currently unsupported.
**`SVM::OPT_TYPE`** The options key for the SVM type
**`SVM::OPT_KERNEL_TYPE`** The options key for the kernel type
**`SVM::OPT_DEGREE`** **`SVM::OPT_SHRINKING`** Training parameter, boolean, for whether to use the shrinking heuristics
**`SVM::OPT_PROBABILITY`** Training parameter, boolean, for whether to collect and use probability estimates
**`SVM::OPT_GAMMA`** Algorithm parameter for Poly, RBF and Sigmoid kernel types.
**`SVM::OPT_NU`** The option key for the nu parameter, only used in the NU\_ SVM types
**`SVM::OPT_EPS`** The option key for the Epsilon parameter, used in epsilon regression
**`SVM::OPT_P`** Training parameter used by Episilon SVR regression
**`SVM::OPT_COEF_ZERO`** Algorithm parameter for poly and sigmoid kernels
**`SVM::OPT_C`** The option for the cost parameter that controls tradeoff between errors and generality - effectively the penalty for misclassifying training examples.
**`SVM::OPT_CACHE_SIZE`** Memory cache size, in MB
Table of Contents
-----------------
* [SVM::\_\_construct](svm.construct) — Construct a new SVM object
* [SVM::crossvalidate](svm.crossvalidate) — Test training params on subsets of the training data
* [SVM::getOptions](svm.getoptions) — Return the current training parameters
* [SVM::setOptions](svm.setoptions) — Set training parameters
* [SVM::train](svm.train) — Create a SVMModel based on training data
php DirectoryIterator::getType DirectoryIterator::getType
==========================
(PHP 5, PHP 7, PHP 8)
DirectoryIterator::getType — Determine the type of the current DirectoryIterator item
### Description
```
public DirectoryIterator::getType(): string
```
Determines which file type the current [DirectoryIterator](class.directoryiterator) item belongs to. One of `file`, `link`, or `dir`.
### Parameters
This function has no parameters.
### Return Values
Returns a string representing the type of the file. May be one of `file`, `link`, or `dir`.
### Examples
**Example #1 **DirectoryIterator::getType()** example**
```
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
foreach ($iterator as $fileinfo) {
echo $fileinfo->getFilename() . " " . $fileinfo->getType() . "\n";
}
?>
```
The above example will output something similar to:
```
. dir
.. dir
apple.jpg file
banana.jpg file
example.php file
pear.jpg file
```
### See Also
* [DirectoryIterator::isDir()](directoryiterator.isdir) - Determine if current DirectoryIterator item is a directory
* [DirectoryIterator::isDot()](directoryiterator.isdot) - Determine if current DirectoryIterator item is '.' or '..'
* [DirectoryIterator::isFile()](directoryiterator.isfile) - Determine if current DirectoryIterator item is a regular file
* [DirectoryIterator::isLink()](directoryiterator.islink) - Determine if current DirectoryIterator item is a symbolic link
php str_ends_with str\_ends\_with
===============
(PHP 8)
str\_ends\_with — Checks if a string ends with a given substring
### Description
```
str_ends_with(string $haystack, string $needle): bool
```
Performs a case-sensitive check indicating if `haystack` ends with `needle`.
### Parameters
`haystack`
The string to search in.
`needle`
The substring to search for in the `haystack`.
### Return Values
Returns **`true`** if `haystack` ends with `needle`, **`false`** otherwise.
### Examples
**Example #1 Using the empty string `''`**
```
<?php
if (str_ends_with('abc', '')) {
echo "All strings end with the empty string";
}
?>
```
The above example will output:
```
All strings end with the empty string
```
**Example #2 Showing case-sensitivity**
```
<?php
$string = 'The lazy fox jumped over the fence';
if (str_ends_with($string, 'fence')) {
echo "The string ends with 'fence'\n";
}
if (str_ends_with($string, 'Fence')) {
echo 'The string ends with "fence"';
} else {
echo '"fence" was not found because the case does not match';
}
?>
```
The above example will output:
```
The string ends with 'fence'
"fence" was not found because the case does not match
```
### Notes
> **Note**: This function is binary-safe.
>
>
### See Also
* [str\_contains()](function.str-contains) - Determine if a string contains a given substring
* [str\_starts\_with()](function.str-starts-with) - Checks if a string starts with a given substring
* [stripos()](function.stripos) - Find the position of the first occurrence of a case-insensitive substring in a string
* [strrpos()](function.strrpos) - Find the position of the last occurrence of a substring in a string
* [strripos()](function.strripos) - Find the position of the last occurrence of a case-insensitive substring in a string
* [strstr()](function.strstr) - Find the first occurrence of a string
* [strpbrk()](function.strpbrk) - Search a string for any of a set of characters
* [substr()](function.substr) - Return part of a string
* [preg\_match()](function.preg-match) - Perform a regular expression match
| programming_docs |
php curl_share_errno curl\_share\_errno
==================
(PHP 7 >= 7.1.0, PHP 8)
curl\_share\_errno — Return the last share curl error number
### Description
```
curl_share_errno(CurlShareHandle $share_handle): int
```
Return an integer containing the last share curl error number.
### Parameters
`share_handle` A cURL share handle returned by [curl\_share\_init()](function.curl-share-init).
### Return Values
Returns an integer containing the last share curl error number, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | The function no longer returns **`false`** on failure. |
| 8.0.0 | `share_handle` expects a [CurlShareHandle](class.curlsharehandle) instance now; previously, a resource was expected. |
### See Also
* [curl\_errno()](function.curl-errno) - Return the last error number
php GMP::__unserialize GMP::\_\_unserialize
====================
(PHP 8 >= 8.1.0)
GMP::\_\_unserialize — Deserializes the `data` parameter into a GMP object
### Description
```
public GMP::__unserialize(array $data): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`data`
The value being deserialized.
### Return Values
No value is returned.
php QuickHashIntHash::update QuickHashIntHash::update
========================
(PECL quickhash >= Unknown)
QuickHashIntHash::update — This method updates an entry in the hash with a new value
### Description
```
public QuickHashIntHash::update(int $key, int $value): bool
```
This method updates an entry with a new value, and returns whether the entry was update. If there are duplicate keys, only the first found element will get an updated value. Use **`QuickHashIntHash::CHECK_FOR_DUPES`** during hash creation to prevent duplicate keys from being part of the hash.
### Parameters
`key`
The key of the entry to update.
`value`
The new value to update the entry with.
### Return Values
**`true`** when the entry was found and updated, and **`false`** if the entry was not part of the hash already.
### Examples
**Example #1 **QuickHashIntHash::update()** example**
```
<?php
$hash = new QuickHashIntHash( 1024 );
var_dump( $hash->add( 141421, 173205 ) );
var_dump( $hash->update( 141421, 223606 ) );
var_dump( $hash->get( 141421 ) );
?>
```
The above example will output something similar to:
```
bool(true)
bool(true)
int(223606)
```
php sodium_crypto_pwhash_scryptsalsa208sha256_str_verify sodium\_crypto\_pwhash\_scryptsalsa208sha256\_str\_verify
=========================================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_pwhash\_scryptsalsa208sha256\_str\_verify — Verify that the password is a valid password verification string
### Description
```
sodium_crypto_pwhash_scryptsalsa208sha256_str_verify(string $hash, string $password): bool
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`hash`
`password`
### Return Values
php Ds\Set::__construct Ds\Set::\_\_construct
=====================
(PECL ds >= 1.0.0)
Ds\Set::\_\_construct — Creates a new instance
### Description
public **Ds\Set::\_\_construct**([mixed](language.types.declarations#language.types.declarations.mixed) `$values` = []) Creates a new instance, using either a [traversable](class.traversable) object or an array for the initial `values`.
### Parameters
`values`
A traversable object or an array to use for the initial values.
### Examples
**Example #1 **Ds\Set::\_\_construct()** example**
```
<?php
$set = new \Ds\Set();
var_dump($set);
$set = new \Ds\Set([1, 2, 3]);
var_dump($set);
?>
```
The above example will output something similar to:
```
object(Ds\Set)#1 (0) {
}
object(Ds\Set)#2 (3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
```
php EvWatcher::clear EvWatcher::clear
================
(PECL ev >= 0.2.0)
EvWatcher::clear — Clear watcher pending status
### Description
```
public EvWatcher::clear(): int
```
If the watcher is pending, this method clears its pending status and returns its revents bitset(as if its callback was invoked). If the watcher isn't pending it does nothing and returns **`0`** .
Sometimes it can be useful to "poll" a watcher instead of waiting for its callback to be invoked, which can be accomplished with this function.
### Parameters
This function has no parameters.
### Return Values
In case if the watcher is pending, returns revents bitset as if the [watcher callback](https://www.php.net/manual/en/ev.watcher-callbacks.php) had been invoked. Otherwise returns **`0`** .
php The Socket class
The Socket class
================
Introduction
------------
(PHP 8)
A fully opaque class which replaces `Socket` resources as of PHP 8.0.0.
Class synopsis
--------------
final class **Socket** { }
php DOMXPath::registerNamespace DOMXPath::registerNamespace
===========================
(PHP 5, PHP 7, PHP 8)
DOMXPath::registerNamespace — Registers the namespace with the [DOMXPath](class.domxpath) object
### Description
```
public DOMXPath::registerNamespace(string $prefix, string $namespace): bool
```
Registers the `namespace` and `prefix` with the DOMXPath object.
### Parameters
`prefix`
The prefix.
`namespace`
The URI of the namespace.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php Imagick::addImage Imagick::addImage
=================
(PECL imagick 2, PECL imagick 3)
Imagick::addImage — Adds new image to Imagick object image list
### Description
```
public Imagick::addImage(Imagick $source): bool
```
Adds new image to Imagick object from the current position of the source object. After the operation iterator position is moved at the end of the list.
### Parameters
`source`
The source Imagick object
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
php Memcached::append Memcached::append
=================
(PECL memcached >= 0.1.0)
Memcached::append — Append data to an existing item
### Description
```
public Memcached::append(string $key, string $value): bool
```
**Memcached::append()** appends the given `value` string to the value of an existing item. The reason that `value` is forced to be a string is that appending mixed types is not well-defined.
>
> **Note**:
>
>
> If the **`Memcached::OPT_COMPRESSION`** is enabled, the operation will fail and a warning will be issued, because appending compressed data to a value that is potentially already compressed is not possible.
>
>
### Parameters
`key`
The key under which to store the value.
`value`
The string to append.
### Return Values
Returns **`true`** on success or **`false`** on failure. The [Memcached::getResultCode()](memcached.getresultcode) will return **`Memcached::RES_NOTSTORED`** if the key does not exist.
### Examples
**Example #1 **Memcached::append()** example**
```
<?php
$m = new Memcached();
$m->addServer('localhost', 11211);
$m->setOption(Memcached::OPT_COMPRESSION, false);
$m->set('foo', 'abc');
$m->append('foo', 'def');
var_dump($m->get('foo'));
?>
```
The above example will output:
```
string(6) "abcdef"
```
### See Also
* [Memcached::appendByKey()](memcached.appendbykey) - Append data to an existing item on a specific server
* [Memcached::prepend()](memcached.prepend) - Prepend data to an existing item
php Threaded::synchronized Threaded::synchronized
======================
(PECL pthreads >= 2.0.0)
Threaded::synchronized — Synchronization
### Description
```
public Threaded::synchronized(Closure $block, mixed ...$args): mixed
```
Executes the block while retaining the referenced objects synchronization lock for the calling context
### Parameters
`block`
The block of code to execute
`args`
Variable length list of arguments to use as function arguments to the block
### Return Values
The return value from the block
### Examples
**Example #1 Synchronizing**
```
<?php
class My extends Thread {
public function run() {
$this->synchronized(function($thread){
if (!$thread->done)
$thread->wait();
}, $this);
}
}
$my = new My();
$my->start();
$my->synchronized(function($thread){
$thread->done = true;
$thread->notify();
}, $my);
var_dump($my->join());
?>
```
The above example will output:
```
bool(true)
```
php IntlTimeZone::getRawOffset IntlTimeZone::getRawOffset
==========================
intltz\_get\_raw\_offset
========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlTimeZone::getRawOffset -- intltz\_get\_raw\_offset — Get the raw GMT offset (before taking daylight savings time into account
### Description
Object-oriented style (method):
```
public IntlTimeZone::getRawOffset(): int
```
Procedural style:
```
intltz_get_raw_offset(IntlTimeZone $timezone): int
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php PDOStatement::bindValue PDOStatement::bindValue
=======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 1.0.0)
PDOStatement::bindValue — Binds a value to a parameter
### Description
```
public PDOStatement::bindValue(string|int $param, mixed $value, int $type = PDO::PARAM_STR): bool
```
Binds a value to a corresponding named or question mark placeholder in the SQL statement that was used to prepare the statement.
### Parameters
`param`
Parameter identifier. For a prepared statement using named placeholders, this will be a parameter name of the form :name. For a prepared statement using question mark placeholders, this will be the 1-indexed position of the parameter.
`value`
The value to bind to the parameter.
`type`
Explicit data type for the parameter using the [`PDO::PARAM_*` constants](https://www.php.net/manual/en/pdo.constants.php).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Execute a prepared statement with named placeholders**
```
<?php
/* Execute a prepared statement by binding PHP variables */
$calories = 150;
$colour = 'red';
$sth = $dbh->prepare('SELECT name, colour, calories
FROM fruit
WHERE calories < :calories AND colour = :colour');
$sth->bindValue('calories', $calories, PDO::PARAM_INT);
/* Names can be prefixed with colons ":" too (optional) */
$sth->bindValue(':colour', $colour, PDO::PARAM_STR);
$sth->execute();
?>
```
**Example #2 Execute a prepared statement with question mark placeholders**
```
<?php
/* Execute a prepared statement by binding PHP variables */
$calories = 150;
$colour = 'red';
$sth = $dbh->prepare('SELECT name, colour, calories
FROM fruit
WHERE calories < ? AND colour = ?');
$sth->bindValue(1, $calories, PDO::PARAM_INT);
$sth->bindValue(2, $colour, PDO::PARAM_STR);
$sth->execute();
?>
```
### See Also
* [PDO::prepare()](pdo.prepare) - Prepares a statement for execution and returns a statement object
* [PDOStatement::execute()](pdostatement.execute) - Executes a prepared statement
* [PDOStatement::bindParam()](pdostatement.bindparam) - Binds a parameter to the specified variable name
php gnupg_gettrustlist gnupg\_gettrustlist
===================
(PECL gnupg >= 0.5)
gnupg\_gettrustlist — Search the trust items
### Description
```
gnupg_gettrustlist(resource $identifier, string $pattern): array
```
### Parameters
`identifier`
The gnupg identifier, from a call to [gnupg\_init()](function.gnupg-init) or **gnupg**.
`pattern`
Expression to limit the list of trust items to only the ones matching the pattern.
### Return Values
On success, this function returns an array of trust items. On failure, this function returns **`null`**.
### Examples
**Example #1 Procedural **gnupg\_gettrustlist()** example**
```
<?php
$res = gnupg_init();
$items = gnupg_gettrustlist($res);
print_r($items);
?>
```
**Example #2 OO **gnupg\_gettrustlist()** example**
```
<?php
$gpg = new gnupg();
$items = $gpg->gettrustlist();
print_r($items);
?>
```
php EventBufferEvent::setPriority EventBufferEvent::setPriority
=============================
(PECL event >= 1.2.6-beta)
EventBufferEvent::setPriority — Assign a priority to a bufferevent
### Description
```
public EventBufferEvent::setPriority( int $priority ): bool
```
Assign a priority to a bufferevent
**Warning** Only supported for socket buffer events
### Parameters
`priority` Priority value.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php The FTP\Connection class
The FTP\Connection class
========================
Introduction
------------
(PHP 8 >= 8.1.0)
A fully opaque class which replaces a `ftp` resource as of PHP 8.1.0.
Class synopsis
--------------
final class **FTP\Connection** { }
php PharFileInfo::decompress PharFileInfo::decompress
========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
PharFileInfo::decompress — Decompresses the current Phar entry within the phar
### Description
```
public PharFileInfo::decompress(): bool
```
This method decompresses the file inside the Phar archive. Depending on how the file is compressed, the [bzip2](https://www.php.net/manual/en/ref.bzip2.php) or [zlib](https://www.php.net/manual/en/ref.zlib.php) extensions must be enabled to take advantage of this feature. As with all functionality that modifies the contents of a phar, the [phar.readonly](https://www.php.net/manual/en/phar.configuration.php#ini.phar.readonly) INI variable must be off in order to succeed if the file is within a [Phar](class.phar) archive. Files within [PharData](class.phardata) archives do not have this restriction.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
Throws [BadMethodCallException](class.badmethodcallexception) if the [phar.readonly](https://www.php.net/manual/en/phar.configuration.php#ini.phar.readonly) INI variable is on, or if the [bzip2](https://www.php.net/manual/en/ref.bzip2.php)/[zlib](https://www.php.net/manual/en/ref.zlib.php) extension is not available.
### Examples
**Example #1 A **PharFileInfo::decompress()** example**
```
<?php
try {
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
$p['myfile.txt'] = 'hi';
$file = $p['myfile.txt'];
$file->compress(Phar::GZ);
var_dump($file->isCompressed());
$p['myfile.txt']->decompress();
var_dump($file->isCompressed());
} catch (Exception $e) {
echo 'Create/modify failed for my.phar: ', $e;
}
?>
```
The above example will output:
```
int(4096)
bool(false)
```
### See Also
* [PharFileInfo::getCompressedSize()](pharfileinfo.getcompressedsize) - Returns the actual size of the file (with compression) inside the Phar archive
* [PharFileInfo::isCompressed()](pharfileinfo.iscompressed) - Returns whether the entry is compressed
* [PharFileInfo::compress()](pharfileinfo.compress) - Compresses the current Phar entry with either zlib or bzip2 compression
* [Phar::canCompress()](phar.cancompress) - Returns whether phar extension supports compression using either zlib or bzip2
* [Phar::isCompressed()](phar.iscompressed) - Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)
* [Phar::compressFiles()](phar.compressfiles) - Compresses all files in the current Phar archive
* [Phar::decompressFiles()](phar.decompressfiles) - Decompresses all files in the current Phar archive
* [Phar::compress()](phar.compress) - Compresses the entire Phar archive using Gzip or Bzip2 compression
* [Phar::decompress()](phar.decompress) - Decompresses the entire Phar archive
* [Phar::getSupportedCompression()](phar.getsupportedcompression) - Return array of supported compression algorithms
php XMLWriter::writeDtdAttlist XMLWriter::writeDtdAttlist
==========================
xmlwriter\_write\_dtd\_attlist
==============================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::writeDtdAttlist -- xmlwriter\_write\_dtd\_attlist — Write full DTD AttList tag
### Description
Object-oriented style
```
public XMLWriter::writeDtdAttlist(string $name, string $content): bool
```
Procedural style
```
xmlwriter_write_dtd_attlist(XMLWriter $writer, string $name, string $content): bool
```
Writes a DTD attribute list.
### Parameters
`writer`
Only for procedural calls. The [XMLWriter](class.xmlwriter) instance that is being modified. This object is returned from a call to [xmlwriter\_open\_uri()](xmlwriter.openuri) or [xmlwriter\_open\_memory()](xmlwriter.openmemory).
`name`
The name of the DTD attribute list.
`content`
The content of the DTD attribute list.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `writer` expects an [XMLWriter](class.xmlwriter) instance now; previously, a resource was expected. |
### See Also
* [XMLWriter::startDtdAttlist()](xmlwriter.startdtdattlist) - Create start DTD AttList
* [XMLWriter::endDtdAttlist()](xmlwriter.enddtdattlist) - End current DTD AttList
php tanh tanh
====
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
tanh — Hyperbolic tangent
### Description
```
tanh(float $num): float
```
Returns the hyperbolic tangent of `num`, defined as `sinh($num)/cosh($num)`.
### Parameters
`num`
The argument to process
### Return Values
The hyperbolic tangent of `num`
### See Also
* [tan()](function.tan) - Tangent
* [atanh()](function.atanh) - Inverse hyperbolic tangent
* [sinh()](function.sinh) - Hyperbolic sine
* [cosh()](function.cosh) - Hyperbolic cosine
php EventBufferEvent::sslGetProtocol EventBufferEvent::sslGetProtocol
================================
(PECL event >= 1.10.0)
EventBufferEvent::sslGetProtocol — Returns the name of the protocol used for current SSL connection
### Description
```
public EventBufferEvent::sslGetProtocol(): string
```
Returns the name of the protocol used for current SSL connection.
>
> **Note**:
>
>
> This function is available only if `Event` is compiled with OpenSSL support.
>
>
### Parameters
This function has no parameters.
### Return Values
Returns the name of the protocol used for current SSL connection.
php SplObjectStorage::offsetExists SplObjectStorage::offsetExists
==============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplObjectStorage::offsetExists — Checks whether an object exists in the storage
### Description
```
public SplObjectStorage::offsetExists(object $object): bool
```
Checks whether an object exists in the storage.
>
> **Note**:
>
>
> **SplObjectStorage::offsetExists()** is an alias of [SplObjectStorage::contains()](splobjectstorage.contains).
>
>
### Parameters
`object`
The object to look for.
### Return Values
Returns **`true`** if the object exists in the storage, and **`false`** otherwise.
### Examples
**Example #1 **SplObjectStorage::offsetExists()** example**
```
<?php
$s = new SplObjectStorage;
$o1 = new StdClass;
$o2 = new StdClass;
$s->attach($o1);
var_dump($s->offsetExists($o1)); // Similar to isset($s[$o1])
var_dump($s->offsetExists($o2)); // Similar to isset($s[$o2])
?>
```
The above example will output something similar to:
```
bool(true)
bool(false)
```
### See Also
* [SplObjectStorage::offsetSet()](splobjectstorage.offsetset) - Associates data to an object in the storage
* [SplObjectStorage::offsetGet()](splobjectstorage.offsetget) - Returns the data associated with an object
* [SplObjectStorage::offsetUnset()](splobjectstorage.offsetunset) - Removes an object from the storage
| programming_docs |
php SolrQuery::setMltCount SolrQuery::setMltCount
======================
(PECL solr >= 0.9.2)
SolrQuery::setMltCount — Set the number of similar documents to return for each result
### Description
```
public SolrQuery::setMltCount(int $count): SolrQuery
```
Set the number of similar documents to return for each result
### Parameters
`count`
The number of similar documents to return for each result
### Return Values
Returns the current SolrQuery object, if the return value is used.
php The ReturnTypeWillChange class
The ReturnTypeWillChange class
==============================
Introduction
------------
(PHP 8 >= 8.1.0)
Most non-final internal methods now require overriding methods to declare a compatible return type, otherwise a deprecated notice is emitted during inheritance validation. In case the return type cannot be declared for an overriding method due to PHP cross-version compatibility concerns, a `#[ReturnTypeWillChange]` attribute can be added to silence the deprecation notice.
Class synopsis
--------------
final class **ReturnTypeWillChange** { } See Also
--------
[Attributes overview](https://www.php.net/manual/en/language.attributes.php)
php stream_socket_get_name stream\_socket\_get\_name
=========================
(PHP 5, PHP 7, PHP 8)
stream\_socket\_get\_name — Retrieve the name of the local or remote sockets
### Description
```
stream_socket_get_name(resource $socket, bool $remote): string|false
```
Returns the local or remote name of a given socket connection.
### Parameters
`socket`
The socket to get the name of.
`remote`
If set to **`true`** the `remote` socket name will be returned, if set to **`false`** the `local` socket name will be returned.
### Return Values
The name of the socket, or **`false`** on failure.
### See Also
* [stream\_socket\_accept()](function.stream-socket-accept) - Accept a connection on a socket created by stream\_socket\_server
php crypt crypt
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
crypt — One-way string hashing
**Warning**This function is not (yet) binary safe!
### Description
```
crypt(string $string, string $salt): string
```
**crypt()** will return a hashed string using the standard Unix DES-based algorithm or alternative algorithms. [password\_verify()](function.password-verify) is compatible with **crypt()**. Therefore, password hashes created by **crypt()** can be used with [password\_verify()](function.password-verify).
Prior to PHP 8.0.0, the `salt` parameter was optional. However, **crypt()** creates a weak hash without the `salt`, and raises an **`E_NOTICE`** error without it. Make sure to specify a strong enough salt for better security.
[password\_hash()](function.password-hash) uses a strong hash, generates a strong salt, and applies proper rounds automatically. [password\_hash()](function.password-hash) is a simple **crypt()** wrapper and compatible with existing password hashes. Use of [password\_hash()](function.password-hash) is encouraged.
The hash type is triggered by the salt argument. If no salt is provided, PHP will auto-generate either a standard two character (DES) salt, or a twelve character (MD5), depending on the availability of MD5 crypt(). PHP sets a constant named **`CRYPT_SALT_LENGTH`** which indicates the longest valid salt allowed by the available hashes.
The standard DES-based **crypt()** returns the salt as the first two characters of the output. It also only uses the first eight characters of `string`, so longer strings that start with the same eight characters will generate the same result (when the same salt is used).
The following hash types are supported:
* **`CRYPT_STD_DES`** - Standard DES-based hash with a two character salt from the alphabet "./0-9A-Za-z". Using invalid characters in the salt will cause crypt() to fail.
* **`CRYPT_EXT_DES`** - Extended DES-based hash. The "salt" is a 9-character string consisting of an underscore followed by 4 characters of iteration count and 4 characters of salt. Each of these 4-character strings encode 24 bits, least significant character first. The values `0` to `63` are encoded as `./0-9A-Za-z`. Using invalid characters in the salt will cause crypt() to fail.
* **`CRYPT_MD5`** - MD5 hashing with a twelve character salt starting with $1$
* **`CRYPT_BLOWFISH`** - Blowfish hashing with a salt as follows: "$2a$", "$2x$" or "$2y$", a two digit cost parameter, "$", and 22 characters from the alphabet "./0-9A-Za-z". Using characters outside of this range in the salt will cause crypt() to return a zero-length string. The two digit cost parameter is the base-2 logarithm of the iteration count for the underlying Blowfish-based hashing algorithm and must be in range 04-31, values outside this range will cause crypt() to fail. "$2x$" hashes are potentially weak; "$2a$" hashes are compatible and mitigate this weakness. For new hashes, "$2y$" should be used.
* **`CRYPT_SHA256`** - SHA-256 hash with a sixteen character salt prefixed with $5$. If the salt string starts with 'rounds=<N>$', the numeric value of N is used to indicate how many times the hashing loop should be executed, much like the cost parameter on Blowfish. The default number of rounds is 5000, there is a minimum of 1000 and a maximum of 999,999,999. Any selection of N outside this range will be truncated to the nearest limit.
* **`CRYPT_SHA512`** - SHA-512 hash with a sixteen character salt prefixed with $6$. If the salt string starts with 'rounds=<N>$', the numeric value of N is used to indicate how many times the hashing loop should be executed, much like the cost parameter on Blowfish. The default number of rounds is 5000, there is a minimum of 1000 and a maximum of 999,999,999. Any selection of N outside this range will be truncated to the nearest limit.
### Parameters
`string`
The string to be hashed.
**Caution** Using the **`CRYPT_BLOWFISH`** algorithm, will result in the `string` parameter being truncated to a maximum length of 72 bytes.
`salt`
A salt string to base the hashing on. If not provided, the behaviour is defined by the algorithm implementation and can lead to unexpected results.
### Return Values
Returns the hashed string or a string that is shorter than 13 characters and is guaranteed to differ from the salt on failure.
**Warning** When validating passwords, a string comparison function that isn't vulnerable to timing attacks should be used to compare the output of **crypt()** to the previously known hash. PHP provides [hash\_equals()](function.hash-equals) for this purpose.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | The `salt` is no longer optional. |
### Examples
**Example #1 **crypt()** examples**
```
<?php
// let the salt be automatically generated; not recommended
$hashed_password = crypt('mypassword');
/* You should pass the entire results of crypt() as the salt for comparing a
password, to avoid problems when different hashing algorithms are used. (As
it says above, standard DES-based password hashing uses a 2-character salt,
but MD5-based hashing uses 12.) */
if (hash_equals($hashed_password, crypt($user_input, $hashed_password))) {
echo "Password verified!";
}
?>
```
**Example #2 Using **crypt()** with htpasswd**
```
<?php
// Set the password
$password = 'mypassword';
// Get the hash, letting the salt be automatically generated; not recommended
$hash = crypt($password);
?>
```
**Example #3 Using **crypt()** with different hash types**
```
<?php
/* These salts are examples only, and should not be used verbatim in your code.
You should generate a distinct, correctly-formatted salt for each password.
*/
echo 'Standard DES: ',
crypt('rasmuslerdorf', 'rl'),
"\n";
echo 'Extended DES: ',
crypt('rasmuslerdorf', '_J9..rasm'),
"\n";
echo 'MD5: ',
crypt('rasmuslerdorf', '$1$rasmusle$'),
"\n";
echo 'Blowfish: ',
crypt('rasmuslerdorf', '$2a$07$usesomesillystringforsalt$'),
"\n";
echo 'SHA-256: ',
crypt('rasmuslerdorf', '$5$rounds=5000$usesomesillystringforsalt$'),
"\n";
echo 'SHA-512: ',
crypt('rasmuslerdorf', '$6$rounds=5000$usesomesillystringforsalt$'),
"\n";
?>
```
The above example will output something similar to:
```
Standard DES: rl.3StKT.4T8M
Extended DES: _J9..rasmBYk8r9AiWNc
MD5: $1$rasmusle$rISCgZzpwk3UhDidwXvin0
Blowfish: $2y$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi
SHA-256: $5$rounds=5000$usesomesillystri$KqJWpanXZHKq2BOB43TSaYhEWsQ1Lr5QNyPCDH/Tp.6
SHA-512: $6$rounds=5000$usesomesillystri$D4IrlXatmP7rx3P3InaxBeoomnAihCKRVQP22JZ6EY47Wc6BkroIuUUBOov1i.S5KPgErtP/EN5mcO.ChWQW21
```
### Notes
> **Note**: There is no decrypt function, since **crypt()** uses a one-way algorithm.
>
>
### See Also
* [hash\_equals()](function.hash-equals) - Timing attack safe string comparison
* [password\_hash()](function.password-hash) - Creates a password hash
* [md5()](function.md5) - Calculate the md5 hash of a string
* The Unix man page for your crypt function for more information
php odbc_fetch_array odbc\_fetch\_array
==================
(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)
odbc\_fetch\_array — Fetch a result row as an associative array
### Description
```
odbc_fetch_array(resource $statement, int $row = -1): array|false
```
Fetch an associative array from an ODBC query.
### Parameters
`statement`
The result resource from [odbc\_exec()](function.odbc-exec).
`row`
Optionally choose which row number to retrieve.
### Return Values
Returns an array that corresponds to the fetched row, or **`false`** if there are no more rows.
### Notes
> **Note**: This function exists when compiled with DBMaker, IBM DB2 or UnixODBC support.
>
>
### See Also
* [odbc\_fetch\_row()](function.odbc-fetch-row) - Fetch a row
* [odbc\_fetch\_object()](function.odbc-fetch-object) - Fetch a result row as an object
* [odbc\_num\_rows()](function.odbc-num-rows) - Number of rows in a result
php ReflectionFunctionAbstract::hasTentativeReturnType ReflectionFunctionAbstract::hasTentativeReturnType
==================================================
(PHP 8 >= 8.1.0)
ReflectionFunctionAbstract::hasTentativeReturnType — Returns whether the function has a tentative return type
### Description
```
public ReflectionFunctionAbstract::hasTentativeReturnType(): bool
```
Returns whether the function has a tentative return type.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the function has a tentative return type, otherwise **`false`**.
### Examples
**Example #1 **ReflectionFunctionAbstract::hasTentativeReturnType()** example**
```
<?php
$method = new ReflectionMethod(\ArrayAccess::class, 'offsetGet');
var_dump($method->hasTentativeReturnType());
```
The above example will output:
```
bool(true)
```
### See Also
* [ReflectionFunctionAbstract::getTentativeReturnType()](reflectionfunctionabstract.gettentativereturntype) - Returns the tentative return type associated with the function
* [ReflectionFunctionAbstract::hasReturnType()](reflectionfunctionabstract.hasreturntype) - Checks if the function has a specified return type
* [Return Type Compatibility with Internal Classes](language.oop5.inheritance#language.oop5.inheritance.internal-classes)
php MultipleIterator::next MultipleIterator::next
======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
MultipleIterator::next — Moves all attached iterator instances forward
### Description
```
public MultipleIterator::next(): void
```
Moves all attached iterator instances forward.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### See Also
* [MultipleIterator::rewind()](multipleiterator.rewind) - Rewinds all attached iterator instances
php EventDnsBase::setOption EventDnsBase::setOption
=======================
(PECL event >= 1.2.6-beta)
EventDnsBase::setOption — Set the value of a configuration option
### Description
```
public EventDnsBase::setOption( string $option , string $value ): bool
```
Set the value of a configuration option.
### Parameters
`option` The currently available configuration options are: `"ndots"` , `"timeout"` , `"max-timeouts"` , `"max-inflight"` , and `"attempts"` .
`value` Option value.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php The Yaf_Exception_StartupError class
The Yaf\_Exception\_StartupError class
======================================
Introduction
------------
(Yaf >=1.0.0)
Class synopsis
--------------
class **Yaf\_Exception\_StartupError** extends [Yaf\_Exception](class.yaf-exception) { /\* Properties \*/ /\* Methods \*/ /\* Inherited methods \*/
```
public Yaf_Exception::getPrevious(): void
```
}
php Imagick::rollImage Imagick::rollImage
==================
(PECL imagick 2, PECL imagick 3)
Imagick::rollImage — Offsets an image
### Description
```
public Imagick::rollImage(int $x, int $y): bool
```
Offsets an image as defined by x and y.
### Parameters
`x`
The X offset.
`y`
The Y offset.
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::rollImage()****
```
<?php
function rollImage($imagePath, $rollX, $rollY) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->rollimage($rollX, $rollY);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php openssl_pkcs7_sign openssl\_pkcs7\_sign
====================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
openssl\_pkcs7\_sign — Sign an S/MIME message
### Description
```
openssl_pkcs7_sign(
string $input_filename,
string $output_filename,
OpenSSLCertificate|string $certificate,
OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key,
?array $headers,
int $flags = PKCS7_DETACHED,
?string $untrusted_certificates_filename = null
): bool
```
**openssl\_pkcs7\_sign()** takes the contents of the file named `input_filename` and signs them using the certificate and its matching private key specified by `certificate` and `private_key` parameters.
### Parameters
`input_filename`
The input file you are intending to digitally sign.
`output_filename`
The file which the digital signature will be written to.
`certificate`
The X.509 certificate used to digitally sign `input_filename`. See [Key/Certificate parameters](https://www.php.net/manual/en/openssl.certparams.php) for a list of valid values.
`private_key`
`private_key` is the private key corresponding to `certificate`. See [Public/Private Key parameters](https://www.php.net/manual/en/openssl.certparams.php) for a list of valid values.
`headers`
`headers` is an array of headers that will be prepended to the data after it has been signed (see [openssl\_pkcs7\_encrypt()](function.openssl-pkcs7-encrypt) for more information about the format of this parameter).
`flags`
`flags` can be used to alter the output - see [PKCS7 constants](https://www.php.net/manual/en/openssl.pkcs7.flags.php).
`untrusted_certificates_filename`
`untrusted_certificates_filename` specifies the name of a file containing a bunch of extra certificates to include in the signature which can for example be used to help the recipient to verify the certificate that you used.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `certificate` accepts an [OpenSSLCertificate](class.opensslcertificate) instance now; previously, a [resource](language.types.resource) of type `OpenSSL X.509 CSR` was accepted. |
| 8.0.0 | `private_key` accepts an [OpenSSLAsymmetricKey](class.opensslasymmetrickey) or [OpenSSLCertificate](class.opensslcertificate) instance now; previously, a [resource](language.types.resource) of type `OpenSSL key` or `OpenSSL X.509 CSR` was accepted. |
### Examples
**Example #1 **openssl\_pkcs7\_sign()** example**
```
<?php
// the message you want to sign so that recipient can be sure it was you that
// sent it
$data = <<<EOD
You have my authorization to spend $10,000 on dinner expenses.
The CEO
EOD;
// save message to file
$fp = fopen("msg.txt", "w");
fwrite($fp, $data);
fclose($fp);
// encrypt it
if (openssl_pkcs7_sign("msg.txt", "signed.txt", "file://mycert.pem",
array("file://mycert.pem", "mypassphrase"),
array("To" => "[email protected]", // keyed syntax
"From: HQ <[email protected]>", // indexed syntax
"Subject" => "Eyes only")
)) {
// message signed - send it!
exec(ini_get("sendmail_path") . " < signed.txt");
}
?>
```
php sodium_crypto_secretstream_xchacha20poly1305_pull sodium\_crypto\_secretstream\_xchacha20poly1305\_pull
=====================================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_secretstream\_xchacha20poly1305\_pull — Decrypt a chunk of data from an encrypted stream
### Description
```
sodium_crypto_secretstream_xchacha20poly1305_pull(string &$state, string $ciphertext, string $additional_data = ""): array|false
```
Decrypt a chunk of data from an encrypted stream.
### Parameters
`state`
See [sodium\_crypto\_secretstream\_xchacha20poly1305\_init\_pull()](function.sodium-crypto-secretstream-xchacha20poly1305-init-pull) and [sodium\_crypto\_secretstream\_xchacha20poly1305\_init\_push()](function.sodium-crypto-secretstream-xchacha20poly1305-init-push)
`ciphertext`
The ciphertext chunk to decrypt.
`additional_data`
Optional additional data to include in the authentication tag.
### Return Values
An array with two values:
* string; The decrypted chunk
* int; An optional tag (if provided during push). Possible values:
+ **`SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE`**: the most common tag, that doesn't add any information about the nature of the message.
+ **`SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_FINAL`**: indicates that the message marks the end of the stream, and erases the secret key used to encrypt the previous sequence.
+ **`SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_PUSH`**: indicates that the message marks the end of a set of messages, but not the end of the stream. For example, a huge JSON string sent as multiple chunks can use this tag to indicate to the application that the string is complete and that it can be decoded. But the stream itself is not closed, and more data may follow.
+ **`SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_REKEY`**: "forget" the key used to encrypt this message and the previous ones, and derive a new secret key.
php PharData::compressFiles PharData::compressFiles
=======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
PharData::compressFiles — Compresses all files in the current tar/zip archive
### Description
```
public PharData::compressFiles(int $compression): void
```
For tar-based archives, this method throws a [BadMethodCallException](class.badmethodcallexception), as compression of individual files within a tar archive is not supported by the file format. Use [PharData::compress()](phardata.compress) to compress an entire tar-based archive.
For Zip-based archives, this method compresses all files in the archive using the specified compression. The [zlib](https://www.php.net/manual/en/ref.zlib.php) or [bzip2](https://www.php.net/manual/en/ref.bzip2.php) extensions must be enabled to take advantage of this feature. In addition, if any files are already compressed using bzip2/zlib compression, the respective extension must be enabled in order to decompress the files prior to re-compressing.
### Parameters
`compression`
Compression must be one of `Phar::GZ`, `Phar::BZ2` to add compression, or `Phar::NONE` to remove compression.
### Return Values
No value is returned.
### Errors/Exceptions
Throws [BadMethodCallException](class.badmethodcallexception) if the [phar.readonly](https://www.php.net/manual/en/phar.configuration.php#ini.phar.readonly) INI variable is on, the [zlib](https://www.php.net/manual/en/ref.zlib.php) extension is not available, or if any files are compressed using bzip2 compression and the [bzip2](https://www.php.net/manual/en/ref.bzip2.php) extension is not enabled.
### Examples
**Example #1 A **PharData::compressFiles()** example**
```
<?php
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
$p['myfile.txt'] = 'hi';
$p['myfile2.txt'] = 'hi';
foreach ($p as $file) {
var_dump($file->getFileName());
var_dump($file->isCompressed());
var_dump($file->isCompressed(Phar::BZ2));
var_dump($file->isCompressed(Phar::GZ));
}
$p->compressFiles(Phar::GZ);
foreach ($p as $file) {
var_dump($file->getFileName());
var_dump($file->isCompressed());
var_dump($file->isCompressed(Phar::BZ2));
var_dump($file->isCompressed(Phar::GZ));
}
?>
```
The above example will output:
```
string(10) "myfile.txt"
bool(false)
bool(false)
bool(false)
string(11) "myfile2.txt"
bool(false)
bool(false)
bool(false)
string(10) "myfile.txt"
int(4096)
bool(false)
bool(true)
string(11) "myfile2.txt"
int(4096)
bool(false)
bool(true)
```
### See Also
* [PharFileInfo::getCompressedSize()](pharfileinfo.getcompressedsize) - Returns the actual size of the file (with compression) inside the Phar archive
* [PharFileInfo::isCompressed()](pharfileinfo.iscompressed) - Returns whether the entry is compressed
* [PharFileInfo::compress()](pharfileinfo.compress) - Compresses the current Phar entry with either zlib or bzip2 compression
* [PharFileInfo::decompress()](pharfileinfo.decompress) - Decompresses the current Phar entry within the phar
* [Phar::canCompress()](phar.cancompress) - Returns whether phar extension supports compression using either zlib or bzip2
* [Phar::isCompressed()](phar.iscompressed) - Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)
* [PharData::decompressFiles()](phardata.decompressfiles) - Decompresses all files in the current zip archive
* [Phar::getSupportedCompression()](phar.getsupportedcompression) - Return array of supported compression algorithms
* [PharData::compress()](phardata.compress) - Compresses the entire tar/zip archive using Gzip or Bzip2 compression
* [PharData::decompress()](phardata.decompress) - Decompresses the entire Phar archive
| programming_docs |
php EventHttpRequest::getResponseCode EventHttpRequest::getResponseCode
=================================
(PECL event >= 1.4.0-beta)
EventHttpRequest::getResponseCode — Returns the response code
### Description
```
public EventHttpRequest::getResponseCode(): int
```
Returns the response code.
### Parameters
This function has no parameters.
### Return Values
Returns the response code of the request.
### See Also
* [EventHttpRequest::getCommand()](eventhttprequest.getcommand) - Returns the request command(method)
* [EventHttpRequest::getHost()](eventhttprequest.gethost) - Returns the request host
* [EventHttpRequest::getUri()](eventhttprequest.geturi) - Returns the request URI
php DeflateContext::__construct DeflateContext::\_\_construct
=============================
(PHP 8)
DeflateContext::\_\_construct — Construct a new DeflateContext instance
### Description
public **DeflateContext::\_\_construct**() Throws an [Error](class.error), since [DeflateContext](class.deflatecontext) is not constructable directly. Use [deflate\_init()](function.deflate-init) instead.
### Parameters
This function has no parameters.
php mcrypt_enc_get_key_size mcrypt\_enc\_get\_key\_size
===========================
(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mcrypt\_enc\_get\_key\_size — Returns the maximum supported keysize of the opened mode
**Warning**This function has been *DEPRECATED* as of PHP 7.1.0 and *REMOVED* as of PHP 7.2.0. Relying on this function is highly discouraged.
### Description
```
mcrypt_enc_get_key_size(resource $td): int
```
Gets the maximum supported key size of the algorithm in bytes.
### Parameters
`td`
The encryption descriptor.
### Return Values
Returns the maximum supported key size of the algorithm in bytes.
php Gmagick::swirlimage Gmagick::swirlimage
===================
(PECL gmagick >= Unknown)
Gmagick::swirlimage — Swirls the pixels about the center of the image
### Description
```
public Gmagick::swirlimage(float $degrees): Gmagick
```
Swirls the pixels about the center of the image, where degrees indicates the sweep of the arc through which each pixel is moved. You get a more dramatic effect as the degrees move from 1 to 360.
### Parameters
`degrees`
Define the tightness of the swirling effect.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php Imagick::getImage Imagick::getImage
=================
(PECL imagick 2, PECL imagick 3)
Imagick::getImage — Returns a new Imagick object
### Description
```
public Imagick::getImage(): Imagick
```
Returns a new Imagick object with the current image sequence.
### Parameters
This function has no parameters.
### Return Values
Returns a new Imagick object with the current image sequence.
### Errors/Exceptions
Throws ImagickException on error.
php SolrServerException::getInternalInfo SolrServerException::getInternalInfo
====================================
(PECL solr >= 1.1.0, >=2.0.0)
SolrServerException::getInternalInfo — Returns internal information where the Exception was thrown
### Description
```
public SolrServerException::getInternalInfo(): array
```
Returns internal information where the Exception was thrown.
### Parameters
This function has no parameters.
### Return Values
Returns an array containing internal information where the error was thrown. Used only for debugging by extension developers.
php Memcached::increment Memcached::increment
====================
(PECL memcached >= 0.1.0)
Memcached::increment — Increment numeric item's value
### Description
```
public Memcached::increment(
string $key,
int $offset = 1,
int $initial_value = 0,
int $expiry = 0
): int|false
```
**Memcached::increment()** increments a numeric item's value by the specified `offset`. If the item's value is not numeric, an error will result. **Memcached::increment()** will set the item to the `initial_value` parameter if the key doesn't exist.
### Parameters
`key`
The key of the item to increment.
`offset`
The amount by which to increment the item's value.
`initial_value`
The value to set the item to if it doesn't currently exist.
`expiry`
The expiry time to set on the item.
### Return Values
Returns new item's value on success or **`false`** on failure.
### Examples
**Example #1 **Memcached::increment()** example**
```
<?php
$m = new Memcached();
$m->addServer('localhost', 11211);
$m->set('counter', 0);
$m->increment('counter');
$n = $m->increment('counter', 10);
var_dump($n);
$m->set('counter', 'abc');
$n = $m->increment('counter');
// ^ will fail due to item value not being numeric
var_dump($n);
?>
```
The above example will output:
```
int(11)
bool(false)
```
### See Also
* [Memcached::decrement()](memcached.decrement) - Decrement numeric item's value
* [Memcached::decrementByKey()](memcached.decrementbykey) - Decrement numeric item's value, stored on a specific server
* [Memcached::incrementByKey()](memcached.incrementbykey) - Increment numeric item's value, stored on a specific server
php mb_strlen mb\_strlen
==========
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
mb\_strlen — Get string length
### Description
```
mb_strlen(string $string, ?string $encoding = null): int
```
Gets the length of a string.
### Parameters
`string`
The string being checked for length.
`encoding`
The `encoding` parameter is the character encoding. If it is omitted or **`null`**, the internal character encoding value will be used.
### Return Values
Returns the number of characters in string `string` having character encoding `encoding`. A multi-byte character is counted as 1.
### Errors/Exceptions
If the encoding is unknown, an error of level **`E_WARNING`** is generated.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `encoding` is nullable now. |
### See Also
* [mb\_internal\_encoding()](function.mb-internal-encoding) - Set/Get internal character encoding
* [grapheme\_strlen()](function.grapheme-strlen) - Get string length in grapheme units
* [iconv\_strlen()](function.iconv-strlen) - Returns the character count of string
* [strlen()](function.strlen) - Get string length
php XMLWriter::writeElementNs XMLWriter::writeElementNs
=========================
xmlwriter\_write\_element\_ns
=============================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::writeElementNs -- xmlwriter\_write\_element\_ns — Write full namespaced element tag
### Description
Object-oriented style
```
public XMLWriter::writeElementNs(
?string $prefix,
string $name,
?string $namespace,
?string $content = null
): bool
```
Procedural style
```
xmlwriter_write_element_ns(
XMLWriter $writer,
?string $prefix,
string $name,
?string $namespace,
?string $content = null
): bool
```
Writes a full namespaced element tag.
### Parameters
`writer`
Only for procedural calls. The [XMLWriter](class.xmlwriter) instance that is being modified. This object is returned from a call to [xmlwriter\_open\_uri()](xmlwriter.openuri) or [xmlwriter\_open\_memory()](xmlwriter.openmemory).
`prefix`
The namespace prefix. If `prefix` is **`null`**, the namespace will be omitted.
`name`
The element name.
`namespace`
The namespace URI. If `namespace` is **`null`**, the namespace declaration will be omitted.
`content`
The element contents.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `writer` expects an [XMLWriter](class.xmlwriter) instance now; previously, a resource was expected. |
### See Also
* [XMLWriter::startElementNs()](xmlwriter.startelementns) - Create start namespaced element tag
* [XMLWriter::endElement()](xmlwriter.endelement) - End current element
* [XMLWriter::writeElement()](xmlwriter.writeelement) - Write full element tag
php openssl_x509_export_to_file openssl\_x509\_export\_to\_file
===============================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
openssl\_x509\_export\_to\_file — Exports a certificate to file
### Description
```
openssl_x509_export_to_file(OpenSSLCertificate|string $certificate, string $output_filename, bool $no_text = true): bool
```
**openssl\_x509\_export\_to\_file()** stores `certificate` into a file named by `output_filename` in a PEM encoded format.
### Parameters
`x509`
See [Key/Certificate parameters](https://www.php.net/manual/en/openssl.certparams.php) for a list of valid values.
`output_filename`
Path to the output file.
`no_text`
The optional parameter `notext` affects the verbosity of the output; if it is **`false`**, then additional human-readable information is included in the output. The default value of `notext` is **`true`**.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `certificate` accepts an [OpenSSLCertificate](class.opensslcertificate) instance now; previously, a [resource](language.types.resource) of type `OpenSSL X.509` was accepted. |
php StompException::getDetails StompException::getDetails
==========================
(PECL stomp >= 0.1.0)
StompException::getDetails — Get exception details
### Description
```
public StompException::getDetails(): string
```
Get exception details.
### Parameters
This function has no parameters.
### Return Values
string containing the error details.
php EventBufferEvent::setTimeouts EventBufferEvent::setTimeouts
=============================
(PECL event >= 1.2.6-beta)
EventBufferEvent::setTimeouts — Set the read and write timeout for a buffer event
### Description
```
public EventBufferEvent::setTimeouts( float $timeout_read , float $timeout_write ): bool
```
Set the read and write timeout for a buffer event
### Parameters
`timeout_read` Read timeout
`timeout_write` Write timeout
### Return Values
Returns **`true`** on success or **`false`** on failure.
php sqlsrv_field_metadata sqlsrv\_field\_metadata
=======================
(No version information available, might only be in Git)
sqlsrv\_field\_metadata — Retrieves metadata for the fields of a statement prepared by [sqlsrv\_prepare()](function.sqlsrv-prepare) or [sqlsrv\_query()](function.sqlsrv-query)
### Description
```
sqlsrv_field_metadata(resource $stmt): mixed
```
Retrieves metadata for the fields of a statement prepared by [sqlsrv\_prepare()](function.sqlsrv-prepare) or [sqlsrv\_query()](function.sqlsrv-query). **sqlsrv\_field\_metadata()** can be called on a statement before or after statement execution.
### Parameters
`stmt`
The statement resource for which metadata is returned.
### Return Values
Returns an array of arrays on success. Otherwise, **`false`** is returned. Each returned array is described by the following table:
**Array returned by sqlsrv\_field\_metadata**| Key | Description |
| --- | --- |
| Name | The name of the field. |
| Type | The numeric value for the SQL type. |
| Size | The number of characters for fields of character type, the number of bytes for fields of binary type, or **`null`** for other types. |
| Precision | The precision for types of variable precision, **`null`** for other types. |
| Scale | The scale for types of variable scale, **`null`** for other types. |
| Nullable | An enumeration indicating whether the column is nullable, not nullable, or if it is not known. |
For more information, see [» sqlsrv\_field\_metadata](http://msdn.microsoft.com/en-us/library/cc296197.aspx) in the Microsoft SQLSRV documentation. ### Examples
**Example #1 **sqlsrv\_field\_metadata()** example**
```
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"AdventureWorks", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT * FROM Table_1";
$stmt = sqlsrv_prepare( $conn, $sql );
foreach( sqlsrv_field_metadata( $stmt ) as $fieldMetadata ) {
foreach( $fieldMetadata as $name => $value) {
echo "$name: $value<br />";
}
echo "<br />";
}
?>
```
### See Also
* [sqlsrv\_client\_info()](function.sqlsrv-client-info) - Returns information about the client and specified connection
php Yaf_Config_Ini::offsetSet Yaf\_Config\_Ini::offsetSet
===========================
(Yaf >=1.0.0)
Yaf\_Config\_Ini::offsetSet — The offsetSet purpose
### Description
```
public Yaf_Config_Ini::offsetSet(string $name, string $value): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`name`
`value`
### Return Values
php Thread::start Thread::start
=============
(PECL pthreads >= 2.0.0)
Thread::start — Execution
### Description
```
public Thread::start(int $options = ?): bool
```
Will start a new Thread to execute the implemented run method
### Parameters
`options`
An optional mask of inheritance constants, by default PTHREADS\_INHERIT\_ALL
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Starting Threads**
```
<?php
class My extends Thread {
public function run() {
/** ... **/
}
}
$my = new My();
var_dump($my->start());
?>
```
The above example will output:
```
bool(true)
```
php ob_get_status ob\_get\_status
===============
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
ob\_get\_status — Get status of output buffers
### Description
```
ob_get_status(bool $full_status = false): array
```
**ob\_get\_status()** returns status information on either the top level output buffer or all active output buffer levels if `full_status` is set to **`true`**.
### Parameters
`full_status`
**`true`** to return all active output buffer levels. If **`false`** or not set, only the top level output buffer is returned.
### Return Values
If called without the `full_status` parameter or with `full_status` = **`false`** a simple array with the following elements is returned:
```
Array
(
[level] => 2
[type] => 0
[status] => 0
[name] => URL-Rewriter
[del] => 1
)
```
**Simple **ob\_get\_status()** results**| Key | Value |
| --- | --- |
| level | Output nesting level |
| type | `0` (internal handler) or `1` (user supplied handler) |
| status | One of `PHP_OUTPUT_HANDLER_START` (0), `PHP_OUTPUT_HANDLER_CONT` (1) or `PHP_OUTPUT_HANDLER_END` (2) |
| name | Name of active output handler or ' default output handler' if none is set |
| del | Erase-flag as set by [ob\_start()](function.ob-start) |
If called with `full_status` = **`true`** an array with one element for each active output buffer level is returned. The output level is used as key of the top level array and each array element itself is another array holding status information on one active output level.
```
Array
(
[0] => Array
(
[chunk_size] => 0
[size] => 40960
[block_size] => 10240
[type] => 1
[status] => 0
[name] => default output handler
[del] => 1
)
[1] => Array
(
[chunk_size] => 0
[size] => 40960
[block_size] => 10240
[type] => 0
[buffer_size] => 0
[status] => 0
[name] => URL-Rewriter
[del] => 1
)
)
```
The full output contains these additional elements:
**Full **ob\_get\_status()** results**| Key | Value |
| --- | --- |
| chunk\_size | Chunk size as set by [ob\_start()](function.ob-start) |
| size | ... |
| blocksize | ... |
### See Also
* [ob\_get\_level()](function.ob-get-level) - Return the nesting level of the output buffering mechanism
* [ob\_list\_handlers()](function.ob-list-handlers) - List all output handlers in use
php The InternalIterator class
The InternalIterator class
==========================
Introduction
------------
(PHP 8)
Class to ease implementing [IteratorAggregate](class.iteratoraggregate) for *internal* classes.
Class synopsis
--------------
final class **InternalIterator** implements [Iterator](class.iterator) { /\* Methods \*/ private [\_\_construct](internaliterator.construct)()
```
public current(): mixed
```
```
public key(): mixed
```
```
public next(): void
```
```
public rewind(): void
```
```
public valid(): bool
```
} Table of Contents
-----------------
* [InternalIterator::\_\_construct](internaliterator.construct) — Private constructor to disallow direct instantiation
* [InternalIterator::current](internaliterator.current) — Return the current element
* [InternalIterator::key](internaliterator.key) — Return the key of the current element
* [InternalIterator::next](internaliterator.next) — Move forward to next element
* [InternalIterator::rewind](internaliterator.rewind) — Rewind the Iterator to the first element
* [InternalIterator::valid](internaliterator.valid) — Check if current position is valid
php CachingIterator::offsetUnset CachingIterator::offsetUnset
============================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
CachingIterator::offsetUnset — The offsetUnset purpose
### Description
```
public CachingIterator::offsetUnset(string $key): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`key`
The index of the element to be unset.
### Return Values
No value is returned.
php PharData::setMetadata PharData::setMetadata
=====================
(No version information available, might only be in Git)
PharData::setMetadata — Sets phar archive meta-data
### Description
```
public PharData::setMetadata(mixed $metadata): void
```
>
> **Note**:
>
>
> This method requires the php.ini setting `phar.readonly` to be set to `0` in order to work for [Phar](class.phar) objects. Otherwise, a [PharException](class.pharexception) will be thrown.
>
>
>
[Phar::setMetadata()](phar.setmetadata) should be used to store customized data that describes something about the phar archive as a complete entity. [PharFileInfo::setMetadata()](pharfileinfo.setmetadata) should be used for file-specific meta-data. Meta-data can slow down the performance of loading a phar archive if the data is large.
Some possible uses for meta-data include specifying which file within the archive should be used to bootstrap the archive, or the location of a file manifest like [» PEAR](https://pear.php.net/)'s package.xml file. However, any useful data that describes the phar archive may be stored.
### Parameters
`metadata`
Any PHP variable containing information to store that describes the phar archive
### Return Values
No value is returned.
### Examples
**Example #1 A [Phar::setMetadata()](phar.setmetadata) example**
```
<?php
// make sure it doesn't exist
@unlink('brandnewphar.phar');
try {
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
$p['file.php'] = '<?php echo "hello"';
$p->setMetadata(array('bootstrap' => 'file.php'));
var_dump($p->getMetadata());
} catch (Exception $e) {
echo 'Could not create and/or modify phar:', $e;
}
?>
```
The above example will output:
```
array(1) {
["bootstrap"]=>
string(8) "file.php"
}
```
### See Also
* [Phar::getMetadata()](phar.getmetadata) - Returns phar archive meta-data
* [Phar::delMetadata()](phar.delmetadata) - Deletes the global metadata of the phar
* [Phar::hasMetadata()](phar.hasmetadata) - Returns whether phar has global meta-data
| programming_docs |
php RecursiveIterator::hasChildren RecursiveIterator::hasChildren
==============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
RecursiveIterator::hasChildren — Returns if an iterator can be created for the current entry
### Description
```
public RecursiveIterator::hasChildren(): bool
```
Returns if an iterator can be created for the current entry. [RecursiveIterator::getChildren()](recursiveiterator.getchildren).
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the current entry can be iterated over, otherwise returns **`false`**.
### See Also
* [RecursiveIterator::getChildren()](recursiveiterator.getchildren) - Returns an iterator for the current entry
php NumberFormatter::create NumberFormatter::create
=======================
numfmt\_create
==============
NumberFormatter::\_\_construct
==============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
NumberFormatter::create -- numfmt\_create -- NumberFormatter::\_\_construct — Create a number formatter
### Description
Object-oriented style (method)
```
public static NumberFormatter::create(string $locale, int $style, ?string $pattern = null): ?NumberFormatter
```
Procedural style
```
numfmt_create(string $locale, int $style, ?string $pattern = null): ?NumberFormatter
```
Object-oriented style (constructor):
public **NumberFormatter::\_\_construct**(string `$locale`, int `$style`, ?string `$pattern` = **`null`**) Creates a number formatter.
### Parameters
`locale`
Locale in which the number would be formatted (locale name, e.g. en\_CA).
`style`
Style of the formatting, one of the [format style](class.numberformatter#intl.numberformatter-constants.unumberformatstyle) constants. If **`NumberFormatter::PATTERN_DECIMAL`** or **`NumberFormatter::PATTERN_RULEBASED`** is passed then the number format is opened using the given pattern, which must conform to the syntax described in [» ICU DecimalFormat documentation](http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#details) or [» ICU RuleBasedNumberFormat documentation](http://www.icu-project.org/apiref/icu4c/classRuleBasedNumberFormat.html#details), respectively.
`pattern`
Pattern string if the chosen style requires a pattern.
### Return Values
Returns [NumberFormatter](class.numberformatter) object or **`null`** on error.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `pattern` is nullable now. |
### Examples
**Example #1 **numfmt\_create()** example**
```
<?php
$fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL );
echo numfmt_format($fmt, 1234567.891234567890000)."\n";
$fmt = numfmt_create( 'it', NumberFormatter::SPELLOUT );
echo numfmt_format($fmt, 1142)."\n";
?>
```
**Example #2 **NumberFormatter::create()** example**
```
<?php
$fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL );
echo $fmt->format(1234567.891234567890000)."\n";
$fmt = new NumberFormatter( 'it', NumberFormatter::SPELLOUT );
echo $fmt->format(1142)."\n";
?>
```
The above example will output:
```
1.234.567,891
millicentoquarantadue
```
### See Also
* [numfmt\_format()](numberformatter.format) - Format a number
* [numfmt\_parse()](numberformatter.parse) - Parse a number
php array_intersect_key array\_intersect\_key
=====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
array\_intersect\_key — Computes the intersection of arrays using keys for comparison
### Description
```
array_intersect_key(array $array, array ...$arrays): array
```
**array\_intersect\_key()** returns an array containing all the entries of `array` which have keys that are present in all the arguments.
### Parameters
`array`
The array with master keys to check.
`arrays`
Arrays to compare keys against.
### Return Values
Returns an associative array containing all the entries of `array` which have keys that are present in all arguments.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function can now be called with only one parameter. Formerly, at least two parameters have been required. |
### Examples
**Example #1 **array\_intersect\_key()** example**
```
<?php
$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
var_dump(array_intersect_key($array1, $array2));
?>
```
The above example will output:
```
array(2) {
["blue"]=>
int(1)
["green"]=>
int(3)
}
```
In our example you see that only the keys `'blue'` and `'green'` are present in both arrays and thus returned. Also notice that the values for the keys `'blue'` and `'green'` differ between the two arrays. A match still occurs because only the keys are checked. The values returned are those of `array`.
The two keys from the `key => value` pairs are considered equal only if `(string) $key1 === (string) $key2` . In other words a strict type check is executed so the string representation must be the same.
### See Also
* [array\_diff()](function.array-diff) - Computes the difference of arrays
* [array\_udiff()](function.array-udiff) - Computes the difference of arrays by using a callback function for data comparison
* [array\_diff\_assoc()](function.array-diff-assoc) - Computes the difference of arrays with additional index check
* [array\_diff\_uassoc()](function.array-diff-uassoc) - Computes the difference of arrays with additional index check which is performed by a user supplied callback function
* [array\_udiff\_assoc()](function.array-udiff-assoc) - Computes the difference of arrays with additional index check, compares data by a callback function
* [array\_udiff\_uassoc()](function.array-udiff-uassoc) - Computes the difference of arrays with additional index check, compares data and indexes by a callback function
* [array\_diff\_key()](function.array-diff-key) - Computes the difference of arrays using keys for comparison
* [array\_diff\_ukey()](function.array-diff-ukey) - Computes the difference of arrays using a callback function on the keys for comparison
* [array\_intersect()](function.array-intersect) - Computes the intersection of arrays
* [array\_intersect\_assoc()](function.array-intersect-assoc) - Computes the intersection of arrays with additional index check
* [array\_intersect\_uassoc()](function.array-intersect-uassoc) - Computes the intersection of arrays with additional index check, compares indexes by a callback function
* [array\_intersect\_ukey()](function.array-intersect-ukey) - Computes the intersection of arrays using a callback function on the keys for comparison
php SolrInputDocument::toArray SolrInputDocument::toArray
==========================
(PECL solr >= 0.9.2)
SolrInputDocument::toArray — Returns an array representation of the input document
### Description
```
public SolrInputDocument::toArray(): array
```
Returns an array representation of the input document.
### Parameters
This function has no parameters.
### Return Values
Returns an array containing the fields. It returns **`false`** on failure.
php gmp_nextprime gmp\_nextprime
==============
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
gmp\_nextprime — Find next prime number
### Description
```
gmp_nextprime(GMP|int|string $num): GMP
```
Find next prime number
### Parameters
`num`
A [GMP](class.gmp) object, an int or a numeric string.
### Return Values
Return the next prime number greater than `num`, as a GMP number.
### Examples
**Example #1 **gmp\_nextprime()** example**
```
<?php
$prime1 = gmp_nextprime(10); // next prime number greater than 10
$prime2 = gmp_nextprime(-1000); // next prime number greater than -1000
echo gmp_strval($prime1) . "\n";
echo gmp_strval($prime2) . "\n";
?>
```
The above example will output:
```
11
2
```
### Notes
>
> **Note**:
>
>
> This function uses a probabilistic algorithm to identify primes and chances to get a composite number are extremely small.
>
>
php getimagesizefromstring getimagesizefromstring
======================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
getimagesizefromstring — Get the size of an image from a string
### Description
```
getimagesizefromstring(string $string, array &$image_info = null): array|false
```
Identical to [getimagesize()](function.getimagesize) except that **getimagesizefromstring()** accepts a string instead of a file name as the first parameter.
See the [getimagesize()](function.getimagesize) documentation for details on how this function works.
### Parameters
`string`
The image data, as a string.
`image_info`
See [getimagesize()](function.getimagesize).
### Return Values
See [getimagesize()](function.getimagesize).
### Examples
**Example #1 **getimagesizefromstring()** example**
```
<?php
$img = '/path/to/test.png';
// Open as a file
$size_info1 = getimagesize($img);
// Or open as a string
$data = file_get_contents($img);
$size_info2 = getimagesizefromstring($data);
?>
```
### See Also
* [getimagesize()](function.getimagesize) - Get the size of an image
php EventHttpConnection::setMaxHeadersSize EventHttpConnection::setMaxHeadersSize
======================================
(PECL event >= 1.2.6-beta)
EventHttpConnection::setMaxHeadersSize — Sets maximum header size
### Description
```
public EventHttpConnection::setMaxHeadersSize( string $max_size ): void
```
Sets maximum header size for the connection.
### Parameters
`max_size` The maximum header size in bytes.
### Return Values
No value is returned.
### See Also
* [EventHttpConnection::setMaxBodySize()](eventhttpconnection.setmaxbodysize) - Sets maximum body size for the connection
php None Repetition
----------
Repetition is specified by quantifiers, which can follow any of the following items:
* a single character, possibly escaped
* the . metacharacter
* a character class
* a back reference (see next section)
* a parenthesized subpattern (unless it is an assertion - see below)
The general repetition quantifier specifies a minimum and maximum number of permitted matches, by giving the two numbers in curly brackets (braces), separated by a comma. The numbers must be less than 65536, and the first must be less than or equal to the second. For example: `z{2,4}` matches "zz", "zzz", or "zzzz". A closing brace on its own is not a special character. If the second number is omitted, but the comma is present, there is no upper limit; if the second number and the comma are both omitted, the quantifier specifies an exact number of required matches. Thus `[aeiou]{3,}` matches at least 3 successive vowels, but may match many more, while `\d{8}` matches exactly 8 digits. An opening curly bracket that appears in a position where a quantifier is not allowed, or one that does not match the syntax of a quantifier, is taken as a literal character. For example, {,6} is not a quantifier, but a literal string of four characters.
The quantifier {0} is permitted, causing the expression to behave as if the previous item and the quantifier were not present.
For convenience (and historical compatibility) the three most common quantifiers have single-character abbreviations:
**Single-character quantifiers**| `*` | equivalent to `{0,}` |
| `+` | equivalent to `{1,}` |
| `?` | equivalent to `{0,1}` |
It is possible to construct infinite loops by following a subpattern that can match no characters with a quantifier that has no upper limit, for example: `(a?)*`
Earlier versions of Perl and PCRE used to give an error at compile time for such patterns. However, because there are cases where this can be useful, such patterns are now accepted, but if any repetition of the subpattern does in fact match no characters, the loop is forcibly broken.
By default, the quantifiers are "greedy", that is, they match as much as possible (up to the maximum number of permitted times), without causing the rest of the pattern to fail. The classic example of where this gives problems is in trying to match comments in C programs. These appear between the sequences /\* and \*/ and within the sequence, individual \* and / characters may appear. An attempt to match C comments by applying the pattern `/\*.*\*/` to the string `/* first comment */ not comment /* second comment */` fails, because it matches the entire string due to the greediness of the .\* item.
However, if a quantifier is followed by a question mark, then it becomes lazy, and instead matches the minimum number of times possible, so the pattern `/\*.*?\*/` does the right thing with the C comments. The meaning of the various quantifiers is not otherwise changed, just the preferred number of matches. Do not confuse this use of question mark with its use as a quantifier in its own right. Because it has two uses, it can sometimes appear doubled, as in `\d??\d` which matches one digit by preference, but can match two if that is the only way the rest of the pattern matches.
If the [PCRE\_UNGREEDY](reference.pcre.pattern.modifiers) option is set (an option which is not available in Perl) then the quantifiers are not greedy by default, but individual ones can be made greedy by following them with a question mark. In other words, it inverts the default behaviour.
Quantifiers followed by `+` are "possessive". They eat as many characters as possible and don't return to match the rest of the pattern. Thus `.*abc` matches "aabc" but `.*+abc` doesn't because `.*+` eats the whole string. Possessive quantifiers can be used to speed up processing.
When a parenthesized subpattern is quantified with a minimum repeat count that is greater than 1 or with a limited maximum, more store is required for the compiled pattern, in proportion to the size of the minimum or maximum.
If a pattern starts with .\* or .{0,} and the [PCRE\_DOTALL](reference.pcre.pattern.modifiers) option (equivalent to Perl's /s) is set, thus allowing the . to match newlines, then the pattern is implicitly anchored, because whatever follows will be tried against every character position in the subject string, so there is no point in retrying the overall match at any position after the first. PCRE treats such a pattern as though it were preceded by \A. In cases where it is known that the subject string contains no newlines, it is worth setting [PCRE\_DOTALL](reference.pcre.pattern.modifiers) when the pattern begins with .\* in order to obtain this optimization, or alternatively using ^ to indicate anchoring explicitly.
When a capturing subpattern is repeated, the value captured is the substring that matched the final iteration. For example, after `(tweedle[dume]{3}\s*)+` has matched "tweedledum tweedledee" the value of the captured substring is "tweedledee". However, if there are nested capturing subpatterns, the corresponding captured values may have been set in previous iterations. For example, after `/(a|(b))+/` matches "aba" the value of the second captured substring is "b".
php ImagickDraw::setStrokeOpacity ImagickDraw::setStrokeOpacity
=============================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setStrokeOpacity — Specifies the opacity of stroked object outlines
### Description
```
public ImagickDraw::setStrokeOpacity(float $stroke_opacity): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Specifies the opacity of stroked object outlines.
### Parameters
`stroke_opacity`
stroke opacity. 1.0 is fully opaque
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::setStrokeOpacity()** example**
```
<?php
function setStrokeOpacity($strokeColor, $fillColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeWidth(1);
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(10);
$draw->setStrokeOpacity(1);
$draw->line(100, 80, 400, 125);
$draw->rectangle(25, 200, 150, 350);
$draw->setStrokeOpacity(0.5);
$draw->line(100, 100, 400, 145);
$draw->rectangle(200, 200, 325, 350);
$draw->setStrokeOpacity(0.2);
$draw->line(100, 120, 400, 165);
$draw->rectangle(375, 200, 500, 350);
$image = new \Imagick();
$image->newImage(550, 400, $backgroundColor);
$image->setImageFormat("png");
$image->drawImage($draw);
header("Content-Type: image/png");
echo $image->getImageBlob();
}
?>
```
php sqlsrv_cancel sqlsrv\_cancel
==============
(No version information available, might only be in Git)
sqlsrv\_cancel — Cancels a statement
### Description
```
sqlsrv_cancel(resource $stmt): bool
```
Cancels a statement. Any results associated with the statement that have not been consumed are deleted. After **sqlsrv\_cancel()** has been called, the specified statement can be re-executed if it was created with [sqlsrv\_prepare()](function.sqlsrv-prepare). Calling **sqlsrv\_cancel()** is not necessary if all the results associated with the statement have been consumed.
### Parameters
`stmt`
The statement resource to be cancelled.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **sqlsrv\_cancel()** example**
```
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT Sales FROM Table_1";
$stmt = sqlsrv_prepare( $conn, $sql);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
if( sqlsrv_execute( $stmt ) === false) {
die( print_r( sqlsrv_errors(), true));
}
$salesTotal = 0;
$count = 0;
while( ($row = sqlsrv_fetch_array( $stmt)) && $salesTotal <=100000)
{
$qty = $row[0];
$price = $row[1];
$salesTotal += ( $price * $qty);
$count++;
}
echo "$count sales accounted for the first $$salesTotal in revenue.<br />";
// Cancel the pending results. The statement can be reused.
sqlsrv_cancel( $stmt);
?>
```
### Notes
The main difference between **sqlsrv\_cancel()** and [sqlsrv\_free\_stmt()](function.sqlsrv-free-stmt) is that a statement resource cancelled with **sqlsrv\_cancel()** can be re-executed if it was created with [sqlsrv\_prepare()](function.sqlsrv-prepare). A statement resource cancelled with **sqlsrv\_free\_statement()** cannot be re-executed.
### See Also
* [sqlsrv\_free\_stmt()](function.sqlsrv-free-stmt) - Frees all resources for the specified statement
* [sqlsrv\_prepare()](function.sqlsrv-prepare) - Prepares a query for execution
php DateInterval::createFromDateString DateInterval::createFromDateString
==================================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
DateInterval::createFromDateString — Sets up a DateInterval from the relative parts of the string
### Description
```
public static DateInterval::createFromDateString(string $datetime): DateInterval|false
```
Uses the date/time parsers as used in the [DateTimeImmutable](class.datetimeimmutable) constructor to create a [DateInterval](class.dateinterval) from the relative parts of the parsed string.
### Parameters
`datetime`
A date with relative parts. Specifically, the [relative formats](https://www.php.net/manual/en/datetime.formats.relative.php) supported by the parser used for [DateTimeImmutable](class.datetimeimmutable), [DateTime](class.datetime), and [strtotime()](function.strtotime) will be used to construct the DateInterval.
To use an ISO-8601 format string like `P7D`, you must use the constructor.
### Return Values
Returns a new [DateInterval](class.dateinterval) instance on success, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.2.0 | Only the `from_string` and `date_string` properties will be visible when a [DateInterval](class.dateinterval) is created with this method. |
### Examples
**Example #1 Parsing valid date intervals**
```
<?php
// Each set of intervals is equal.
$i = new DateInterval('P1D');
$i = DateInterval::createFromDateString('1 day');
$i = new DateInterval('P2W');
$i = DateInterval::createFromDateString('2 weeks');
$i = new DateInterval('P3M');
$i = DateInterval::createFromDateString('3 months');
$i = new DateInterval('P4Y');
$i = DateInterval::createFromDateString('4 years');
$i = new DateInterval('P1Y1D');
$i = DateInterval::createFromDateString('1 year + 1 day');
$i = new DateInterval('P1DT12H');
$i = DateInterval::createFromDateString('1 day + 12 hours');
$i = new DateInterval('PT3600S');
$i = DateInterval::createFromDateString('3600 seconds');
?>
```
**Example #2 Parsing combinations and negative intervals**
```
<?php
$i = DateInterval::createFromDateString('62 weeks + 1 day + 2 weeks + 2 hours + 70 minutes');
echo $i->format('%d %h %i'), "\n";
$i = DateInterval::createFromDateString('1 year - 10 days');
echo $i->format('%y %d'), "\n";
?>
```
The above example will output:
449 2 70
1 -10
**Example #3 Parsing special relative date intervals**
```
<?php
$i = DateInterval::createFromDateString('last day of next month');
var_dump($i);
$i = DateInterval::createFromDateString('last weekday');
var_dump($i);
```
Output of the above example in PHP 8.2:
```
object(DateInterval)#1 (2) {
["from_string"]=>
bool(true)
["date_string"]=>
string(22) "last day of next month"
}
object(DateInterval)#2 (2) {
["from_string"]=>
bool(true)
["date_string"]=>
string(12) "last weekday"
}
```
Output of the above example in PHP 8 is similar to:
```
object(DateInterval)#1 (16) {
["y"]=>
int(0)
["m"]=>
int(1)
["d"]=>
int(0)
["h"]=>
int(0)
["i"]=>
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
int(0)
["first_last_day_of"]=>
int(2)
["invert"]=>
int(0)
["days"]=>
bool(false)
["special_type"]=>
int(0)
["special_amount"]=>
int(0)
["have_weekday_relative"]=>
int(0)
["have_special_relative"]=>
int(0)
}
object(DateInterval)#2 (16) {
["y"]=>
int(0)
["m"]=>
int(0)
["d"]=>
int(0)
["h"]=>
int(0)
["i"]=>
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
int(0)
["first_last_day_of"]=>
int(0)
["invert"]=>
int(0)
["days"]=>
bool(false)
["special_type"]=>
int(1)
["special_amount"]=>
int(-1)
["have_weekday_relative"]=>
int(0)
["have_special_relative"]=>
int(1)
}
```
| programming_docs |
php DOMElement::setAttributeNodeNS DOMElement::setAttributeNodeNS
==============================
(PHP 5, PHP 7, PHP 8)
DOMElement::setAttributeNodeNS — Adds new attribute node to element
### Description
```
public DOMElement::setAttributeNodeNS(DOMAttr $attr): DOMAttr|null|false
```
Adds new attribute node `attr` to element.
### Parameters
`attr`
The attribute node.
### Return Values
Returns the old node if the attribute has been replaced.
### Errors/Exceptions
**`DOM_NO_MODIFICATION_ALLOWED_ERR`**
Raised if the node is readonly.
### See Also
* [DOMElement::hasAttributeNS()](domelement.hasattributens) - Checks to see if attribute exists
* [DOMElement::getAttributeNodeNS()](domelement.getattributenodens) - Returns attribute node
* [DOMElement::removeAttributeNode()](domelement.removeattributenode) - Removes attribute
php shmop_read shmop\_read
===========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
shmop\_read — Read data from shared memory block
### Description
```
shmop_read(Shmop $shmop, int $offset, int $size): string
```
**shmop\_read()** will read a string from shared memory block.
### Parameters
`shmop`
The shared memory block identifier created by [shmop\_open()](function.shmop-open)
`offset`
Offset from which to start reading
`size`
The number of bytes to read. `0` reads `shmop_size($shmid) - $start` bytes.
### Return Values
Returns the data or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `shmop` expects a [Shmop](class.shmop) instance now; previously, a resource was expected. |
### Examples
**Example #1 Reading shared memory block**
```
<?php
$shm_data = shmop_read($shm_id, 0, 50);
?>
```
This example will read 50 bytes from shared memory block and place the data inside `$shm_data`.
### See Also
* [shmop\_write()](function.shmop-write) - Write data into shared memory block
php EvLoop::signal EvLoop::signal
==============
(PECL ev >= 0.2.0)
EvLoop::signal — Creates EvSignal watcher object associated with the current event loop instance
### Description
```
final public EvLoop::signal(
int $signum ,
callable $callback ,
mixed $data = null ,
int $priority = 0
): EvSignal
```
Creates EvSignal watcher object associated with the current event loop instance
### Parameters
All parameters have the same meaning as for [EvSignal::\_\_construct()](evsignal.construct)
### Return Values
Returns EvSignal object on success
### See Also
* [EvSignal::\_\_construct()](evsignal.construct) - Constructs EvSignal watcher object
php ReflectionGenerator::getExecutingLine ReflectionGenerator::getExecutingLine
=====================================
(PHP 7, PHP 8)
ReflectionGenerator::getExecutingLine — Gets the currently executing line of the generator
### Description
```
public ReflectionGenerator::getExecutingLine(): int
```
Get the currently executing line number of the generator.
### Parameters
This function has no parameters.
### Return Values
Returns the line number of the currently executing statement in the generator.
### Examples
**Example #1 **ReflectionGenerator::getExecutingLine()** example**
```
<?php
class GenExample
{
public function gen()
{
yield 1;
}
}
$gen = (new GenExample)->gen();
$reflectionGen = new ReflectionGenerator($gen);
echo "Line: {$reflectionGen->getExecutingLine()}";
```
The above example will output something similar to:
```
Line: 7
```
### See Also
* [ReflectionGenerator::getExecutingGenerator()](reflectiongenerator.getexecutinggenerator) - Gets the executing Generator object
* [ReflectionGenerator::getExecutingFile()](reflectiongenerator.getexecutingfile) - Gets the file name of the currently executing generator
php ReflectionExtension::getVersion ReflectionExtension::getVersion
===============================
(PHP 5, PHP 7, PHP 8)
ReflectionExtension::getVersion — Gets extension version
### Description
```
public ReflectionExtension::getVersion(): ?string
```
Gets the version of the extension.
### Parameters
This function has no parameters.
### Return Values
The version of the extension, or **`null`** if the extension has no version.
### Examples
**Example #1 **ReflectionExtension::getVersion()** example**
```
<?php
$ext = new ReflectionExtension('mysqli');
var_dump($ext->getVersion());
?>
```
The above example will output something similar to:
```
string(3) "0.1"
```
### See Also
* [ReflectionExtension::info()](reflectionextension.info) - Print extension info
php The Componere\Method class
The Componere\Method class
==========================
Introduction
------------
(Componere 2 >= 2.1.0)
A Method represents a function with modifiable accessibility flags
Class synopsis
--------------
final class **Componere\Method** { /\* Constructor \*/ public [\_\_construct](componere-method.construct)([Closure](class.closure) `$closure`) /\* Methods \*/
```
public setPrivate(): Method
```
```
public setProtected(): Method
```
```
public setStatic(): Method
```
```
public getReflector(): ReflectionMethod
```
} Table of Contents
-----------------
* [Componere\Method::\_\_construct](componere-method.construct) — Method Construction
* [Componere\Method::setPrivate](componere-method.setprivate) — Accessibility Modification
* [Componere\Method::setProtected](componere-method.setprotected) — Accessibility Modification
* [Componere\Method::setStatic](componere-method.setstatic) — Accessibility Modification
* [Componere\Method::getReflector](componere-method.getreflector) — Reflection
php GearmanJob::workloadSize GearmanJob::workloadSize
========================
(PECL gearman >= 0.5.0)
GearmanJob::workloadSize — Get size of work load
### Description
```
public GearmanJob::workloadSize(): int
```
Returns the size of the job's work load (the data the worker is to process) in bytes.
### Parameters
This function has no parameters.
### Return Values
The size in bytes.
### See Also
* [GearmanJob::workload()](gearmanjob.workload) - Get workload
php zip_entry_name zip\_entry\_name
================
(PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.0.0)
zip\_entry\_name — Retrieve the name of a directory entry
**Warning**This function has been *DEPRECATED* as of PHP 8.0.0. Relying on this function is highly discouraged.
### Description
```
zip_entry_name(resource $zip_entry): string|false
```
Returns the name of the specified directory entry.
### Parameters
`zip_entry`
A directory entry returned by [zip\_read()](function.zip-read).
### Return Values
The name of the directory entry, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function is deprecated in favor of the Object API, see [ZipArchive::statIndex()](ziparchive.statindex). |
### See Also
* [zip\_open()](function.zip-open) - Open a ZIP file archive
* [zip\_read()](function.zip-read) - Read next entry in a ZIP file archive
php EventBuffer::enableLocking EventBuffer::enableLocking
==========================
(PECL event >= 1.2.6-beta)
EventBuffer::enableLocking —
### Description
```
public EventBuffer::enableLocking(): void
```
Enable locking on an [EventBuffer](class.eventbuffer) so that it can safely be used by multiple threads at the same time. When locking is enabled, the lock will be held when callbacks are invoked. This could result in deadlock if you aren't careful. Plan accordingly!
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### See Also
* [» Evbuffers and Thread-safety](http://www.wangafu.net/~nickm/libevent-book/Ref7_evbuffer.html#_evbuffers_and_thread_safety)
php IntlChar::islower IntlChar::islower
=================
(PHP 7, PHP 8)
IntlChar::islower — Check if code point is a lowercase letter
### Description
```
public static IntlChar::islower(int|string $codepoint): ?bool
```
Determines whether the specified code point has the general category "Ll" (lowercase letter).
>
> **Note**:
>
>
> This misses some characters that are also lowercase but have a different general category value. In order to include those, use [IntlChar::isULowercase()](intlchar.isulowercase).
>
>
### Parameters
`codepoint`
The int codepoint value (e.g. `0x2603` for *U+2603 SNOWMAN*), or the character encoded as a UTF-8 string (e.g. `"\u{2603}"`)
### Return Values
Returns **`true`** if `codepoint` is an Ll lowercase letter, **`false`** if not. Returns **`null`** on failure.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::islower("A"));
var_dump(IntlChar::islower("a"));
var_dump(IntlChar::islower("Φ"));
var_dump(IntlChar::islower("φ"));
var_dump(IntlChar::islower("1"));
?>
```
The above example will output:
```
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
```
### See Also
* [IntlChar::isupper()](intlchar.isupper) - Check if code point has the general category "Lu" (uppercase letter)
* [IntlChar::istitle()](intlchar.istitle) - Check if code point is a titlecase letter
* [IntlChar::tolower()](intlchar.tolower) - Make Unicode character lowercase
* [IntlChar::toupper()](intlchar.toupper) - Make Unicode character uppercase
* **`IntlChar::PROPERTY_LOWERCASE`**
php ibase_execute ibase\_execute
==============
(PHP 5, PHP 7 < 7.4.0)
ibase\_execute — Execute a previously prepared query
### Description
```
ibase_execute(resource $query, mixed ...$values): resource
```
Execute a query prepared by [ibase\_prepare()](function.ibase-prepare).
This is a lot more effective than using [ibase\_query()](function.ibase-query) if you are repeating a same kind of query several times with only some parameters changing.
### Parameters
`query`
An InterBase query prepared by [ibase\_prepare()](function.ibase-prepare).
`values`
### Return Values
If the query raises an error, returns **`false`**. If it is successful and there is a (possibly empty) result set (such as with a SELECT query), returns a result identifier. If the query was successful and there were no results, returns **`true`**.
>
> **Note**:
>
>
> This function returns the number of rows affected by the query (if > 0 and applicable to the statement type). A query that succeeded, but did not affect any rows (e.g. an UPDATE of a non-existent record) will return **`true`**.
>
>
### Examples
**Example #1 **ibase\_execute()** example**
```
<?php
$dbh = ibase_connect($host, $username, $password);
$updates = array(
1 => 'Eric',
5 => 'Filip',
7 => 'Larry'
);
$query = ibase_prepare($dbh, "UPDATE FOO SET BAR = ? WHERE BAZ = ?");
foreach ($updates as $baz => $bar) {
ibase_execute($query, $bar, $baz);
}
?>
```
### See Also
* [ibase\_query()](function.ibase-query) - Execute a query on an InterBase database
php posix_setegid posix\_setegid
==============
(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)
posix\_setegid — Set the effective GID of the current process
### Description
```
posix_setegid(int $group_id): bool
```
Set the effective group ID of the current process. This is a privileged function and needs appropriate privileges (usually root) on the system to be able to perform this function.
### Parameters
`group_id`
The group id.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **posix\_setegid()** example**
This example will print out the effective group id, once changed.
```
<?php
echo 'My real group id is '.posix_getgid(); //20
posix_setegid(40);
echo 'My real group id is '.posix_getgid(); //20
echo 'My effective group id is '.posix_getegid(); //40
?>
```
### See Also
* [posix\_getgrgid()](function.posix-getgrgid) - Return info about a group by group id
* [posix\_getgid()](function.posix-getgid) - Return the real group ID of the current process
* [posix\_setgid()](function.posix-setgid) - Set the GID of the current process
php substr_compare substr\_compare
===============
(PHP 5, PHP 7, PHP 8)
substr\_compare — Binary safe comparison of two strings from an offset, up to length characters
### Description
```
substr_compare(
string $haystack,
string $needle,
int $offset,
?int $length = null,
bool $case_insensitive = false
): int
```
**substr\_compare()** compares `haystack` from position `offset` with `needle` up to `length` characters.
### Parameters
`haystack`
The main string being compared.
`needle`
The secondary string being compared.
`offset`
The start position for the comparison. If negative, it starts counting from the end of the string.
`length`
The length of the comparison. The default value is the largest of the length of the `needle` compared to the length of `haystack` minus the `offset`.
`case_insensitive`
If `case_insensitive` is **`true`**, comparison is case insensitive.
### Return Values
Returns `-1` if `haystack` from position `offset` is less than `needle`, `1` if it is greater than `needle`, and `0` if they are equal. If `offset` is equal to (prior to PHP 7.2.18, 7.3.5) or greater than the length of `haystack`, or the `length` is set and is less than 0, **substr\_compare()** prints a warning and returns **`false`**.
### Changelog
| Version | Description |
| --- | --- |
| 8.2.0 | This function now returns `-1` or `1`, where it previously returned a negative or positive number. |
| 8.0.0 | `length` is nullable now. |
| 7.2.18, 7.3.5 | `offset` may now be equal to the length of `haystack`. |
### Examples
**Example #1 A **substr\_compare()** example**
```
<?php
echo substr_compare("abcde", "bc", 1, 2); // 0
echo substr_compare("abcde", "de", -2, 2); // 0
echo substr_compare("abcde", "bcg", 1, 2); // 0
echo substr_compare("abcde", "BC", 1, 2, true); // 0
echo substr_compare("abcde", "bc", 1, 3); // 1
echo substr_compare("abcde", "cd", 1, 2); // -1
echo substr_compare("abcde", "abc", 5, 1); // warning
?>
```
### See Also
* [strncmp()](function.strncmp) - Binary safe string comparison of the first n characters
php imagefill imagefill
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
imagefill — Flood fill
### Description
```
imagefill(
GdImage $image,
int $x,
int $y,
int $color
): bool
```
Performs a flood fill starting at the given coordinate (top left is 0, 0) with the given `color` in the `image`.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`x`
x-coordinate of start point.
`y`
y-coordinate of start point.
`color`
The fill color. A color identifier created with [imagecolorallocate()](function.imagecolorallocate).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 **imagefill()** example**
```
<?php
$im = imagecreatetruecolor(100, 100);
// sets background to red
$red = imagecolorallocate($im, 255, 0, 0);
imagefill($im, 0, 0, $red);
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
```
The above example will output something similar to:
### See Also
* [imagecolorallocate()](function.imagecolorallocate) - Allocate a color for an image
php Yac::__get Yac::\_\_get
============
(PECL yac >= 1.0.0)
Yac::\_\_get — Getter
### Description
```
public Yac::__get(string $key): mixed
```
Retrieve values from cache
### Parameters
`key`
string key
### Return Values
mixed on success, **`null`** on failure
php PharData::setDefaultStub PharData::setDefaultStub
========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
PharData::setDefaultStub — Dummy function (Phar::setDefaultStub is not valid for PharData)
### Description
```
public PharData::setDefaultStub(?string $index = null, ?string $webIndex = null): bool
```
Non-executable tar/zip archives cannot have a stub, so this method simply throws an exception.
### Parameters
`index`
Relative path within the phar archive to run if accessed on the command-line
`webIndex`
Relative path within the phar archive to run if accessed through a web browser
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
Throws [PharException](class.pharexception) on all method calls
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `webIndex` is nullable now. |
### See Also
* [Phar::setDefaultStub()](phar.setdefaultstub) - Used to set the PHP loader or bootstrap stub of a Phar archive to the default loader
php None Constructors and Destructors
----------------------------
### Constructor
```
__construct(mixed ...$values = ""): void
```
PHP allows developers to declare constructor methods for classes. Classes which have a constructor method call this method on each newly-created object, so it is suitable for any initialization that the object may need before it is used.
> **Note**: Parent constructors are not called implicitly if the child class defines a constructor. In order to run a parent constructor, a call to **parent::\_\_construct()** within the child constructor is required. If the child does not define a constructor then it may be inherited from the parent class just like a normal class method (if it was not declared as private).
>
>
**Example #1 Constructors in inheritance**
```
<?php
class BaseClass {
function __construct() {
print "In BaseClass constructor\n";
}
}
class SubClass extends BaseClass {
function __construct() {
parent::__construct();
print "In SubClass constructor\n";
}
}
class OtherSubClass extends BaseClass {
// inherits BaseClass's constructor
}
// In BaseClass constructor
$obj = new BaseClass();
// In BaseClass constructor
// In SubClass constructor
$obj = new SubClass();
// In BaseClass constructor
$obj = new OtherSubClass();
?>
```
Unlike other methods, [\_\_construct()](language.oop5.decon#object.construct) is exempt from the usual [signature compatibility rules](language.oop5.basic#language.oop.lsp) when being extended.
Constructors are ordinary methods which are called during the instantiation of their corresponding object. As such, they may define an arbitrary number of arguments, which may be required, may have a type, and may have a default value. Constructor arguments are called by placing the arguments in parentheses after the class name.
**Example #2 Using constructor arguments**
```
<?php
class Point {
protected int $x;
protected int $y;
public function __construct(int $x, int $y = 0) {
$this->x = $x;
$this->y = $y;
}
}
// Pass both parameters.
$p1 = new Point(4, 5);
// Pass only the required parameter. $y will take its default value of 0.
$p2 = new Point(4);
// With named parameters (as of PHP 8.0):
$p3 = new Point(y: 5, x: 4);
?>
```
If a class has no constructor, or the constructor has no required arguments, the parentheses may be omitted.
#### Old-style constructors
Prior to PHP 8.0.0, classes in the global namespace will interpret a method named the same as the class as an old-style constructor. That syntax is deprecated, and will result in an **`E_DEPRECATED`** error but still call that function as a constructor. If both [\_\_construct()](language.oop5.decon#object.construct) and a same-name method are defined, [\_\_construct()](language.oop5.decon#object.construct) will be called.
In namespaced classes, or any class as of PHP 8.0.0, a method named the same as the class never has any special meaning.
Always use [\_\_construct()](language.oop5.decon#object.construct) in new code.
#### Constructor Promotion
As of PHP 8.0.0, constructor parameters may also be promoted to correspond to an object property. It is very common for constructor parameters to be assigned to a property in the constructor but otherwise not operated upon. Constructor promotion provides a short-hand for that use case. The example above could be rewritten as the following.
**Example #3 Using constructor property promotion**
```
<?php
class Point {
public function __construct(protected int $x, protected int $y = 0) {
}
}
```
When a constructor argument includes a visibility modifier, PHP will interpret it as both an object property and a constructor argument, and assign the argument value to the property. The constructor body may then be empty or may contain other statements. Any additional statements will be executed after the argument values have been assigned to the corresponding properties.
Not all arguments need to be promoted. It is possible to mix and match promoted and not-promoted arguments, in any order. Promoted arguments have no impact on code calling the constructor.
>
> **Note**:
>
>
> Object properties may not be typed [callable](language.types.callable) due to engine ambiguity that would introduce. Promoted arguments, therefore, may not be typed [callable](language.types.callable) either. Any other [type declaration](language.types.declarations) is permitted, however.
>
>
>
> **Note**:
>
>
> [Attributes](https://www.php.net/manual/en/language.attributes.php) placed on a promoted constructor argument will be replicated to both the property and argument.
>
>
#### New in initializers
As of PHP 8.1.0, objects can be used as default parameter values, static variables, and global constants, as well as in attribute arguments. Objects can also be passed to [define()](function.define) now.
>
> **Note**:
>
>
> The use of a dynamic or non-string class name or an anonymous class is not allowed. The use of argument unpacking is not allowed. The use of unsupported expressions as arguments is not allowed.
>
>
**Example #4 Using new in initializers**
```
<?php
// All allowed:
static $x = new Foo;
const C = new Foo;
function test($param = new Foo) {}
#[AnAttribute(new Foo)]
class Test {
public function __construct(
public $prop = new Foo,
) {}
}
// All not allowed (compile-time error):
function test(
$a = new (CLASS_NAME_CONSTANT)(), // dynamic class name
$b = new class {}, // anonymous class
$c = new A(...[]), // argument unpacking
$d = new B($abc), // unsupported constant expression
) {}
?>
```
#### Static creation methods
PHP only supports a single constructor per class. In some cases, however, it may be desirable to allow an object to be constructed in different ways with different inputs. The recommended way to do so is by using static methods as constructor wrappers.
**Example #5 Using static creation methods**
```
<?php
class Product {
private ?int $id;
private ?string $name;
private function __construct(?int $id = null, ?string $name = null) {
$this->id = $id;
$this->name = $name;
}
public static function fromBasicData(int $id, string $name): static {
$new = new static($id, $name);
return $new;
}
public static function fromJson(string $json): static {
$data = json_decode($json);
return new static($data['id'], $data['name']);
}
public static function fromXml(string $xml): static {
// Custom logic here.
$data = convert_xml_to_array($xml);
$new = new static();
$new->id = $data['id'];
$new->name = $data['name'];
return $new;
}
}
$p1 = Product::fromBasicData(5, 'Widget');
$p2 = Product::fromJson($some_json_string);
$p3 = Product::fromXml($some_xml_string);
```
The constructor may be made private or protected to prevent it from being called externally. If so, only a static method will be able to instantiate the class. Because they are in the same class definition they have access to private methods, even if not of the same object instance. The private constructor is optional and may or may not make sense depending on the use case.
The three public static methods then demonstrate different ways of instantiating the object.
* `fromBasicData()` takes the exact parameters that are needed, then creates the object by calling the constructor and returning the result.
* `fromJson()` accepts a JSON string and does some pre-processing on it itself to convert it into the format desired by the constructor. It then returns the new object.
* `fromXml()` accepts an XML string, preprocesses it, and then creates a bare object. The constructor is still called, but as all of the parameters are optional the method skips them. It then assigns values to the object properties directly before returning the result.
In all three cases, the `static` keyword is translated into the name of the class the code is in. In this case, `Product`.
### Destructor
```
__destruct(): void
```
PHP possesses a destructor concept similar to that of other object-oriented languages, such as C++. The destructor method will be called as soon as there are no other references to a particular object, or in any order during the shutdown sequence.
**Example #6 Destructor Example**
```
<?php
class MyDestructableClass
{
function __construct() {
print "In constructor\n";
}
function __destruct() {
print "Destroying " . __CLASS__ . "\n";
}
}
$obj = new MyDestructableClass();
```
Like constructors, parent destructors will not be called implicitly by the engine. In order to run a parent destructor, one would have to explicitly call **parent::\_\_destruct()** in the destructor body. Also like constructors, a child class may inherit the parent's destructor if it does not implement one itself.
The destructor will be called even if script execution is stopped using [exit()](function.exit). Calling [exit()](function.exit) in a destructor will prevent the remaining shutdown routines from executing.
>
> **Note**:
>
>
> Destructors called during the script shutdown have HTTP headers already sent. The working directory in the script shutdown phase can be different with some SAPIs (e.g. Apache).
>
>
>
> **Note**:
>
>
> Attempting to throw an exception from a destructor (called in the time of script termination) causes a fatal error.
>
>
| programming_docs |
php sodium_crypto_sign_publickey sodium\_crypto\_sign\_publickey
===============================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_sign\_publickey — Extract the Ed25519 public key from a keypair
### Description
```
sodium_crypto_sign_publickey(string $key_pair): string
```
Extract the Ed25519 public key from a keypair
### Parameters
`key_pair`
Ed25519 keypair (see: [sodium\_crypto\_sign\_keypair()](function.sodium-crypto-sign-keypair))
### Return Values
Ed25519 public key
php ArrayObject::serialize ArrayObject::serialize
======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
ArrayObject::serialize — Serialize an ArrayObject
### Description
```
public ArrayObject::serialize(): string
```
Serializes an [ArrayObject](class.arrayobject).
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
The serialized representation of the [ArrayObject](class.arrayobject).
### Examples
**Example #1 **ArrayObject::serialize()** example**
```
<?php
$o = new ArrayObject();
$s1 = serialize($o);
$s2 = $o->serialize();
var_dump($s1);
var_dump($s2);
?>
```
The above example will output:
```
string(45) "C:11:"ArrayObject":21:{x:i:0;a:0:{};m:a:0:{}}"
string(21) "x:i:0;a:0:{};m:a:0:{}"
```
### See Also
* [ArrayObject::unserialize()](arrayobject.unserialize) - Unserialize an ArrayObject
* [serialize()](function.serialize) - Generates a storable representation of a value
* [Serializing Objects](language.oop5.serialization)
php tidy_get_output tidy\_get\_output
=================
(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.5.2)
tidy\_get\_output — Return a string representing the parsed tidy markup
### Description
```
tidy_get_output(tidy $tidy): string
```
Gets a string with the repaired html.
### Parameters
`tidy`
The [Tidy](class.tidy) object.
### Return Values
Returns the parsed tidy markup.
### Examples
**Example #1 **tidy\_get\_output()** example**
```
<?php
$html = '<p>paragraph</i>';
$tidy = tidy_parse_string($html);
$tidy->cleanRepair();
echo tidy_get_output($tidy);
?>
```
The above example will output:
```
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title></title>
</head>
<body>
<p>paragraph</p>
</body>
</html>
```
php is_null is\_null
========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
is\_null — Finds whether a variable is **`null`**
### Description
```
is_null(mixed $value): bool
```
Finds whether the given variable is **`null`**.
### Parameters
`value`
The variable being evaluated.
### Return Values
Returns **`true`** if `value` is null, **`false`** otherwise.
### Examples
**Example #1 **is\_null()** example**
```
<?php
error_reporting(E_ALL);
$foo = NULL;
var_dump(is_null($inexistent), is_null($foo));
?>
```
```
Notice: Undefined variable: inexistent in ...
bool(true)
bool(true)
```
### See Also
* The [**`null`**](language.types.null#language.types.null.syntax) type
* [isset()](function.isset) - Determine if a variable is declared and is different than null
* [is\_bool()](function.is-bool) - Finds out whether a variable is a boolean
* [is\_numeric()](function.is-numeric) - Finds whether a variable is a number or a numeric string
* [is\_float()](function.is-float) - Finds whether the type of a variable is float
* [is\_int()](function.is-int) - Find whether the type of a variable is integer
* [is\_string()](function.is-string) - Find whether the type of a variable is string
* [is\_object()](function.is-object) - Finds whether a variable is an object
* [is\_array()](function.is-array) - Finds whether a variable is an array
php odbc_connection_string_quote odbc\_connection\_string\_quote
===============================
(PHP 8 >= 8.2.0)
odbc\_connection\_string\_quote — Quotes an ODBC connection string value
### Description
```
odbc_connection_string_quote(string $str): string
```
Quotes a value for a connection string, according to ODBC rules. That is, it will be surrounded by quotes, and any ending curly braces will be escaped. This should be done for any connection string values that come from user input. Not doing so can lead to issues with parsing the connection string, or values being injected into the connection string.
Note that this function does not check if the string is already quoted, nor if the string needs quoting. For that, call [odbc\_connection\_string\_is\_quoted()](function.odbc-connection-string-is-quoted) and [odbc\_connection\_string\_should\_quote()](function.odbc-connection-string-should-quote).
### Parameters
`str`
The unquoted string.
### Return Values
A quoted string, surrounded by curly braces, and properly escaped.
### Examples
**Example #1 **odbc\_connection\_string\_quote()** example**
This example quotes a string, then puts it in a connection string. Note that the string is quoted, and the ending quote character in the middle of the string has been escaped.
```
<?php
$value = odbc_connection_string_quote("foo}bar");
$connection_string = "DSN=PHP;UserValue=$value";
echo $connection_string;
?>
```
The above example will output something similar to:
```
DSN=PHP;UserValue={foo}}bar}
```
### See Also
* [odbc\_connection\_string\_is\_quoted()](function.odbc-connection-string-is-quoted) - Determines if an ODBC connection string value is quoted
* [odbc\_connection\_string\_should\_quote()](function.odbc-connection-string-should-quote) - Determines if an ODBC connection string value should be quoted
php DOMElement::__construct DOMElement::\_\_construct
=========================
(PHP 5, PHP 7, PHP 8)
DOMElement::\_\_construct — Creates a new DOMElement object
### Description
public **DOMElement::\_\_construct**(string `$qualifiedName`, ?string `$value` = **`null`**, string `$namespace` = "") Creates a new [DOMElement](class.domelement) object. This object is read only. It may be appended to a document, but additional nodes may not be appended to this node until the node is associated with a document. To create a writeable node, use [DOMDocument::createElement](domdocument.createelement) or [DOMDocument::createElementNS](domdocument.createelementns).
### Parameters
`qualifiedName`
The tag name of the element. When also passing in namespaceURI, the element name may take a prefix to be associated with the URI.
`value`
The value of the element.
`namespace`
A namespace URI to create the element within a specific namespace.
### Examples
**Example #1 Creating a new DOMElement**
```
<?php
$dom = new DOMDocument('1.0', 'iso-8859-1');
$element = $dom->appendChild(new DOMElement('root'));
$element_ns = new DOMElement('pr:node1', 'thisvalue', 'http://xyz');
$element->appendChild($element_ns);
echo $dom->saveXML(); /* <?xml version="1.0" encoding="utf-8"?>
<root><pr:node1 xmlns:pr="http://xyz">thisvalue</pr:node1></root> */
?>
```
### See Also
* [DOMDocument::createElement()](domdocument.createelement) - Create new element node
* [DOMDocument::createElementNS()](domdocument.createelementns) - Create new element node with an associated namespace
php Ds\Deque::clear Ds\Deque::clear
===============
(PECL ds >= 1.0.0)
Ds\Deque::clear — Removes all values from the deque
### Description
```
public Ds\Deque::clear(): void
```
Removes all values from the deque.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Deque::clear()** example**
```
<?php
$deque = new \Ds\Deque([1, 2, 3]);
print_r($deque);
$deque->clear();
print_r($deque);
?>
```
The above example will output something similar to:
```
Ds\Deque Object
(
[0] => 1
[1] => 2
[2] => 3
)
Ds\Deque Object
(
)
```
php bindtextdomain bindtextdomain
==============
(PHP 4, PHP 5, PHP 7, PHP 8)
bindtextdomain — Sets or gets the path for a domain
### Description
```
bindtextdomain(string $domain, ?string $directory): string|false
```
The **bindtextdomain()** function sets or gets the path for a domain.
### Parameters
`domain`
The domain.
`directory`
The directory path. An empty string means the current directory. If **`null`**, the currently set directory is returned.
### Return Values
The full pathname for the `domain` currently being set, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.3 | `directory` is nullable now. Previously, it was not possible to retrieve the currently set directory. |
### Examples
**Example #1 **bindtextdomain()** example**
```
<?php
$domain = 'myapp';
echo bindtextdomain($domain, '/usr/share/myapp/locale');
?>
```
The above example will output:
```
/usr/share/myapp/locale
```
### Notes
>
> **Note**:
>
>
> The **bindtextdomain()** information is maintained per process, not per thread.
>
>
php RecursiveTreeIterator::getPrefix RecursiveTreeIterator::getPrefix
================================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
RecursiveTreeIterator::getPrefix — Get the prefix
### Description
```
public RecursiveTreeIterator::getPrefix(): string
```
Gets the string to place in front of current element
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
Returns the string to place in front of current element
php Yaf_Application::app Yaf\_Application::app
=====================
(Yaf >=1.0.0)
Yaf\_Application::app — Retrieve an Application instance
### Description
```
public staticYaf_Application::app(): mixed
```
Retrieve the [Yaf\_Application](class.yaf-application) instance. Alternatively, we also could use [Yaf\_Dispatcher::getApplication()](yaf-dispatcher.getapplication).
### Parameters
This function has no parameters.
### Return Values
A Yaf\_Application instance, if no Yaf\_Application was initialized before, **`null`** will be returned.
### See Also
* [Yaf\_Dispatcher::getApplication()](yaf-dispatcher.getapplication) - Retrieve the application
php $_COOKIE $\_COOKIE
=========
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
$\_COOKIE — HTTP Cookies
### Description
An associative array of variables passed to the current script via HTTP Cookies.
### Examples
**Example #1 $\_COOKIE example**
```
<?php
echo 'Hello ' . htmlspecialchars($_COOKIE["name"]) . '!';
?>
```
Assuming the "name" cookie has been set earlier
The above example will output something similar to:
```
Hello Hannes!
```
### Notes
>
> **Note**:
>
>
> This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. There is no need to do **global $variable;** to access it within functions or methods.
>
>
>
### See Also
* [setcookie()](function.setcookie) - Send a cookie
* [Handling external variables](language.variables.external)
* [The filter extension](https://www.php.net/manual/en/book.filter.php)
php SplPriorityQueue::isCorrupted SplPriorityQueue::isCorrupted
=============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplPriorityQueue::isCorrupted — Tells if the priority queue is in a corrupted state
### Description
```
public SplPriorityQueue::isCorrupted(): bool
```
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the priority queue is corrupted, **`false`** otherwise.
php bcsub bcsub
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
bcsub — Subtract one arbitrary precision number from another
### Description
```
bcsub(string $num1, string $num2, ?int $scale = null): string
```
Subtracts the `num2` from the `num1`.
### Parameters
`num1`
The left operand, as a string.
`num2`
The right operand, as a string.
`scale`
This optional parameter is used to set the number of digits after the decimal place in the result. If omitted, it will default to the scale set globally with the [bcscale()](function.bcscale) function, or fallback to `0` if this has not been set.
### Return Values
The result of the subtraction, as a string.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `scale` is now nullable. |
### Examples
**Example #1 **bcsub()** example**
```
<?php
$a = '1.234';
$b = '5';
echo bcsub($a, $b); // -3
echo bcsub($a, $b, 4); // -3.7660
?>
```
### See Also
* [bcadd()](function.bcadd) - Add two arbitrary precision numbers
php streamWrapper::dir_readdir streamWrapper::dir\_readdir
===========================
(PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8)
streamWrapper::dir\_readdir — Read entry from directory handle
### Description
```
public streamWrapper::dir_readdir(): string
```
This method is called in response to [readdir()](function.readdir).
### Parameters
This function has no parameters.
### Return Values
Should return string representing the next filename, or **`false`** if there is no next file.
>
> **Note**:
>
>
> The return value will be casted to string.
>
>
### Errors/Exceptions
Emits **`E_WARNING`** if call to this method fails (i.e. not implemented).
### Examples
**Example #1 Listing files from tar archives**
```
<?php
class streamWrapper {
protected $fp;
public function dir_opendir($path, $options) {
$url = parse_url($path);
$path = $url["host"] . $url["path"];
if (!is_readable($path)) {
trigger_error("$path isn't readable for me", E_USER_NOTICE);
return false;
}
if (!is_file($path)) {
trigger_error("$path isn't a file", E_USER_NOTICE);
return false;
}
$this->fp = fopen($path, "rb");
return true;
}
public function dir_readdir() {
// Extract the header for this entry
$header = fread($this->fp, 512);
$data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1filetype/a100link/a100linkedfile", $header);
// Trim the filename and filesize
$filename = trim($data["filename"]);
// No filename? We are the end of the archive
if (!$filename) {
return false;
}
$octal_bytes = trim($data["size"]);
// Filesize is defined in octects
$bytes = octdec($octal_bytes);
// tar rounds up filesizes up to multiple of 512 bytes (zero filled)
$rest = $bytes % 512;
if ($rest > 0) {
$bytes += 512 - $rest;
}
// Seek over the file
fseek($this->fp, $bytes, SEEK_CUR);
return $filename;
}
public function dir_closedir() {
return fclose($this->fp);
}
public function dir_rewinddir() {
return fseek($this->fp, 0, SEEK_SET);
}
}
stream_wrapper_register("tar", "streamWrapper");
$handle = opendir("tar://example.tar");
while (false !== ($file = readdir($handle))) {
var_dump($file);
}
echo "Rewinding..\n";
rewind($handle);
var_dump(readdir($handle));
closedir($handle);
?>
```
The above example will output something similar to:
```
string(13) "construct.xml"
string(16) "dir-closedir.xml"
string(15) "dir-opendir.xml"
string(15) "dir-readdir.xml"
string(17) "dir-rewinddir.xml"
string(9) "mkdir.xml"
string(10) "rename.xml"
string(9) "rmdir.xml"
string(15) "stream-cast.xml"
string(16) "stream-close.xml"
string(14) "stream-eof.xml"
string(16) "stream-flush.xml"
string(15) "stream-lock.xml"
string(15) "stream-open.xml"
string(15) "stream-read.xml"
string(15) "stream-seek.xml"
string(21) "stream-set-option.xml"
string(15) "stream-stat.xml"
string(15) "stream-tell.xml"
string(16) "stream-write.xml"
string(10) "unlink.xml"
string(12) "url-stat.xml"
Rewinding..
string(13) "construct.xml"
```
### See Also
* [readdir()](function.readdir) - Read entry from directory handle
php gzdecode gzdecode
========
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
gzdecode — Decodes a gzip compressed string
### Description
```
gzdecode(string $data, int $max_length = 0): string|false
```
This function returns a decoded version of the input `data`.
### Parameters
`data`
The data to decode, encoded by [gzencode()](function.gzencode).
`max_length`
The maximum length of data to decode.
### Return Values
The decoded string, or or **`false`** on failure.
### Errors/Exceptions
In case of failure, an **`E_WARNING`** level error is issued.
### See Also
* [gzencode()](function.gzencode) - Create a gzip compressed string
php get_included_files get\_included\_files
====================
(PHP 4, PHP 5, PHP 7, PHP 8)
get\_included\_files — Returns an array with the names of included or required files
### Description
```
get_included_files(): array
```
Gets the names of all files that have been included using [include](function.include), [include\_once](function.include-once), [require](function.require) or [require\_once](function.require-once).
### Parameters
This function has no parameters.
### Return Values
Returns an array of the names of all files.
The script originally called is considered an "included file," so it will be listed together with the files referenced by [include](function.include) and family.
Files that are included or required multiple times only show up once in the returned array.
### Examples
**Example #1 **get\_included\_files()** example**
```
<?php
// This file is abc.php
include 'test1.php';
include_once 'test2.php';
require 'test3.php';
require_once 'test4.php';
$included_files = get_included_files();
foreach ($included_files as $filename) {
echo "$filename\n";
}
?>
```
The above example will output:
```
/path/to/abc.php
/path/to/test1.php
/path/to/test2.php
/path/to/test3.php
/path/to/test4.php
```
### See Also
* [include](function.include) - include
* [include\_once](function.include-once) - include\_once
* [require](function.require) - require
* [require\_once](function.require-once) - require\_once
* [get\_required\_files()](function.get-required-files) - Alias of get\_included\_files
php xmlrpc_parse_method_descriptions xmlrpc\_parse\_method\_descriptions
===================================
(PHP 4 >= 4.1.0, PHP 5, PHP 7)
xmlrpc\_parse\_method\_descriptions — Decodes XML into a list of method descriptions
### Description
```
xmlrpc_parse_method_descriptions(string $xml): array
```
**Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
**Warning**This function is currently not documented; only its argument list is available.
php None Variable functions
------------------
PHP supports the concept of variable functions. This means that if a variable name has parentheses appended to it, PHP will look for a function with the same name as whatever the variable evaluates to, and will attempt to execute it. Among other things, this can be used to implement callbacks, function tables, and so forth.
Variable functions won't work with language constructs such as [echo](function.echo), [print](function.print), [unset()](function.unset), [isset()](function.isset), [empty()](function.empty), [include](function.include), [require](function.require) and the like. Utilize wrapper functions to make use of any of these constructs as variable functions.
**Example #1 Variable function example**
```
<?php
function foo() {
echo "In foo()<br />\n";
}
function bar($arg = '')
{
echo "In bar(); argument was '$arg'.<br />\n";
}
// This is a wrapper function around echo
function echoit($string)
{
echo $string;
}
$func = 'foo';
$func(); // This calls foo()
$func = 'bar';
$func('test'); // This calls bar()
$func = 'echoit';
$func('test'); // This calls echoit()
?>
```
Object methods can also be called with the variable functions syntax.
**Example #2 Variable method example**
```
<?php
class Foo
{
function Variable()
{
$name = 'Bar';
$this->$name(); // This calls the Bar() method
}
function Bar()
{
echo "This is Bar";
}
}
$foo = new Foo();
$funcname = "Variable";
$foo->$funcname(); // This calls $foo->Variable()
?>
```
When calling static methods, the function call is stronger than the static property operator:
**Example #3 Variable method example with static properties**
```
<?php
class Foo
{
static $variable = 'static property';
static function Variable()
{
echo 'Method Variable called';
}
}
echo Foo::$variable; // This prints 'static property'. It does need a $variable in this scope.
$variable = "Variable";
Foo::$variable(); // This calls $foo->Variable() reading $variable in this scope.
?>
```
**Example #4 Complex callables**
```
<?php
class Foo
{
static function bar()
{
echo "bar\n";
}
function baz()
{
echo "baz\n";
}
}
$func = array("Foo", "bar");
$func(); // prints "bar"
$func = array(new Foo, "baz");
$func(); // prints "baz"
$func = "Foo::bar";
$func(); // prints "bar"
?>
```
### See Also
* [is\_callable()](function.is-callable)
* [call\_user\_func()](function.call-user-func)
* [function\_exists()](function.function-exists)
* [variable variables](language.variables.variable)
| programming_docs |
php Gmagick::getimagecolors Gmagick::getimagecolors
=======================
(PECL gmagick >= Unknown)
Gmagick::getimagecolors — Returns the color of the specified colormap index
### Description
```
public Gmagick::getimagecolors(): int
```
Returns the color of the specified colormap index.
### Parameters
This function has no parameters.
### Return Values
The number of colors in image.
### Errors/Exceptions
Throws an **GmagickException** on error.
php The SNMP class
The SNMP class
==============
Introduction
------------
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
Represents SNMP session.
Class synopsis
--------------
class **SNMP** { /\* Properties \*/ public readonly array [$info](class.snmp#snmp.props.info);
public ?int [$max\_oids](class.snmp#snmp.props.max-oids);
public int [$valueretrieval](class.snmp#snmp.props.valueretrieval);
public bool [$quick\_print](class.snmp#snmp.props.quick-print);
public bool [$enum\_print](class.snmp#snmp.props.enum-print);
public int [$oid\_output\_format](class.snmp#snmp.props.oid-output-format);
public bool [$oid\_increasing\_check](class.snmp#snmp.props.oid-increasing-check);
public int [$exceptions\_enabled](class.snmp#snmp.props.exceptions-enabled); /\* Methods \*/ public [\_\_construct](snmp.construct)(
int `$version`,
string `$hostname`,
string `$community`,
int `$timeout` = -1,
int `$retries` = -1
)
```
public close(): bool
```
```
public get(array|string $objectId, bool $preserveKeys = false): mixed
```
```
public getErrno(): int
```
```
public getError(): string
```
```
public getnext(array|string $objectId): mixed
```
```
public set(array|string $objectId, array|string $type, array|string $value): bool
```
```
public setSecurity(
string $securityLevel,
string $authProtocol = "",
string $authPassphrase = "",
string $privacyProtocol = "",
string $privacyPassphrase = "",
string $contextName = "",
string $contextEngineId = ""
): bool
```
```
public walk(
array|string $objectId,
bool $suffixAsKey = false,
int $maxRepetitions = -1,
int $nonRepeaters = -1
): array|false
```
/\* Constants \*/ const int [ERRNO\_NOERROR](class.snmp#snmp.class.constants.errno-noerror) = 0;
const int [ERRNO\_GENERIC](class.snmp#snmp.class.constants.errno-generic) = 2;
const int [ERRNO\_TIMEOUT](class.snmp#snmp.class.constants.errno-timeout) = 4;
const int [ERRNO\_ERROR\_IN\_REPLY](class.snmp#snmp.class.constants.errno-error-in-reply) = 8;
const int [ERRNO\_OID\_NOT\_INCREASING](class.snmp#snmp.class.constants.errno-oid-not-increasing) = 16;
const int [ERRNO\_OID\_PARSING\_ERROR](class.snmp#snmp.class.constants.errno-oid-parsing-error) = 32;
const int [ERRNO\_MULTIPLE\_SET\_QUERIES](class.snmp#snmp.class.constants.errno-multiple-set-queries) = 64;
const int [ERRNO\_ANY](class.snmp#snmp.class.constants.errno-multiple-set-queries) = 126;
const int [VERSION\_1](class.snmp#snmp.class.constants.version-1) = 0;
const int [VERSION\_2C](class.snmp#snmp.class.constants.version-2c) = 1;
const int [VERSION\_2c](class.snmp#snmp.class.constants.version-2c) = 1;
const int [VERSION\_3](class.snmp#snmp.class.constants.version-3) = 3; } Properties
----------
max\_oids Maximum OID per GET/SET/GETBULK request
valueretrieval Controls the method how the SNMP values will be returned
| | |
| --- | --- |
| **`SNMP_VALUE_LIBRARY`** | The return values will be as returned by the Net-SNMP library. |
| **`SNMP_VALUE_PLAIN`** | The return values will be the plain value without the SNMP type information. |
| **`SNMP_VALUE_OBJECT`** | The return values will be objects with the properties "value" and "type", where the latter is one of the SNMP\_OCTET\_STR, SNMP\_COUNTER etc. constants. The way "value" is returned is based on which one of **`SNMP_VALUE_LIBRARY`**, **`SNMP_VALUE_PLAIN`** is set |
quick\_print Value of `quick_print` within the NET-SNMP library
Sets the value of `quick_print` within the NET-SNMP library. When this is set (1), the SNMP library will return 'quick printed' values. This means that just the value will be printed. When `quick_print` is not enabled (default) the NET-SNMP library prints extra information including the type of the value (i.e. IpAddress or OID). Additionally, if quick\_print is not enabled, the library prints additional hex values for all strings of three characters or less.
enum\_print Controls the way enum values are printed
Parameter toggles if walk/get etc. should automatically lookup enum values in the MIB and return them together with their human readable string.
oid\_output\_format Controls OID output format
**OID .1.3.6.1.2.1.1.3.0 representation for various oid\_output\_format values**| **`SNMP_OID_OUTPUT_FULL`** | .iso.org.dod.internet.mgmt.mib-2.system.sysUpTime.sysUpTimeInstance |
| **`SNMP_OID_OUTPUT_NUMERIC`** | .1.3.6.1.2.1.1.3.0 |
| **`SNMP_OID_OUTPUT_MODULE`** | DISMAN-EVENT-MIB::sysUpTimeInstance |
| **`SNMP_OID_OUTPUT_SUFFIX`** | sysUpTimeInstance |
| **`SNMP_OID_OUTPUT_UCD`** | system.sysUpTime.sysUpTimeInstance |
| **`SNMP_OID_OUTPUT_NONE`** | Undefined |
oid\_increasing\_check Controls disabling check for increasing OID while walking OID tree
Some SNMP agents are known for returning OIDs out of order but can complete the walk anyway. Other agents return OIDs that are out of order and can cause [SNMP::walk()](snmp.walk) to loop indefinitely until memory limit will be reached. PHP SNMP library by default performs OID increasing check and stops walking on OID tree when it detects possible loop with issuing warning about non-increasing OID faced. Set oid\_increasing\_check to **`false`** to disable this check.
exceptions\_enabled Controls which failures will raise SNMPException instead of warning. Use bitwise OR'ed **`SNMP::ERRNO_*`** constants. By default all SNMP exceptions are disabled.
info Read-only property with remote agent configuration: hostname, port, default timeout, default retries count
Predefined Constants
--------------------
SNMP Error Types
-----------------
**`SNMP::ERRNO_NOERROR`** No SNMP-specific error occurred.
**`SNMP::ERRNO_GENERIC`** A generic SNMP error occurred.
**`SNMP::ERRNO_TIMEOUT`** Request to SNMP agent timed out.
**`SNMP::ERRNO_ERROR_IN_REPLY`** SNMP agent returned an error in reply.
**`SNMP::ERRNO_OID_NOT_INCREASING`** SNMP agent faced OID cycling reporning non-increasing OID while executing (BULK)WALK command. This indicates bogus remote SNMP agent.
**`SNMP::ERRNO_OID_PARSING_ERROR`** Library failed while parsing OID (and/or type for SET command). No queries has been made.
**`SNMP::ERRNO_MULTIPLE_SET_QUERIES`** Library will use multiple queries for SET operation requested. That means that operation will be performed in a non-transaction manner and second or subsequent chunks may fail if a type or value failure will be faced.
**`SNMP::ERRNO_ANY`** All SNMP::ERRNO\_\* codes bitwise OR'ed.
SNMP Protocol Versions
-----------------------
**`SNMP::VERSION_1`**
**`SNMP::VERSION_2C`**, **`SNMP::VERSION_2c`**
**`SNMP::VERSION_3`** Table of Contents
-----------------
* [SNMP::close](snmp.close) — Close SNMP session
* [SNMP::\_\_construct](snmp.construct) — Creates SNMP instance representing session to remote SNMP agent
* [SNMP::get](snmp.get) — Fetch an SNMP object
* [SNMP::getErrno](snmp.geterrno) — Get last error code
* [SNMP::getError](snmp.geterror) — Get last error message
* [SNMP::getnext](snmp.getnext) — Fetch an SNMP object which follows the given object id
* [SNMP::set](snmp.set) — Set the value of an SNMP object
* [SNMP::setSecurity](snmp.setsecurity) — Configures security-related SNMPv3 session parameters
* [SNMP::walk](snmp.walk) — Fetch SNMP object subtree
php SplDoublyLinkedList::push SplDoublyLinkedList::push
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplDoublyLinkedList::push — Pushes an element at the end of the doubly linked list
### Description
```
public SplDoublyLinkedList::push(mixed $value): void
```
Pushes `value` at the end of the doubly linked list.
### Parameters
`value`
The value to push.
### Return Values
No value is returned.
php Yaf_Session::__construct Yaf\_Session::\_\_construct
===========================
(Yaf >=1.0.0)
Yaf\_Session::\_\_construct — Constructor of Yaf\_Session
### Description
private **Yaf\_Session::\_\_construct**()
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php Lua::eval Lua::eval
=========
(PECL lua >=0.9.0)
Lua::eval — Evaluate a string as Lua code
### Description
```
public Lua::eval(string $statements): mixed
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`statements`
### Return Values
Returns result of evaled code, **`null`** for wrong arguments or **`false`** on other failure.
### Examples
**Example #1 **Lua::eval()**example**
```
<?php
$lua = new Lua();
$lua->eval(<<<CODE
print(2);
CODE
);
?>
```
The above example will output:
```
2
```
php is_readable is\_readable
============
(PHP 4, PHP 5, PHP 7, PHP 8)
is\_readable — Tells whether a file exists and is readable
### Description
```
is_readable(string $filename): bool
```
Tells whether a file exists and is readable.
### Parameters
`filename`
Path to the file.
### Return Values
Returns **`true`** if the file or directory specified by `filename` exists and is readable, **`false`** otherwise.
### Errors/Exceptions
Upon failure, an **`E_WARNING`** is emitted.
### Examples
**Example #1 **is\_readable()** example**
```
<?php
$filename = 'test.txt';
if (is_readable($filename)) {
echo 'The file is readable';
} else {
echo 'The file is not readable';
}
?>
```
### Notes
Keep in mind that PHP may be accessing the file as the user id that the web server runs as (often 'nobody').
> **Note**: The results of this function are cached. See [clearstatcache()](function.clearstatcache) for more details.
>
>
**Tip**As of PHP 5.0.0, this function can also be used with *some* URL wrappers. Refer to [Supported Protocols and Wrappers](https://www.php.net/manual/en/wrappers.php) to determine which wrappers support [stat()](function.stat) family of functionality.
>
> **Note**:
>
>
> The check is done using the real UID/GID instead of the effective one.
>
>
This function may return **`true`** for directories. Use [is\_dir()](function.is-dir) to distinguish file and directory.
### See Also
* [is\_writable()](function.is-writable) - Tells whether the filename is writable
* [file\_exists()](function.file-exists) - Checks whether a file or directory exists
* [fgets()](function.fgets) - Gets line from file pointer
php convert_uuencode convert\_uuencode
=================
(PHP 5, PHP 7, PHP 8)
convert\_uuencode — Uuencode a string
### Description
```
convert_uuencode(string $string): string
```
**convert\_uuencode()** encodes a string using the uuencode algorithm.
Uuencode translates all strings (including binary data) into printable characters, making them safe for network transmissions. Uuencoded data is about 35% larger than the original.
> **Note**: **convert\_uuencode()** neither produces the `begin` nor the `end` line, which are part of uuencoded *files*.
>
>
### Parameters
`string`
The data to be encoded.
### Return Values
Returns the uuencoded data.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Prior to this version, trying to convert an empty string returned **`false`** for no particular reason. |
### Examples
**Example #1 **convert\_uuencode()** example**
```
<?php
$some_string = "test\ntext text\r\n";
echo convert_uuencode($some_string);
?>
```
The above example will output:
```
0=&5S=`IT97AT('1E>'0-"@``
`
```
### See Also
* [convert\_uudecode()](function.convert-uudecode) - Decode a uuencoded string
* [base64\_encode()](function.base64-encode) - Encodes data with MIME base64
php SolrParams::getParam SolrParams::getParam
====================
(PECL solr >= 0.9.2)
SolrParams::getParam — Returns a parameter value
### Description
```
final public SolrParams::getParam(string $param_name = ?): mixed
```
Returns a parameter with name param\_name
### Parameters
`param_name`
The name of the parameter
### Return Values
Returns a string or an array depending on the type of the parameter
php SyncSharedMemory::size SyncSharedMemory::size
======================
(PECL sync >= 1.1.0)
SyncSharedMemory::size — Returns the size of the named shared memory
### Description
```
public SyncSharedMemory::size(): int
```
Retrieves the shared memory size of a [SyncSharedMemory](class.syncsharedmemory) object.
### Parameters
This function has no parameters.
### Return Values
An integer containing the size of the shared memory. This will be the same size that was passed to the constructor.
### Examples
**Example #1 **SyncSharedMemory::size()** example**
```
<?php
$mem = new SyncSharedMemory("AppReportName", 1024);
var_dump($mem->size());
?>
```
The above example will output something similar to:
```
int(1024)
```
### See Also
* [SyncSharedMemory::\_\_construct()](syncsharedmemory.construct) - Constructs a new SyncSharedMemory object
* [SyncSharedMemory::write()](syncsharedmemory.write) - Copy data to named shared memory
* [SyncSharedMemory::read()](syncsharedmemory.read) - Copy data from named shared memory
php The V8Js class
The V8Js class
==============
Introduction
------------
(PECL v8js >= 0.1.0)
This is the core class for V8Js extension. Each instance created from this class has own context in which all JavaScript is compiled and executed.
See [V8Js::\_\_construct()](v8js.construct) for more information.
Class synopsis
--------------
class **V8Js** { /\* Constants \*/ const string [V8\_VERSION](class.v8js#v8js.constants.v8-version);
const int [FLAG\_NONE](class.v8js#v8js.constants.flag-none) = 1;
const int [FLAG\_FORCE\_ARRAY](class.v8js#v8js.constants.flag-force-array) = 2; /\* Methods \*/ public [\_\_construct](v8js.construct)(
string `$object_name` = "PHP",
array `$variables` = array(),
array `$extensions` = array(),
bool `$report_uncaught_exceptions` = **`true`**
)
```
public executeString(string $script, string $identifier = "V8Js::executeString()", int $flags = V8Js::FLAG_NONE): mixed
```
```
public static getExtensions(): array
```
```
public getPendingException(): V8JsException
```
```
public static registerExtension(
string $extension_name,
string $script,
array $dependencies = array(),
bool $auto_enable = false
): bool
```
} Predefined Constants
--------------------
**`V8Js::V8_VERSION`** The V8 Javascript Engine version.
**`V8Js::FLAG_NONE`** No flags.
**`V8Js::FLAG_FORCE_ARRAY`** Forces all JS objects to be associative arrays in PHP.
Table of Contents
-----------------
* [V8Js::\_\_construct](v8js.construct) — Construct a new V8Js object
* [V8Js::executeString](v8js.executestring) — Execute a string as Javascript code
* [V8Js::getExtensions](v8js.getextensions) — Return an array of registered extensions
* [V8Js::getPendingException](v8js.getpendingexception) — Return pending uncaught Javascript exception
* [V8Js::registerExtension](v8js.registerextension) — Register Javascript extensions for V8Js
php ldap_mod_replace ldap\_mod\_replace
==================
(PHP 4, PHP 5, PHP 7, PHP 8)
ldap\_mod\_replace — Replace attribute values with new ones
### Description
```
ldap_mod_replace(
LDAP\Connection $ldap,
string $dn,
array $entry,
?array $controls = null
): bool
```
Replaces one or more attributes from the specified `dn`. It may also add or remove attributes.
### Parameters
`ldap`
An [LDAP\Connection](class.ldap-connection) instance, returned by [ldap\_connect()](function.ldap-connect).
`dn`
The distinguished name of an LDAP entity.
`entry`
An associative array listing the attributes to replace. Sending an empty array as value will remove the attribute, while sending an attribute not existing yet on this entry will add it.
`controls`
Array of [LDAP Controls](https://www.php.net/manual/en/ldap.controls.php) to send with the request.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `ldap` parameter expects an [LDAP\Connection](class.ldap-connection) instance now; previously, a [resource](language.types.resource) was expected. |
| 8.0.0 | `controls` is nullable now; previously, it defaulted to `[]`. |
| 7.3.0 | Support for `controls` added |
### Notes
> **Note**: This function is binary-safe.
>
>
### See Also
* [ldap\_mod\_replace\_ext()](function.ldap-mod_replace-ext) - Replace attribute values with new ones
* [ldap\_mod\_del()](function.ldap-mod-del) - Delete attribute values from current attributes
* [ldap\_mod\_add()](function.ldap-mod-add) - Add attribute values to current attributes
* [ldap\_modify\_batch()](function.ldap-modify-batch) - Batch and execute modifications on an LDAP entry
php Phar::isCompressed Phar::isCompressed
==================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
Phar::isCompressed — Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)
### Description
```
public Phar::isCompressed(): int|false
```
>
> **Note**:
>
>
> This method requires the php.ini setting `phar.readonly` to be set to `0` in order to work for [Phar](class.phar) objects. Otherwise, a [PharException](class.pharexception) will be thrown.
>
>
>
Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on). Zip-based phar archives cannot be compressed as a file, and so this method will always return **`false`** if a zip-based phar archive is queried.
### Parameters
No parameters.
### Return Values
`Phar::GZ`, `Phar::BZ2` or **`false`**.
### Examples
**Example #1 A **Phar::isCompressed()** example**
```
<?php
try {
$phar1 = new Phar('myphar.zip.phar');
var_dump($phar1->isCompressed());
$phar2 = new Phar('myuncompressed.tar.phar');
var_dump($phar2->isCompressed());
$phar2->compress(Phar::GZ);
var_dump($phar2->isCompressed() == Phar::GZ);
} catch (Exception $e) {
}
?>
```
The above example will output:
```
bool(false)
bool(false)
bool(true)
```
### See Also
* [PharFileInfo::getCompressedSize()](pharfileinfo.getcompressedsize) - Returns the actual size of the file (with compression) inside the Phar archive
* [PharFileInfo::isCompressed()](pharfileinfo.iscompressed) - Returns whether the entry is compressed
* [PharFileInfo::decompress()](pharfileinfo.decompress) - Decompresses the current Phar entry within the phar
* [PharFileInfo::compress()](pharfileinfo.compress) - Compresses the current Phar entry with either zlib or bzip2 compression
* [Phar::decompress()](phar.decompress) - Decompresses the entire Phar archive
* [Phar::compress()](phar.compress) - Compresses the entire Phar archive using Gzip or Bzip2 compression
* [Phar::canCompress()](phar.cancompress) - Returns whether phar extension supports compression using either zlib or bzip2
* [Phar::compressFiles()](phar.compressfiles) - Compresses all files in the current Phar archive
* [Phar::decompressFiles()](phar.decompressfiles) - Decompresses all files in the current Phar archive
* [Phar::getSupportedCompression()](phar.getsupportedcompression) - Return array of supported compression algorithms
| programming_docs |
php Imagick::gammaImage Imagick::gammaImage
===================
(PECL imagick 2, PECL imagick 3)
Imagick::gammaImage — Gamma-corrects an image
### Description
```
public Imagick::gammaImage(float $gamma, int $channel = Imagick::CHANNEL_DEFAULT): bool
```
Gamma-corrects an image. The same image viewed on different devices will have perceptual differences in the way the image's intensities are represented on the screen. Specify individual gamma levels for the red, green, and blue channels, or adjust all three with the gamma parameter. Values typically range from 0.8 to 2.3.
### Parameters
`gamma`
The amount of gamma-correction.
`channel`
Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channeltype constants using bitwise operators. Refer to this list of [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel).
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::gammaImage()****
```
<?php
function gammaImage($imagePath, $gamma, $channel) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->gammaImage($gamma, $channel);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php mysqli_result::fetch_assoc mysqli\_result::fetch\_assoc
============================
mysqli\_fetch\_assoc
====================
(PHP 5, PHP 7, PHP 8)
mysqli\_result::fetch\_assoc -- mysqli\_fetch\_assoc — Fetch the next row of a result set as an associative array
### Description
Object-oriented style
```
public mysqli_result::fetch_assoc(): array|null|false
```
Procedural style
```
mysqli_fetch_assoc(mysqli_result $result): array|null|false
```
Fetches one row of data from the result set and returns it as an associative array. Each subsequent call to this function will return the next row within the result set, or **`null`** if there are no more rows.
If two or more columns of the result have the same name, the last column will take precedence and overwrite any previous data. To access multiple columns with the same name, [mysqli\_fetch\_row()](mysqli-result.fetch-row) may be used to fetch the numerically indexed array, or aliases may be used in the SQL query select list to give columns different names.
> **Note**: Field names returned by this function are *case-sensitive*.
>
>
> **Note**: This function sets NULL fields to the PHP **`null`** value.
>
>
### Parameters
`result`
Procedural style only: A [mysqli\_result](class.mysqli-result) object returned by [mysqli\_query()](mysqli.query), [mysqli\_store\_result()](mysqli.store-result), [mysqli\_use\_result()](mysqli.use-result) or [mysqli\_stmt\_get\_result()](mysqli-stmt.get-result).
### Return Values
Returns an associative array representing the fetched row, where each key in the array represents the name of one of the result set's columns, **`null`** if there are no more rows in the result set, or **`false`** on failure.
### Examples
**Example #1 **mysqli\_result::fetch\_assoc()** example**
Object-oriented style
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
$query = "SELECT Name, CountryCode FROM City ORDER BY ID DESC";
$result = $mysqli->query($query);
/* fetch associative array */
while ($row = $result->fetch_assoc()) {
printf("%s (%s)\n", $row["Name"], $row["CountryCode"]);
}
```
Procedural style
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = mysqli_connect("localhost", "my_user", "my_password", "world");
$query = "SELECT Name, CountryCode FROM City ORDER BY ID DESC";
$result = mysqli_query($mysqli, $query);
/* fetch associative array */
while ($row = mysqli_fetch_assoc($result)) {
printf("%s (%s)\n", $row["Name"], $row["CountryCode"]);
}
```
The above examples will output something similar to:
```
Pueblo (USA)
Arvada (USA)
Cape Coral (USA)
Green Bay (USA)
Santa Clara (USA)
```
**Example #2 Comparison of [mysqli\_result](class.mysqli-result) [iterator](class.iterator) and **mysqli\_result::fetch\_assoc()** usage**
[mysqli\_result](class.mysqli-result) can be iterated using [foreach](control-structures.foreach). The result set will always be iterated from the first row, regardless of the current position.
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
$query = 'SELECT Name, CountryCode FROM City ORDER BY ID DESC';
// Using iterators
$result = $mysqli->query($query);
foreach ($result as $row) {
printf("%s (%s)\n", $row["Name"], $row["CountryCode"]);
}
echo "\n==================\n";
// Not using iterators
$result = $mysqli->query($query);
while ($row = $result->fetch_assoc()) {
printf("%s (%s)\n", $row["Name"], $row["CountryCode"]);
}
```
The above example will output something similar to:
```
Pueblo (USA)
Arvada (USA)
Cape Coral (USA)
Green Bay (USA)
Santa Clara (USA)
==================
Pueblo (USA)
Arvada (USA)
Cape Coral (USA)
Green Bay (USA)
Santa Clara (USA)
```
### See Also
* [mysqli\_fetch\_array()](mysqli-result.fetch-array) - Fetch the next row of a result set as an associative, a numeric array, or both
* [mysqli\_fetch\_column()](mysqli-result.fetch-column) - Fetch a single column from the next row of a result set
* [mysqli\_fetch\_row()](mysqli-result.fetch-row) - Fetch the next row of a result set as an enumerated array
* [mysqli\_fetch\_object()](mysqli-result.fetch-object) - Fetch the next row of a result set as an object
* [mysqli\_query()](mysqli.query) - Performs a query on the database
* [mysqli\_data\_seek()](mysqli-result.data-seek) - Adjusts the result pointer to an arbitrary row in the result
php AppendIterator::append AppendIterator::append
======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
AppendIterator::append — Appends an iterator
### Description
```
public AppendIterator::append(Iterator $iterator): void
```
Appends an iterator.
### Parameters
`iterator`
The iterator to append.
### Return Values
No value is returned.
### Examples
**Example #1 **AppendIterator::append()** example**
```
<?php
$array_a = new ArrayIterator(array('a', 'b', 'c'));
$array_b = new ArrayIterator(array('d', 'e', 'f'));
$iterator = new AppendIterator;
$iterator->append($array_a);
$iterator->append($array_b);
foreach ($iterator as $current) {
echo $current;
}
?>
```
The above example will output:
```
abcdef
```
### See Also
* [AppendIterator::\_\_construct()](appenditerator.construct) - Constructs an AppendIterator
php The DOMNodeList class
The DOMNodeList class
=====================
Class synopsis
--------------
(PHP 5, PHP 7, PHP 8)
class **DOMNodeList** implements [IteratorAggregate](class.iteratoraggregate), [Countable](class.countable) { /\* Properties \*/ public readonly int [$length](class.domnodelist#domnodelist.props.length); /\* Methods \*/
```
public count(): int
```
```
public item(int $index): DOMNode|DOMNameSpaceNode|null
```
} Properties
----------
length The number of nodes in the list. The range of valid child node indices is 0 to `length - 1` inclusive.
Changelog
---------
| Version | Description |
| --- | --- |
| 8.0.0 | **DOMNodeList** implements [IteratorAggregate](class.iteratoraggregate) now. Previously, [Traversable](class.traversable) was implemented instead. |
| 7.2.0 | The [Countable](class.countable) interface is implemented and returns the value of the [length](class.domnodelist#domnodelist.props.length) property. |
See Also
--------
* [» W3C specification of NodeList](http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-536297177)
Table of Contents
-----------------
* [DOMNodeList::count](domnodelist.count) — Get number of nodes in the list
* [DOMNodeList::item](domnodelist.item) — Retrieves a node specified by index
php The DOMImplementation class
The DOMImplementation class
===========================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
The **DOMImplementation** class provides a number of methods for performing operations that are independent of any particular instance of the document object model.
Class synopsis
--------------
class **DOMImplementation** { /\* Methods \*/
```
public createDocument(?string $namespace = null, string $qualifiedName = "", ?DOMDocumentType $doctype = null): DOMDocument|false
```
```
public createDocumentType(string $qualifiedName, string $publicId = "", string $systemId = ""): DOMDocumentType|false
```
```
public hasFeature(string $feature, string $version): bool
```
} Table of Contents
-----------------
* [DOMImplementation::\_\_construct](domimplementation.construct) — Creates a new DOMImplementation object
* [DOMImplementation::createDocument](domimplementation.createdocument) — Creates a DOMDocument object of the specified type with its document element
* [DOMImplementation::createDocumentType](domimplementation.createdocumenttype) — Creates an empty DOMDocumentType object
* [DOMImplementation::hasFeature](domimplementation.hasfeature) — Test if the DOM implementation implements a specific feature
php gettext gettext
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
gettext — Lookup a message in the current domain
### Description
```
gettext(string $message): string
```
Looks up a message in the current domain.
### Parameters
`message`
The message being translated.
### Return Values
Returns a translated string if one is found in the translation table, or the submitted message if not found.
### Examples
**Example #1 **gettext()**-check**
```
<?php
// Set language to German
putenv('LC_ALL=de_DE');
setlocale(LC_ALL, 'de_DE');
// Specify location of translation tables
bindtextdomain("myPHPApp", "./locale");
// Choose domain
textdomain("myPHPApp");
// Translation is looking for in ./locale/de_DE/LC_MESSAGES/myPHPApp.mo now
// Print a test message
echo gettext("Welcome to My PHP Application");
// Or use the alias _() for gettext()
echo _("Have a nice day");
?>
```
### Notes
>
> **Note**:
>
>
> You may use the underscore character '\_' as an alias to this function.
>
>
>
> **Note**:
>
>
> Setting a language isn't enough for some systems and the [putenv()](function.putenv) should be used to define the current locale.
>
>
### See Also
* [setlocale()](function.setlocale) - Set locale information
php gnupg_geterrorinfo gnupg\_geterrorinfo
===================
(PECL gnupg >= 1.5)
gnupg\_geterrorinfo — Returns the error info
### Description
```
gnupg_geterrorinfo(resource $identifier): array
```
### Parameters
`identifier`
The gnupg identifier, from a call to [gnupg\_init()](function.gnupg-init) or **gnupg**.
### Return Values
Returns an array with error info.
### Examples
**Example #1 Procedural **gnupg\_geterrorinfo()** example**
```
<?php
$res = gnupg_init();
// this is called without any error
print_r(gnupg_geterrorinfo($res));
?>
```
The above example will output:
```
array(4) {
["generic_message"]=>
bool(false)
["gpgme_code"]=>
int(0)
["gpgme_source"]=>
string(18) "Unspecified source"
["gpgme_message"]=>
string(7) "Success"
}
```
**Example #2 OO **gnupg\_geterrorinfo()** example**
```
<?php
$gpg = new gnupg();
// error call
$gpg->decrypt('abc');
// error info should be displayed
print_r($gpg->geterrorinfo());
?>
```
The above example will output:
```
array(4) {
["generic_message"]=>
string(14) "decrypt failed"
["gpgme_code"]=>
int(117440570)
["gpgme_source"]=>
string(5) "GPGME"
["gpgme_message"]=>
string(7) "No data"
}
```
php ImagickDraw::getFillOpacity ImagickDraw::getFillOpacity
===========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::getFillOpacity — Returns the opacity used when drawing
### Description
```
public ImagickDraw::getFillOpacity(): float
```
**Warning**This function is currently not documented; only its argument list is available.
Returns the opacity used when drawing using the fill color or fill texture. Fully opaque is 1.0.
### Return Values
The opacity.
php SplDoublyLinkedList::offsetSet SplDoublyLinkedList::offsetSet
==============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplDoublyLinkedList::offsetSet — Sets the value at the specified $index to $value
### Description
```
public SplDoublyLinkedList::offsetSet(?int $index, mixed $value): void
```
Sets the value at the specified `index` to `value`.
### Parameters
`index`
The index being set. If **`null`**, the next value will be added after the last item.
`value`
The new value for the `index`.
### Return Values
No value is returned.
### Errors/Exceptions
Throws [OutOfRangeException](class.outofrangeexception) when `index` is out of bounds or when `index` cannot be parsed as an integer.
php Ds\Map::putAll Ds\Map::putAll
==============
(PECL ds >= 1.0.2)
Ds\Map::putAll — Associates all key-value pairs of a traversable object or array
### Description
```
public Ds\Map::putAll(mixed $pairs): void
```
Associates all key-value `pairs` of a [traversable](class.traversable) object or array.
>
> **Note**:
>
>
> Keys of type object are supported. If an object implements **Ds\Hashable**, equality will be determined by the object's `equals` function. If an object does not implement **Ds\Hashable**, objects must be references to the same instance to be considered equal.
>
>
### Parameters
`pairs`
[traversable](class.traversable) object or array.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Map::putAll()** example**
```
<?php
$map = new \Ds\Map();
$map->putAll([
"a" => 1,
"b" => 2,
"c" => 3,
]);
print_r($map);
?>
```
The above example will output something similar to:
```
Ds\Map Object
(
[0] => Ds\Pair Object
(
[key] => a
[value] => 1
)
[1] => Ds\Pair Object
(
[key] => b
[value] => 2
)
[2] => Ds\Pair Object
(
[key] => c
[value] => 3
)
)
```
php explode explode
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
explode — Split a string by a string
### Description
```
explode(string $separator, string $string, int $limit = PHP_INT_MAX): array
```
Returns an array of strings, each of which is a substring of `string` formed by splitting it on boundaries formed by the string `separator`.
### Parameters
`separator`
The boundary string.
`string`
The input string.
`limit`
If `limit` is set and positive, the returned array will contain a maximum of `limit` elements with the last element containing the rest of `string`.
If the `limit` parameter is negative, all components except the last -`limit` are returned.
If the `limit` parameter is zero, then this is treated as 1.
>
> **Note**:
>
>
> Prior to PHP 8.0, [implode()](function.implode) accepted its parameters in either order. **explode()** has never supported this: you must ensure that the `separator` argument comes before the `string` argument.
>
>
### Return Values
Returns an array of strings created by splitting the `string` parameter on boundaries formed by the `separator`.
If `separator` is an empty string (""), **explode()** throws a [ValueError](class.valueerror). If `separator` contains a value that is not contained in `string` and a negative `limit` is used, then an empty array will be returned, otherwise an array containing `string` will be returned. If `separator` values appear at the start or end of `string`, said values will be added as an empty array value either in the first or last position of the returned array respectively.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | **explode()** will now throw [ValueError](class.valueerror) when `separator` parameter is given an empty string (`""`). Previously, **explode()** returned **`false`** instead. |
### Examples
**Example #1 **explode()** examples**
```
<?php
// Example 1
$pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2
// Example 2
$data = "foo:*:1023:1000::/home/foo:/bin/sh";
list($user, $pass, $uid, $gid, $gecos, $home, $shell) = explode(":", $data);
echo $user; // foo
echo $pass; // *
?>
```
**Example #2 **explode()** return examples**
```
<?php
/*
A string that doesn't contain the delimiter will simply
return a one-length array of the original string.
*/
$input1 = "hello";
$input2 = "hello,there";
$input3 = ',';
var_dump( explode( ',', $input1 ) );
var_dump( explode( ',', $input2 ) );
var_dump( explode( ',', $input3 ) );
?>
```
The above example will output:
```
array(1)
(
[0] => string(5) "hello"
)
array(2)
(
[0] => string(5) "hello"
[1] => string(5) "there"
)
array(2)
(
[0] => string(0) ""
[1] => string(0) ""
)
```
**Example #3 `limit` parameter examples**
```
<?php
$str = 'one|two|three|four';
// positive limit
print_r(explode('|', $str, 2));
// negative limit
print_r(explode('|', $str, -1));
?>
```
The above example will output:
```
Array
(
[0] => one
[1] => two|three|four
)
Array
(
[0] => one
[1] => two
[2] => three
)
```
### Notes
> **Note**: This function is binary-safe.
>
>
### See Also
* [preg\_split()](function.preg-split) - Split string by a regular expression
* [str\_split()](function.str-split) - Convert a string to an array
* [mb\_split()](function.mb-split) - Split multibyte string using regular expression
* [str\_word\_count()](function.str-word-count) - Return information about words used in a string
* [strtok()](function.strtok) - Tokenize string
* [implode()](function.implode) - Join array elements with a string
php DirectoryIterator::isReadable DirectoryIterator::isReadable
=============================
(PHP 5, PHP 7, PHP 8)
DirectoryIterator::isReadable — Determine if current DirectoryIterator item can be read
### Description
```
public DirectoryIterator::isReadable(): bool
```
Determines if the current [DirectoryIterator](class.directoryiterator) item is readable.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the file is readable, otherwise **`false`**
### Examples
**Example #1 **DirectoryIterator::isReadable()** example**
```
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
foreach ($iterator as $fileinfo) {
if ($fileinfo->isReadable()) {
echo $fileinfo->getFilename() . "\n";
}
}
?>
```
The above example will output something similar to:
```
apple.jpg
banana.jpg
example.php
pears.jpg
```
### See Also
* [DirectoryIterator::isExecutable()](directoryiterator.isexecutable) - Determine if current DirectoryIterator item is executable
* [DirectoryIterator::isWritable()](directoryiterator.iswritable) - Determine if current DirectoryIterator item can be written to
* [DirectoryIterator::getPerms()](directoryiterator.getperms) - Get the permissions of current DirectoryIterator item
php Zookeeper::__construct Zookeeper::\_\_construct
========================
(PECL zookeeper >= 0.1.0)
Zookeeper::\_\_construct — Create a handle to used communicate with zookeeper
### Description
public **Zookeeper::\_\_construct**(string `$host` = '', [callable](language.types.callable) `$watcher_cb` = **`null`**, int `$recv_timeout` = 10000) This method creates a new handle and a zookeeper session that corresponds to that handle. Session establishment is asynchronous, meaning that the session should not be considered established until (and unless) an event of state ZOO\_CONNECTED\_STATE is received.
### Parameters
`host`
comma separated host:port pairs, each corresponding to a zk server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002"
`watcher_cb`
the global watcher callback function. When notifications are triggered this function will be invoked.
`recv_timeout`
the timeout for this session, only valid if the connections is currently connected (ie. last watcher state is ZOO\_CONNECTED\_STATE).
### Errors/Exceptions
This method emits PHP error/warning when parameters count or types are wrong or could not init instance.
**Caution** Since version 0.3.0, this method emits [ZookeeperException](class.zookeeperexception) and it's derivatives.
### See Also
* [Zookeeper::connect()](zookeeper.connect) - Create a handle to used communicate with zookeeper
* [ZookeeperException](class.zookeeperexception)
| programming_docs |
php Componere\Method::setProtected Componere\Method::setProtected
==============================
(Componere 2 >= 2.1.0)
Componere\Method::setProtected — Accessibility Modification
### Description
```
public Componere\Method::setProtected(): Method
```
### Return Values
The current Method
### Exceptions
**Warning** Shall throw [RuntimeException](class.runtimeexception) if access level was previously set
php Imagick::setType Imagick::setType
================
(PECL imagick 2, PECL imagick 3)
Imagick::setType — Sets the image type attribute
### Description
```
public Imagick::setType(int $image_type): bool
```
Sets the image type attribute.
### Parameters
`image_type`
### Return Values
Returns **`true`** on success.
php Imagick::transverseImage Imagick::transverseImage
========================
(PECL imagick 2, PECL imagick 3)
Imagick::transverseImage — Creates a horizontal mirror image
### Description
```
public Imagick::transverseImage(): bool
```
Creates a horizontal mirror image by reflecting the pixels around the central y-axis while rotating them 270-degrees. This method is available if Imagick has been compiled against ImageMagick version 6.2.9 or newer.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::transverseImage()****
```
<?php
function transverseImage($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->transverseImage();
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
### See Also
* [Imagick::transposeImage()](imagick.transposeimage) - Creates a vertical mirror image
php SolrClient::__destruct SolrClient::\_\_destruct
========================
(PECL solr >= 0.9.2)
SolrClient::\_\_destruct — Destructor for SolrClient
### Description
public **SolrClient::\_\_destruct**() Destructor
### Parameters
This function has no parameters.
### Return Values
Destructor for SolrClient
### See Also
* [SolrClient::\_\_construct()](solrclient.construct) - Constructor for the SolrClient object
php SplHeap::recoverFromCorruption SplHeap::recoverFromCorruption
==============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplHeap::recoverFromCorruption — Recover from the corrupted state and allow further actions on the heap
### Description
```
public SplHeap::recoverFromCorruption(): bool
```
### Parameters
This function has no parameters.
### Return Values
Always returns **`true`**.
php Generator::rewind Generator::rewind
=================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
Generator::rewind — Rewind the iterator
### Description
```
public Generator::rewind(): void
```
If iteration has already begun, this will throw an exception.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php bzerrstr bzerrstr
========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
bzerrstr — Returns a bzip2 error string
### Description
```
bzerrstr(resource $bz): string
```
Gets the error string of any bzip2 error returned by the given file pointer.
### Parameters
`bz`
The file pointer. It must be valid and must point to a file successfully opened by [bzopen()](function.bzopen).
### Return Values
Returns a string containing the error message.
### See Also
* [bzerrno()](function.bzerrno) - Returns a bzip2 error number
* [bzerror()](function.bzerror) - Returns the bzip2 error number and error string in an array
php Gmagick::setCompressionQuality Gmagick::setCompressionQuality
==============================
(No version information available, might only be in Git)
Gmagick::setCompressionQuality — Sets the object's default compression quality
### Description
```
Gmagick::setCompressionQuality( int $quality = 75 ): Gmagick
```
Sets the object's default compression quality.
### Parameters
`quality`
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
### Examples
**Example #1 **Gmagick::setCompressionQuality()****
```
<?php
$gm = new Gmagick();
$gm->read("magick:rose");
$gm->setCompressionQuality(2);
?>
```
php pg_prepare pg\_prepare
===========
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
pg\_prepare — Submits a request to create a prepared statement with the given parameters, and waits for completion
### Description
```
pg_prepare(PgSql\Connection $connection = ?, string $stmtname, string $query): PgSql\Result|false
```
**pg\_prepare()** creates a prepared statement for later execution with [pg\_execute()](function.pg-execute) or [pg\_send\_execute()](function.pg-send-execute). This feature allows commands that will be used repeatedly to be parsed and planned just once, rather than each time they are executed. **pg\_prepare()** is supported only against PostgreSQL 7.4 or higher connections; it will fail when using earlier versions.
The function creates a prepared statement named `stmtname` from the `query` string, which must contain a single SQL command. `stmtname` may be "" to create an unnamed statement, in which case any pre-existing unnamed statement is automatically replaced; otherwise it is an error if the statement name is already defined in the current session. If any parameters are used, they are referred to in the `query` as $1, $2, etc.
Prepared statements for use with **pg\_prepare()** can also be created by executing SQL `PREPARE` statements. (But **pg\_prepare()** is more flexible since it does not require parameter types to be pre-specified.) Also, although there is no PHP function for deleting a prepared statement, the SQL `DEALLOCATE` statement can be used for that purpose.
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance. When `connection` is unspecified, the default connection is used. The default connection is the last connection made by [pg\_connect()](function.pg-connect) or [pg\_pconnect()](function.pg-pconnect).
**Warning**As of PHP 8.1.0, using the default connection is deprecated.
`stmtname`
The name to give the prepared statement. Must be unique per-connection. If "" is specified, then an unnamed statement is created, overwriting any previously defined unnamed statement.
`query`
The parameterized SQL statement. Must contain only a single statement. (multiple statements separated by semi-colons are not allowed.) If any parameters are used, they are referred to as $1, $2, etc.
### Return Values
An [PgSql\Result](class.pgsql-result) instance on success, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | Returns an [PgSql\Result](class.pgsql-result) instance now; previously, a [resource](language.types.resource) was returned. |
| 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 Using **pg\_prepare()****
```
<?php
// Connect to a database named "mary"
$dbconn = pg_connect("dbname=mary");
// Prepare a query for execution
$result = pg_prepare($dbconn, "my_query", 'SELECT * FROM shops WHERE name = $1');
// Execute the prepared query. Note that it is not necessary to escape
// the string "Joe's Widgets" in any way
$result = pg_execute($dbconn, "my_query", array("Joe's Widgets"));
// Execute the same prepared query, this time with a different parameter
$result = pg_execute($dbconn, "my_query", array("Clothes Clothes Clothes"));
?>
```
### See Also
* [pg\_execute()](function.pg-execute) - Sends a request to execute a prepared statement with given parameters, and waits for the result
* [pg\_send\_execute()](function.pg-send-execute) - Sends a request to execute a prepared statement with given parameters, without waiting for the result(s)
php ibase_wait_event ibase\_wait\_event
==================
(PHP 5, PHP 7 < 7.4.0)
ibase\_wait\_event — Wait for an event to be posted by the database
### Description
```
ibase_wait_event(string $event_name, string ...$event_names): string
```
```
ibase_wait_event(resource $connection, string $event_name, string ...$event_names): string
```
This function suspends execution of the script until one of the specified events is posted by the database. The name of the event that was posted is returned. This function accepts up to 15 event arguments.
### Parameters
`event_name`
The event name.
`event_names`
### Return Values
Returns the name of the event that was posted.
### See Also
* [ibase\_set\_event\_handler()](function.ibase-set-event-handler) - Register a callback function to be called when events are posted
* [ibase\_free\_event\_handler()](function.ibase-free-event-handler) - Cancels a registered event handler
php is_double is\_double
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
is\_double — Alias of [is\_float()](function.is-float)
### Description
This function is an alias of: [is\_float()](function.is-float).
php The ReflectionIntersectionType class
The ReflectionIntersectionType class
====================================
Introduction
------------
(PHP 8 >= 8.1.0)
Class synopsis
--------------
class **ReflectionIntersectionType** extends [ReflectionType](class.reflectiontype) { /\* Methods \*/
```
public getTypes(): array
```
/\* Inherited methods \*/
```
public ReflectionType::allowsNull(): bool
```
```
public ReflectionType::__toString(): string
```
} Table of Contents
-----------------
* [ReflectionIntersectionType::getTypes](reflectionintersectiontype.gettypes) — Returns the types included in the intersection type
php The mysqli_sql_exception class
The mysqli\_sql\_exception class
================================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
The mysqli exception handling class.
Class synopsis
--------------
final class **mysqli\_sql\_exception** extends [RuntimeException](class.runtimeexception) { /\* Properties \*/ protected string [$sqlstate](class.mysqli-sql-exception#mysqli-sql-exception.props.sqlstate) = "00000"; /\* Inherited properties \*/
protected string [$message](class.exception#exception.props.message) = "";
private string [$string](class.exception#exception.props.string) = "";
protected int [$code](class.exception#exception.props.code);
protected string [$file](class.exception#exception.props.file) = "";
protected int [$line](class.exception#exception.props.line);
private array [$trace](class.exception#exception.props.trace) = [];
private ?[Throwable](class.throwable) [$previous](class.exception#exception.props.previous) = null; /\* Methods \*/
```
public getSqlState(): string
```
/\* Inherited methods \*/
```
final public Exception::getMessage(): string
```
```
final public Exception::getPrevious(): ?Throwable
```
```
final public Exception::getCode(): int
```
```
final public Exception::getFile(): string
```
```
final public Exception::getLine(): int
```
```
final public Exception::getTrace(): array
```
```
final public Exception::getTraceAsString(): string
```
```
public Exception::__toString(): string
```
```
private Exception::__clone(): void
```
} Properties
----------
sqlstate The sql state with the error.
Table of Contents
-----------------
* [mysqli\_sql\_exception::getSqlState](mysqli-sql-exception.getsqlstate) — Returns the SQLSTATE error code
php Gmagick::getimageformat Gmagick::getimageformat
=======================
(PECL gmagick >= Unknown)
Gmagick::getimageformat — Returns the format of a particular image in a sequence
### Description
```
public Gmagick::getimageformat(): string
```
Returns the format of a particular image in a sequence.
### Parameters
This function has no parameters.
### Return Values
Returns a string containing the image format on success.
### Errors/Exceptions
Throws an **GmagickException** on error.
php stats_rand_gen_ipoisson stats\_rand\_gen\_ipoisson
==========================
(PECL stats >= 1.0.0)
stats\_rand\_gen\_ipoisson — Generates a single random deviate from a Poisson distribution
### Description
```
stats_rand_gen_ipoisson(float $mu): int
```
Returns a random deviate from the Poisson distribution with parameter `mu`.
### Parameters
`mu`
The parameter of the Poisson distribution
### Return Values
A random deviate
php eio_set_max_parallel eio\_set\_max\_parallel
=======================
(PECL eio >= 0.0.1dev)
eio\_set\_max\_parallel — Set maximum parallel threads
### Description
```
eio_set_max_parallel(int $nthreads): void
```
### Parameters
`nthreads`
Number of parallel threads
### Return Values
No value is returned.
### See Also
* [eio\_nthreads()](function.eio-nthreads) - Returns number of threads currently in use
* [eio\_set\_max\_idle()](function.eio-set-max-idle) - Set maximum number of idle threads
* [eio\_set\_min\_parallel()](function.eio-set-min-parallel) - Set minimum parallel thread number
php Exception::getFile Exception::getFile
==================
(PHP 5, PHP 7, PHP 8)
Exception::getFile — Gets the file in which the exception was created
### Description
```
final public Exception::getFile(): string
```
Get the name of the file in which the exception was created.
### Parameters
This function has no parameters.
### Return Values
Returns the filename in which the exception was created.
### Examples
**Example #1 **Exception::getFile()** example**
```
<?php
try {
throw new Exception;
} catch(Exception $e) {
echo $e->getFile();
}
?>
```
The above example will output something similar to:
```
/home/bjori/tmp/ex.php
```
### See Also
* [Throwable::getFile()](throwable.getfile) - Gets the file in which the object was created
php Gmagick::getimagebordercolor Gmagick::getimagebordercolor
============================
(PECL gmagick >= Unknown)
Gmagick::getimagebordercolor — Returns the image border color
### Description
```
public Gmagick::getimagebordercolor(): GmagickPixel
```
Returns the image border color.
### Parameters
This function has no parameters.
### Return Values
[GmagickPixel](class.gmagickpixel) object representing the color of the border.
### Errors/Exceptions
Throws an **GmagickException** on error.
php Imagick::coalesceImages Imagick::coalesceImages
=======================
(PECL imagick 2, PECL imagick 3)
Imagick::coalesceImages — Composites a set of images
### Description
```
public Imagick::coalesceImages(): Imagick
```
Composites a set of images while respecting any page offsets and disposal methods. GIF, MIFF, and MNG animation sequences typically start with an image background and each subsequent image varies in size and offset. Returns a new Imagick object where each image in the sequence is the same size as the first and composited with the next image in the sequence.
### Parameters
This function has no parameters.
### Return Values
Returns a new Imagick object on success.
### Errors/Exceptions
Throws ImagickException on error.
php lchgrp lchgrp
======
(PHP 5 >= 5.1.3, PHP 7, PHP 8)
lchgrp — Changes group ownership of symlink
### Description
```
lchgrp(string $filename, string|int $group): bool
```
Attempts to change the group of the symlink `filename` to `group`.
Only the superuser may change the group of a symlink arbitrarily; other users may change the group of a symlink to any group of which that user is a member.
### Parameters
`filename`
Path to the symlink.
`group`
The group specified by name or number.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Changing the group of a symbolic link**
```
<?php
$target = 'output.php';
$link = 'output.html';
symlink($target, $link);
lchgrp($link, 8);
?>
```
### Notes
> **Note**: This function will not work on [remote files](https://www.php.net/manual/en/features.remote-files.php) as the file to be examined must be accessible via the server's filesystem.
>
>
> **Note**: This function is not implemented on Windows platforms.
>
>
### See Also
* [chgrp()](function.chgrp) - Changes file group
* [lchown()](function.lchown) - Changes user ownership of symlink
* [chown()](function.chown) - Changes file owner
* [chmod()](function.chmod) - Changes file mode
php strcmp strcmp
======
(PHP 4, PHP 5, PHP 7, PHP 8)
strcmp — Binary safe string comparison
### Description
```
strcmp(string $string1, string $string2): int
```
Note that this comparison is case sensitive.
### Parameters
`string1`
The first string.
`string2`
The second string.
### Return Values
Returns `-1` if `string1` is less than `string2`; `1` if `string1` is greater than `string2`, and `0` if they are equal.
### Changelog
| Version | Description |
| --- | --- |
| 8.2.0 | This function now returns `-1` or `1`, where it previously returned a negative or positive number. |
### Examples
**Example #1 **strcmp()** example**
```
<?php
$var1 = "Hello";
$var2 = "hello";
if (strcmp($var1, $var2) !== 0) {
echo '$var1 is not equal to $var2 in a case sensitive string comparison';
}
?>
```
### See Also
* [strcasecmp()](function.strcasecmp) - Binary safe case-insensitive string comparison
* [preg\_match()](function.preg-match) - Perform a regular expression match
* [substr\_compare()](function.substr-compare) - Binary safe comparison of two strings from an offset, up to length characters
* [strncmp()](function.strncmp) - Binary safe string comparison of the first n characters
* [strstr()](function.strstr) - Find the first occurrence of a string
* [substr()](function.substr) - Return part of a string
php Yaf_Config_Simple::toArray Yaf\_Config\_Simple::toArray
============================
(Yaf >=1.0.0)
Yaf\_Config\_Simple::toArray — Returns a PHP array
### Description
```
public Yaf_Config_Simple::toArray(): array
```
Returns a PHP array from the [Yaf\_Config\_Simple](class.yaf-config-simple)
### Parameters
This function has no parameters.
### Return Values
php IntlIterator::key IntlIterator::key
=================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlIterator::key — Get the current key
### Description
```
public IntlIterator::key(): mixed
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php Yaf_Config_Simple::offsetGet Yaf\_Config\_Simple::offsetGet
==============================
(Yaf >=1.0.0)
Yaf\_Config\_Simple::offsetGet — The offsetGet purpose
### Description
```
public Yaf_Config_Simple::offsetGet(string $name): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`name`
### Return Values
php Throwable::getMessage Throwable::getMessage
=====================
(PHP 7, PHP 8)
Throwable::getMessage — Gets the message
### Description
```
public Throwable::getMessage(): string
```
Returns the message associated with the thrown object.
### Parameters
This function has no parameters.
### Return Values
Returns the message associated with the thrown object.
### See Also
* [Exception::getMessage()](exception.getmessage) - Gets the Exception message
php Imagick::getImageResolution Imagick::getImageResolution
===========================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageResolution — Gets the image X and Y resolution
### Description
```
public Imagick::getImageResolution(): array
```
Gets the image X and Y resolution.
### Parameters
This function has no parameters.
### Return Values
Returns the resolution as an array.
### Errors/Exceptions
Throws ImagickException on error.
| programming_docs |
php Yaf_Controller_Abstract::getViewpath Yaf\_Controller\_Abstract::getViewpath
======================================
(Yaf >=1.0.0)
Yaf\_Controller\_Abstract::getViewpath — The getViewpath purpose
### Description
```
public Yaf_Controller_Abstract::getViewpath(): string
```
### Parameters
This function has no parameters.
### Return Values
php Imagick::setImageWhitePoint Imagick::setImageWhitePoint
===========================
(PECL imagick 2, PECL imagick 3)
Imagick::setImageWhitePoint — Sets the image chromaticity white point
### Description
```
public Imagick::setImageWhitePoint(float $x, float $y): bool
```
Sets the image chromaticity white point.
### Parameters
`x`
`y`
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
php EventBufferEvent::__construct EventBufferEvent::\_\_construct
===============================
(PECL event >= 1.2.6-beta)
EventBufferEvent::\_\_construct — Constructs EventBufferEvent object
### Description
```
public EventBufferEvent::__construct(
EventBase $base ,
mixed $socket = null ,
int $options = 0 ,
callable $readcb = null ,
callable $writecb = null ,
callable $eventcb = null ,
mixed $arg = null
)
```
Create a buffer event on a socket, stream or a file descriptor. Passing **`null`** to `socket` means that the socket should be created later, e.g. by means of [EventBufferEvent::connect()](eventbufferevent.connect) .
### Parameters
`base` Event base that should be associated with the new buffer event.
`socket` May be created as a stream(not necessarily by means of `sockets` extension)
`options` One of [EventBufferEvent::OPT\_\* constants](class.eventbufferevent#eventbufferevent.constants) , or **`0`** .
`readcb` Read event callback. See [About buffer event callbacks](https://www.php.net/manual/en/eventbufferevent.about.callbacks.php) .
`writecb` Write event callback. See [About buffer event callbacks](https://www.php.net/manual/en/eventbufferevent.about.callbacks.php) .
`eventcb` Status-change event callback. See [About buffer event callbacks](https://www.php.net/manual/en/eventbufferevent.about.callbacks.php) .
`arg` A variable that will be passed to all the callbacks.
### Return Values
Returns buffer event resource optionally associated with socket resource. \*/
### See Also
* [EventBufferEvent::sslFilter()](eventbufferevent.sslfilter) - Create a new SSL buffer event to send its data over another buffer event
* [EventBufferEvent::sslSocket()](eventbufferevent.sslsocket) - Creates a new SSL buffer event to send its data over an SSL on a socket
php mysqli_stmt::$sqlstate mysqli\_stmt::$sqlstate
=======================
mysqli\_stmt\_sqlstate
======================
(PHP 5, PHP 7, PHP 8)
mysqli\_stmt::$sqlstate -- mysqli\_stmt\_sqlstate — Returns SQLSTATE error from previous statement operation
### Description
Object-oriented style
string [$mysqli\_stmt->sqlstate](mysqli-stmt.sqlstate); Procedural style
```
mysqli_stmt_sqlstate(mysqli_stmt $statement): string
```
Returns a string containing the SQLSTATE error code for the most recently invoked prepared statement function that can succeed or fail. The error code consists of five characters. `'00000'` means no error. The values are specified by ANSI SQL and ODBC. For a list of possible values, see [» http://dev.mysql.com/doc/mysql/en/error-handling.html](http://dev.mysql.com/doc/mysql/en/error-handling.html).
### Parameters
`statement`
Procedural style only: A [mysqli\_stmt](class.mysqli-stmt) object returned by [mysqli\_stmt\_init()](mysqli.stmt-init).
### Return Values
Returns a string containing the SQLSTATE error code for the last error. The error code consists of five characters. `'00000'` means no error.
### Examples
**Example #1 Object-oriented style**
```
<?php
/* Open a connection */
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$mysqli->query("CREATE TABLE myCountry LIKE Country");
$mysqli->query("INSERT INTO myCountry SELECT * FROM Country");
$query = "SELECT Name, Code FROM myCountry ORDER BY Name";
if ($stmt = $mysqli->prepare($query)) {
/* drop table */
$mysqli->query("DROP TABLE myCountry");
/* execute query */
$stmt->execute();
printf("Error: %s.\n", $stmt->sqlstate);
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
```
**Example #2 Procedural style**
```
<?php
/* Open a connection */
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
mysqli_query($link, "CREATE TABLE myCountry LIKE Country");
mysqli_query($link, "INSERT INTO myCountry SELECT * FROM Country");
$query = "SELECT Name, Code FROM myCountry ORDER BY Name";
if ($stmt = mysqli_prepare($link, $query)) {
/* drop table */
mysqli_query($link, "DROP TABLE myCountry");
/* execute query */
mysqli_stmt_execute($stmt);
printf("Error: %s.\n", mysqli_stmt_sqlstate($stmt));
/* close statement */
mysqli_stmt_close($stmt);
}
/* close connection */
mysqli_close($link);
?>
```
The above examples will output:
```
Error: 42S02.
```
### Notes
>
> **Note**:
>
>
> Note that not all MySQL errors are yet mapped to SQLSTATE's. The value `HY000` (general error) is used for unmapped errors.
>
>
### See Also
* [mysqli\_stmt\_errno()](mysqli-stmt.errno) - Returns the error code for the most recent statement call
* [mysqli\_stmt\_error()](mysqli-stmt.error) - Returns a string description for last statement error
php DOMElement::hasAttribute DOMElement::hasAttribute
========================
(PHP 5, PHP 7, PHP 8)
DOMElement::hasAttribute — Checks to see if attribute exists
### Description
```
public DOMElement::hasAttribute(string $qualifiedName): bool
```
Indicates whether attribute named `qualifiedName` exists as a member of the element.
### Parameters
`qualifiedName`
The attribute name.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [DOMElement::hasAttributeNS()](domelement.hasattributens) - Checks to see if attribute exists
* [DOMElement::getAttribute()](domelement.getattribute) - Returns value of attribute
* [DOMElement::setAttribute()](domelement.setattribute) - Adds new or modifies existing attribute
* [DOMElement::removeAttribute()](domelement.removeattribute) - Removes attribute
php grapheme_substr grapheme\_substr
================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
grapheme\_substr — Return part of a string
### Description
Procedural style
```
grapheme_substr(string $string, int $offset, ?int $length = null): string|false
```
Return part of a string
### Parameters
`string`
The input string. Must be valid UTF-8.
`offset`
Start position in default grapheme units. If `offset` is non-negative, the returned string will start at the `offset`'th position in `string`, counting from zero. If `offset` is negative, the returned string will start at the `offset`'th grapheme unit from the end of string.
`length`
Length in grapheme units. If `length` is given and is positive, the string returned will contain at most `length` grapheme units beginning from `offset` (depending on the length of string). If `length` is given and is negative, then that many grapheme units will be omitted from the end of string (after the start position has been calculated when `offset` is negative). If `offset` denotes a position beyond this truncation, an empty string will be returned.
### Return Values
Returns the extracted part of `string`, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | The function now consistently clamps out-of-bounds offsets to the string boundary. Previously, **`false`** was returned instead of the empty string in some cases. |
### Examples
**Example #1 **grapheme\_substr()** example**
```
<?php
$char_a_ring_nfd = "a\xCC\x8A"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) normalization form "D"
$char_o_diaeresis_nfd = "o\xCC\x88"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) normalization form "D"
print urlencode(grapheme_substr( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 2, -1 ));
?>
```
The above example will output:
```
a%CC%8Abco%CC%88
```
### See Also
* [grapheme\_extract()](function.grapheme-extract) - Function to extract a sequence of default grapheme clusters from a text buffer, which must be encoded in UTF-8
* [» Unicode Text Segmentation: Grapheme Cluster Boundaries](http://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries)
php SolrInputDocument::setFieldBoost SolrInputDocument::setFieldBoost
================================
(PECL solr >= 0.9.2)
SolrInputDocument::setFieldBoost — Sets the index-time boost value for a field
### Description
```
public SolrInputDocument::setFieldBoost(string $fieldName, float $fieldBoostValue): bool
```
Sets the index-time boost value for a field. This replaces the current boost value for this field.
### Parameters
`fieldName`
The name of the field.
`fieldBoostValue`
The index time boost value.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php IntlCalendar::equals IntlCalendar::equals
====================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::equals — Compare time of two IntlCalendar objects for equality
### Description
Object-oriented style
```
public IntlCalendar::equals(IntlCalendar $other): bool
```
Procedural style
```
intlcal_equals(IntlCalendar $calendar, IntlCalendar $other): bool
```
Returns true if this calendar and the given calendar have the same time. The settings, calendar types and field states do not have to be the same.
### Parameters
`calendar`
An [IntlCalendar](class.intlcalendar) instance.
`other`
The calendar to compare with the primary object.
### Return Values
Returns **`true`** if the current time of both this and the passed in [IntlCalendar](class.intlcalendar) object are the same, or **`false`** otherwise.
On failure **`false`** is also returned. To detect error conditions use [intl\_get\_error\_code()](function.intl-get-error-code), or set up Intl to throw [exceptions](https://www.php.net/manual/en/intl.configuration.php#ini.intl.use-exceptions).
### Examples
**Example #1 **IntlCalendar::equals()****
```
<?php
ini_set('date.timezone', 'UTC');
$cal1 = IntlCalendar::createInstance(NULL, 'es_ES');
$cal2 = clone $cal1;
var_dump($cal1->equals($cal2)); //TRUE
//The locale is not included in the comparison
$cal2 = IntlCalendar::createInstance(NULL, 'pt_PT');
$cal2->setTime($cal1->getTime());
var_dump($cal1->equals($cal2)); //TRUE
//And set fields state is not included as well
$cal2->clear(IntlCalendar::FIELD_YEAR);
var_dump($cal1->isSet(IntlCalendar::FIELD_YEAR) ==
$cal2->isSet(IntlCalendar::FIELD_YEAR)); //FALSE
var_dump($cal1->equals($cal2)); //TRUE
//Neither is the calendar type
$cal2 = IntlCalendar::createInstance(NULL, 'es_ES@calendar=islamic');
$cal2->setTime($cal1->getTime());
var_dump($cal1->equals($cal2)); //TRUE
//Only the time is
$cal2 = clone $cal1;
$cal2->setTime($cal1->getTime() + 1.);
var_dump($cal1->equals($cal2)); //FALSE
```
php Parle\Parser::consume Parle\Parser::consume
=====================
(PECL parle >= 0.5.1)
Parle\Parser::consume — Consume the data for processing
### Description
```
public Parle\Parser::consume(string $data, Parle\Lexer $lexer): void
```
Consume the data for parsing.
### Parameters
`data`
Data to be parsed.
`lexer`
A lexer object containing the lexing rules prepared for the particular grammar.
### Return Values
No value is returned.
php Yaf_Response_Abstract::prependBody Yaf\_Response\_Abstract::prependBody
====================================
(Yaf >=1.0.0)
Yaf\_Response\_Abstract::prependBody — The prependBody purpose
### Description
```
public Yaf_Response_Abstract::prependBody(string $content, string $key = ?): bool
```
prepend a content to a exists content block
### Parameters
`body`
content string
`key`
the content key, you can set a content with a key, if you don't specific, then Yaf\_Response\_Abstract::DEFAULT\_BODY will be used
>
> **Note**:
>
>
> this parameter is introduced as of 2.2.0
>
>
### Return Values
bool
### Examples
**Example #1 **Yaf\_Response\_Abstract::prependBody()**example**
```
<?php
$response = new Yaf_Response_Http();
$response->setBody("World")->prependBody("Hello ");
echo $response;
?>
```
The above example will output something similar to:
```
Hello World
```
### See Also
* [Yaf\_Response\_Abstract::getBody()](yaf-response-abstract.getbody) - Retrieve a exists content
* [Yaf\_Response\_Abstract::setBody()](yaf-response-abstract.setbody) - Set content to response
* [Yaf\_Response\_Abstract::appendBody()](yaf-response-abstract.appendbody) - Append to response body
* [Yaf\_Response\_Abstract::clearBody()](yaf-response-abstract.clearbody) - Discard all exists response body
php Yaf_Session::__get Yaf\_Session::\_\_get
=====================
(Yaf >=1.0.0)
Yaf\_Session::\_\_get — The \_\_get purpose
### Description
```
public Yaf_Session::__get(string $name): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`name`
### Return Values
php pg_send_query pg\_send\_query
===============
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg\_send\_query — Sends asynchronous query
### Description
```
pg_send_query(PgSql\Connection $connection, string $query): int|bool
```
**pg\_send\_query()** sends a query or queries asynchronously to the `connection`. Unlike [pg\_query()](function.pg-query), it can send multiple queries at once to PostgreSQL and get the results one by one using [pg\_get\_result()](function.pg-get-result).
Script execution is not blocked while the queries are executing. Use [pg\_connection\_busy()](function.pg-connection-busy) to check if the connection is busy (i.e. the query is executing). Queries may be cancelled using [pg\_cancel\_query()](function.pg-cancel-query).
Although the user can send multiple queries at once, multiple queries cannot be sent over a busy connection. If a query is sent while the connection is busy, it waits until the last query is finished and discards all its results.
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance.
`query`
The SQL statement or statements to be executed.
Data inside the query should be [properly escaped](function.pg-escape-string).
### Return Values
Returns **`true`** on success, **`false`** or `0` on failure. Use [pg\_get\_result()](function.pg-get-result) to determine the query result.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **pg\_send\_query()** example**
```
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
if (!pg_connection_busy($dbconn)) {
pg_send_query($dbconn, "select * from authors; select count(*) from authors;");
}
$res1 = pg_get_result($dbconn);
echo "First call to pg_get_result(): $res1\n";
$rows1 = pg_num_rows($res1);
echo "$res1 has $rows1 records\n\n";
$res2 = pg_get_result($dbconn);
echo "Second call to pg_get_result(): $res2\n";
$rows2 = pg_num_rows($res2);
echo "$res2 has $rows2 records\n";
?>
```
The above example will output:
```
First call to pg_get_result(): Resource id #3
Resource id #3 has 3 records
Second call to pg_get_result(): Resource id #4
Resource id #4 has 1 records
```
### See Also
* [pg\_query()](function.pg-query) - Execute a query
* [pg\_cancel\_query()](function.pg-cancel-query) - Cancel an asynchronous query
* [pg\_get\_result()](function.pg-get-result) - Get asynchronous query result
* [pg\_connection\_busy()](function.pg-connection-busy) - Get connection is busy or not
php Ds\Map::map Ds\Map::map
===========
(PECL ds >= 1.0.0)
Ds\Map::map — Returns the result of applying a callback to each value
### Description
```
public Ds\Map::map(callable $callback): Ds\Map
```
Returns the result of applying a `callback` function to each value of the map.
### Parameters
`callback`
```
callback(mixed $key, mixed $value): mixed
```
A [callable](language.types.callable) to apply to each value in the map.
The callable should return what the key will be mapped to in the resulting map.
### Return Values
The result of applying a `callback` to each value in the map.
>
> **Note**:
>
>
> The keys and values of the current instance won't be affected.
>
>
### Examples
**Example #1 **Ds\Map::map()** example**
```
<?php
$map = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]);
print_r($map->map(function($key, $value) { return $value * 2; }));
print_r($map);
?>
```
The above example will output something similar to:
```
(
[0] => Ds\Pair Object
(
[key] => a
[value] => 2
)
[1] => Ds\Pair Object
(
[key] => b
[value] => 4
)
[2] => Ds\Pair Object
(
[key] => c
[value] => 6
)
)
Ds\Map Object
(
[0] => Ds\Pair Object
(
[key] => a
[value] => 1
)
[1] => Ds\Pair Object
(
[key] => b
[value] => 2
)
[2] => Ds\Pair Object
(
[key] => c
[value] => 3
)
)
```
php EventHttpRequest::sendReplyStart EventHttpRequest::sendReplyStart
================================
(PECL event >= 1.4.0-beta)
EventHttpRequest::sendReplyStart — Initiate a chunked reply
### Description
```
public EventHttpRequest::sendReplyStart( int $code , string $reason ): void
```
Initiate a reply that uses `Transfer-Encoding` `chunked` .
This allows the caller to stream the reply back to the client and is useful when either not all of the reply data is immediately available or when sending very large replies.
The caller needs to supply data chunks with [EventHttpRequest::sendReplyChunk()](eventhttprequest.sendreplychunk) and complete the reply by calling [EventHttpRequest::sendReplyEnd()](eventhttprequest.sendreplyend) .
### Parameters
`code` The HTTP response code to send.
`reason` A brief message to send with the response code.
### Return Values
No value is returned.
### See Also
* [EventHttpRequest::sendReplyChunk()](eventhttprequest.sendreplychunk) - Send another data chunk as part of an ongoing chunked reply
* [EventHttpRequest::sendReplyEnd()](eventhttprequest.sendreplyend) - Complete a chunked reply, freeing the request as appropriate
php date_interval_create_from_date_string date\_interval\_create\_from\_date\_string
==========================================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
date\_interval\_create\_from\_date\_string — Alias of [DateInterval::createFromDateString()](dateinterval.createfromdatestring)
### Description
This function is an alias of: [DateInterval::createFromDateString()](dateinterval.createfromdatestring)
| programming_docs |
php ReflectionParameter::isOptional ReflectionParameter::isOptional
===============================
(PHP 5 >= 5.0.3, PHP 7, PHP 8)
ReflectionParameter::isOptional — Checks if optional
### Description
```
public ReflectionParameter::isOptional(): bool
```
Checks if the parameter is optional.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the parameter is optional, otherwise **`false`**
### See Also
* [ReflectionParameter::getName()](reflectionparameter.getname) - Gets parameter name
php SolrQuery::setQuery SolrQuery::setQuery
===================
(PECL solr >= 0.9.2)
SolrQuery::setQuery — Sets the search query
### Description
```
public SolrQuery::setQuery(string $query): SolrQuery
```
Sets the search query.
### Parameters
`query`
The search query
### Return Values
Returns the current SolrQuery object
php strrpos strrpos
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
strrpos — Find the position of the last occurrence of a substring in a string
### Description
```
strrpos(string $haystack, string $needle, int $offset = 0): int|false
```
Find the numeric position of the last occurrence of `needle` in the `haystack` string.
### Parameters
`haystack`
The string to search in.
`needle`
Prior to PHP 8.0.0, if `needle` is not a string, it is converted to an integer and applied as the ordinal value of a character. This behavior is deprecated as of PHP 7.3.0, and relying on it is highly discouraged. Depending on the intended behavior, the `needle` should either be explicitly cast to string, or an explicit call to [chr()](function.chr) should be performed.
`offset`
If zero or positive, the search is performed left to right skipping the first `offset` bytes of the `haystack`.
If negative, the search is performed right to left skipping the last `offset` bytes of the `haystack` and searching for the first occurrence of `needle`.
>
> **Note**:
>
>
> This is effectively looking for the last occurrence of `needle` before the last `offset` bytes.
>
>
### Return Values
Returns the position where the needle exists relative to the beginning of the `haystack` string (independent of search direction or offset).
> **Note**: String positions start at 0, and not 1.
>
>
Returns **`false`** if the needle was not found.
**Warning**This function may return Boolean **`false`**, but may also return a non-Boolean value which evaluates to **`false`**. Please read the section on [Booleans](language.types.boolean) for more information. Use [the === operator](language.operators.comparison) for testing the return value of this function.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Passing an int as `needle` is no longer supported. |
| 7.3.0 | Passing an int as `needle` has been deprecated. |
### Examples
**Example #1 Checking if a needle is in the haystack**
It is easy to mistake the return values for "character found at position 0" and "character not found". Here's how to detect the difference:
```
<?php
$pos = strrpos($mystring, "b");
if ($pos === false) { // note: three equal signs
// not found...
}
?>
```
**Example #2 Searching with offsets**
```
<?php
$foo = "0123456789a123456789b123456789c";
// Looking for '0' from the 0th byte (from the beginning)
var_dump(strrpos($foo, '0', 0));
// Looking for '0' from the 1st byte (after byte "0")
var_dump(strrpos($foo, '0', 1));
// Looking for '7' from the 21th byte (after byte 20)
var_dump(strrpos($foo, '7', 20));
// Looking for '7' from the 29th byte (after byte 28)
var_dump(strrpos($foo, '7', 28));
// Looking for '7' right to left from the 5th byte from the end
var_dump(strrpos($foo, '7', -5));
// Looking for 'c' right to left from the 2nd byte from the end
var_dump(strrpos($foo, 'c', -2));
// Looking for '9c' right to left from the 2nd byte from the end
var_dump(strrpos($foo, '9c', -2));
?>
```
The above example will output:
```
int(0)
bool(false)
int(27)
bool(false)
int(17)
bool(false)
int(29)
```
### See Also
* [strpos()](function.strpos) - Find the position of the first occurrence of a substring in a string
* [stripos()](function.stripos) - Find the position of the first occurrence of a case-insensitive substring in a string
* [strripos()](function.strripos) - Find the position of the last occurrence of a case-insensitive substring in a string
* [strrchr()](function.strrchr) - Find the last occurrence of a character in a string
* [substr()](function.substr) - Return part of a string
php Throwable::getFile Throwable::getFile
==================
(PHP 7, PHP 8)
Throwable::getFile — Gets the file in which the object was created
### Description
```
public Throwable::getFile(): string
```
Get the name of the file in which the thrown object was created.
### Parameters
This function has no parameters.
### Return Values
Returns the filename in which the thrown object was created.
### See Also
* [Exception::getFile()](exception.getfile) - Gets the file in which the exception was created
php ArrayObject::uksort ArrayObject::uksort
===================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
ArrayObject::uksort — Sort the entries by keys using a user-defined comparison function
### Description
```
public ArrayObject::uksort(callable $callback): bool
```
This function sorts the keys of the entries using a user-supplied comparison function. The key to entry correlations will be maintained.
>
> **Note**:
>
>
> If two members compare as equal, they retain their original order. Prior to PHP 8.0.0, their relative order in the sorted array was undefined.
>
>
### Parameters
`callback`
The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
```
callback(mixed $a, mixed $b): int
```
### Return Values
Always returns **`true`**.
### Examples
**Example #1 **ArrayObject::uksort()** example**
```
<?php
function cmp($a, $b) {
$a = preg_replace('@^(a|an|the) @', '', $a);
$b = preg_replace('@^(a|an|the) @', '', $b);
return strcasecmp($a, $b);
}
$array = array("John" => 1, "the Earth" => 2, "an apple" => 3, "a banana" => 4);
$arrayObject = new ArrayObject($array);
$arrayObject->uksort('cmp');
foreach ($arrayObject as $key => $value) {
echo "$key: $value\n";
}
?>
```
The above example will output:
```
an apple: 3
a banana: 4
the Earth: 2
John: 1
```
### See Also
* [ArrayObject::asort()](arrayobject.asort) - Sort the entries by value
* [ArrayObject::ksort()](arrayobject.ksort) - Sort the entries by key
* [ArrayObject::natsort()](arrayobject.natsort) - Sort entries using a "natural order" algorithm
* [ArrayObject::natcasesort()](arrayobject.natcasesort) - Sort an array using a case insensitive "natural order" algorithm
* [ArrayObject::uasort()](arrayobject.uasort) - Sort the entries with a user-defined comparison function and maintain key association
* [uksort()](function.uksort) - Sort an array by keys using a user-defined comparison function
php None Resources
---------
A resource is a special variable, holding a reference to an external resource. Resources are created and used by special functions. See the [appendix](https://www.php.net/manual/en/resource.php) for a listing of all these functions and the corresponding resource types.
See also the [get\_resource\_type()](function.get-resource-type) function.
### Converting to resource
As resource variables hold special handles to opened files, database connections, image canvas areas and the like, converting to a resource makes no sense.
### Freeing resources
Thanks to the reference-counting system being part of Zend Engine, a resource with no more references to it is detected automatically, and it is freed by the garbage collector. For this reason, it is rarely necessary to free the memory manually.
> **Note**: Persistent database links are an exception to this rule. They are *not* destroyed by the garbage collector. See the [persistent connections](https://www.php.net/manual/en/features.persistent-connections.php) section for more information.
>
>
php openssl_pkcs12_read openssl\_pkcs12\_read
=====================
(PHP 5 >= 5.2.2, PHP 7, PHP 8)
openssl\_pkcs12\_read — Parse a PKCS#12 Certificate Store into an array
### Description
```
openssl_pkcs12_read(string $pkcs12, array &$certificates, string $passphrase): bool
```
**openssl\_pkcs12\_read()** parses the PKCS#12 certificate store supplied by `pkcs12` into a array named `certificates`.
### Parameters
`pkcs12`
The certificate store contents, not its file name.
`certificates`
On success, this will hold the Certificate Store Data.
`passphrase`
Encryption password for unlocking the PKCS#12 file.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **openssl\_pkcs12\_read()** example**
```
<?php
if (!$cert_store = file_get_contents("/certs/file.p12")) {
echo "Error: Unable to read the cert file\n";
exit;
}
if (openssl_pkcs12_read($cert_store, $cert_info, "my_secret_pass")) {
echo "Certificate Information\n";
print_r($cert_info);
} else {
echo "Error: Unable to read the cert store.\n";
exit;
}
?>
```
php SolrQuery::setHighlightSnippets SolrQuery::setHighlightSnippets
===============================
(PECL solr >= 0.9.2)
SolrQuery::setHighlightSnippets — Sets the maximum number of highlighted snippets to generate per field
### Description
```
public SolrQuery::setHighlightSnippets(int $value, string $field_override = ?): SolrQuery
```
Sets the maximum number of highlighted snippets to generate per field
### Parameters
`value`
The maximum number of highlighted snippets to generate per field
`field_override`
The name of the field.
### Return Values
Returns the current SolrQuery object, if the return value is used.
php stream_wrapper_restore stream\_wrapper\_restore
========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
stream\_wrapper\_restore — Restores a previously unregistered built-in wrapper
### Description
```
stream_wrapper_restore(string $protocol): bool
```
Restores a built-in wrapper previously unregistered with [stream\_wrapper\_unregister()](function.stream-wrapper-unregister).
### Parameters
`protocol`
### Return Values
Returns **`true`** on success or **`false`** on failure.
php phpversion phpversion
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
phpversion — Gets the current PHP version
### Description
```
phpversion(?string $extension = null): string|false
```
Returns a string containing the version of the currently running PHP parser or extension.
### Parameters
`extension`
An optional extension name.
### Return Values
Returns the current PHP version as a string. If a string argument is provided for `extension` parameter, **phpversion()** returns the version of that extension, or **`false`** if there is no version information associated or the extension isn't enabled.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `extension` is nullable now. |
### Examples
**Example #1 **phpversion()** example**
```
<?php
// prints e.g. 'Current PHP version: 4.1.1'
echo 'Current PHP version: ' . phpversion();
// prints e.g. '2.0' or nothing if the extension isn't enabled
echo phpversion('tidy');
?>
```
**Example #2 **`PHP_VERSION_ID`** example and usage**
```
<?php
// PHP_VERSION_ID is available as of PHP 5.2.7, if our
// version is lower than that, then emulate it
if (!defined('PHP_VERSION_ID')) {
$version = explode('.', PHP_VERSION);
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
}
// PHP_VERSION_ID is defined as a number, where the higher the number
// is, the newer a PHP version is used. It's defined as used in the above
// expression:
//
// $version_id = $major_version * 10000 + $minor_version * 100 + $release_version;
//
// Now with PHP_VERSION_ID we can check for features this PHP version
// may have, this doesn't require to use version_compare() everytime
// you check if the current PHP version may not support a feature.
//
// For example, we may here define the PHP_VERSION_* constants thats
// not available in versions prior to 5.2.7
if (PHP_VERSION_ID < 50207) {
define('PHP_MAJOR_VERSION', $version[0]);
define('PHP_MINOR_VERSION', $version[1]);
define('PHP_RELEASE_VERSION', $version[2]);
// and so on, ...
}
?>
```
### Notes
>
> **Note**:
>
>
> This information is also available in the predefined constant **`PHP_VERSION`**. More versioning information is available using the **`PHP_VERSION_*`** constants.
>
>
### See Also
* [PHP\_VERSION constants](https://www.php.net/manual/en/reserved.constants.php#reserved.constants.core)
* [version\_compare()](function.version-compare) - Compares two "PHP-standardized" version number strings
* [phpinfo()](function.phpinfo) - Outputs information about PHP's configuration
* [phpcredits()](function.phpcredits) - Prints out the credits for PHP
* [zend\_version()](function.zend-version) - Gets the version of the current Zend engine
php Imagick::getImageProperties Imagick::getImageProperties
===========================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageProperties — Returns the image properties
### Description
```
public Imagick::getImageProperties(string $pattern = "*", bool $include_values = true): array
```
Returns all associated properties that match the pattern. If **`false`** is passed as second parameter only the property names are returned. This method is available if Imagick has been compiled against ImageMagick version 6.3.6 or newer.
### Parameters
`pattern`
The pattern for property names.
`include_values`
Whether to return only property names. If **`false`** then only property names will be returned.
### Return Values
Returns an array containing the image properties or property names.
### Examples
**Example #1 Using **Imagick::getImageProperties()**:**
An example of extracting EXIF information.
```
<?php
/* Create the object */
$im = new imagick("/path/to/example.jpg");
/* Get the EXIF information */
$exifArray = $im->getImageProperties("exif:*");
/* Loop trough the EXIF properties */
foreach ($exifArray as $name => $property)
{
echo "{$name} => {$property}<br />\n";
}
?>
```
php The RecursiveCallbackFilterIterator class
The RecursiveCallbackFilterIterator class
=========================================
Introduction
------------
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
Class synopsis
--------------
class **RecursiveCallbackFilterIterator** extends [CallbackFilterIterator](class.callbackfilteriterator) implements [RecursiveIterator](class.recursiveiterator) { /\* Methods \*/ public [\_\_construct](recursivecallbackfilteriterator.construct)([RecursiveIterator](class.recursiveiterator) `$iterator`, [callable](language.types.callable) `$callback`)
```
public getChildren(): RecursiveCallbackFilterIterator
```
```
public hasChildren(): bool
```
/\* Inherited methods \*/
```
public CallbackFilterIterator::accept(): bool
```
```
public FilterIterator::accept(): bool
```
```
public FilterIterator::current(): mixed
```
```
public FilterIterator::getInnerIterator(): Iterator
```
```
public FilterIterator::key(): mixed
```
```
public FilterIterator::next(): void
```
```
public FilterIterator::rewind(): void
```
```
public FilterIterator::valid(): bool
```
```
public IteratorIterator::current(): mixed
```
```
public IteratorIterator::getInnerIterator(): ?Iterator
```
```
public IteratorIterator::key(): mixed
```
```
public IteratorIterator::next(): void
```
```
public IteratorIterator::rewind(): void
```
```
public IteratorIterator::valid(): bool
```
} Examples
--------
The callback should accept up to three arguments: the current item, the current key and the iterator, respectively.
**Example #1 Available callback arguments**
```
<?php
/**
* Callback for RecursiveCallbackFilterIterator
*
* @param $current Current item's value
* @param $key Current item's key
* @param $iterator Iterator being filtered
* @return boolean TRUE to accept the current item, FALSE otherwise
*/
function my_callback($current, $key, $iterator) {
// Your filtering code here
}
?>
```
Filtering a recursive iterator generally involves two conditions. The first is that, to allow recursion, the callback function should return **`true`** if the current iterator item has children. The second is the normal filter condition, such as a file size or extension check as in the example below.
**Example #2 Recursive callback basic example**
```
<?php
$dir = new RecursiveDirectoryIterator(__DIR__);
// Filter large files ( > 100MB)
$files = new RecursiveCallbackFilterIterator($dir, function ($current, $key, $iterator) {
// Allow recursion
if ($iterator->hasChildren()) {
return TRUE;
}
// Check for large file
if ($current->isFile() && $current->getSize() > 104857600) {
return TRUE;
}
return FALSE;
});
foreach (new RecursiveIteratorIterator($files) as $file) {
echo $file->getPathname() . PHP_EOL;
}
?>
```
Table of Contents
-----------------
* [RecursiveCallbackFilterIterator::\_\_construct](recursivecallbackfilteriterator.construct) — Create a RecursiveCallbackFilterIterator from a RecursiveIterator
* [RecursiveCallbackFilterIterator::getChildren](recursivecallbackfilteriterator.getchildren) — Return the inner iterator's children contained in a RecursiveCallbackFilterIterator
* [RecursiveCallbackFilterIterator::hasChildren](recursivecallbackfilteriterator.haschildren) — Check whether the inner iterator's current element has children
php DOMNode::replaceChild DOMNode::replaceChild
=====================
(PHP 5, PHP 7, PHP 8)
DOMNode::replaceChild — Replaces a child
### Description
```
public DOMNode::replaceChild(DOMNode $node, DOMNode $child): DOMNode|false
```
This function replaces the child `child` with the passed new node. If the `node` is already a child it will not be added a second time. If the replacement succeeds the old node is returned.
### Parameters
`node`
The new node. It must be a member of the target document, i.e. created by one of the DOMDocument->createXXX() methods or imported in the document by [DOMDocument::importNode](domdocument.importnode).
`child`
The old node.
### Return Values
The old node or **`false`** if an error occur.
### Errors/Exceptions
**`DOM_NO_MODIFICATION_ALLOWED_ERR`**
Raised if this node is readonly or if the previous parent of the node being inserted is readonly.
**`DOM_HIERARCHY_REQUEST_ERR`**
Raised if this node is of a type that does not allow children of the type of the `node` node, or if the node to put in is one of this node's ancestors or this node itself.
**`DOM_WRONG_DOCUMENT_ERR`**
Raised if `node` was created from a different document than the one that created this node.
**`DOM_NOT_FOUND`**
Raised if `child` is not a child of this node.
### See Also
* [DOMChildNode::replaceWith()](domchildnode.replacewith) - Replaces the node with new nodes
* [DOMNode::appendChild()](domnode.appendchild) - Adds new child at the end of the children
* [DOMNode::removeChild()](domnode.removechild) - Removes child from list of children
php PDOStatement::fetchAll PDOStatement::fetchAll
======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0)
PDOStatement::fetchAll — Fetches the remaining rows from a result set
### Description
```
public PDOStatement::fetchAll(int $mode = PDO::FETCH_DEFAULT): array
```
```
public PDOStatement::fetchAll(int $mode = PDO::FETCH_COLUMN, int $column): array
```
```
public PDOStatement::fetchAll(int $mode = PDO::FETCH_CLASS, string $class, ?array $constructorArgs): array
```
```
public PDOStatement::fetchAll(int $mode = PDO::FETCH_FUNC, callable $callback): array
```
### Parameters
`mode`
Controls the contents of the returned array as documented in [PDOStatement::fetch()](pdostatement.fetch). Defaults to value of **`PDO::ATTR_DEFAULT_FETCH_MODE`** (which defaults to **`PDO::FETCH_BOTH`**)
To return an array consisting of all values of a single column from the result set, specify **`PDO::FETCH_COLUMN`**. You can specify which column you want with the `column` parameter.
To fetch only the unique values of a single column from the result set, bitwise-OR **`PDO::FETCH_COLUMN`** with **`PDO::FETCH_UNIQUE`**.
To return an associative array grouped by the values of a specified column, bitwise-OR **`PDO::FETCH_COLUMN`** with **`PDO::FETCH_GROUP`**.
`args`
This argument has a different meaning depending on the value of the `mode` parameter:
* **`PDO::FETCH_COLUMN`**: Returns the indicated 0-indexed column.
* **`PDO::FETCH_CLASS`**: Returns instances of the specified class, mapping the columns of each row to named properties in the class.
* **`PDO::FETCH_FUNC`**: Returns the results of calling the specified function, using each row's columns as parameters in the call.
`constructorArgs`
Arguments of custom class constructor when the `mode` parameter is **`PDO::FETCH_CLASS`**.
### Return Values
**PDOStatement::fetchAll()** returns an array containing all of the remaining rows in the result set. The array represents each row as either an array of column values or an object with properties corresponding to each column name. An empty array is returned if there are zero results to fetch.
Using this method to fetch large result sets will result in a heavy demand on system and possibly network resources. Rather than retrieving all of the data and manipulating it in PHP, consider using the database server to manipulate the result sets. For example, use the WHERE and ORDER BY clauses in SQL to restrict results before retrieving and processing them with PHP.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This method always returns an array now, while previously **`false`** may have been returned on failure. |
### Examples
**Example #1 Fetch all remaining rows in a result set**
```
<?php
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();
/* Fetch all of the remaining rows in the result set */
print("Fetch all of the remaining rows in the result set:\n");
$result = $sth->fetchAll();
print_r($result);
?>
```
The above example will output something similar to:
```
Fetch all of the remaining rows in the result set:
Array
(
[0] => Array
(
[name] => apple
[0] => apple
[colour] => red
[1] => red
)
[1] => Array
(
[name] => pear
[0] => pear
[colour] => green
[1] => green
)
[2] => Array
(
[name] => watermelon
[0] => watermelon
[colour] => pink
[1] => pink
)
)
```
**Example #2 Fetching all values of a single column from a result set**
The following example demonstrates how to return all of the values of a single column from a result set, even though the SQL statement itself may return multiple columns per row.
```
<?php
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();
/* Fetch all of the values of the first column */
$result = $sth->fetchAll(PDO::FETCH_COLUMN, 0);
var_dump($result);
?>
```
The above example will output something similar to:
```
Array(3)
(
[0] =>
string(5) => apple
[1] =>
string(4) => pear
[2] =>
string(10) => watermelon
)
```
**Example #3 Grouping all values by a single column**
The following example demonstrates how to return an associative array grouped by the values of the specified column in the result set. The array contains three keys: values `apple` and `pear` are returned as arrays that contain two different colours, while `watermelon` is returned as an array that contains only one colour.
```
<?php
$insert = $dbh->prepare("INSERT INTO fruit(name, colour) VALUES (?, ?)");
$insert->execute(array('apple', 'green'));
$insert->execute(array('pear', 'yellow'));
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();
/* Group values by the first column */
var_dump($sth->fetchAll(PDO::FETCH_COLUMN|PDO::FETCH_GROUP));
?>
```
The above example will output something similar to:
```
array(3) {
["apple"]=>
array(2) {
[0]=>
string(5) "green"
[1]=>
string(3) "red"
}
["pear"]=>
array(2) {
[0]=>
string(5) "green"
[1]=>
string(6) "yellow"
}
["watermelon"]=>
array(1) {
[0]=>
string(5) "pink"
}
}
```
**Example #4 Instantiating a class for each result**
The following example demonstrates the behaviour of the **`PDO::FETCH_CLASS`** fetch style.
```
<?php
class fruit {
public $name;
public $colour;
}
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();
$result = $sth->fetchAll(PDO::FETCH_CLASS, "fruit");
var_dump($result);
?>
```
The above example will output something similar to:
```
array(3) {
[0]=>
object(fruit)#1 (2) {
["name"]=>
string(5) "apple"
["colour"]=>
string(5) "green"
}
[1]=>
object(fruit)#2 (2) {
["name"]=>
string(4) "pear"
["colour"]=>
string(6) "yellow"
}
[2]=>
object(fruit)#3 (2) {
["name"]=>
string(10) "watermelon"
["colour"]=>
string(4) "pink"
}
[3]=>
object(fruit)#4 (2) {
["name"]=>
string(5) "apple"
["colour"]=>
string(3) "red"
}
[4]=>
object(fruit)#5 (2) {
["name"]=>
string(4) "pear"
["colour"]=>
string(5) "green"
}
}
```
**Example #5 Calling a function for each result**
The following example demonstrates the behaviour of the **`PDO::FETCH_FUNC`** fetch style.
```
<?php
function fruit($name, $colour) {
return "{$name}: {$colour}";
}
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();
$result = $sth->fetchAll(PDO::FETCH_FUNC, "fruit");
var_dump($result);
?>
```
The above example will output something similar to:
```
array(3) {
[0]=>
string(12) "apple: green"
[1]=>
string(12) "pear: yellow"
[2]=>
string(16) "watermelon: pink"
[3]=>
string(10) "apple: red"
[4]=>
string(11) "pear: green"
}
```
### See Also
* [PDO::query()](pdo.query) - Prepares and executes an SQL statement without placeholders
* [PDOStatement::fetch()](pdostatement.fetch) - Fetches the next row from a result set
* [PDOStatement::fetchColumn()](pdostatement.fetchcolumn) - Returns a single column from the next row of a result set
* [PDO::prepare()](pdo.prepare) - Prepares a statement for execution and returns a statement object
* [PDOStatement::setFetchMode()](pdostatement.setfetchmode) - Set the default fetch mode for this statement
| programming_docs |
php The EvLoop class
The EvLoop class
================
Introduction
------------
(PECL ev >= 0.2.0)
Represents an event loop that is always distinct from the *default loop* . Unlike the *default loop* , it cannot handle [EvChild](class.evchild) watchers.
Having threads we have to create a loop per thread, and use the *default loop* in the parent thread.
The *default event loop* is initialized automatically by *Ev* . It is accessible via methods of the [Ev](class.ev) class, or via [EvLoop::defaultLoop()](evloop.defaultloop) method.
Class synopsis
--------------
final class **EvLoop** { /\* Properties \*/ public [$data](class.evloop#evloop.props.data);
public [$backend](class.evloop#evloop.props.backend);
public [$is\_default\_loop](class.evloop#evloop.props.is-default-loop);
public [$iteration](class.evloop#evloop.props.iteration);
public [$pending](class.evloop#evloop.props.pending);
public [$io\_interval](class.evloop#evloop.props.io-interval);
public [$timeout\_interval](class.evloop#evloop.props.timeout-interval);
public [$depth](class.evloop#evloop.props.depth); /\* Methods \*/ public [\_\_construct](evloop.construct)(
int `$flags` = ?,
[mixed](language.types.declarations#language.types.declarations.mixed) `$data` = NULL ,
float `$io_interval` = 0.0 ,
float `$timeout_interval` = 0.0
)
```
public backend(): int
```
```
final public check( string $callback , string $data = ?, string $priority = ?): EvCheck
```
```
final public child(
string $pid ,
string $trace ,
string $callback ,
string $data = ?,
string $priority = ?
): EvChild
```
```
public static defaultLoop(
int $flags = Ev::FLAG_AUTO ,
mixed $data = NULL ,
float $io_interval = 0. ,
float $timeout_interval = 0.
): EvLoop
```
```
final public embed(
string $other ,
string $callback = ?,
string $data = ?,
string $priority = ?
): EvEmbed
```
```
final public fork( callable $callback , mixed $data = null , int $priority = 0 ): EvFork
```
```
final public idle( callable $callback , mixed $data = null , int $priority = 0 ): EvIdle
```
```
public invokePending(): void
```
```
final public io(
mixed $fd ,
int $events ,
callable $callback ,
mixed $data = null ,
int $priority = 0
): EvIo
```
```
public loopFork(): void
```
```
public now(): float
```
```
public nowUpdate(): void
```
```
final public periodic(
float $offset ,
float $interval ,
callable $callback ,
mixed $data = null ,
int $priority = 0
): EvPeriodic
```
```
final public prepare( callable $callback , mixed $data = null , int $priority = 0 ): EvPrepare
```
```
public resume(): void
```
```
public run( int $flags = 0 ): void
```
```
final public signal(
int $signum ,
callable $callback ,
mixed $data = null ,
int $priority = 0
): EvSignal
```
```
final public stat(
string $path ,
float $interval ,
callable $callback ,
mixed $data = null ,
int $priority = 0
): EvStat
```
```
public stop( int $how = ?): void
```
```
public suspend(): void
```
```
final public timer(
float $after ,
float $repeat ,
callable $callback ,
mixed $data = null ,
int $priority = 0
): EvTimer
```
```
public verify(): void
```
} Properties
----------
data Custom data attached to loop
backend *Readonly* . The [backend flags](class.ev#ev.constants.watcher-backends) indicating the event backend in use.
is\_default\_loop *Readonly* . **`true`** if it is the default event loop.
iteration The current iteration count of the loop. See [Ev::iteration()](ev.iteration)
pending The number of pending watchers. **`0`** indicates that there are no watchers pending.
io\_interval Higher io\_interval allows *libev* to spend more time collecting [EvIo](class.evio) events, so more events can be handled per iteration, at the cost of increasing latency. Timeouts (both [EvPeriodic](class.evperiodic) and [EvTimer](class.evtimer) ) will not be affected. Setting this to a non-zero value will introduce an additional `sleep()` call into most loop iterations. The sleep time ensures that *libev* will not poll for [EvIo](class.evio) events more often than once per this interval, on average. Many programs can usually benefit by setting the io\_interval to a value near **`0.1`** , which is often enough for interactive servers(not for games). It usually doesn't make much sense to set it to a lower value than **`0.01`** , as this approaches the timing granularity of most systems.
See also [» FUNCTIONS CONTROLLING EVENT LOOPS](http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#FUNCTIONS_CONTROLLING_EVENT_LOOPS) .
timeout\_interval Higher timeout\_interval allows *libev* to spend more time collecting timeouts, at the expense of increased latency/jitter/inexactness(the watcher callback will be called later). [EvIo](class.evio) watchers will not be affected. Setting this to a non-null value will not introduce any overhead in *libev* . See also [» FUNCTIONS CONTROLLING EVENT LOOPS](http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#FUNCTIONS_CONTROLLING_EVENT_LOOPS) .
depth The recursion depth. See [Ev::depth()](ev.depth) .
Table of Contents
-----------------
* [EvLoop::backend](evloop.backend) — Returns an integer describing the backend used by libev
* [EvLoop::check](evloop.check) — Creates EvCheck object associated with the current event loop instance
* [EvLoop::child](evloop.child) — Creates EvChild object associated with the current event loop
* [EvLoop::\_\_construct](evloop.construct) — Constructs the event loop object
* [EvLoop::defaultLoop](evloop.defaultloop) — Returns or creates the default event loop
* [EvLoop::embed](evloop.embed) — Creates an instance of EvEmbed watcher associated with the current EvLoop object
* [EvLoop::fork](evloop.fork) — Creates EvFork watcher object associated with the current event loop instance
* [EvLoop::idle](evloop.idle) — Creates EvIdle watcher object associated with the current event loop instance
* [EvLoop::invokePending](evloop.invokepending) — Invoke all pending watchers while resetting their pending state
* [EvLoop::io](evloop.io) — Create EvIo watcher object associated with the current event loop instance
* [EvLoop::loopFork](evloop.loopfork) — Must be called after a fork
* [EvLoop::now](evloop.now) — Returns the current "event loop time"
* [EvLoop::nowUpdate](evloop.nowupdate) — Establishes the current time by querying the kernel, updating the time returned by EvLoop::now in the progress
* [EvLoop::periodic](evloop.periodic) — Creates EvPeriodic watcher object associated with the current event loop instance
* [EvLoop::prepare](evloop.prepare) — Creates EvPrepare watcher object associated with the current event loop instance
* [EvLoop::resume](evloop.resume) — Resume previously suspended default event loop
* [EvLoop::run](evloop.run) — Begin checking for events and calling callbacks for the loop
* [EvLoop::signal](evloop.signal) — Creates EvSignal watcher object associated with the current event loop instance
* [EvLoop::stat](evloop.stat) — Creates EvStat watcher object associated with the current event loop instance
* [EvLoop::stop](evloop.stop) — Stops the event loop
* [EvLoop::suspend](evloop.suspend) — Suspend the loop
* [EvLoop::timer](evloop.timer) — Creates EvTimer watcher object associated with the current event loop instance
* [EvLoop::verify](evloop.verify) — Performs internal consistency checks(for debugging)
php SolrGenericResponse::__destruct SolrGenericResponse::\_\_destruct
=================================
(PECL solr >= 0.9.2)
SolrGenericResponse::\_\_destruct — Destructor
### Description
public **SolrGenericResponse::\_\_destruct**() Destructor.
### Parameters
This function has no parameters.
### Return Values
None
php Zookeeper::addAuth Zookeeper::addAuth
==================
(PECL zookeeper >= 0.1.0)
Zookeeper::addAuth — Specify application credentials
### Description
```
public Zookeeper::addAuth(string $scheme, string $cert, callable $completion_cb = null): bool
```
The application calls this function to specify its credentials for purposes of authentication. The server will use the security provider specified by the scheme parameter to authenticate the client connection. If the authentication request has failed: - the server connection is dropped. - the watcher is called with the ZOO\_AUTH\_FAILED\_STATE value as the state parameter.
### Parameters
`scheme`
The id of authentication scheme. Natively supported: "digest" password-based authentication
`cert`
Application credentials. The actual value depends on the scheme.
`completion_cb`
The routine to invoke when the request completes. One of the following result codes may be passed into the completion callback: - ZOK operation completed successfully - ZAUTHFAILED authentication failed
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
This method emits PHP error/warning when parameters count or types are wrong or operation fails.
**Caution** Since version 0.3.0, this method emits [ZookeeperException](class.zookeeperexception) and it's derivatives.
### Examples
**Example #1 **Zookeeper::addAuth()** example**
Add auth before requesting node value.
```
<?php
$zookeeper = new Zookeeper('locahost:2181');
$path = '/path/to/node';
$value = 'nodevalue';
$zookeeper->set($path, $value);
$zookeeper->addAuth('digest', 'user0:passwd0');
$r = $zookeeper->get($path);
if ($r)
echo $r;
else
echo 'ERR';
?>
```
The above example will output:
```
nodevalue
```
### See Also
* [Zookeeper::create()](zookeeper.create) - Create a node synchronously
* [Zookeeper::setAcl()](zookeeper.setacl) - Sets the acl associated with a node synchronously
* [Zookeeper::getAcl()](zookeeper.getacl) - Gets the acl associated with a node synchronously
* [ZooKeeper States](class.zookeeper#zookeeper.class.constants.states)
* [ZookeeperException](class.zookeeperexception)
php snmp3_set snmp3\_set
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
snmp3\_set — Set the value of an SNMP object
### Description
```
snmp3_set(
string $hostname,
string $security_name,
string $security_level,
string $auth_protocol,
string $auth_passphrase,
string $privacy_protocol,
string $privacy_passphrase,
array|string $object_id,
array|string $type,
array|string $value,
int $timeout = -1,
int $retries = -1
): bool
```
**snmp3\_set()** is used to set the value of an SNMP object specified by the `object_id`.
Even if the security level does not use an auth or priv protocol/password valid values have to be specified.
### Parameters
`hostname`
The hostname of the SNMP agent (server).
`security_name`
the security name, usually some kind of username
`security_level`
the security level (noAuthNoPriv|authNoPriv|authPriv)
`auth_protocol`
the authentication protocol (MD5 or SHA)
`auth_passphrase`
the authentication pass phrase
`privacy_protocol`
the privacy protocol (DES or AES)
`privacy_passphrase`
the privacy pass phrase
`object_id`
The SNMP object id.
`type`
The MIB defines the type of each object id. It has to be specified as a single character from the below list.
**types**| = | The type is taken from the MIB |
| i | INTEGER |
| u | INTEGER |
| s | STRING |
| x | HEX STRING |
| d | DECIMAL STRING |
| n | NULLOBJ |
| o | OBJID |
| t | TIMETICKS |
| a | IPADDRESS |
| b | BITS |
If **`OPAQUE_SPECIAL_TYPES`** was defined while compiling the SNMP library, the following are also valid:
**types**| U | unsigned int64 |
| I | signed int64 |
| F | float |
| D | double |
Most of these will use the obvious corresponding ASN.1 type. 's', 'x', 'd' and 'b' are all different ways of specifying an OCTET STRING value, and the 'u' unsigned type is also used for handling Gauge32 values.
If the MIB-Files are loaded by into the MIB Tree with "snmp\_read\_mib" or by specifying it in the libsnmp config, '=' may be used as the `type` parameter for all object ids as the type can then be automatically read from the MIB.
Note that there are two ways to set a variable of the type BITS like e.g. "SYNTAX BITS {telnet(0), ftp(1), http(2), icmp(3), snmp(4), ssh(5), https(6)}":
* Using type "b" and a list of bit numbers. This method is not recommended since GET query for the same OID would return e.g. 0xF8.
* Using type "x" and a hex number but without(!) the usual "0x" prefix.
See examples section for more details.
`value`
The new value
`timeout`
The number of microseconds until the first timeout.
`retries`
The number of times to retry if timeouts occur.
### Return Values
Returns **`true`** on success or **`false`** on failure.
If the SNMP host rejects the data type, an E\_WARNING message like "Warning: Error in packet. Reason: (badValue) The value given has the wrong type or length." is shown. If an unknown or invalid OID is specified the warning probably reads "Could not add variable".
### Examples
**Example #1 Using **snmp3\_set()****
```
<?php
snmp3_set('localhost', 'james', 'authPriv', 'SHA', 'secret007', 'AES', 'secret007', 'IF-MIB::ifAlias.3', 's', "foo");
?>
```
**Example #2 Using **snmp3\_set()** for setting BITS SNMP object id**
```
<?php
snmp3_set('localhost', 'james', 'authPriv', 'SHA', 'secret007', 'AES', 'secret007', 'FOO-MIB::bar.42', 'b', '0 1 2 3 4');
// or
snmp3_set('localhost', 'james', 'authPriv', 'SHA', 'secret007', 'AES', 'secret007', 'FOO-MIB::bar.42', 'x', 'F0');
?>
```
php phpdbg_exec phpdbg\_exec
============
(PHP 5 >= 5.6.0, PHP 7, PHP 8)
phpdbg\_exec — Attempts to set the execution context
### Description
```
phpdbg_exec(string $context): string|bool
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`context`
### Return Values
If the execution context was set previously it is returned. If the execution context was not set previously **`true`** is returned. If the request to set the context fails, **`false`** is returned, and an **`E_WARNING`** raised.
php password_hash password\_hash
==============
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
password\_hash — Creates a password hash
### Description
```
password_hash(string $password, string|int|null $algo, array $options = []): string
```
**password\_hash()** creates a new password hash using a strong one-way hashing algorithm.
The following algorithms are currently supported:
* **`PASSWORD_DEFAULT`** - Use the bcrypt algorithm (default as of PHP 5.5.0). Note that this constant is designed to change over time as new and stronger algorithms are added to PHP. For that reason, the length of the result from using this identifier can change over time. Therefore, it is recommended to store the result in a database column that can expand beyond 60 characters (255 characters would be a good choice).
* **`PASSWORD_BCRYPT`** - Use the **`CRYPT_BLOWFISH`** algorithm to create the hash. This will produce a standard [crypt()](function.crypt) compatible hash using the "$2y$" identifier. The result will always be a 60 character string, or **`false`** on failure.
* **`PASSWORD_ARGON2I`** - Use the Argon2i hashing algorithm to create the hash. This algorithm is only available if PHP has been compiled with Argon2 support.
* **`PASSWORD_ARGON2ID`** - Use the Argon2id hashing algorithm to create the hash. This algorithm is only available if PHP has been compiled with Argon2 support.
Supported options for **`PASSWORD_BCRYPT`**:
* `salt` (string) - to manually provide a salt to use when hashing the password. Note that this will override and prevent a salt from being automatically generated.
If omitted, a random salt will be generated by **password\_hash()** for each password hashed. This is the intended mode of operation.
**Warning** The salt option is deprecated. It is now preferred to simply use the salt that is generated by default. As of PHP 8.0.0, an explicitly given salt is ignored.
* `cost` (int) - which denotes the algorithmic cost that should be used. Examples of these values can be found on the [crypt()](function.crypt) page.
If omitted, a default value of `10` will be used. This is a good baseline cost, but you may want to consider increasing it depending on your hardware.
Supported options for **`PASSWORD_ARGON2I`** and **`PASSWORD_ARGON2ID`**:
* `memory_cost` (int) - Maximum memory (in kibibytes) that may be used to compute the Argon2 hash. Defaults to **`PASSWORD_ARGON2_DEFAULT_MEMORY_COST`**.
* `time_cost` (int) - Maximum amount of time it may take to compute the Argon2 hash. Defaults to **`PASSWORD_ARGON2_DEFAULT_TIME_COST`**.
* `threads` (int) - Number of threads to use for computing the Argon2 hash. Defaults to **`PASSWORD_ARGON2_DEFAULT_THREADS`**.
**Warning** Only available when PHP uses libargon2, not with libsodium implementation.
### Parameters
`password`
The user's password.
**Caution** Using the **`PASSWORD_BCRYPT`** as the algorithm, will result in the `password` parameter being truncated to a maximum length of 72 bytes.
`algo`
A [password algorithm constant](https://www.php.net/manual/en/password.constants.php) denoting the algorithm to use when hashing the password.
`options`
An associative array containing options. See the [password algorithm constants](https://www.php.net/manual/en/password.constants.php) for documentation on the supported options for each algorithm.
If omitted, a random salt will be created and the default cost will be used.
### Return Values
Returns the hashed password.
The used algorithm, cost and salt are returned as part of the hash. Therefore, all information that's needed to verify the hash is included in it. This allows the [password\_verify()](function.password-verify) function to verify the hash without needing separate storage for the salt or algorithm information.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | **password\_hash()** no longer returns **`false`** on failure. |
| 8.0.0 | The `algo` parameter is nullable now. |
| 7.4.0 | The `algo` parameter expects a string now, but still accepts ints for backward compatibility. |
| 7.4.0 | The sodium extension provides an alternative implementation for Argon2 passwords. |
| 7.3.0 | Support for Argon2id passwords using **`PASSWORD_ARGON2ID`** was added. |
| 7.2.0 | Support for Argon2i passwords using **`PASSWORD_ARGON2I`** was added. |
### Examples
**Example #1 **password\_hash()** example**
```
<?php
/**
* We just want to hash our password using the current DEFAULT algorithm.
* This is presently BCRYPT, and will produce a 60 character result.
*
* Beware that DEFAULT may change over time, so you would want to prepare
* By allowing your storage to expand past 60 characters (255 would be good)
*/
echo password_hash("rasmuslerdorf", PASSWORD_DEFAULT);
?>
```
The above example will output something similar to:
```
$2y$10$.vGA1O9wmRjrwAVXD98HNOgsNpDczlqm3Jq7KnEd1rVAGv3Fykk1a
```
**Example #2 **password\_hash()** example setting cost manually**
```
<?php
/**
* In this case, we want to increase the default cost for BCRYPT to 12.
* Note that we also switched to BCRYPT, which will always be 60 characters.
*/
$options = [
'cost' => 12,
];
echo password_hash("rasmuslerdorf", PASSWORD_BCRYPT, $options);
?>
```
The above example will output something similar to:
```
$2y$12$QjSH496pcT5CEbzjD/vtVeH03tfHKFy36d4J0Ltp3lRtee9HDxY3K
```
**Example #3 **password\_hash()** example finding a good cost**
```
<?php
/**
* This code will benchmark your server to determine how high of a cost you can
* afford. You want to set the highest cost that you can without slowing down
* you server too much. 8-10 is a good baseline, and more is good if your servers
* are fast enough. The code below aims for ≤ 50 milliseconds stretching time,
* which is a good baseline for systems handling interactive logins.
*/
$timeTarget = 0.05; // 50 milliseconds
$cost = 8;
do {
$cost++;
$start = microtime(true);
password_hash("test", PASSWORD_BCRYPT, ["cost" => $cost]);
$end = microtime(true);
} while (($end - $start) < $timeTarget);
echo "Appropriate Cost Found: " . $cost;
?>
```
The above example will output something similar to:
```
Appropriate Cost Found: 10
```
**Example #4 **password\_hash()** example using Argon2i**
```
<?php
echo 'Argon2i hash: ' . password_hash('rasmuslerdorf', PASSWORD_ARGON2I);
?>
```
The above example will output something similar to:
```
Argon2i hash: $argon2i$v=19$m=1024,t=2,p=2$YzJBSzV4TUhkMzc3d3laeg$zqU/1IN0/AogfP4cmSJI1vc8lpXRW9/S0sYY2i2jHT0
```
### Notes
**Caution** It is strongly recommended that you do not generate your own salt for this function. It will create a secure salt automatically for you if you do not specify one.
As noted above, providing the `salt` option in PHP 7.0 will generate a deprecation warning. Support for providing a salt manually may be removed in a future PHP release.
>
> **Note**:
>
>
> It is recommended that you test this function on your servers, and adjust the cost parameter so that execution of the function takes less than 100 milliseconds on interactive systems. The script in the above example will help you choose a good cost value for your hardware.
>
>
>
> **Note**: Updates to supported algorithms by this function (or changes to the default one) must follow the following rules:
>
>
> * Any new algorithm must be in core for at least 1 full release of PHP prior to becoming default. So if, for example, a new algorithm is added in 7.5.5, it would not be eligible for default until 7.7 (since 7.6 would be the first full release). But if a different algorithm was added in 7.6.0, it would also be eligible for default at 7.7.0.
> * The default should only change in a full release (7.3.0, 8.0.0, etc) and not in a revision release. The only exception to this is in an emergency when a critical security flaw is found in the current default.
>
>
### See Also
* [password\_verify()](function.password-verify) - Verifies that a password matches a hash
* [crypt()](function.crypt) - One-way string hashing
* [» userland implementation](https://github.com/ircmaxell/password_compat)
* [sodium\_crypto\_pwhash\_str()](function.sodium-crypto-pwhash-str) - Get an ASCII-encoded hash
| programming_docs |
php fopen fopen
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
fopen — Opens file or URL
### Description
```
fopen(
string $filename,
string $mode,
bool $use_include_path = false,
?resource $context = null
): resource|false
```
**fopen()** binds a named resource, specified by `filename`, to a stream.
### Parameters
`filename`
If `filename` is of the form "scheme://...", it is assumed to be a URL and PHP will search for a protocol handler (also known as a wrapper) for that scheme. If no wrappers for that protocol are registered, PHP will emit a notice to help you track potential problems in your script and then continue as though `filename` specifies a regular file.
If PHP has decided that `filename` specifies a local file, then it will try to open a stream on that file. The file must be accessible to PHP, so you need to ensure that the file access permissions allow this access. If you have enabled [open\_basedir](https://www.php.net/manual/en/ini.core.php#ini.open-basedir) further restrictions may apply.
If PHP has decided that `filename` specifies a registered protocol, and that protocol is registered as a network URL, PHP will check to make sure that [allow\_url\_fopen](https://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen) is enabled. If it is switched off, PHP will emit a warning and the fopen call will fail.
>
> **Note**:
>
>
> The list of supported protocols can be found in [Supported Protocols and Wrappers](https://www.php.net/manual/en/wrappers.php). Some protocols (also referred to as `wrappers`) support `context` and/or php.ini options. Refer to the specific page for the protocol in use for a list of options which can be set. (e.g. php.ini value `user_agent` used by the `http` wrapper).
>
>
On the Windows platform, be careful to escape any backslashes used in the path to the file, or use forward slashes.
```
<?php
$handle = fopen("c:\\folder\\resource.txt", "r");
?>
```
`mode`
The `mode` parameter specifies the type of access you require to the stream. It may be any of the following:
**A list of possible modes for **fopen()** using `mode`** | `mode` | Description |
| --- | --- |
| `'r'` | Open for reading only; place the file pointer at the beginning of the file. |
| `'r+'` | Open for reading and writing; place the file pointer at the beginning of the file. |
| `'w'` | Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. |
| `'w+'` | Open for reading and writing; otherwise it has the same behavior as `'w'`. |
| `'a'` | Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it. In this mode, [fseek()](function.fseek) has no effect, writes are always appended. |
| `'a+'` | Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it. In this mode, [fseek()](function.fseek) only affects the reading position, writes are always appended. |
| `'x'` | Create and open for writing only; place the file pointer at the beginning of the file. If the file already exists, the **fopen()** call will fail by returning **`false`** and generating an error of level **`E_WARNING`**. If the file does not exist, attempt to create it. This is equivalent to specifying `O_EXCL|O_CREAT` flags for the underlying `open(2)` system call. |
| `'x+'` | Create and open for reading and writing; otherwise it has the same behavior as `'x'`. |
| `'c'` | Open the file for writing only. If the file does not exist, it is created. If it exists, it is neither truncated (as opposed to `'w'`), nor the call to this function fails (as is the case with `'x'`). The file pointer is positioned on the beginning of the file. This may be useful if it's desired to get an advisory lock (see [flock()](function.flock)) before attempting to modify the file, as using `'w'` could truncate the file before the lock was obtained (if truncation is desired, [ftruncate()](function.ftruncate) can be used after the lock is requested). |
| `'c+'` | Open the file for reading and writing; otherwise it has the same behavior as `'c'`. |
| `'e'` | Set close-on-exec flag on the opened file descriptor. Only available in PHP compiled on POSIX.1-2008 conform systems. |
>
> **Note**:
>
>
> Different operating system families have different line-ending conventions. When you write a text file and want to insert a line break, you need to use the correct line-ending character(s) for your operating system. Unix based systems use `\n` as the line ending character, Windows based systems use `\r\n` as the line ending characters and Macintosh based systems (Mac OS Classic) used `\r` as the line ending character.
>
> If you use the wrong line ending characters when writing your files, you might find that other applications that open those files will "look funny".
>
> Windows offers a text-mode translation flag (`'t'`) which will transparently translate `\n` to `\r\n` when working with the file. In contrast, you can also use `'b'` to force binary mode, which will not translate your data. To use these flags, specify either `'b'` or `'t'` as the last character of the `mode` parameter.
>
> The default translation mode is `'b'`. You can use the `'t'` mode if you are working with plain-text files and you use `\n` to delimit your line endings in your script, but expect your files to be readable with applications such as old versions of notepad. You should use the `'b'` in all other cases.
>
> If you specify the 't' flag when working with binary files, you may experience strange problems with your data, including broken image files and strange problems with `\r\n` characters.
>
>
>
> **Note**:
>
>
> For portability, it is also strongly recommended that you re-write code that uses or relies upon the `'t'` mode so that it uses the correct line endings and `'b'` mode instead.
>
>
> **Note**: The `mode` is ignored for php://output, php://input, php://stdin, php://stdout, php://stderr and php://fd stream wrappers.
>
>
`use_include_path`
The optional third `use_include_path` parameter can be set to '1' or **`true`** if you want to search for the file in the [include\_path](https://www.php.net/manual/en/ini.core.php#ini.include-path), too.
`context`
A [context stream](https://www.php.net/manual/en/stream.contexts.php) resource.
### Return Values
Returns a file pointer resource on success, or **`false`** on failure
### Errors/Exceptions
Upon failure, an **`E_WARNING`** is emitted.
### Changelog
| Version | Description |
| --- | --- |
| 7.0.16, 7.1.2 | The `'e'` option was added. |
### Examples
**Example #1 **fopen()** examples**
```
<?php
$handle = fopen("/home/rasmus/file.txt", "r");
$handle = fopen("/home/rasmus/file.gif", "wb");
$handle = fopen("http://www.example.com/", "r");
$handle = fopen("ftp://user:[email protected]/somefile.txt", "w");
?>
```
### Notes
**Warning**When using SSL, Microsoft IIS will violate the protocol by closing the connection without sending a `close_notify` indicator. PHP will report this as "SSL: Fatal Protocol Error" when you reach the end of the data. To work around this, the value of [error\_reporting](https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting) should be lowered to a level that does not include warnings. PHP can detect buggy IIS server software when you open the stream using the `https://` wrapper and will suppress the warning. When using [fsockopen()](function.fsockopen) to create an `ssl://` socket, the developer is responsible for detecting and suppressing this warning.
>
> **Note**:
>
>
> If you are experiencing problems with reading and writing to files and you're using the server module version of PHP, remember to make sure that the files and directories you're using are accessible to the server process.
>
>
>
> **Note**:
>
>
> This function may also succeed when `filename` is a directory. If you are unsure whether `filename` is a file or a directory, you may need to use the [is\_dir()](function.is-dir) function before calling **fopen()**.
>
>
### See Also
* [Supported Protocols and Wrappers](https://www.php.net/manual/en/wrappers.php)
* [fclose()](function.fclose) - Closes an open file pointer
* [fgets()](function.fgets) - Gets line from file pointer
* [fread()](function.fread) - Binary-safe file read
* [fwrite()](function.fwrite) - Binary-safe file write
* [fsockopen()](function.fsockopen) - Open Internet or Unix domain socket connection
* [file()](function.file) - Reads entire file into an array
* [file\_exists()](function.file-exists) - Checks whether a file or directory exists
* [is\_readable()](function.is-readable) - Tells whether a file exists and is readable
* [stream\_set\_timeout()](function.stream-set-timeout) - Set timeout period on a stream
* [popen()](function.popen) - Opens process file pointer
* [stream\_context\_create()](function.stream-context-create) - Creates a stream context
* [umask()](function.umask) - Changes the current umask
* [SplFileObject](class.splfileobject)
php Security warning include
-------
(PHP 4, PHP 5, PHP 7, PHP 8)
The `include` expression includes and evaluates the specified file.
The documentation below also applies to [require](function.require).
Files are included based on the file path given or, if none is given, the [include\_path](https://www.php.net/manual/en/ini.core.php#ini.include-path) specified. If the file isn't found in the [include\_path](https://www.php.net/manual/en/ini.core.php#ini.include-path), `include` will finally check in the calling script's own directory and the current working directory before failing. The `include` construct will emit an **`E_WARNING`** if it cannot find a file; this is different behavior from [require](function.require), which will emit an **`E_ERROR`**.
Note that both `include` and `require` raise additional **`E_WARNING`**s, if the file cannot be accessed, before raising the final **`E_WARNING`** or **`E_ERROR`**, respectively.
If a path is defined — whether absolute (starting with a drive letter or `\` on Windows, or `/` on Unix/Linux systems) or relative to the current directory (starting with `.` or `..`) — the [include\_path](https://www.php.net/manual/en/ini.core.php#ini.include-path) will be ignored altogether. For example, if a filename begins with `../`, the parser will look in the parent directory to find the requested file.
For more information on how PHP handles including files and the include path, see the documentation for [include\_path](https://www.php.net/manual/en/ini.core.php#ini.include-path).
When a file is included, the code it contains inherits the [variable scope](language.variables.scope) of the line on which the include occurs. Any variables available at that line in the calling file will be available within the called file, from that point forward. However, all functions and classes defined in the included file have the global scope.
**Example #1 Basic `include` example**
```
vars.php
<?php
$color = 'green';
$fruit = 'apple';
?>
test.php
<?php
echo "A $color $fruit"; // A
include 'vars.php';
echo "A $color $fruit"; // A green apple
?>
```
If the include occurs inside a function within the calling file, then all of the code contained in the called file will behave as though it had been defined inside that function. So, it will follow the variable scope of that function. An exception to this rule are [magic constants](language.constants.predefined) which are evaluated by the parser before the include occurs.
**Example #2 Including within functions**
```
<?php
function foo()
{
global $color;
include 'vars.php';
echo "A $color $fruit";
}
/* vars.php is in the scope of foo() so *
* $fruit is NOT available outside of this *
* scope. $color is because we declared it *
* as global. */
foo(); // A green apple
echo "A $color $fruit"; // A green
?>
```
When a file is included, parsing drops out of PHP mode and into HTML mode at the beginning of the target file, and resumes again at the end. For this reason, any code inside the target file which should be executed as PHP code must be enclosed within [valid PHP start and end tags](language.basic-syntax.phpmode).
If "[URL include wrappers](https://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-include)" are enabled in PHP, you can specify the file to be included using a URL (via HTTP or other supported wrapper - see [Supported Protocols and Wrappers](https://www.php.net/manual/en/wrappers.php) for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.
**Example #3 `include` through HTTP**
```
<?php
/* This example assumes that www.example.com is configured to parse .php
* files and not .txt files. Also, 'Works' here means that the variables
* $foo and $bar are available within the included file. */
// Won't work; file.txt wasn't handled by www.example.com as PHP
include 'http://www.example.com/file.txt?foo=1&bar=2';
// Won't work; looks for a file named 'file.php?foo=1&bar=2' on the
// local filesystem.
include 'file.php?foo=1&bar=2';
// Works.
include 'http://www.example.com/file.php?foo=1&bar=2';
?>
```
**Warning** Security warning
================
Remote file may be processed at the remote server (depending on the file extension and the fact if the remote server runs PHP or not) but it still has to produce a valid PHP script because it will be processed at the local server. If the file from the remote server should be processed there and outputted only, [readfile()](function.readfile) is much better function to use. Otherwise, special care should be taken to secure the remote script to produce a valid and desired code.
See also [Remote files](https://www.php.net/manual/en/features.remote-files.php), [fopen()](function.fopen) and [file()](function.file) for related information.
Handling Returns: `include` returns `FALSE` on failure and raises a warning. Successful includes, unless overridden by the included file, return `1`. It is possible to execute a [return](function.return) statement inside an included file in order to terminate processing in that file and return to the script which called it. Also, it's possible to return values from included files. You can take the value of the include call as you would for a normal function. This is not, however, possible when including remote files unless the output of the remote file has [valid PHP start and end tags](language.basic-syntax.phpmode) (as with any local file). You can declare the needed variables within those tags and they will be introduced at whichever point the file was included.
Because `include` is a special language construct, parentheses are not needed around its argument. Take care when comparing return value.
**Example #4 Comparing return value of include**
```
<?php
// won't work, evaluated as include(('vars.php') == TRUE), i.e. include('1')
if (include('vars.php') == TRUE) {
echo 'OK';
}
// works
if ((include 'vars.php') == TRUE) {
echo 'OK';
}
?>
```
**Example #5 `include` and the [return](function.return) statement**
```
return.php
<?php
$var = 'PHP';
return $var;
?>
noreturn.php
<?php
$var = 'PHP';
?>
testreturns.php
<?php
$foo = include 'return.php';
echo $foo; // prints 'PHP'
$bar = include 'noreturn.php';
echo $bar; // prints 1
?>
```
`$bar` is the value `1` because the include was successful. Notice the difference between the above examples. The first uses [return](function.return) within the included file while the other does not. If the file can't be included, **`false`** is returned and **`E_WARNING`** is issued.
If there are functions defined in the included file, they can be used in the main file independent if they are before [return](function.return) or after. If the file is included twice, PHP will raise a fatal error because the functions were already declared. It is recommended to use [include\_once](function.include-once) instead of checking if the file was already included and conditionally return inside the included file.
Another way to "include" a PHP file into a variable is to capture the output by using the [Output Control Functions](https://www.php.net/manual/en/ref.outcontrol.php) with `include`. For example:
**Example #6 Using output buffering to include a PHP file into a string**
```
<?php
$string = get_include_contents('somefile.php');
function get_include_contents($filename) {
if (is_file($filename)) {
ob_start();
include $filename;
return ob_get_clean();
}
return false;
}
?>
```
In order to automatically include files within scripts, see also the [auto\_prepend\_file](https://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file) and [auto\_append\_file](https://www.php.net/manual/en/ini.core.php#ini.auto-append-file) configuration options in php.ini.
> **Note**: Because this is a language construct and not a function, it cannot be called using [variable functions](functions.variable-functions), or [named arguments](functions.arguments#functions.named-arguments).
>
>
See also [require](function.require), [require\_once](function.require-once), [include\_once](function.include-once), [get\_included\_files()](function.get-included-files), [readfile()](function.readfile), [virtual()](function.virtual), and [include\_path](https://www.php.net/manual/en/ini.core.php#ini.include-path).
php The OAuth class
The OAuth class
===============
Introduction
------------
(PECL OAuth >= 0.99.1)
The OAuth extension provides a simple interface to interact with data providers using the OAuth HTTP specification to protect private resources.
Class synopsis
--------------
class **OAuth** { /\* Properties \*/ public [$debug](class.oauth#oauth.props.debug);
public [$sslChecks](class.oauth#oauth.props.sslchecks);
public [$debugInfo](class.oauth#oauth.props.debuginfo); /\* Methods \*/ public [\_\_construct](oauth.construct)(
string `$consumer_key`,
string `$consumer_secret`,
string `$signature_method` = **`OAUTH_SIG_METHOD_HMACSHA1`**,
int `$auth_type` = 0
)
```
public __destruct(): void
```
```
public disableDebug(): bool
```
```
public disableRedirects(): bool
```
```
public disableSSLChecks(): bool
```
```
public enableDebug(): bool
```
```
public enableRedirects(): bool
```
```
public enableSSLChecks(): bool
```
```
public fetch(
string $protected_resource_url,
array $extra_parameters = ?,
string $http_method = ?,
array $http_headers = ?
): mixed
```
```
public generateSignature(string $http_method, string $url, mixed $extra_parameters = ?): string|false
```
```
public getAccessToken(
string $access_token_url,
string $auth_session_handle = ?,
string $verifier_token = ?,
string $http_method = ?
): array
```
```
public getCAPath(): array
```
```
public getLastResponse(): string
```
```
public getLastResponseHeaders(): string|false
```
```
public getLastResponseInfo(): array
```
```
public getRequestHeader(string $http_method, string $url, mixed $extra_parameters = ?): string|false
```
```
public getRequestToken(string $request_token_url, string $callback_url = ?, string $http_method = ?): array
```
```
public setAuthType(int $auth_type): bool
```
```
public setCAPath(string $ca_path = ?, string $ca_info = ?): mixed
```
```
public setNonce(string $nonce): mixed
```
```
public setRequestEngine(int $reqengine): void
```
```
public setRSACertificate(string $cert): mixed
```
```
public setSSLChecks(int $sslcheck): bool
```
```
public setTimestamp(string $timestamp): mixed
```
```
public setToken(string $token, string $token_secret): bool
```
```
public setVersion(string $version): bool
```
} Properties
----------
debug sslChecks debugInfo Table of Contents
-----------------
* [OAuth::\_\_construct](oauth.construct) — Create a new OAuth object
* [OAuth::\_\_destruct](oauth.destruct) — The destructor
* [OAuth::disableDebug](oauth.disabledebug) — Turn off verbose debugging
* [OAuth::disableRedirects](oauth.disableredirects) — Turn off redirects
* [OAuth::disableSSLChecks](oauth.disablesslchecks) — Turn off SSL checks
* [OAuth::enableDebug](oauth.enabledebug) — Turn on verbose debugging
* [OAuth::enableRedirects](oauth.enableredirects) — Turn on redirects
* [OAuth::enableSSLChecks](oauth.enablesslchecks) — Turn on SSL checks
* [OAuth::fetch](oauth.fetch) — Fetch an OAuth protected resource
* [OAuth::generateSignature](oauth.generatesignature) — Generate a signature
* [OAuth::getAccessToken](oauth.getaccesstoken) — Fetch an access token
* [OAuth::getCAPath](oauth.getcapath) — Gets CA information
* [OAuth::getLastResponse](oauth.getlastresponse) — Get the last response
* [OAuth::getLastResponseHeaders](oauth.getlastresponseheaders) — Get headers for last response
* [OAuth::getLastResponseInfo](oauth.getlastresponseinfo) — Get HTTP information about the last response
* [OAuth::getRequestHeader](oauth.getrequestheader) — Generate OAuth header string signature
* [OAuth::getRequestToken](oauth.getrequesttoken) — Fetch a request token
* [OAuth::setAuthType](oauth.setauthtype) — Set authorization type
* [OAuth::setCAPath](oauth.setcapath) — Set CA path and info
* [OAuth::setNonce](oauth.setnonce) — Set the nonce for subsequent requests
* [OAuth::setRequestEngine](oauth.setrequestengine) — The setRequestEngine purpose
* [OAuth::setRSACertificate](oauth.setrsacertificate) — Set the RSA certificate
* [OAuth::setSSLChecks](oauth.setsslchecks) — Tweak specific SSL checks for requests
* [OAuth::setTimestamp](oauth.settimestamp) — Set the timestamp
* [OAuth::setToken](oauth.settoken) — Sets the token and secret
* [OAuth::setVersion](oauth.setversion) — Set the OAuth version
| programming_docs |
php ibase_commit_ret ibase\_commit\_ret
==================
(PHP 5, PHP 7 < 7.4.0)
ibase\_commit\_ret — Commit a transaction without closing it
### Description
```
ibase_commit_ret(resource $link_or_trans_identifier = null): bool
```
Commits a transaction without closing it.
### Parameters
`link_or_trans_identifier`
If called without an argument, this function commits the default transaction of the default link. If the argument is a connection identifier, the default transaction of the corresponding connection will be committed. If the argument is a transaction identifier, the corresponding transaction will be committed. The transaction context will be retained, so statements executed from within this transaction will not be invalidated.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php GearmanWorker::timeout GearmanWorker::timeout
======================
(PECL gearman >= 0.6.0)
GearmanWorker::timeout — Get socket I/O activity timeout
### Description
```
public GearmanWorker::timeout(): int
```
Returns the current time to wait, in milliseconds, for socket I/O activity.
### Parameters
This function has no parameters.
### Return Values
A time period is milliseconds. A negative value indicates an infinite timeout.
### See Also
* [GearmanWorker::setTimeout()](gearmanworker.settimeout) - Set socket I/O activity timeout
php The SolrModifiableParams class
The SolrModifiableParams class
==============================
Introduction
------------
(PECL solr >= 0.9.2)
Represents a collection of name-value pairs sent to the Solr server during a request.
Class synopsis
--------------
class **SolrModifiableParams** extends [SolrParams](class.solrparams) implements [Serializable](class.serializable) { /\* Methods \*/ public [\_\_construct](solrmodifiableparams.construct)()
public [\_\_destruct](solrmodifiableparams.destruct)() /\* Inherited methods \*/
```
final public SolrParams::add(string $name, string $value): SolrParams
```
```
public SolrParams::addParam(string $name, string $value): SolrParams
```
```
final public SolrParams::get(string $param_name): mixed
```
```
final public SolrParams::getParam(string $param_name = ?): mixed
```
```
final public SolrParams::getParams(): array
```
```
final public SolrParams::getPreparedParams(): array
```
```
final public SolrParams::serialize(): string
```
```
final public SolrParams::set(string $name, string $value): void
```
```
public SolrParams::setParam(string $name, string $value): SolrParams
```
```
final public SolrParams::toString(bool $url_encode = false): string
```
```
final public SolrParams::unserialize(string $serialized): void
```
} Table of Contents
-----------------
* [SolrModifiableParams::\_\_construct](solrmodifiableparams.construct) — Constructor
* [SolrModifiableParams::\_\_destruct](solrmodifiableparams.destruct) — Destructor
php Yaf_View_Simple::eval Yaf\_View\_Simple::eval
=======================
(Yaf >=2.2.0)
Yaf\_View\_Simple::eval — Render template
### Description
```
public Yaf_View_Simple::eval(string $tpl_content, array $tpl_vars = ?): string
```
Render a string tempalte and return the result.
### Parameters
`tpl_content`
string template
`tpl_vars`
### Return Values
php snmp2_set snmp2\_set
==========
(PHP >= 5.2.0, PHP 7, PHP 8)
snmp2\_set — Set the value of an SNMP object
### Description
```
snmp2_set(
string $hostname,
string $community,
array|string $object_id,
array|string $type,
array|string $value,
int $timeout = -1,
int $retries = -1
): bool
```
**snmp2\_set()** is used to set the value of an SNMP object specified by the `object_id`.
### Parameters
`hostname`
The hostname of the SNMP agent (server).
`community`
The write community.
`object_id`
The SNMP object id.
`type`
The MIB defines the type of each object id. It has to be specified as a single character from the below list.
**types**| = | The type is taken from the MIB |
| i | INTEGER |
| u | INTEGER |
| s | STRING |
| x | HEX STRING |
| d | DECIMAL STRING |
| n | NULLOBJ |
| o | OBJID |
| t | TIMETICKS |
| a | IPADDRESS |
| b | BITS |
If **`OPAQUE_SPECIAL_TYPES`** was defined while compiling the SNMP library, the following are also valid:
**types**| U | unsigned int64 |
| I | signed int64 |
| F | float |
| D | double |
Most of these will use the obvious corresponding ASN.1 type. 's', 'x', 'd' and 'b' are all different ways of specifying an OCTET STRING value, and the 'u' unsigned type is also used for handling Gauge32 values.
If the MIB-Files are loaded by into the MIB Tree with "snmp\_read\_mib" or by specifying it in the libsnmp config, '=' may be used as the `type` parameter for all object ids as the type can then be automatically read from the MIB.
Note that there are two ways to set a variable of the type BITS like e.g. "SYNTAX BITS {telnet(0), ftp(1), http(2), icmp(3), snmp(4), ssh(5), https(6)}":
* Using type "b" and a list of bit numbers. This method is not recommended since GET query for the same OID would return e.g. 0xF8.
* Using type "x" and a hex number but without(!) the usual "0x" prefix.
See examples section for more details.
`value`
The new value.
`timeout`
The number of microseconds until the first timeout.
`retries`
The number of times to retry if timeouts occur.
### Return Values
Returns **`true`** on success or **`false`** on failure.
If the SNMP host rejects the data type, an E\_WARNING message like "Warning: Error in packet. Reason: (badValue) The value given has the wrong type or length." is shown. If an unknown or invalid OID is specified the warning probably reads "Could not add variable".
### Examples
**Example #1 Using **snmp2\_set()****
```
<?php
snmp2_set("localhost", "public", "IF-MIB::ifAlias.3", "s", "foo");
?>
```
**Example #2 Using **snmp2\_set()** for setting BITS SNMP object id**
```
<?php
snmp2_set("localhost", "public", 'FOO-MIB::bar.42', 'b', '0 1 2 3 4');
// or
snmp2_set("localhost", "public", 'FOO-MIB::bar.42', 'x', 'F0');
?>
```
### See Also
* [snmp2\_get()](function.snmp2-get) - Fetch an SNMP object
php WeakMap::__construct WeakMap::\_\_construct
======================
(PHP 8)
WeakMap::\_\_construct — Constructs a new map
### Description
public **WeakMap::\_\_construct**() Constructs a new map.
### Parameters
This function has no parameters.
php ldap_parse_exop ldap\_parse\_exop
=================
(PHP 7 >= 7.2.0, PHP 8)
ldap\_parse\_exop — Parse result object from an LDAP extended operation
### Description
```
ldap_parse_exop(
LDAP\Connection $ldap,
LDAP\Result $result,
string &$response_data = null,
string &$response_oid = null
): bool
```
Parse LDAP extended operation data from result object `result`
### Parameters
`ldap`
An [LDAP\Connection](class.ldap-connection) instance, returned by [ldap\_connect()](function.ldap-connect).
`result`
An [LDAP\Result](class.ldap-result) instance, returned by [ldap\_list()](function.ldap-list) or [ldap\_search()](function.ldap-search).
`response_data`
Will be filled by the response data.
`response_oid`
Will be filled by the response OID.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `ldap` parameter expects an [LDAP\Connection](class.ldap-connection) instance now; previously, a [resource](language.types.resource) was expected. |
| 8.1.0 | The `result` parameter expects an [LDAP\Result](class.ldap-result) instance now; previously, a [resource](language.types.resource) was expected. |
### See Also
* [ldap\_exop()](function.ldap-exop) - Performs an extended operation
php None Basic enumerations
------------------
Enums are similar to classes, and share the same namespaces as classes, interfaces, and traits. They are also autoloadable the same way. An Enum defines a new type, which has a fixed, limited number of possible legal values.
```
<?php
enum Suit
{
case Hearts;
case Diamonds;
case Clubs;
case Spades;
}
?>
```
This declaration creates a new enumerated type named `Suit`, which has four and only four legal values: `Suit::Hearts`, `Suit::Diamonds`, `Suit::Clubs`, and `Suit::Spades`. Variables may be assigned to one of those legal values. A function may be type checked against an enumerated type, in which case only values of that type may be passed.
```
<?php
function pick_a_card(Suit $suit) { ... }
$val = Suit::Diamonds;
// OK
pick_a_card($val);
// OK
pick_a_card(Suit::Clubs);
// TypeError: pick_a_card(): Argument #1 ($suit) must be of type Suit, string given
pick_a_card('Spades');
?>
```
An Enumeration may have zero or more `case` definitions, with no maximum. A zero-case enum is syntactically valid, if rather useless.
For Enumeration cases, the same syntax rules apply as to any label in PHP, see [Constants](language.constants).
By default, cases are not intrinsically backed by a scalar value. That is, `Suit::Hearts` is not equal to `"0"`. Instead, each case is backed by a singleton object of that name. That means that:
```
<?php
$a = Suit::Spades;
$b = Suit::Spades;
$a === $b; // true
$a instanceof Suit; // true
?>
```
It also means that enum values are never `<` or `>` each other, since those comparisons are not meaningful on objects. Those comparisons will always return **`false`** when working with enum values.
This type of case, with no related data, is called a "Pure Case." An Enum that contains only Pure Cases is called a Pure Enum.
All Pure Cases are implemented as instances of their enum type. The enum type is represented internally as a class.
All Cases have a read-only property, `name`, that is the case-sensitive name of the case itself.
```
<?php
print Suit::Spades->name;
// prints "Spades"
?>
```
php xdiff_string_rabdiff xdiff\_string\_rabdiff
======================
(PECL xdiff >= 1.5.0)
xdiff\_string\_rabdiff — Make binary diff of two strings using the Rabin's polynomial fingerprinting algorithm
### Description
```
xdiff_string_bdiff(string $old_data, string $new_data): string
```
Makes a binary diff of two strings and returns the result. The difference between this function and [xdiff\_string\_bdiff()](function.xdiff-string-bdiff) is different algorithm used which should result in faster execution and smaller diff produced. This function works with both text and binary data. Resulting patch can be later applied using [xdiff\_string\_bpatch()](function.xdiff-string-bpatch)/[xdiff\_file\_bpatch()](function.xdiff-file-bpatch).
For more details about differences between algorithm used please check [» libxdiff](http://www.xmailserver.org/xdiff-lib.html) website.
### Parameters
`old_data`
First string with binary data. It acts as "old" data.
`new_data`
Second string with binary data. It acts as "new" data.
### Return Values
Returns string with binary diff containing differences between "old" and "new" data or **`false`** if an internal error occurred.
### See Also
* [xdiff\_string\_bpatch()](function.xdiff-string-bpatch) - Patch a string with a binary diff
php Yaf_Dispatcher::setErrorHandler Yaf\_Dispatcher::setErrorHandler
================================
(Yaf >=1.0.0)
Yaf\_Dispatcher::setErrorHandler — Set error handler
### Description
```
public Yaf_Dispatcher::setErrorHandler(call $callback, int $error_types): Yaf_Dispatcher
```
Set error handler for Yaf. when [application.dispatcher.throwException](https://www.php.net/manual/en/yaf.appconfig.php#configuration.yaf.dispatcher.throwexception) is off, Yaf will trigger catchable error while unexpected errors occurred.
Thus, this error handler will be called while the error raise.
### Parameters
`callback`
A callable callback
`error_types`
### Return Values
### See Also
* [Yaf\_Dispatcher::throwException()](yaf-dispatcher.throwexception) - Switch on/off exception throwing
* [Yaf\_Application::getLastErrorNo()](yaf-application.getlasterrorno) - Get code of last occurred error
* [Yaf\_Application::getLastErrorMsg()](yaf-application.getlasterrormsg) - Get message of the last occurred error
php PDOStatement::bindParam PDOStatement::bindParam
=======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0)
PDOStatement::bindParam — Binds a parameter to the specified variable name
### Description
```
public PDOStatement::bindParam(
string|int $param,
mixed &$var,
int $type = PDO::PARAM_STR,
int $maxLength = 0,
mixed $driverOptions = null
): bool
```
Binds a PHP variable to a corresponding named or question mark placeholder in the SQL statement that was used to prepare the statement. Unlike [PDOStatement::bindValue()](pdostatement.bindvalue), the variable is bound as a reference and will only be evaluated at the time that [PDOStatement::execute()](pdostatement.execute) is called.
Most parameters are input parameters, that is, parameters that are used in a read-only fashion to build up the query (but may nonetheless be cast according to `type`). Some drivers support the invocation of stored procedures that return data as output parameters, and some also as input/output parameters that both send in data and are updated to receive it.
### Parameters
`param`
Parameter identifier. For a prepared statement using named placeholders, this will be a parameter name of the form :name. For a prepared statement using question mark placeholders, this will be the 1-indexed position of the parameter.
`var`
Name of the PHP variable to bind to the SQL statement parameter.
`type`
Explicit data type for the parameter using the [`PDO::PARAM_*` constants](https://www.php.net/manual/en/pdo.constants.php). To return an INOUT parameter from a stored procedure, use the bitwise OR operator to set the **`PDO::PARAM_INPUT_OUTPUT`** bits for the `type` parameter.
`maxLength`
Length of the data type. To indicate that a parameter is an OUT parameter from a stored procedure, you must explicitly set the length. Meaningful only when `type` parameter is **`PDO::PARAM_INPUT_OUTPUT`**.
`driverOptions`
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Execute a prepared statement with named placeholders**
```
<?php
/* Execute a prepared statement by binding PHP variables */
$calories = 150;
$colour = 'red';
$sth = $dbh->prepare('SELECT name, colour, calories
FROM fruit
WHERE calories < :calories AND colour = :colour');
$sth->bindParam('calories', $calories, PDO::PARAM_INT);
/* Names can be prefixed with colons ":" too (optional) */
$sth->bindParam(':colour', $colour, PDO::PARAM_STR);
$sth->execute();
?>
```
**Example #2 Execute a prepared statement with question mark placeholders**
```
<?php
/* Execute a prepared statement by binding PHP variables */
$calories = 150;
$colour = 'red';
$sth = $dbh->prepare('SELECT name, colour, calories
FROM fruit
WHERE calories < ? AND colour = ?');
$sth->bindParam(1, $calories, PDO::PARAM_INT);
$sth->bindParam(2, $colour, PDO::PARAM_STR);
$sth->execute();
?>
```
**Example #3 Call a stored procedure with an INOUT parameter**
```
<?php
/* Call a stored procedure with an INOUT parameter */
$colour = 'red';
$sth = $dbh->prepare('CALL puree_fruit(?)');
$sth->bindParam(1, $colour, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 12);
$sth->execute();
print("After pureeing fruit, the colour is: $colour");
?>
```
### See Also
* [PDO::prepare()](pdo.prepare) - Prepares a statement for execution and returns a statement object
* [PDOStatement::execute()](pdostatement.execute) - Executes a prepared statement
* [PDOStatement::bindValue()](pdostatement.bindvalue) - Binds a value to a parameter
php readdir readdir
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
readdir — Read entry from directory handle
### Description
```
readdir(?resource $dir_handle = null): string|false
```
Returns the name of the next entry in the directory. The entries are returned in the order in which they are stored by the filesystem.
### Parameters
`dir_handle`
The directory handle resource previously opened with [opendir()](function.opendir). If the directory handle is not specified, the last link opened by [opendir()](function.opendir) is assumed.
### Return Values
Returns the entry name on success or **`false`** on failure.
**Warning**This function may return Boolean **`false`**, but may also return a non-Boolean value which evaluates to **`false`**. Please read the section on [Booleans](language.types.boolean) for more information. Use [the === operator](language.operators.comparison) for testing the return value of this function.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `dir_handle` is now nullable. |
### Examples
**Example #1 List all entries in a directory**
Please note the fashion in which **readdir()**'s return value is checked in the examples below. We are explicitly testing whether the return value is identical to (equal to and of the same type as--see [Comparison Operators](language.operators.comparison) for more information) **`false`** since otherwise, any directory entry whose name evaluates to **`false`** will stop the loop (e.g. a directory named "0").
```
<?php
if ($handle = opendir('/path/to/files')) {
echo "Directory handle: $handle\n";
echo "Entries:\n";
/* This is the correct way to loop over the directory. */
while (false !== ($entry = readdir($handle))) {
echo "$entry\n";
}
/* This is the WRONG way to loop over the directory. */
while ($entry = readdir($handle)) {
echo "$entry\n";
}
closedir($handle);
}
?>
```
**Example #2 List all entries in the current directory and strip out `.` and `..`**
```
<?php
if ($handle = opendir('.')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
echo "$entry\n";
}
}
closedir($handle);
}
?>
```
### See Also
* [is\_dir()](function.is-dir) - Tells whether the filename is a directory
* [glob()](function.glob) - Find pathnames matching a pattern
* [opendir()](function.opendir) - Open directory handle
* [scandir()](function.scandir) - List files and directories inside the specified path
php stream_context_get_default stream\_context\_get\_default
=============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
stream\_context\_get\_default — Retrieve the default stream context
### Description
```
stream_context_get_default(?array $options = null): resource
```
Returns the default stream context which is used whenever file operations ([fopen()](function.fopen), [file\_get\_contents()](function.file-get-contents), etc...) are called without a context parameter. Options for the default context can optionally be specified with this function using the same syntax as [stream\_context\_create()](function.stream-context-create).
### Parameters
`options`
`options` must be an associative array of associative arrays in the format `$arr['wrapper']['option'] = $value`, or **`null`**. ### Return Values
A stream context resource.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `options` is now nullable. |
### Examples
**Example #1 Using **stream\_context\_get\_default()****
```
<?php
$default_opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar",
'proxy'=>"tcp://10.54.1.39:8000"
)
);
$alternate_opts = array(
'http'=>array(
'method'=>"POST",
'header'=>"Content-type: application/x-www-form-urlencoded\r\n" .
"Content-length: " . strlen("baz=bomb"),
'content'=>"baz=bomb"
)
);
$default = stream_context_get_default($default_opts);
$alternate = stream_context_create($alternate_opts);
/* Sends a regular GET request to proxy server at 10.54.1.39
* For www.example.com using context options specified in $default_opts
*/
readfile('http://www.example.com');
/* Sends a POST request directly to www.example.com
* Using context options specified in $alternate_opts
*/
readfile('http://www.example.com', false, $alternate);
?>
```
### See Also
* [stream\_context\_create()](function.stream-context-create) - Creates a stream context
* [stream\_context\_set\_default()](function.stream-context-set-default) - Set the default stream context
* Listing of supported wrappers with context options ([Supported Protocols and Wrappers](https://www.php.net/manual/en/wrappers.php)).
| programming_docs |
php gzwrite gzwrite
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
gzwrite — Binary-safe gz-file write
### Description
```
gzwrite(resource $stream, string $data, ?int $length = null): int|false
```
**gzwrite()** writes the contents of `data` to the given gz-file.
### Parameters
`stream`
The gz-file pointer. It must be valid, and must point to a file successfully opened by [gzopen()](function.gzopen).
`data`
The string to write.
`length`
The number of uncompressed bytes to write. If supplied, writing will stop after `length` (uncompressed) bytes have been written or the end of `data` is reached, whichever comes first.
### Return Values
Returns the number of (uncompressed) bytes written to the given gz-file stream, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `length` is nullable now; previously, the default was `0`. |
| 7.4.0 | This functions returns **`false`** on failure now; previously `0` was returned. |
### Examples
**Example #1 **gzwrite()** example**
```
<?php
$string = 'Some information to compress';
$gz = gzopen('somefile.gz','w9');
gzwrite($gz, $string);
gzclose($gz);
?>
```
### See Also
* [gzread()](function.gzread) - Binary-safe gz-file read
* [gzopen()](function.gzopen) - Open gz-file
php Imagick::getResource Imagick::getResource
====================
(PECL imagick 2, PECL imagick 3)
Imagick::getResource — Returns the specified resource's memory usage
### Description
```
public static Imagick::getResource(int $type): int
```
Returns the specified resource's memory usage in megabytes.
### Parameters
`type`
Refer to the list of [resourcetype constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.resourcetypes).
### Return Values
Returns the specified resource's memory usage in megabytes.
### Errors/Exceptions
Throws ImagickException on error.
php Imagick::compareImageChannels Imagick::compareImageChannels
=============================
(PECL imagick 2, PECL imagick 3)
Imagick::compareImageChannels — Returns the difference in one or more images
### Description
```
public Imagick::compareImageChannels(Imagick $image, int $channelType, int $metricType): array
```
Compares one or more images and returns the difference image.
### Parameters
`image`
Imagick object containing the image to compare.
`channelType`
Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channeltype constants using bitwise operators. Refer to this list of [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel).
`metricType`
One of the [metric type constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.metric).
### Return Values
Array consisting of `new_wand` and `distortion`.
### Errors/Exceptions
Throws ImagickException on error.
php SolrParams::addParam SolrParams::addParam
====================
(PECL solr >= 0.9.2)
SolrParams::addParam — Adds a parameter to the object
### Description
```
public SolrParams::addParam(string $name, string $value): SolrParams
```
Adds a parameter to the object. This is used for parameters that can be specified multiple times.
### Parameters
`name`
Name of parameter
`value`
Value of parameter
### Return Values
Returns a SolrParam object on success and **`false`** on failure.
php Imagick::gaussianBlurImage Imagick::gaussianBlurImage
==========================
(PECL imagick 2, PECL imagick 3)
Imagick::gaussianBlurImage — Blurs an image
### Description
```
public Imagick::gaussianBlurImage(float $radius, float $sigma, int $channel = Imagick::CHANNEL_DEFAULT): bool
```
Blurs an image. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, the radius should be larger than sigma. Use a radius of 0 and selects a suitable radius for you.
### Parameters
`radius`
The radius of the Gaussian, in pixels, not counting the center pixel.
`sigma`
The standard deviation of the Gaussian, in pixels.
`channel`
Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channeltype constants using bitwise operators. Refer to this list of [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel).
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::gaussianBlurImage()****
```
<?php
function gaussianBlurImage($imagePath, $radius, $sigma, $channel) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->gaussianBlurImage($radius, $sigma, $channel);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php Lua::registerCallback Lua::registerCallback
=====================
(No version information available, might only be in Git)
Lua::registerCallback — Register a PHP function to Lua
### Description
```
public Lua::registerCallback(string $name, callable $function): mixed
```
Register a PHP function to Lua as a function named "$name"
### Parameters
`name`
`function`
A valid PHP function callback
### Return Values
Returns $this, **`null`** for wrong arguments or **`false`** on other failure.
### Examples
**Example #1 **Lua::registerCallback()**example**
```
<?php
$lua = new Lua();
$lua->registerCallback("echo", "var_dump");
$lua->eval(<<<CODE
echo({1, 2, 3});
CODE
);
?>
```
The above example will output:
```
array(3) {
[1]=>
float(1)
[2]=>
float(2)
[3]=>
float(3)
}
```
php IntlCalendar::roll IntlCalendar::roll
==================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::roll — Add value to field without carrying into more significant fields
### Description
Object-oriented style
```
public IntlCalendar::roll(int $field, int|bool $value): bool
```
Procedural style
```
intlcal_roll(IntlCalendar $calendar, int $field, int|bool $value): bool
```
Adds a (signed) amount to a field. The difference with respect to [IntlCalendar::add()](intlcalendar.add) is that when the field value overflows, it does not carry into more significant fields.
### Parameters
`calendar`
An [IntlCalendar](class.intlcalendar) instance.
`field`
One of the [IntlCalendar](class.intlcalendar) date/time [field constants](class.intlcalendar#intlcalendar.constants). These are integer values between `0` and **`IntlCalendar::FIELD_COUNT`**.
`value`
The (signed) amount to add to the field, **`true`** for rolling up (adding `1`), or **`false`** for rolling down (subtracting `1`).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **IntlCalendar::roll()****
```
<?php
ini_set('date.timezone', 'Europe/Lisbon');
ini_set('intl.default_locale', 'pt_PT');
$cal = new IntlGregorianCalendar(2013, 5 /* June */, 30);
$cal->add(IntlCalendar::FIELD_DAY_OF_MONTH, 1);
var_dump(IntlDateFormatter::formatObject($cal)); // "01/07/2013, 00:00:00"
$cal->set(2013, 5 /* June */, 30);
$cal->roll(IntlCalendar::FIELD_DAY_OF_MONTH, true); // roll up, same as rolling +1
var_dump(IntlDateFormatter::formatObject($cal)); // "01/06/2013, 00:00:00"
```
The above example will output:
```
string(20) "01/07/2013, 00:00:00"
string(20) "01/06/2013, 00:00:00"
```
### See Also
* [IntlCalendar::add()](intlcalendar.add) - Add a (signed) amount of time to a field
* [IntlCalendar::set()](intlcalendar.set) - Set a time field or several common fields at once
php QuickHashIntHash::add QuickHashIntHash::add
=====================
(PECL quickhash >= Unknown)
QuickHashIntHash::add — This method adds a new entry to the hash
### Description
```
public QuickHashIntHash::add(int $key, int $value = ?): bool
```
This method adds a new entry to the hash, and returns whether the entry was added. Entries are by default always added unless **`QuickHashIntHash::CHECK_FOR_DUPES`** has been passed when the hash was created.
### Parameters
`key`
The key of the entry to add.
`value`
The optional value of the entry to add. If no value is specified, `1` will be used.
### Return Values
**`true`** when the entry was added, and **`false`** if the entry was not added.
### Examples
**Example #1 **QuickHashIntHash::add()** example**
```
<?php
echo "without dupe checking\n";
$hash = new QuickHashIntHash( 1024 );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->get( 4 ) );
var_dump( $hash->add( 4, 22 ) );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->get( 4 ) );
var_dump( $hash->add( 4, 12 ) );
echo "\nwith dupe checking\n";
$hash = new QuickHashIntHash( 1024, QuickHashIntHash::CHECK_FOR_DUPES );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->get( 4 ) );
var_dump( $hash->add( 4, 78 ) );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->get( 4 ) );
var_dump( $hash->add( 4, 9 ) );
echo "\ndefault value\n";
var_dump( $hash->add( 5 ) );
var_dump( $hash->get( 5 ) );
?>
```
The above example will output something similar to:
```
without dupe checking
bool(false)
bool(false)
bool(true)
bool(true)
int(22)
bool(true)
with dupe checking
bool(false)
bool(false)
bool(true)
bool(true)
int(78)
bool(false)
default value
bool(true)
int(1)
```
php ReflectionClass::hasProperty ReflectionClass::hasProperty
============================
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
ReflectionClass::hasProperty — Checks if property is defined
### Description
```
public ReflectionClass::hasProperty(string $name): bool
```
Checks whether the specified property is defined.
### Parameters
`name`
Name of the property being checked for.
### Return Values
**`true`** if it has the property, otherwise **`false`**
### Examples
**Example #1 **ReflectionClass::hasProperty()** example**
```
<?php
class Foo {
public $p1;
protected $p2;
private $p3;
}
$obj = new ReflectionObject(new Foo());
var_dump($obj->hasProperty("p1"));
var_dump($obj->hasProperty("p2"));
var_dump($obj->hasProperty("p3"));
var_dump($obj->hasProperty("p4"));
?>
```
The above example will output something similar to:
```
bool(true)
bool(true)
bool(true)
bool(false)
```
### See Also
* [ReflectionClass::hasConstant()](reflectionclass.hasconstant) - Checks if constant is defined
* [ReflectionClass::hasMethod()](reflectionclass.hasmethod) - Checks if method is defined
php socket_shutdown socket\_shutdown
================
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
socket\_shutdown — Shuts down a socket for receiving, sending, or both
### Description
```
socket_shutdown(Socket $socket, int $mode = 2): bool
```
The **socket\_shutdown()** function allows you to stop incoming, outgoing or all data (the default) from being sent through the `socket`
>
> **Note**:
>
>
> The associated buffer, or buffers, may or may not be emptied.
>
>
### Parameters
`socket`
A [Socket](class.socket) instance created with [socket\_create()](function.socket-create).
`mode`
The value of `mode` can be one of the following:
**possible values for `mode`**| `0` | Shutdown socket reading |
| `1` | Shutdown socket writing |
| `2` | Shutdown socket reading and writing |
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `socket` is a [Socket](class.socket) instance now; previously, it was a resource. |
php timezone_transitions_get timezone\_transitions\_get
==========================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
timezone\_transitions\_get — Alias of [DateTimeZone::getTransitions()](datetimezone.gettransitions)
### Description
This function is an alias of: [DateTimeZone::getTransitions()](datetimezone.gettransitions)
php mb_detect_order mb\_detect\_order
=================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
mb\_detect\_order — Set/Get character encoding detection order
### Description
```
mb_detect_order(array|string|null $encoding = null): array|bool
```
Sets the automatic character encoding detection order to `encoding`.
### Parameters
`encoding`
`encoding` is an array or comma separated list of character encoding. See [supported encodings](https://www.php.net/manual/en/mbstring.supported-encodings.php).
If `encoding` is omitted or **`null`**, it returns the current character encoding detection order as array.
This setting affects [mb\_detect\_encoding()](function.mb-detect-encoding) and [mb\_send\_mail()](function.mb-send-mail).
`mbstring` currently implements the following encoding detection filters. If there is an invalid byte sequence for the following encodings, encoding detection will fail.
`UTF-8`, `UTF-7`, `ASCII`, `EUC-JP`,`SJIS`, `eucJP-win`, `SJIS-win`, `JIS`, `ISO-2022-JP` For `ISO-8859-*`, `mbstring` always detects as `ISO-8859-*`.
For `UTF-16`, `UTF-32`, `UCS2` and `UCS4`, encoding detection will fail always.
### Return Values
When setting the encoding detection order, **`true`** is returned on success or **`false`** on failure.
When getting the encoding detection order, an ordered array of the encodings is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `encoding` is nullable now. |
### Examples
**Example #1 **mb\_detect\_order()** examples**
```
<?php
/* Set detection order by enumerated list */
mb_detect_order("eucjp-win,sjis-win,UTF-8");
/* Set detection order by array */
$ary[] = "ASCII";
$ary[] = "JIS";
$ary[] = "EUC-JP";
mb_detect_order($ary);
/* Display current detection order */
echo implode(", ", mb_detect_order());
?>
```
**Example #2 Example showing useless detect orders**
```
; Always detect as ISO-8859-1
detect_order = ISO-8859-1, UTF-8
; Always detect as UTF-8, since ASCII/UTF-7 values are
; valid for UTF-8
detect_order = UTF-8, ASCII, UTF-7
```
### See Also
* [mb\_internal\_encoding()](function.mb-internal-encoding) - Set/Get internal character encoding
* [mb\_http\_input()](function.mb-http-input) - Detect HTTP input character encoding
* [mb\_http\_output()](function.mb-http-output) - Set/Get HTTP output character encoding
* [mb\_send\_mail()](function.mb-send-mail) - Send encoded mail
php PharData::setStub PharData::setStub
=================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
PharData::setStub — Dummy function (Phar::setStub is not valid for PharData)
### Description
```
public PharData::setStub(string $stub, int $len = -1): bool
```
Non-executable tar/zip archives cannot have a stub, so this method simply throws an exception.
### Parameters
`stub`
A string or an open stream handle to use as the executable stub for this phar archive. This parameter is ignored.
`len`
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
Throws [PharException](class.pharexception) on all method calls
### See Also
* [Phar::setStub()](phar.setstub) - Used to set the PHP loader or bootstrap stub of a Phar archive
php Yaf_Route_Rewrite::__construct Yaf\_Route\_Rewrite::\_\_construct
==================================
(Yaf >=1.0.0)
Yaf\_Route\_Rewrite::\_\_construct — Yaf\_Route\_Rewrite constructor
### Description
public **Yaf\_Route\_Rewrite::\_\_construct**(string `$match`, array `$route`, array `$verify` = ?) ### Parameters
`match`
A pattern, will be used to match a request uri, if it doesn't match, [Yaf\_Route\_Rewrite](class.yaf-route-rewrite) will return **`false`**.
You can use :name style to name segments matched, and use \* to match the rest of the URL segments.
`route`
When the match pattern matches the request uri, [Yaf\_Route\_Rewrite](class.yaf-route-rewrite) will use this to decide which module/controller/action is the destination.
Either of module/controller/action in this array is optional, if you don't assign a specific value, it will be routed to default.
`verify`
### Return Values
### Examples
**Example #1 **Yaf\_Route\_Rewrite()**example**
```
<?php
/**
* Add a rewrite route to Yaf_Router route stack
*/
Yaf_Dispatcher::getInstance()->getRouter()->addRoute("name",
new Yaf_Route_rewrite(
"/product/:name/:id/*", //match request uri leading "/product"
array(
'controller' => "product", //route to product controller,
),
)
);
?>
```
The above example will output something similar to:
```
/* for http://yourdomain.com/product/foo/22/foo/bar
* route will result in following values:
*/
array(
"controller" => "product",
"module" => "index", //(default)
"action" => "index", //(default)
)
/**
* and request parameters:
*/
array(
"name" => "foo",
"id" => 22,
"foo" => bar
)
```
**Example #2 **Yaf\_Route\_Rewrite()**example**
```
<?php
/**
* Add a rewrite route to Yaf_Router route stack by calling addconfig
*/
$config = array(
"name" => array(
"type" => "rewrite", //Yaf_Route_Rewrite route
"match" => "/user-list/:id", //match only /user/list/?/
"route" => array(
'controller' => "user", //route to user controller,
'action' => "list", //route to list action
),
),
);
Yaf_Dispatcher::getInstance()->getRouter()->addConfig(
new Yaf_Config_Simple($config));
?>
```
The above example will output something similar to:
```
/* for http://yourdomain.com/user-list/22
* route will result in following values:
*/
array(
"controller" => "user",
"action" => "list",
"module" => "index", //(default)
)
/**
* and request parameters:
*/
array(
"id" => 22,
)
```
**Example #3 **Yaf\_Route\_Rewrite(as of 2.3.0)()**example**
```
<?php
/**
* Add a rewrite route use match result as m/c/a name
*/
$config = array(
"name" => array(
"type" => "rewrite",
"match" => "/user-list/:a/:id", //match only /user-list/*
"route" => array(
'controller' => "user", //route to user controller,
'action' => ":a", //route to :a action
),
),
);
Yaf_Dispatcher::getInstance()->getRouter()->addConfig(
new Yaf_Config_Simple($config));
?>
```
The above example will output something similar to:
```
/* for http://yourdomain.com/user-list/list/22
* route will result in following values:
*/
array(
"controller" => "user",
"action" => "list",
"module" => "index", //(default)
)
/**
* and request parameters:
*/
array(
"id" => 22,
)
```
### See Also
* [Yaf\_Router::addRoute()](yaf-router.addroute) - Add new Route into Router
* [Yaf\_Router::addConfig()](yaf-router.addconfig) - Add config-defined routes into Router
* [Yaf\_Route\_Static](class.yaf-route-static)
* [Yaf\_Route\_Supervar](class.yaf-route-supervar)
* [Yaf\_Route\_Simple](class.yaf-route-simple)
* [Yaf\_Route\_Regex](class.yaf-route-regex)
* [Yaf\_Route\_Map](class.yaf-route-map)
php Gmagick::borderimage Gmagick::borderimage
====================
(PECL gmagick >= Unknown)
Gmagick::borderimage — Surrounds the image with a border
### Description
```
public Gmagick::borderimage(GmagickPixel $color, int $width, int $height): Gmagick
```
Surrounds the image with a border of the color defined by the bordercolor [GmagickPixel](class.gmagickpixel) object or a color string.
### Parameters
`color`
[GmagickPixel](class.gmagickpixel) object or a string containing the border color.
`width`
Border width.
`height`
Border height.
### Return Values
The [Gmagick](class.gmagick) object with border defined.
### Errors/Exceptions
Throws an **GmagickException** on error.
| programming_docs |
php time time
====
(PHP 4, PHP 5, PHP 7, PHP 8)
time — Return current Unix timestamp
### Description
```
time(): int
```
Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
>
> **Note**:
>
>
> Unix timestamps do not contain any information with regards to any local timezone. It is recommended to use the [DateTimeImmutable](class.datetimeimmutable) class for handling date and time information in order to avoid the pitfalls that come with just Unix timestamps.
>
>
### Parameters
This function has no parameters.
### Return Values
Returns the current timestamp.
### Examples
**Example #1 **time()** example**
```
<?php
echo 'Now: '. time();
?>
```
The above example will output something similar to:
```
Now: 1660338149
```
### Notes
**Tip** Timestamp of the start of the request is available in [$\_SERVER['REQUEST\_TIME']](reserved.variables.server).
### See Also
* [DateTimeImmutable](class.datetimeimmutable)
* [date()](function.date) - Format a Unix timestamp
* [microtime()](function.microtime) - Return current Unix timestamp with microseconds
php pg_lo_open pg\_lo\_open
============
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg\_lo\_open — Open a large object
### Description
```
pg_lo_open(PgSql\Connection $connection, int $oid, string $mode): PgSql\Lob|false
```
**pg\_lo\_open()** opens a large object in the database and returns an [PgSql\Lob](class.pgsql-lob) instance so that it can be manipulated.
**Warning** Do not close the database connection before closing the [PgSql\Lob](class.pgsql-lob) instance.
To use the large object interface, it is necessary to enclose it within a transaction block.
>
> **Note**:
>
>
> This function used to be called **pg\_loopen()**.
>
>
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance. When `connection` is unspecified, the default connection is used. The default connection is the last connection made by [pg\_connect()](function.pg-connect) or [pg\_pconnect()](function.pg-pconnect).
**Warning**As of PHP 8.1.0, using the default connection is deprecated.
`oid`
The OID of the large object in the database.
`mode`
Can be either "r" for read-only, "w" for write only or "rw" for read and write.
### Return Values
An [PgSql\Lob](class.pgsql-lob) instance, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | Returns an [PgSql\Lob](class.pgsql-lob) instance now; previously, a [resource](language.types.resource) was returned. |
| 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **pg\_lo\_open()** example**
```
<?php
$database = pg_connect("dbname=jacarta");
pg_query($database, "begin");
$oid = pg_lo_create($database);
echo "$oid\n";
$handle = pg_lo_open($database, $oid, "w");
echo "$handle\n";
pg_lo_write($handle, "large object data");
pg_lo_close($handle);
pg_query($database, "commit");
?>
```
### See Also
* [pg\_lo\_close()](function.pg-lo-close) - Close a large object
* [pg\_lo\_create()](function.pg-lo-create) - Create a large object
php The RecursiveIteratorIterator class
The RecursiveIteratorIterator class
===================================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
Can be used to iterate through recursive iterators.
Class synopsis
--------------
class **RecursiveIteratorIterator** implements [OuterIterator](class.outeriterator) { /\* Constants \*/ public const int [LEAVES\_ONLY](class.recursiveiteratoriterator#recursiveiteratoriterator.constants.leaves-only);
public const int [SELF\_FIRST](class.recursiveiteratoriterator#recursiveiteratoriterator.constants.self-first);
public const int [CHILD\_FIRST](class.recursiveiteratoriterator#recursiveiteratoriterator.constants.child-first);
public const int [CATCH\_GET\_CHILD](class.recursiveiteratoriterator#recursiveiteratoriterator.constants.catch-get-child); /\* Methods \*/ public [\_\_construct](recursiveiteratoriterator.construct)([Traversable](class.traversable) `$iterator`, int `$mode` = RecursiveIteratorIterator::LEAVES\_ONLY, int `$flags` = 0)
```
public beginChildren(): void
```
```
public beginIteration(): void
```
```
public callGetChildren(): ?RecursiveIterator
```
```
public callHasChildren(): bool
```
```
public current(): mixed
```
```
public endChildren(): void
```
```
public endIteration(): void
```
```
public getDepth(): int
```
```
public getInnerIterator(): RecursiveIterator
```
```
public getMaxDepth(): int|false
```
```
public getSubIterator(?int $level = null): ?RecursiveIterator
```
```
public key(): mixed
```
```
public next(): void
```
```
public nextElement(): void
```
```
public rewind(): void
```
```
public setMaxDepth(int $maxDepth = -1): void
```
```
public valid(): bool
```
} Predefined Constants
--------------------
**`RecursiveIteratorIterator::LEAVES_ONLY`** **`RecursiveIteratorIterator::SELF_FIRST`** **`RecursiveIteratorIterator::CHILD_FIRST`** **`RecursiveIteratorIterator::CATCH_GET_CHILD`** Table of Contents
-----------------
* [RecursiveIteratorIterator::beginChildren](recursiveiteratoriterator.beginchildren) — Begin children
* [RecursiveIteratorIterator::beginIteration](recursiveiteratoriterator.beginiteration) — Begin Iteration
* [RecursiveIteratorIterator::callGetChildren](recursiveiteratoriterator.callgetchildren) — Get children
* [RecursiveIteratorIterator::callHasChildren](recursiveiteratoriterator.callhaschildren) — Has children
* [RecursiveIteratorIterator::\_\_construct](recursiveiteratoriterator.construct) — Construct a RecursiveIteratorIterator
* [RecursiveIteratorIterator::current](recursiveiteratoriterator.current) — Access the current element value
* [RecursiveIteratorIterator::endChildren](recursiveiteratoriterator.endchildren) — End children
* [RecursiveIteratorIterator::endIteration](recursiveiteratoriterator.enditeration) — End Iteration
* [RecursiveIteratorIterator::getDepth](recursiveiteratoriterator.getdepth) — Get the current depth of the recursive iteration
* [RecursiveIteratorIterator::getInnerIterator](recursiveiteratoriterator.getinneriterator) — Get inner iterator
* [RecursiveIteratorIterator::getMaxDepth](recursiveiteratoriterator.getmaxdepth) — Get max depth
* [RecursiveIteratorIterator::getSubIterator](recursiveiteratoriterator.getsubiterator) — The current active sub iterator
* [RecursiveIteratorIterator::key](recursiveiteratoriterator.key) — Access the current key
* [RecursiveIteratorIterator::next](recursiveiteratoriterator.next) — Move forward to the next element
* [RecursiveIteratorIterator::nextElement](recursiveiteratoriterator.nextelement) — Next element
* [RecursiveIteratorIterator::rewind](recursiveiteratoriterator.rewind) — Rewind the iterator to the first element of the top level inner iterator
* [RecursiveIteratorIterator::setMaxDepth](recursiveiteratoriterator.setmaxdepth) — Set max depth
* [RecursiveIteratorIterator::valid](recursiveiteratoriterator.valid) — Check whether the current position is valid
php xml_parser_set_option xml\_parser\_set\_option
========================
(PHP 4, PHP 5, PHP 7, PHP 8)
xml\_parser\_set\_option — Set options in an XML parser
### Description
```
xml_parser_set_option(XMLParser $parser, int $option, string|int $value): bool
```
Sets an option in an XML parser.
### Parameters
`parser`
A reference to the XML parser to set an option in.
`option`
Which option to set. See below.
The following options are available:
**XML parser options**| Option constant | Data type | Description |
| --- | --- | --- |
| **`XML_OPTION_CASE_FOLDING`** | integer | Controls whether [case-folding](https://www.php.net/manual/en/xml.case-folding.php) is enabled for this XML parser. Enabled by default. |
| **`XML_OPTION_SKIP_TAGSTART`** | integer | Specify how many characters should be skipped in the beginning of a tag name. |
| **`XML_OPTION_SKIP_WHITE`** | integer | Whether to skip values consisting of whitespace characters. |
| **`XML_OPTION_TARGET_ENCODING`** | string | Sets which [target encoding](https://www.php.net/manual/en/xml.encoding.php) to use in this XML parser.By default, it is set to the same as the source encoding used by [xml\_parser\_create()](function.xml-parser-create). Supported target encodings are `ISO-8859-1`, `US-ASCII` and `UTF-8`. |
`value`
The option's new value.
### Return Values
This function returns **`false`** if `parser` does not refer to a valid parser, or if the option could not be set. Else the option is set and **`true`** is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `parser` expects an [XMLParser](class.xmlparser) instance now; previously, a resource was expected. |
php rmdir rmdir
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
rmdir — Removes directory
### Description
```
rmdir(string $directory, ?resource $context = null): bool
```
Attempts to remove the directory named by `directory`. The directory must be empty, and the relevant permissions must permit this. A **`E_WARNING`** level error will be generated on failure.
### Parameters
`directory`
Path to the directory.
`context`
A [context stream](https://www.php.net/manual/en/stream.contexts.php) resource.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **rmdir()** example**
```
<?php
if (!is_dir('examples')) {
mkdir('examples');
}
rmdir('examples');
?>
```
### See Also
* [is\_dir()](function.is-dir) - Tells whether the filename is a directory
* [mkdir()](function.mkdir) - Makes directory
* [unlink()](function.unlink) - Deletes a file
php imap_8bit imap\_8bit
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_8bit — Convert an 8bit string to a quoted-printable string
### Description
```
imap_8bit(string $string): string|false
```
Convert an 8bit string to a quoted-printable string (according to [» RFC2045](http://www.faqs.org/rfcs/rfc2045), section 6.7).
### Parameters
`string`
The 8bit string to convert
### Return Values
Returns a quoted-printable string, or **`false`** on failure.
### See Also
* [imap\_qprint()](function.imap-qprint) - Convert a quoted-printable string to an 8 bit string
php strtolower strtolower
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
strtolower — Make a string lowercase
### Description
```
strtolower(string $string): string
```
Returns `string` with all ASCII alphabetic characters converted to lowercase.
Bytes in the range `"A"` (0x41) to `"Z"` (0x5a) will be converted to the corresponding lowercase letter by adding 32 to each byte value.
This can be used to convert ASCII characters within strings encoded with UTF-8, since multibyte UTF-8 characters will be ignored. To convert multibyte non-ASCII characters, use [mb\_strtolower()](function.mb-strtolower).
### Parameters
`string`
The input string.
### Return Values
Returns the lowercased string.
### Changelog
| Version | Description |
| --- | --- |
| 8.2.0 | Case conversion no longer depends on the locale set with [setlocale()](function.setlocale). Only ASCII characters will be converted. |
### Examples
**Example #1 **strtolower()** example**
```
<?php
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = strtolower($str);
echo $str; // Prints mary had a little lamb and she loved it so
?>
```
### Notes
> **Note**: This function is binary-safe.
>
>
### See Also
* [strtoupper()](function.strtoupper) - Make a string uppercase
* [ucfirst()](function.ucfirst) - Make a string's first character uppercase
* [ucwords()](function.ucwords) - Uppercase the first character of each word in a string
* [mb\_strtolower()](function.mb-strtolower) - Make a string lowercase
php Collator::getSortKey Collator::getSortKey
====================
collator\_get\_sort\_key
========================
(PHP 5 >= 5.3.2, PHP 7, PHP 8, PECL intl >= 1.0.3)
Collator::getSortKey -- collator\_get\_sort\_key — Get sorting key for a string
### Description
Object-oriented style
```
public Collator::getSortKey(string $string): string|false
```
Procedural style
```
collator_get_sort_key(Collator $object, string $string): string|false
```
Return collation key for a string. Collation keys can be compared directly instead of strings, though are implementation specific and may change between ICU library versions. Sort keys are generally only useful in databases or other circumstances where function calls are extremely expensive.
### Parameters
`object`
[Collator](class.collator) object.
`string`
The string to produce the key from.
### Return Values
Returns the collation key for the string, or **`false`** on failure.
**Warning**This function may return Boolean **`false`**, but may also return a non-Boolean value which evaluates to **`false`**. Please read the section on [Booleans](language.types.boolean) for more information. Use [the === operator](language.operators.comparison) for testing the return value of this function.
### Examples
**Example #1 **collator\_get\_sort\_key()**example**
```
<?php
$s1 = 'Hello';
$coll = collator_create('en_US');
$res = collator_get_sort_key($coll, $s1);
echo bin2hex($res);
?>
```
The above example will output something similar to:
3832404046010901dc08
### See Also
* [collator\_sort()](collator.sort) - Sort array using specified collator
* [collator\_sort\_with\_sort\_keys()](collator.sortwithsortkeys) - Sort array using specified collator and sort keys
php SolrCollapseFunction::getSize SolrCollapseFunction::getSize
=============================
(PECL solr >= 2.2.0)
SolrCollapseFunction::getSize — Returns size parameter
### Description
```
public SolrCollapseFunction::getSize(): int
```
Gets the initial size of the collapse data structures when collapsing on a numeric field only
### Parameters
This function has no parameters.
### Return Values
### See Also
* [SolrCollapseFunction::setSize()](solrcollapsefunction.setsize) - Sets the initial size of the collapse data structures when collapsing on a numeric field only
php SolrQuery::addGroupSortField SolrQuery::addGroupSortField
============================
(PECL solr >= 2.2.0)
SolrQuery::addGroupSortField — Add a group sort field (group.sort parameter)
### Description
```
public SolrQuery::addGroupSortField(string $field, int $order = ?): SolrQuery
```
Allow sorting group documents, using group sort field (group.sort parameter).
### Parameters
`field`
Field name
`order`
Order ASC/DESC, utilizes SolrQuery::ORDER\_\* constants
### Return Values
### Examples
**Example #1 **SolrQuery::addGroupSortField()** example**
```
<?php
$solrQuery = new SolrQuery('*:*');
$solrQuery
->setGroup(true)
->addGroupSortField('price', SolrQuery::ORDER_ASC);
echo $solrQuery;
?>
```
The above example will output something similar to:
```
q=*:*&group=true&group.sort=price asc
```
### See Also
* [SolrQuery::setGroup()](solrquery.setgroup) - Enable/Disable result grouping (group parameter)
* [SolrQuery::addGroupField()](solrquery.addgroupfield) - Add a field to be used to group results
* [SolrQuery::addGroupFunction()](solrquery.addgroupfunction) - Allows grouping results based on the unique values of a function query (group.func parameter)
* [SolrQuery::addGroupQuery()](solrquery.addgroupquery) - Allows grouping of documents that match the given query
* [SolrQuery::setGroupFacet()](solrquery.setgroupfacet) - Sets group.facet parameter
* [SolrQuery::setGroupOffset()](solrquery.setgroupoffset) - Sets the group.offset parameter
* [SolrQuery::setGroupLimit()](solrquery.setgrouplimit) - Specifies the number of results to return for each group. The server default value is 1
* [SolrQuery::setGroupMain()](solrquery.setgroupmain) - If true, the result of the first field grouping command is used as the main result list in the response, using group.format=simple
* [SolrQuery::setGroupNGroups()](solrquery.setgroupngroups) - If true, Solr includes the number of groups that have matched the query in the results
* [SolrQuery::setGroupTruncate()](solrquery.setgrouptruncate) - If true, facet counts are based on the most relevant document of each group matching the query
* [SolrQuery::setGroupFormat()](solrquery.setgroupformat) - Sets the group format, result structure (group.format parameter)
* [SolrQuery::setGroupCachePercent()](solrquery.setgroupcachepercent) - Enables caching for result grouping
php get_resources get\_resources
==============
(PHP 7, PHP 8)
get\_resources — Returns active resources
### Description
```
get_resources(?string $type = null): array
```
Returns an array of all currently active resources, optionally filtered by resource type.
> **Note**: This function is meant for debugging and testing purposes. It is not supposed to be used in production environments, especially not to access or even manipulate resources which are normally not accessible (e.g. the underlying stream resource of [SplFileObject](class.splfileobject) instances).
>
>
### Parameters
`type`
If defined, this will cause **get\_resources()** to only return resources of the given type. [A list of resource types is available.](https://www.php.net/manual/en/resource.php)
If the string `Unknown` is provided as the type, then only resources that are of an unknown type will be returned.
If omitted, all resources will be returned.
### Return Values
Returns an array of currently active resources, indexed by resource number.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `type` is nullable now. |
### Examples
**Example #1 Unfiltered **get\_resources()****
```
<?php
$fp = tmpfile();
var_dump(get_resources());
?>
```
The above example will output something similar to:
```
array(1) {
[1]=>
resource(1) of type (stream)
}
```
**Example #2 Filtered **get\_resources()****
```
<?php
$fp = tmpfile();
var_dump(get_resources('stream'));
var_dump(get_resources('curl'));
?>
```
The above example will output something similar to:
```
array(1) {
[1]=>
resource(1) of type (stream)
}
array(0) {
}
```
### See Also
* [get\_loaded\_extensions()](function.get-loaded-extensions) - Returns an array with the names of all modules compiled and loaded
* [get\_defined\_constants()](function.get-defined-constants) - Returns an associative array with the names of all the constants and their values
* [get\_defined\_functions()](function.get-defined-functions) - Returns an array of all defined functions
* [get\_defined\_vars()](function.get-defined-vars) - Returns an array of all defined variables
php Componere\Value::hasDefault Componere\Value::hasDefault
===========================
(Componere 2 >= 2.1.0)
Componere\Value::hasDefault — Value Interaction
### Description
```
public Componere\Value::hasDefault(): bool
```
php None Arrow Functions
---------------
Arrow functions were introduced in PHP 7.4 as a more concise syntax for [anonymous functions](functions.anonymous).
Both anonymous functions and arrow functions are implemented using the [[Closure](class.closure)](class.closure) class.
Arrow functions have the basic form `fn (argument_list) => expr`.
Arrow functions support the same features as [anonymous functions](functions.anonymous), except that using variables from the parent scope is always automatic.
When a variable used in the expression is defined in the parent scope it will be implicitly captured by-value. In the following example, the functions $fn1 and $fn2 behave the same way.
**Example #1 Arrow functions capture variables by value automatically**
```
<?php
$y = 1;
$fn1 = fn($x) => $x + $y;
// equivalent to using $y by value:
$fn2 = function ($x) use ($y) {
return $x + $y;
};
var_export($fn1(3));
?>
```
The above example will output:
```
4
```
This also works if the arrow functions are nested:
**Example #2 Arrow functions capture variables by value automatically, even when nested**
```
<?php
$z = 1;
$fn = fn($x) => fn($y) => $x * $y + $z;
// Outputs 51
var_export($fn(5)(10));
?>
```
Similarly to anonymous functions, the arrow function syntax allows arbitrary function signatures, including parameter and return types, default values, variadics, as well as by-reference passing and returning. All of the following are valid examples of arrow functions:
**Example #3 Examples of arrow functions**
```
<?php
fn(array $x) => $x;
static fn(): int => $x;
fn($x = 42) => $x;
fn(&$x) => $x;
fn&($x) => $x;
fn($x, ...$rest) => $rest;
?>
```
Arrow functions use by-value variable binding. This is roughly equivalent to performing a `use($x)` for every variable $x used inside the arrow function. A by-value binding means that it is not possible to modify any values from the outer scope. [Anonymous functions](functions.anonymous) can be used instead for by-ref bindings.
**Example #4 Values from the outer scope cannot be modified by arrow functions**
```
<?php
$x = 1;
$fn = fn() => $x++; // Has no effect
$fn();
var_export($x); // Outputs 1
?>
```
### Changelog
| Version | Description |
| --- | --- |
| 7.4.0 | Arrow functions became available. |
### Notes
> **Note**: It is possible to use [func\_num\_args()](function.func-num-args), [func\_get\_arg()](function.func-get-arg), and [func\_get\_args()](function.func-get-args) from within an arrow function.
>
>
| programming_docs |
php ZipArchive::getStatusString ZipArchive::getStatusString
===========================
(PHP 5 >= 5.2.7, PHP 7, PHP 8)
ZipArchive::getStatusString — Returns the status error message, system and/or zip messages
### Description
```
public ZipArchive::getStatusString(): string
```
Returns the status error message, system and/or zip messages.
### Parameters
This function has no parameters.
### Return Values
Returns a string with the status message.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 / 1.18.0 | This method can be called on closed archive. |
| 8.0.0 / 1.18.0 | This method no longer returns **`false`** on failure. |
php SimpleXMLIterator::current SimpleXMLIterator::current
==========================
(PHP 5, PHP 7, PHP 8)
SimpleXMLIterator::current — Returns the current element
### Description
```
public SimpleXMLIterator::current(): mixed
```
This method returns the current element as a [SimpleXMLIterator](class.simplexmliterator) object or **`null`**.
### Parameters
This function has no parameters.
### Return Values
Returns the current element as a [SimpleXMLIterator](class.simplexmliterator) object or **`null`** on failure.
### Examples
**Example #1 Return the current element**
```
<?php
$xmlIterator = new SimpleXMLIterator('<books><book>PHP basics</book><book>XML basics</book></books>');
var_dump($xmlIterator->current());
$xmlIterator->rewind(); // rewind to first element
var_dump($xmlIterator->current());
?>
```
The above example will output:
```
NULL
object(SimpleXMLIterator)#2 (1) {
[0]=>
string(10) "PHP basics"
}
```
### See Also
* [SimpleXMLIterator::key()](simplexmliterator.key) - Return current key
* [SimpleXMLIterator::next()](simplexmliterator.next) - Move to next element
* [SimpleXMLIterator::rewind()](simplexmliterator.rewind) - Rewind to the first element
* [SimpleXMLIterator::valid()](simplexmliterator.valid) - Check whether the current element is valid
* [SimpleXMLElement](class.simplexmlelement)
php func_num_args func\_num\_args
===============
(PHP 4, PHP 5, PHP 7, PHP 8)
func\_num\_args — Returns the number of arguments passed to the function
### Description
```
func_num_args(): int
```
Gets the number of arguments passed to the function.
This function may be used in conjunction with [func\_get\_arg()](function.func-get-arg) and [func\_get\_args()](function.func-get-args) to allow user-defined functions to accept variable-length argument lists.
### Parameters
This function has no parameters.
### Return Values
Returns the number of arguments passed into the current user-defined function.
### Errors/Exceptions
Generates a warning if called from outside of a user-defined function.
### Examples
**Example #1 **func\_num\_args()** example**
```
<?php
function foo()
{
echo "Number of arguments: ", func_num_args(), PHP_EOL;
}
foo(1, 2, 3);
?>
```
The above example will output:
```
Number of arguments: 3
```
### Notes
>
> **Note**:
>
>
> As of PHP 8.0.0, the func\_\*() family of functions is intended to be mostly transparent with regard to named arguments, by treating the arguments as if they were all passed positionally, and missing arguments are replaced with their defaults. This function ignores the collection of unknown named variadic arguments. Unknown named arguments which are collected can only be accessed through the variadic parameter.
>
>
>
### See Also
* [`...` syntax](functions.arguments#functions.variable-arg-list)
* [func\_get\_arg()](function.func-get-arg)
* [func\_get\_args()](function.func-get-args)
* [ReflectionFunctionAbstract::getNumberOfParameters()](reflectionfunctionabstract.getnumberofparameters)
php SolrInputDocument::getFieldBoost SolrInputDocument::getFieldBoost
================================
(PECL solr >= 0.9.2)
SolrInputDocument::getFieldBoost — Retrieves the boost value for a particular field
### Description
```
public SolrInputDocument::getFieldBoost(string $fieldName): float
```
Retrieves the boost value for a particular field.
### Parameters
`fieldName`
The name of the field.
### Return Values
Returns the boost value for the field or **`false`** if there was an error.
php inotify_init inotify\_init
=============
(PECL inotify >= 0.1.2)
inotify\_init — Initialize an inotify instance
### Description
```
inotify_init(): resource
```
Initialize an inotify instance for use with [inotify\_add\_watch()](function.inotify-add-watch)
### Parameters
This function has no parameters.
### Return Values
A stream resource or **`false`** on error.
### Examples
**Example #1 Example usage of inotify**
```
<?php
// Open an inotify instance
$fd = inotify_init();
// Watch __FILE__ for metadata changes (e.g. mtime)
$watch_descriptor = inotify_add_watch($fd, __FILE__, IN_ATTRIB);
// generate an event
touch(__FILE__);
// Read events
$events = inotify_read($fd);
print_r($events);
// The following methods allows to use inotify functions without blocking on inotify_read():
// - Using stream_select() on $fd:
$read = array($fd);
$write = null;
$except = null;
stream_select($read,$write,$except,0);
// - Using stream_set_blocking() on $fd
stream_set_blocking($fd, 0);
inotify_read($fd); // Does no block, and return false if no events are pending
// - Using inotify_queue_len() to check if event queue is not empty
$queue_len = inotify_queue_len($fd); // If > 0, inotify_read() will not block
// Stop watching __FILE__ for metadata changes
inotify_rm_watch($fd, $watch_descriptor);
// Close the inotify instance
// This may have closed all watches if this was not already done
fclose($fd);
?>
```
The above example will output something similar to:
```
array(
array(
'wd' => 1, // Equals $watch_descriptor
'mask' => 4, // IN_ATTRIB bit is set
'cookie' => 0, // unique id to connect related events (e.g.
// IN_MOVE_FROM and IN_MOVE_TO events)
'name' => '', // the name of a file (e.g. if we monitored changes
// in a directory)
),
);
```
### See Also
* [inotify\_add\_watch()](function.inotify-add-watch) - Add a watch to an initialized inotify instance
* [inotify\_rm\_watch()](function.inotify-rm-watch) - Remove an existing watch from an inotify instance
* [inotify\_queue\_len()](function.inotify-queue-len) - Return a number upper than zero if there are pending events
* [inotify\_read()](function.inotify-read) - Read events from an inotify instance
* [fclose()](function.fclose) - Closes an open file pointer
php NumberFormatter::getPattern NumberFormatter::getPattern
===========================
numfmt\_get\_pattern
====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
NumberFormatter::getPattern -- numfmt\_get\_pattern — Get formatter pattern
### Description
Object-oriented style
```
public NumberFormatter::getPattern(): string|false
```
Procedural style
```
numfmt_get_pattern(NumberFormatter $formatter): string|false
```
Extract pattern used by the formatter.
### Parameters
`formatter`
[NumberFormatter](class.numberformatter) object.
### Return Values
Pattern string that is used by the formatter, or **`false`** if an error happens.
### Examples
**Example #1 **numfmt\_get\_pattern()** example**
```
<?php
$fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL );
echo "Pattern: ".numfmt_get_pattern($fmt)."\n";
echo numfmt_format($fmt, 1234567.891234567890000)."\n";
numfmt_set_pattern($fmt, "#0.# kg");
echo "Pattern: ".numfmt_get_pattern($fmt)."\n";
echo numfmt_format($fmt, 1234567.891234567890000)."\n";
?>
```
**Example #2 OO example**
```
<?php
$fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL );
echo "Pattern: ".$fmt->getPattern()."\n";
echo $fmt->format(1234567.891234567890000)."\n";
$fmt->setPattern("#0.# kg");
echo "Pattern: ".$fmt->getPattern()."\n";
echo $fmt->format(1234567.891234567890000)."\n";
?>
```
The above example will output:
```
Pattern: #,##0.###
1.234.567,891
Pattern: #0.# kg
1234567,9 kg
```
### See Also
* [numfmt\_get\_error\_code()](numberformatter.geterrorcode) - Get formatter's last error code
* [numfmt\_set\_pattern()](numberformatter.setpattern) - Set formatter pattern
* [numfmt\_create()](numberformatter.create) - Create a number formatter
php Parle\RParser::tokenId Parle\RParser::tokenId
======================
(PECL parle >= 0.7.0)
Parle\RParser::tokenId — Get token id
### Description
```
public Parle\RParser::tokenId(string $tok): int
```
Retrieve the id of the named token.
### Parameters
`tok`
Name of the token as used in [Parle\RParser::token()](parle-rparser.token).
### Return Values
Returns int representing the token id.
php sqlsrv_num_rows sqlsrv\_num\_rows
=================
(No version information available, might only be in Git)
sqlsrv\_num\_rows — Retrieves the number of rows in a result set
### Description
```
sqlsrv_num_rows(resource $stmt): mixed
```
Retrieves the number of rows in a result set. This function requires that the statement resource be created with a static or keyset cursor. For more information, see [sqlsrv\_query()](function.sqlsrv-query), [sqlsrv\_prepare()](function.sqlsrv-prepare), or [» Specifying a Cursor Type and Selecting Rows](http://msdn.microsoft.com/en-us/library/ee376927.aspx) in the Microsoft SQLSRV documentation.
### Parameters
`stmt`
The statement for which the row count is returned. The statement resource must be created with a static or keyset cursor. For more information, see [sqlsrv\_query()](function.sqlsrv-query), [sqlsrv\_prepare()](function.sqlsrv-prepare), or [» Specifying a Cursor Type and Selecting Rows](http://msdn.microsoft.com/en-us/library/ee376927.aspx) in the Microsoft SQLSRV documentation.
### Return Values
Returns the number of rows retrieved on success and **`false`** if an error occurred. If a forward cursor (the default) or dynamic cursor is used, **`false`** is returned.
### Examples
**Example #1 **sqlsrv\_num\_rows()** example**
```
<?php
$server = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password" );
$conn = sqlsrv_connect( $server, $connectionInfo );
$sql = "SELECT * FROM Table_1";
$params = array();
$options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET );
$stmt = sqlsrv_query( $conn, $sql , $params, $options );
$row_count = sqlsrv_num_rows( $stmt );
if ($row_count === false)
echo "Error in retrieveing row count.";
else
echo $row_count;
?>
```
### See Also
* [sqlsrv\_has\_rows()](function.sqlsrv-has-rows) - Indicates whether the specified statement has rows
* [sqlsrv\_rows\_affected()](function.sqlsrv-rows-affected) - Returns the number of rows modified by the last INSERT, UPDATE, or DELETE query executed
php stats_stat_factorial stats\_stat\_factorial
======================
(PECL stats >= 1.0.0)
stats\_stat\_factorial — Returns the factorial of an integer
### Description
```
stats_stat_factorial(int $n): float
```
Returns the factorial of an integer, `n`.
### Parameters
`n`
An integer
### Return Values
The factorial of `n`.
php xdiff_file_patch xdiff\_file\_patch
==================
(PECL xdiff >= 0.2.0)
xdiff\_file\_patch — Patch a file with an unified diff
### Description
```
xdiff_file_patch(
string $file,
string $patch,
string $dest,
int $flags = DIFF_PATCH_NORMAL
): mixed
```
Patches a `file` with a `patch` and stores the result in a file. `patch` has to be an unified diff created by [xdiff\_file\_diff()](function.xdiff-file-diff)/[xdiff\_string\_diff()](function.xdiff-string-diff) function. An optional `flags` parameter specifies mode of operation.
### Parameters
`file`
The original file.
`patch`
The unified patch file. It has to be created using [xdiff\_string\_diff()](function.xdiff-string-diff), [xdiff\_file\_diff()](function.xdiff-file-diff) functions or compatible tools.
`dest`
Path of the resulting file.
`flags`
Can be either **`XDIFF_PATCH_NORMAL`** (default mode, normal patch) or **`XDIFF_PATCH_REVERSE`** (reversed patch).
Starting from version 1.5.0, you can also use binary OR to enable **`XDIFF_PATCH_IGNORESPACE`** flag.
### Return Values
Returns **`false`** if an internal error happened, string with rejected chunks if patch couldn't be applied or **`true`** if patch has been successfully applied.
### Examples
**Example #1 **xdiff\_file\_patch()** example**
The following code applies unified diff to a file.
```
<?php
$old_version = 'my_script-1.0.php';
$patch = 'my_script.patch';
$errors = xdiff_file_patch($old_version, $patch, 'my_script-1.1.php');
if (is_string($errors)) {
echo "Rejects:\n";
echo $errors;
}
?>
```
**Example #2 Patch reversing example**
The following code reverses a patch.
```
<?php
$new_version = 'my_script-1.1.php';
$patch = 'my_script.patch';
$errors = xdiff_file_patch($new_version, $patch, 'my_script-1.0.php', XDIFF_PATCH_REVERSE);
if (is_string($errors)) {
echo "Rejects:\n";
echo $errors;
}
?>
```
### See Also
* [xdiff\_file\_diff()](function.xdiff-file-diff) - Make unified diff of two files
php openssl_pkey_export_to_file openssl\_pkey\_export\_to\_file
===============================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
openssl\_pkey\_export\_to\_file — Gets an exportable representation of a key into a file
### Description
```
openssl_pkey_export_to_file(
OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key,
string $output_filename,
?string $passphrase = null,
?array $options = null
): bool
```
**openssl\_pkey\_export\_to\_file()** saves an ascii-armoured (PEM encoded) rendition of `key` into the file named by `output_filename`.
> **Note**: You need to have a valid openssl.cnf installed for this function to operate correctly. See the notes under [the installation section](https://www.php.net/manual/en/openssl.installation.php) for more information.
>
>
### Parameters
`key`
`output_filename`
Path to the output file.
`passphrase`
The key can be optionally protected by a `passphrase`.
`options`
`options` can be used to fine-tune the export process by specifying and/or overriding options for the openssl configuration file. See [openssl\_csr\_new()](function.openssl-csr-new) for more information about `options`.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `key` accepts an [OpenSSLAsymmetricKey](class.opensslasymmetrickey) or [OpenSSLCertificate](class.opensslcertificate) instance now; previously, a [resource](language.types.resource) of type `OpenSSL key` or `OpenSSL X.509` was accepted. |
php ReflectionParameter::getDefaultValue ReflectionParameter::getDefaultValue
====================================
(PHP 5 >= 5.0.3, PHP 7, PHP 8)
ReflectionParameter::getDefaultValue — Gets default parameter value
### Description
```
public ReflectionParameter::getDefaultValue(): mixed
```
Gets the default value of the parameter for any user-defined or internal function or method. If the parameter is not optional a [ReflectionException](class.reflectionexception) will be thrown.
### Parameters
This function has no parameters.
### Return Values
The parameters default value.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This method now allows getting the default value of parameters of built-in functions and built-in class methods. Previously, a [ReflectionException](class.reflectionexception) was thrown. |
### Examples
**Example #1 Getting default values of function parameters**
```
<?php
function foo($test, $bar = 'baz')
{
echo $test . $bar;
}
$function = new ReflectionFunction('foo');
foreach ($function->getParameters() as $param) {
echo 'Name: ' . $param->getName() . PHP_EOL;
if ($param->isOptional()) {
echo 'Default value: ' . $param->getDefaultValue() . PHP_EOL;
}
echo PHP_EOL;
}
?>
```
The above example will output:
```
Name: test
Name: bar
Default value: baz
```
### See Also
* [ReflectionParameter::isOptional()](reflectionparameter.isoptional) - Checks if optional
* [ReflectionParameter::isDefaultValueAvailable()](reflectionparameter.isdefaultvalueavailable) - Checks if a default value is available
* [ReflectionParameter::getDefaultValueConstantName()](reflectionparameter.getdefaultvalueconstantname) - Returns the default value's constant name if default value is constant or null
* [ReflectionParameter::isPassedByReference()](reflectionparameter.ispassedbyreference) - Checks if passed by reference
php readline_add_history readline\_add\_history
======================
(PHP 4, PHP 5, PHP 7, PHP 8)
readline\_add\_history — Adds a line to the history
### Description
```
readline_add_history(string $prompt): bool
```
This function adds a line to the command line history.
### Parameters
`prompt`
The line to be added in the history.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php mysqli::get_charset mysqli::get\_charset
====================
mysqli\_get\_charset
====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
mysqli::get\_charset -- mysqli\_get\_charset — Returns a character set object
### Description
Object-oriented style
```
public mysqli::get_charset(): ?object
```
Procedural style
```
mysqli_get_charset(mysqli $mysql): ?object
```
Returns a character set object providing several properties of the current active character set.
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
### Return Values
The function returns a character set object with the following properties:
`charset`
Character set name
`collation`
Collation name
`dir`
Directory the charset description was fetched from (?) or "" for built-in character sets
`min_length`
Minimum character length in bytes
`max_length`
Maximum character length in bytes
`number`
Internal character set number
`state`
Character set status (?)
### Examples
**Example #1 **mysqli::get\_charset()** example**
Object-oriented style
```
<?php
$db = mysqli_init();
$db->real_connect("localhost","root","","test");
var_dump($db->get_charset());
?>
```
Procedural style
```
<?php
$db = mysqli_init();
mysqli_real_connect($db, "localhost","root","","test");
var_dump(mysqli_get_charset($db));
?>
```
The above examples will output:
```
object(stdClass)#2 (7) {
["charset"]=>
string(6) "latin1"
["collation"]=>
string(17) "latin1_swedish_ci"
["dir"]=>
string(0) ""
["min_length"]=>
int(1)
["max_length"]=>
int(1)
["number"]=>
int(8)
["state"]=>
int(801)
}
```
### See Also
* [mysqli\_character\_set\_name()](mysqli.character-set-name) - Returns the current character set of the database connection
* [mysqli\_set\_charset()](mysqli.set-charset) - Sets the client character set
php SplObjectStorage::attach SplObjectStorage::attach
========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplObjectStorage::attach — Adds an object in the storage
### Description
```
public SplObjectStorage::attach(object $object, mixed $info = null): void
```
Adds an object inside the storage, and optionally associate it to some data.
### Parameters
`object`
The object to add.
`info`
The data to associate with the object.
### Return Values
No value is returned.
### Examples
**Example #1 **SplObjectStorage::attach()** example**
```
<?php
$o1 = new StdClass;
$o2 = new StdClass;
$s = new SplObjectStorage();
$s->attach($o1); // similar to $s[$o1] = NULL;
$s->attach($o2, "hello"); // similar to $s[$o2] = "hello";
var_dump($s[$o1]);
var_dump($s[$o2]);
?>
```
The above example will output something similar to:
```
NULL
string(5) "hello"
```
### See Also
* [SplObjectStorage::detach()](splobjectstorage.detach) - Removes an object from the storage
* [SplObjectStorage::offsetSet()](splobjectstorage.offsetset) - Associates data to an object in the storage
| programming_docs |
php EventHttpRequest::getCommand EventHttpRequest::getCommand
============================
(PECL event >= 1.4.0-beta)
EventHttpRequest::getCommand — Returns the request command(method)
### Description
```
public EventHttpRequest::getCommand(): void
```
Returns the request command, one of [`EventHttpRequest::CMD_*`](class.eventhttprequest#eventhttprequest.constants) constants.
### Parameters
This function has no parameters.
### Return Values
Returns the request command, one of [`EventHttpRequest::CMD_*`](class.eventhttprequest#eventhttprequest.constants) constants.
php Imagick::subImageMatch Imagick::subImageMatch
======================
(PECL imagick 3 >= 3.3.0)
Imagick::subImageMatch — Description
### Description
```
public Imagick::subImageMatch(Imagick $Imagick, array &$offset = ?, float &$similarity = ?): Imagick
```
Searches for a subimage in the current image and returns a similarity image such that an exact match location is completely white and if none of the pixels match, black, otherwise some gray level in-between. You can also pass in the optional parameters bestMatch and similarity. After calling the function similarity will be set to the 'score' of the similarity between the subimage and the matching position in the larger image, bestMatch will contain an associative array with elements x, y, width, height that describe the matching region.
### Parameters
`Imagick`
`offset`
`similarity`
A new image that displays the amount of similarity at each pixel.
### Return Values
### Examples
**Example #1 **Imagick::subImageMatch()****
```
<?php
function subImageMatch($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imagick2 = clone $imagick;
$imagick2->cropimage(40, 40, 250, 110);
$imagick2->vignetteimage(0, 1, 3, 3);
$similarity = null;
$bestMatch = null;
$comparison = $imagick->subImageMatch($imagick2, $bestMatch, $similarity);
$comparison->setImageFormat('png');
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
php sodium_crypto_box_open sodium\_crypto\_box\_open
=========================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_box\_open — Authenticated public-key decryption
### Description
```
sodium_crypto_box_open(string $ciphertext, string $nonce, string $key_pair): string|false
```
Decrypt a message using asymmetric (public key) cryptography.
### Parameters
`ciphertext`
The encrypted message to attempt to decrypt.
`nonce`
A number that must be only used once, per message. 24 bytes long. This is a large enough bound to generate randomly (i.e. [random\_bytes()](https://www.php.net/manual/en/function.random-bytes.php)).
`key_pair`
See [sodium\_crypto\_box\_keypair\_from\_secretkey\_and\_publickey()](function.sodium-crypto-box-keypair-from-secretkey-and-publickey). This should include the sender's public key and the recipient's secret key.
### Return Values
Returns the plaintext message on success, or **`false`** on failure.
php SolrQuery::setHighlightFragsize SolrQuery::setHighlightFragsize
===============================
(PECL solr >= 0.9.2)
SolrQuery::setHighlightFragsize — The size of fragments to consider for highlighting
### Description
```
public SolrQuery::setHighlightFragsize(int $size, string $field_override = ?): SolrQuery
```
Sets the size, in characters, of fragments to consider for highlighting. "0" indicates that the whole field value should be used (no fragmenting).
### Parameters
`size`
The size, in characters, of fragments to consider for highlighting
`field_override`
The name of the field.
### Return Values
Returns the current SolrQuery object, if the return value is used.
php The tidyNode class
The tidyNode class
==================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
An HTML node in an HTML file, as detected by tidy.
Class synopsis
--------------
final class **tidyNode** { /\* Properties \*/ public readonly string [$value](class.tidynode#tidynode.props.value);
public readonly string [$name](class.tidynode#tidynode.props.name);
public readonly int [$type](class.tidynode#tidynode.props.type);
public readonly int [$line](class.tidynode#tidynode.props.line);
public readonly int [$column](class.tidynode#tidynode.props.column);
public readonly bool [$proprietary](class.tidynode#tidynode.props.proprietary);
public readonly ?int [$id](class.tidynode#tidynode.props.id);
public readonly ?array [$attribute](class.tidynode#tidynode.props.attribute);
public readonly ?array [$child](class.tidynode#tidynode.props.child); /\* Methods \*/ private [\_\_construct](tidynode.construct)()
```
public getParent(): ?tidyNode
```
```
public hasChildren(): bool
```
```
public hasSiblings(): bool
```
```
public isAsp(): bool
```
```
public isComment(): bool
```
```
public isHtml(): bool
```
```
public isJste(): bool
```
```
public isPhp(): bool
```
```
public isText(): bool
```
} Properties
----------
value The HTML representation of the node, including the surrounding tags.
name The name of the HTML node
type The type of the node (one of the [nodetype constants](https://www.php.net/manual/en/tidy.constants.php#tidy.constants.nodetype), e.g. **`TIDY_NODETYPE_PHP`**)
line The line number at which the tags is located in the file
column The column number at which the tags is located in the file
proprietary Indicates if the node is a proprietary tag
id The ID of the node (one of the [tag constants](https://www.php.net/manual/en/tidy.constants.php#tidy.constants.tag), e.g. **`TIDY_TAG_FRAME`**)
attribute An array of string, representing the attributes names (as keys) of the current node.
child An array of **tidyNode**, representing the children of the current node.
Table of Contents
-----------------
* [tidyNode::\_\_construct](tidynode.construct) — Private constructor to disallow direct instantiation
* [tidyNode::getParent](tidynode.getparent) — Returns the parent node of the current node
* [tidyNode::hasChildren](tidynode.haschildren) — Checks if a node has children
* [tidyNode::hasSiblings](tidynode.hassiblings) — Checks if a node has siblings
* [tidyNode::isAsp](tidynode.isasp) — Checks if this node is ASP
* [tidyNode::isComment](tidynode.iscomment) — Checks if a node represents a comment
* [tidyNode::isHtml](tidynode.ishtml) — Checks if a node is an element node
* [tidyNode::isJste](tidynode.isjste) — Checks if this node is JSTE
* [tidyNode::isPhp](tidynode.isphp) — Checks if a node is PHP
* [tidyNode::isText](tidynode.istext) — Checks if a node represents text (no markup)
php is_writeable is\_writeable
=============
(PHP 4, PHP 5, PHP 7, PHP 8)
is\_writeable — Alias of [is\_writable()](function.is-writable)
### Description
This function is an alias of: [is\_writable()](function.is-writable).
php SolrQuery::getFacetDateStart SolrQuery::getFacetDateStart
============================
(PECL solr >= 0.9.2)
SolrQuery::getFacetDateStart — Returns the lower bound for the first date range for all date faceting on this field
### Description
```
public SolrQuery::getFacetDateStart(string $field_override = ?): string
```
Returns the lower bound for the first date range for all date faceting on this field. Accepts an optional field override
### Parameters
`field_override`
The name of the field
### Return Values
Returns a string on success and **`null`** if not set
php Yaf_Config_Ini::offsetGet Yaf\_Config\_Ini::offsetGet
===========================
(Yaf >=1.0.0)
Yaf\_Config\_Ini::offsetGet — The offsetGet purpose
### Description
```
public Yaf_Config_Ini::offsetGet(string $name): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`name`
### Return Values
php SimpleXMLElement::getNamespaces SimpleXMLElement::getNamespaces
===============================
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
SimpleXMLElement::getNamespaces — Returns namespaces used in document
### Description
```
public SimpleXMLElement::getNamespaces(bool $recursive = false): array
```
Returns namespaces used in document
### Parameters
`recursive`
If specified, returns all namespaces used in parent and child nodes. Otherwise, returns only namespaces used in root node.
### Return Values
The `getNamespaces` method returns an array of namespace names with their associated URIs.
### Examples
**Example #1 Get document namespaces in use**
```
<?php
$xml = <<<XML
<?xml version="1.0" standalone="yes"?>
<people xmlns:p="http://example.org/ns" xmlns:t="http://example.org/test">
<p:person id="1">John Doe</p:person>
<p:person id="2">Susie Q. Public</p:person>
</people>
XML;
$sxe = new SimpleXMLElement($xml);
$namespaces = $sxe->getNamespaces(true);
var_dump($namespaces);
?>
```
The above example will output:
```
array(1) {
["p"]=>
string(21) "http://example.org/ns"
}
```
### See Also
* [SimpleXMLElement::getDocNamespaces()](simplexmlelement.getdocnamespaces) - Returns namespaces declared in document
* [SimpleXMLElement::registerXPathNamespace()](simplexmlelement.registerxpathnamespace) - Creates a prefix/ns context for the next XPath query
php IntlCalendar::setTimeZone IntlCalendar::setTimeZone
=========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::setTimeZone — Set the timezone used by this calendar
### Description
Object-oriented style
```
public IntlCalendar::setTimeZone(IntlTimeZone|DateTimeZone|string|null $timezone): bool
```
Procedural style
```
intlcal_set_time_zone(IntlCalendar $calendar, IntlTimeZone|DateTimeZone|string|null $timezone): bool
```
Defines a new timezone for this calendar. The time represented by the object is preserved to the detriment of the field values.
### Parameters
`calendar`
An [IntlCalendar](class.intlcalendar) instance.
`timezone`
The new timezone to be used by this calendar. It can be specified in the following ways:
* **`null`**, in which case the default timezone will be used, as specified in the ini setting [date.timezone](https://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone) or through the function [date\_default\_timezone\_set()](function.date-default-timezone-set) and as returned by [date\_default\_timezone\_get()](function.date-default-timezone-get).
* An [IntlTimeZone](class.intltimezone), which will be used directly.
* A [DateTimeZone](class.datetimezone). Its identifier will be extracted and an ICU timezone object will be created; the timezone will be backed by ICUʼs database, not PHPʼs.
* A string, which should be a valid ICU timezone identifier. See [IntlTimeZone::createTimeZoneIDEnumeration()](intltimezone.createtimezoneidenumeration). Raw offsets such as `"GMT+08:30"` are also accepted.
### Return Values
Returns **`true`** on success and **`false`** on failure.
### Examples
**Example #1 **IntlCalendar::setTimeZone()****
```
<?php
ini_set('date.timezone', 'Europe/Lisbon');
ini_set('intl.default_locale', 'es_ES');
$cal = new IntlGregorianCalendar(2013, 5 /* May */, 1, 12, 0, 0);
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
echo "(instant {$cal->getTime()})\n";
$cal->setTimeZone(IntlTimeZone::getGMT());
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
echo "(instant {$cal->getTime()})\n";
$cal->setTimeZone('GMT+03:33');
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
echo "(instant {$cal->getTime()})\n";
```
The above example will output:
```
sábado, 1 de junio de 2013 12:00:00 Hora de verano de Europa occidental
(instant 1370084400000)
sábado, 1 de junio de 2013 11:00:00 GMT
(instant 1370084400000)
sábado, 1 de junio de 2013 14:33:00 GMT+03:33
(instant 1370084400000)
```
php AppendIterator::key AppendIterator::key
===================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
AppendIterator::key — Gets the current key
### Description
```
public AppendIterator::key(): scalar
```
Get the current key.
### Parameters
This function has no parameters.
### Return Values
The current key if it is valid or **`null`** otherwise.
### Examples
**Example #1 **AppendIterator::key()** basic example**
```
<?php
$array_a = new ArrayIterator(array('a' => 'aardwolf', 'b' => 'bear', 'c' => 'capybara'));
$array_b = new ArrayIterator(array('apple', 'orange', 'lemon'));
$iterator = new AppendIterator;
$iterator->append($array_a);
$iterator->append($array_b);
// Manual iteration
$iterator->rewind();
while ($iterator->valid()) {
echo $iterator->key() . ' ' . $iterator->current() . PHP_EOL;
$iterator->next();
}
echo PHP_EOL;
// With foreach
foreach ($iterator as $key => $current) {
echo $key . ' ' . $current . PHP_EOL;
}
?>
```
The above example will output:
```
a aardwolf
b bear
c capybara
0 apple
1 orange
2 lemon
a aardwolf
b bear
c capybara
0 apple
1 orange
2 lemon
```
### See Also
* [Iterator::key()](iterator.key) - Return the key of the current element
* [AppendIterator::current()](appenditerator.current) - Gets the current value
* [AppendIterator::valid()](appenditerator.valid) - Checks validity of the current element
* [AppendIterator::next()](appenditerator.next) - Moves to the next element
* [AppendIterator::rewind()](appenditerator.rewind) - Rewinds the Iterator
php IntlChar::istitle IntlChar::istitle
=================
(PHP 7, PHP 8)
IntlChar::istitle — Check if code point is a titlecase letter
### Description
```
public static IntlChar::istitle(int|string $codepoint): ?bool
```
Determines whether the specified code point is a titlecase letter.
**`true`** for general category "Lt" (titlecase letter).
### Parameters
`codepoint`
The int codepoint value (e.g. `0x2603` for *U+2603 SNOWMAN*), or the character encoded as a UTF-8 string (e.g. `"\u{2603}"`)
### Return Values
Returns **`true`** if `codepoint` is a titlecase letter, **`false`** if not. Returns **`null`** on failure.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::istitle("A"));
var_dump(IntlChar::istitle("a"));
var_dump(IntlChar::istitle("Φ"));
var_dump(IntlChar::istitle("φ"));
var_dump(IntlChar::istitle("1"));
?>
```
The above example will output:
```
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
```
### See Also
* [IntlChar::isupper()](intlchar.isupper) - Check if code point has the general category "Lu" (uppercase letter)
* [IntlChar::islower()](intlchar.islower) - Check if code point is a lowercase letter
* [IntlChar::totitle()](intlchar.totitle) - Make Unicode character titlecase
php imap_setacl imap\_setacl
============
(PHP 4 >= 4.0.7, PHP 5, PHP 7, PHP 8)
imap\_setacl — Sets the ACL for a given mailbox
### Description
```
imap_setacl(
IMAP\Connection $imap,
string $mailbox,
string $user_id,
string $rights
): bool
```
Sets the ACL for a giving mailbox.
### Parameters
`imap`
An [IMAP\Connection](class.imap-connection) instance.
`mailbox`
The mailbox name, see [imap\_open()](function.imap-open) for more information
**Warning** Passing untrusted data to this parameter is *insecure*, unless [imap.enable\_insecure\_rsh](https://www.php.net/manual/en/imap.configuration.php#ini.imap.enable-insecure-rsh) is disabled.
`user_id`
The user to give the rights to.
`rights`
The rights to give to the user. Passing an empty string will delete acl.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `imap` parameter expects an [IMAP\Connection](class.imap-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Notes
This function is currently only available to users of the c-client2000 or greater library.
### See Also
* [imap\_getacl()](function.imap-getacl) - Gets the ACL for a given mailbox
php The EventSslContext class
The EventSslContext class
=========================
Introduction
------------
(PECL event >= 1.2.6-beta)
Represents `SSL_CTX` structure. Provides methods and properties to configure the SSL context.
Class synopsis
--------------
final class **EventSslContext** { /\* Constants \*/ const int [SSLv2\_CLIENT\_METHOD](class.eventsslcontext#eventsslcontext.constants.sslv2-client-method) = 1;
const int [SSLv3\_CLIENT\_METHOD](class.eventsslcontext#eventsslcontext.constants.sslv3-client-method) = 2;
const int [SSLv23\_CLIENT\_METHOD](class.eventsslcontext#eventsslcontext.constants.sslv23-client-method) = 3;
const int [TLS\_CLIENT\_METHOD](class.eventsslcontext#eventsslcontext.constants.tls-client-method) = 4;
const int [SSLv2\_SERVER\_METHOD](class.eventsslcontext#eventsslcontext.constants.sslv2-server-method) = 5;
const int [SSLv3\_SERVER\_METHOD](class.eventsslcontext#eventsslcontext.constants.sslv3-server-method) = 6;
const int [SSLv23\_SERVER\_METHOD](class.eventsslcontext#eventsslcontext.constants.sslv23-server-method) = 7;
const int [TLS\_SERVER\_METHOD](class.eventsslcontext#eventsslcontext.constants.tls-server-method) = 8;
const int [OPT\_LOCAL\_CERT](class.eventsslcontext#eventsslcontext.constants.opt-local-cert) = 1;
const int [OPT\_LOCAL\_PK](class.eventsslcontext#eventsslcontext.constants.opt-local-pk) = 2;
const int [OPT\_PASSPHRASE](class.eventsslcontext#eventsslcontext.constants.opt-passphrase) = 3;
const int [OPT\_CA\_FILE](class.eventsslcontext#eventsslcontext.constants.opt-ca-file) = 4;
const int [OPT\_CA\_PATH](class.eventsslcontext#eventsslcontext.constants.opt-ca-path) = 5;
const int [OPT\_ALLOW\_SELF\_SIGNED](class.eventsslcontext#eventsslcontext.constants.opt-allow-self-signed) = 6;
const int [OPT\_VERIFY\_PEER](class.eventsslcontext#eventsslcontext.constants.opt-verify-peer) = 7;
const int [OPT\_VERIFY\_DEPTH](class.eventsslcontext#eventsslcontext.constants.opt-verify-depth) = 8;
const int [OPT\_CIPHERS](class.eventsslcontext#eventsslcontext.constants.opt-ciphers) = 9; /\* Properties \*/
public string [$local\_cert](class.eventsslcontext#eventsslcontext.props.local-cert);
public string [$local\_pk](class.eventsslcontext#eventsslcontext.props.local-pk); /\* Methods \*/
```
public __construct( string $method , string $options )
```
} Properties
----------
local\_cert Path to local certificate file on filesystem. It must be a PEM-encoded file which contains certificate. It can optionally contain the certificate chain of issuers.
local\_pk Path to local private key file
Predefined Constants
--------------------
**`EventSslContext::SSLv2_CLIENT_METHOD`** SSLv2 client method. See `SSL_CTX_new(3)` man page.
**`EventSslContext::SSLv3_CLIENT_METHOD`** SSLv3 client method. See `SSL_CTX_new(3)` man page.
**`EventSslContext::SSLv23_CLIENT_METHOD`** SSLv23 client method. See `SSL_CTX_new(3)` man page.
**`EventSslContext::TLS_CLIENT_METHOD`** TLS client method. See `SSL_CTX_new(3)` man page.
**`EventSslContext::SSLv2_SERVER_METHOD`** SSLv2 server method. See `SSL_CTX_new(3)` man page.
**`EventSslContext::SSLv3_SERVER_METHOD`** SSLv3 server method. See `SSL_CTX_new(3)` man page.
**`EventSslContext::SSLv23_SERVER_METHOD`** SSLv23 server method. See `SSL_CTX_new(3)` man page.
**`EventSslContext::TLS_SERVER_METHOD`** TLS server method. See `SSL_CTX_new(3)` man page.
**`EventSslContext::OPT_LOCAL_CERT`** Key for an item of the options' array used in [EventSslContext::\_\_construct()](eventsslcontext.construct) . The option points to path of local certificate.
**`EventSslContext::OPT_LOCAL_PK`** Key for an item of the options' array used in [EventSslContext::\_\_construct()](eventsslcontext.construct) . The option points to path of the private key.
**`EventSslContext::OPT_PASSPHRASE`** Key for an item of the options' array used in [EventSslContext::\_\_construct()](eventsslcontext.construct) . Represents passphrase of the certificate.
**`EventSslContext::OPT_CA_FILE`** Key for an item of the options' array used in [EventSslContext::\_\_construct()](eventsslcontext.construct) . Represents path of the certificate authority file.
**`EventSslContext::OPT_CA_PATH`** Key for an item of the options' array used in [EventSslContext::\_\_construct()](eventsslcontext.construct) . Represents path where the certificate authority file should be searched for.
**`EventSslContext::OPT_ALLOW_SELF_SIGNED`** Key for an item of the options' array used in [EventSslContext::\_\_construct()](eventsslcontext.construct) . Represents option that allows self-signed certificates.
**`EventSslContext::OPT_VERIFY_PEER`** Key for an item of the options' array used in [EventSslContext::\_\_construct()](eventsslcontext.construct) . Represents option that tells Event to verify peer.
**`EventSslContext::OPT_VERIFY_DEPTH`** Key for an item of the options' array used in [EventSslContext::\_\_construct()](eventsslcontext.construct) . Represents maximum depth for the certificate chain verification that shall be allowed for the SSL context.
**`EventSslContext::OPT_CIPHERS`** Key for an item of the options' array used in [EventSslContext::\_\_construct()](eventsslcontext.construct) . Represents the cipher list for the SSL context.
Table of Contents
-----------------
* [EventSslContext::\_\_construct](eventsslcontext.construct) — Constructs an OpenSSL context for use with Event classes
| programming_docs |
php imagetypes imagetypes
==========
(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)
imagetypes — Return the image types supported by this PHP build
### Description
```
imagetypes(): int
```
Returns the image types supported by the current PHP installation.
### Parameters
This function has no parameters.
### Return Values
Returns a bit-field corresponding to the image formats supported by the version of GD linked into PHP. The following bits are returned, **`IMG_AVIF`** | **`IMG_BMP`** | **`IMG_GIF`** | **`IMG_JPG`** | **`IMG_PNG`** | **`IMG_WBMP`** | **`IMG_XPM`** | **`IMG_WEBP`**.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | **`IMG_AVIF`** added. |
| 7.2.0 | **`IMG_BMP`** added. |
| 7.0.10 | **`IMG_WEBP`** added. |
### Examples
**Example #1 Checking for PNG support**
```
<?php
if (imagetypes() & IMG_PNG) {
echo "PNG Support is enabled";
}
?>
```
### See Also
* [gd\_info()](function.gd-info) - Retrieve information about the currently installed GD library
php openal_context_destroy openal\_context\_destroy
========================
(PECL openal >= 0.1.0)
openal\_context\_destroy — Destroys a context
### Description
```
openal_context_destroy(resource $context): bool
```
### Parameters
`context`
An [Open AL(Context)](https://www.php.net/manual/en/openal.resources.php) resource (previously created by [openal\_context\_create()](function.openal-context-create)).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [openal\_context\_create()](function.openal-context-create) - Create an audio processing context
php socket_sendmsg socket\_sendmsg
===============
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
socket\_sendmsg — Send a message
### Description
```
socket_sendmsg(Socket $socket, array $message, int $flags = 0): int|false
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`socket`
`message`
`flags`
### Return Values
Returns the number of bytes sent, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `socket` is a [Socket](class.socket) instance now; previously, it was a resource. |
### See Also
* [socket\_recvmsg()](function.socket-recvmsg) - Read a message
* [socket\_cmsg\_space()](function.socket-cmsg-space) - Calculate message buffer size
php imagecreatefromxbm imagecreatefromxbm
==================
(PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8)
imagecreatefromxbm — Create a new image from file or URL
### Description
```
imagecreatefromxbm(string $filename): GdImage|false
```
**imagecreatefromxbm()** returns an image identifier representing the image obtained from the given filename.
**Tip**A URL can be used as a filename with this function if the [fopen wrappers](https://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen) have been enabled. See [fopen()](function.fopen) for more details on how to specify the filename. See the [Supported Protocols and Wrappers](https://www.php.net/manual/en/wrappers.php) for links to information about what abilities the various wrappers have, notes on their usage, and information on any predefined variables they may provide.
### Parameters
`filename`
Path to the XBM image.
### Return Values
Returns an image object on success, **`false`** on errors.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | On success, this function returns a [GDImage](class.gdimage) instance now; previously, a resource was returned. |
### Examples
**Example #1 Convert an XBM image to a png image using **imagecreatefromxbm()****
```
<?php
// Load the xbm file
$xbm = imagecreatefromxbm('./example.xbm');
// Convert it to a png file
imagepng($xbm, './example.png');
imagedestroy($xbm);
?>
```
php eio_cancel eio\_cancel
===========
(PECL eio >= 0.0.1dev)
eio\_cancel — Cancels a request
### Description
```
eio_cancel(resource $req): void
```
**eio\_cancel()** cancels a request specified by `req`
### Parameters
`req`
The request resource
`pri`
The request priority: **`EIO_PRI_DEFAULT`**, **`EIO_PRI_MIN`**, **`EIO_PRI_MAX`**, or **`null`**. If **`null`** passed, `pri` internally is set to **`EIO_PRI_DEFAULT`**.
`callback`
`callback` function is called when the request is done. It should match the following prototype:
```
void callback(mixed $data, int $result[, resource $req]);
```
`data`
is custom data passed to the request.
`result`
request-specific result value; basically, the value returned by corresponding system call.
`req`
is optional request resource which can be used with functions like [eio\_get\_last\_error()](function.eio-get-last-error)
`data`
Arbitrary variable passed to `callback`.
### Return Values
No value is returned.
### Examples
**Example #1 **eio\_cancel()** example**
```
<?php
/* Is called when eio_nop() finished */
function my_nop_cb($data, $result) {
echo "my_nop ", $data, "\n";
}
// This eio_nop() call will be cancelled
$req = eio_nop(EIO_PRI_DEFAULT, "my_nop_cb", "1");
var_dump($req);
eio_cancel($req);
// This time eio_nop() will be processed
eio_nop(EIO_PRI_DEFAULT, "my_nop_cb", "2");
// Process requests
eio_event_loop();
?>
```
The above example will output something similar to:
```
resource(4) of type (EIO Request Descriptor)
my_nop 2
```
### See Also
* [eio\_grp\_cancel()](function.eio-grp-cancel) - Cancels a request group
php ImagickDraw::getTextEncoding ImagickDraw::getTextEncoding
============================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::getTextEncoding — Returns the code set used for text annotations
### Description
```
public ImagickDraw::getTextEncoding(): string
```
**Warning**This function is currently not documented; only its argument list is available.
Returns a string which specifies the code set used for text annotations.
### Return Values
Returns a string specifying the code set or false if text encoding is not set.
php SimpleXMLElement::children SimpleXMLElement::children
==========================
(PHP 5, PHP 7, PHP 8)
SimpleXMLElement::children — Finds children of given node
### Description
```
public SimpleXMLElement::children(?string $namespaceOrPrefix = null, bool $isPrefix = false): ?SimpleXMLElement
```
This method finds the children of an element. The result follows normal iteration rules.
> **Note**: SimpleXML has made a rule of adding iterative properties to most methods. They cannot be viewed using [var\_dump()](function.var-dump) or anything else which can examine objects.
>
>
### Parameters
`namespaceOrPrefix`
An XML namespace.
`isPrefix`
If `isPrefix` is **`true`**, `namespaceOrPrefix` will be regarded as a prefix. If **`false`**, `namespaceOrPrefix` will be regarded as a namespace URL.
### Return Values
Returns a [SimpleXMLElement](class.simplexmlelement) element, whether the node has children or not, unless the node represents an attribute, in which case **`null`** is returned.
### Examples
**Example #1 Traversing a `children()` pseudo-array**
```
<?php
$xml = new SimpleXMLElement(
'<person>
<child role="son">
<child role="daughter"/>
</child>
<child role="daughter">
<child role="son">
<child role="son"/>
</child>
</child>
</person>');
foreach ($xml->children() as $second_gen) {
echo ' The person begot a ' . $second_gen['role'];
foreach ($second_gen->children() as $third_gen) {
echo ' who begot a ' . $third_gen['role'] . ';';
foreach ($third_gen->children() as $fourth_gen) {
echo ' and that ' . $third_gen['role'] .
' begot a ' . $fourth_gen['role'];
}
}
}
?>
```
The above example will output:
```
The person begot a son who begot a daughter; The person
begot a daughter who begot a son; and that son begot a son
```
**Example #2 Using namespaces**
```
<?php
$xml = '<example xmlns:foo="my.foo.urn">
<foo:a>Apple</foo:a>
<foo:b>Banana</foo:b>
<c>Cherry</c>
</example>';
$sxe = new SimpleXMLElement($xml);
$kids = $sxe->children('foo');
var_dump(count($kids));
$kids = $sxe->children('foo', TRUE);
var_dump(count($kids));
$kids = $sxe->children('my.foo.urn');
var_dump(count($kids));
$kids = $sxe->children('my.foo.urn', TRUE);
var_dump(count($kids));
$kids = $sxe->children();
var_dump(count($kids));
?>
```
```
int(0)
int(2)
int(2)
int(0)
int(1)
```
### See Also
* [SimpleXMLElement::count()](simplexmlelement.count) - Counts the children of an element
* [count()](function.count) - Counts all elements in an array or in a Countable object
php ReflectionFunctionAbstract::isUserDefined ReflectionFunctionAbstract::isUserDefined
=========================================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
ReflectionFunctionAbstract::isUserDefined — Checks if user defined
### Description
```
public ReflectionFunctionAbstract::isUserDefined(): bool
```
Checks whether the function is user-defined, as opposed to internal.
### Parameters
This function has no parameters.
### Return Values
**`true`** if it's user-defined, otherwise false;
### See Also
* [ReflectionFunctionAbstract::isInternal()](reflectionfunctionabstract.isinternal) - Checks if is internal
php The ReflectionProperty class
The ReflectionProperty class
============================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
The **ReflectionProperty** class reports information about class properties.
Class synopsis
--------------
class **ReflectionProperty** implements [Reflector](class.reflector) { /\* Constants \*/ public const int [IS\_STATIC](class.reflectionproperty#reflectionproperty.constants.is-static);
public const int [IS\_READONLY](class.reflectionproperty#reflectionproperty.constants.is-readonly);
public const int [IS\_PUBLIC](class.reflectionproperty#reflectionproperty.constants.is-public);
public const int [IS\_PROTECTED](class.reflectionproperty#reflectionproperty.constants.is-protected);
public const int [IS\_PRIVATE](class.reflectionproperty#reflectionproperty.constants.is-private); /\* Properties \*/
public string [$name](class.reflectionproperty#reflectionproperty.props.name);
public string [$class](class.reflectionproperty#reflectionproperty.props.class); /\* Methods \*/ public [\_\_construct](reflectionproperty.construct)(object|string `$class`, string `$property`)
```
private __clone(): void
```
```
public static export(mixed $class, string $name, bool $return = ?): string
```
```
public getAttributes(?string $name = null, int $flags = 0): array
```
```
public getDeclaringClass(): ReflectionClass
```
```
public getDefaultValue(): mixed
```
```
public getDocComment(): string|false
```
```
public getModifiers(): int
```
```
public getName(): string
```
```
public getType(): ?ReflectionType
```
```
public getValue(?object $object = null): mixed
```
```
public hasDefaultValue(): bool
```
```
public hasType(): bool
```
```
public isDefault(): bool
```
```
public isInitialized(?object $object = null): bool
```
```
public isPrivate(): bool
```
```
public isPromoted(): bool
```
```
public isProtected(): bool
```
```
public isPublic(): bool
```
```
public isReadOnly(): bool
```
```
public isStatic(): bool
```
```
public setAccessible(bool $accessible): void
```
```
public setValue(object $object, mixed $value): void
```
```
public __toString(): string
```
} Properties
----------
name Name of the property. Read-only, throws [ReflectionException](class.reflectionexception) in attempt to write.
class Name of the class where the property is defined. Read-only, throws [ReflectionException](class.reflectionexception) in attempt to write.
Predefined Constants
--------------------
ReflectionProperty Modifiers
----------------------------
**`ReflectionProperty::IS_STATIC`** Indicates [static](language.oop5.static) properties. Prior to PHP 7.4.0, the value was `1`.
**`ReflectionProperty::IS_READONLY`** Indicates [readonly](language.oop5.properties#language.oop5.properties.readonly-properties) properties. Available as of PHP 8.1.0.
**`ReflectionProperty::IS_PUBLIC`** Indicates [public](language.oop5.visibility) properties. Prior to PHP 7.4.0, the value was `256`.
**`ReflectionProperty::IS_PROTECTED`** Indicates [protected](language.oop5.visibility) properties. Prior to PHP 7.4.0, the value was `512`.
**`ReflectionProperty::IS_PRIVATE`** Indicates [private](language.oop5.visibility) properties. Prior to PHP 7.4.0, the value was `1024`.
>
> **Note**:
>
>
> The values of these constants may change between PHP versions. It is recommended to always use the constants and not rely on the values directly.
>
>
Table of Contents
-----------------
* [ReflectionProperty::\_\_clone](reflectionproperty.clone) — Clone
* [ReflectionProperty::\_\_construct](reflectionproperty.construct) — Construct a ReflectionProperty object
* [ReflectionProperty::export](reflectionproperty.export) — Export
* [ReflectionProperty::getAttributes](reflectionproperty.getattributes) — Gets Attributes
* [ReflectionProperty::getDeclaringClass](reflectionproperty.getdeclaringclass) — Gets declaring class
* [ReflectionProperty::getDefaultValue](reflectionproperty.getdefaultvalue) — Returns the default value declared for a property
* [ReflectionProperty::getDocComment](reflectionproperty.getdoccomment) — Gets the property doc comment
* [ReflectionProperty::getModifiers](reflectionproperty.getmodifiers) — Gets the property modifiers
* [ReflectionProperty::getName](reflectionproperty.getname) — Gets property name
* [ReflectionProperty::getType](reflectionproperty.gettype) — Gets a property's type
* [ReflectionProperty::getValue](reflectionproperty.getvalue) — Gets value
* [ReflectionProperty::hasDefaultValue](reflectionproperty.hasdefaultvalue) — Checks if property has a default value declared
* [ReflectionProperty::hasType](reflectionproperty.hastype) — Checks if property has a type
* [ReflectionProperty::isDefault](reflectionproperty.isdefault) — Checks if property is a default property
* [ReflectionProperty::isInitialized](reflectionproperty.isinitialized) — Checks whether a property is initialized
* [ReflectionProperty::isPrivate](reflectionproperty.isprivate) — Checks if property is private
* [ReflectionProperty::isPromoted](reflectionproperty.ispromoted) — Checks if property is promoted
* [ReflectionProperty::isProtected](reflectionproperty.isprotected) — Checks if property is protected
* [ReflectionProperty::isPublic](reflectionproperty.ispublic) — Checks if property is public
* [ReflectionProperty::isReadOnly](reflectionproperty.isreadonly) — Checks if property is readonly
* [ReflectionProperty::isStatic](reflectionproperty.isstatic) — Checks if property is static
* [ReflectionProperty::setAccessible](reflectionproperty.setaccessible) — Set property accessibility
* [ReflectionProperty::setValue](reflectionproperty.setvalue) — Set property value
* [ReflectionProperty::\_\_toString](reflectionproperty.tostring) — To string
php radius_close radius\_close
=============
(PECL radius >= 1.1.0)
radius\_close — Frees all ressources
### Description
```
radius_close(resource $radius_handle): bool
```
It is not needed to call this function because php frees all resources at the end of each request.
### Parameters
`radius_handle`
The RADIUS resource.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php odbc_primarykeys odbc\_primarykeys
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
odbc\_primarykeys — Gets the primary keys for a table
### Description
```
odbc_primarykeys(
resource $odbc,
?string $catalog,
string $schema,
string $table
): resource|false
```
Returns a result identifier that can be used to fetch the column names that comprise the primary key for a table.
### Parameters
`odbc`
The ODBC connection identifier, see [odbc\_connect()](function.odbc-connect) for details.
`catalog`
The catalog ('qualifier' in ODBC 2 parlance).
`schema`
The schema ('owner' in ODBC 2 parlance).
`table`
### Return Values
Returns an ODBC result identifier or **`false`** on failure.
The result set has the following columns:
* `TABLE_CAT`
* `TABLE_SCHEM`
* `TABLE_NAME`
* `COLUMN_NAME`
* `KEY_SEQ`
* `PK_NAME`
Drivers can report additional columns. The result set is ordered by `TABLE_CAT`, `TABLE_SCHEM`, `TABLE_NAME` and `KEY_SEQ`.
### Examples
**Example #1 List primary Keys of a Column**
```
<?php
$conn = odbc_connect($dsn, $user, $pass);
$primarykeys = odbc_primarykeys($conn, 'TutorialDB', 'dbo', 'TEST');
while (($row = odbc_fetch_array($primarykeys))) {
print_r($row);
break; // further rows omitted for brevity
}
?>
```
The above example will output something similar to:
```
Array
(
[TABLE_CAT] => TutorialDB
[TABLE_SCHEM] => dbo
[TABLE_NAME] => TEST
[COLUMN_NAME] => id
[KEY_SEQ] => 1
[PK_NAME] => PK__TEST__3213E83FE141F843
)
```
### See Also
* [odbc\_tables()](function.odbc-tables) - Get the list of table names stored in a specific data source
* [odbc\_foreignkeys()](function.odbc-foreignkeys) - Retrieves a list of foreign keys
php svn_add svn\_add
========
(PECL svn >= 0.1.0)
svn\_add — Schedules the addition of an item in a working directory
### Description
```
svn_add(string $path, bool $recursive = true, bool $force = false): bool
```
Adds the file, directory or symbolic link at `path` to the working directory. The item will be added to the repository the next time you call [svn\_commit()](function.svn-commit) on the working copy.
### Parameters
`path`
Path of item to add.
> **Note**: Relative paths will be resolved as if the current working directory was the one that contains the PHP binary. To use the calling script's working directory, use [realpath()](function.realpath) or dirname(\_\_FILE\_\_).
>
>
`recursive`
If item is directory, whether or not to recursively add all of its contents. Default is **`true`**
`force`
If true, Subversion will recurse into already versioned directories in order to add unversioned files that may be hiding in those directories. Default is **`false`**
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **svn\_add()** example**
In a working directory where **`svn status`** returns:
```
$ svn status
? foobar.txt
```
...this code:
```
<?php
svn_add('foobar.txt');
?>
```
...will schedule foobar.txt for addition into the repository.
### Notes
**Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
### See Also
* [» SVN documentation on svn add](http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.add.html)
php SplDoublyLinkedList::top SplDoublyLinkedList::top
========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplDoublyLinkedList::top — Peeks at the node from the end of the doubly linked list
### Description
```
public SplDoublyLinkedList::top(): mixed
```
### Parameters
This function has no parameters.
### Return Values
The value of the last node.
### Errors/Exceptions
Throws [RuntimeException](class.runtimeexception) when the data-structure is empty.
php PDOStatement::fetch PDOStatement::fetch
===================
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0)
PDOStatement::fetch — Fetches the next row from a result set
### Description
```
public PDOStatement::fetch(int $mode = PDO::FETCH_DEFAULT, int $cursorOrientation = PDO::FETCH_ORI_NEXT, int $cursorOffset = 0): mixed
```
Fetches a row from a result set associated with a PDOStatement object. The `mode` parameter determines how PDO returns the row.
### Parameters
`mode`
Controls how the next row will be returned to the caller. This value must be one of the `PDO::FETCH_*` constants, defaulting to value of `PDO::ATTR_DEFAULT_FETCH_MODE` (which defaults to `PDO::FETCH_BOTH`).
* `PDO::FETCH_ASSOC`: returns an array indexed by column name as returned in your result set
* `PDO::FETCH_BOTH` (default): returns an array indexed by both column name and 0-indexed column number as returned in your result set
* `PDO::FETCH_BOUND`: returns **`true`** and assigns the values of the columns in your result set to the PHP variables to which they were bound with the [PDOStatement::bindColumn()](pdostatement.bindcolumn) method
* `PDO::FETCH_CLASS`: returns a new instance of the requested class, mapping the columns of the result set to named properties in the class, and calling the constructor afterwards, unless `PDO::FETCH_PROPS_LATE` is also given. If `mode` includes PDO::FETCH\_CLASSTYPE (e.g. `PDO::FETCH_CLASS |
PDO::FETCH_CLASSTYPE`) then the name of the class is determined from a value of the first column.
* `PDO::FETCH_INTO`: updates an existing instance of the requested class, mapping the columns of the result set to named properties in the class
* `PDO::FETCH_LAZY`: combines `PDO::FETCH_BOTH` and `PDO::FETCH_OBJ`, creating the object variable names as they are accessed
* `PDO::FETCH_NAMED`: returns an array with the same form as `PDO::FETCH_ASSOC`, except that if there are multiple columns with the same name, the value referred to by that key will be an array of all the values in the row that had that column name
* `PDO::FETCH_NUM`: returns an array indexed by column number as returned in your result set, starting at column 0
* `PDO::FETCH_OBJ`: returns an anonymous object with property names that correspond to the column names returned in your result set
* `PDO::FETCH_PROPS_LATE`: when used with `PDO::FETCH_CLASS`, the constructor of the class is called before the properties are assigned from the respective column values.
`cursorOrientation`
For a PDOStatement object representing a scrollable cursor, this value determines which row will be returned to the caller. This value must be one of the `PDO::FETCH_ORI_*` constants, defaulting to `PDO::FETCH_ORI_NEXT`. To request a scrollable cursor for your PDOStatement object, you must set the `PDO::ATTR_CURSOR` attribute to `PDO::CURSOR_SCROLL` when you prepare the SQL statement with [PDO::prepare()](pdo.prepare).
`offset`
For a PDOStatement object representing a scrollable cursor for which the `cursor_orientation` parameter is set to `PDO::FETCH_ORI_ABS`, this value specifies the absolute number of the row in the result set that shall be fetched.
For a PDOStatement object representing a scrollable cursor for which the `cursor_orientation` parameter is set to `PDO::FETCH_ORI_REL`, this value specifies the row to fetch relative to the cursor position before **PDOStatement::fetch()** was called.
### Return Values
The return value of this function on success depends on the fetch type. In all cases, **`false`** is returned on failure or if there are no more rows.
### Examples
**Example #1 Fetching rows using different fetch styles**
```
<?php
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();
/* Exercise PDOStatement::fetch styles */
print("PDO::FETCH_ASSOC: ");
print("Return next row as an array indexed by column name\n");
$result = $sth->fetch(PDO::FETCH_ASSOC);
print_r($result);
print("\n");
print("PDO::FETCH_BOTH: ");
print("Return next row as an array indexed by both column name and number\n");
$result = $sth->fetch(PDO::FETCH_BOTH);
print_r($result);
print("\n");
print("PDO::FETCH_LAZY: ");
print("Return next row as an anonymous object with column names as properties\n");
$result = $sth->fetch(PDO::FETCH_LAZY);
print_r($result);
print("\n");
print("PDO::FETCH_OBJ: ");
print("Return next row as an anonymous object with column names as properties\n");
$result = $sth->fetch(PDO::FETCH_OBJ);
print $result->name;
print("\n");
?>
```
The above example will output:
```
PDO::FETCH_ASSOC: Return next row as an array indexed by column name
Array
(
[name] => apple
[colour] => red
)
PDO::FETCH_BOTH: Return next row as an array indexed by both column name and number
Array
(
[name] => banana
[0] => banana
[colour] => yellow
[1] => yellow
)
PDO::FETCH_LAZY: Return next row as an anonymous object with column names as properties
PDORow Object
(
[name] => orange
[colour] => orange
)
PDO::FETCH_OBJ: Return next row as an anonymous object with column names as properties
kiwi
```
**Example #2 Fetching rows with a scrollable cursor**
```
<?php
function readDataForwards($dbh) {
$sql = 'SELECT hand, won, bet FROM mynumbers ORDER BY BET';
$stmt = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_NEXT)) {
$data = $row[0] . "\t" . $row[1] . "\t" . $row[2] . "\n";
print $data;
}
}
function readDataBackwards($dbh) {
$sql = 'SELECT hand, won, bet FROM mynumbers ORDER BY bet';
$stmt = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_LAST);
do {
$data = $row[0] . "\t" . $row[1] . "\t" . $row[2] . "\n";
print $data;
} while ($row = $stmt->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_PRIOR));
}
print "Reading forwards:\n";
readDataForwards($conn);
print "Reading backwards:\n";
readDataBackwards($conn);
?>
```
The above example will output:
```
Reading forwards:
21 10 5
16 0 5
19 20 10
Reading backwards:
19 20 10
16 0 5
21 10 5
```
**Example #3 Construction order**
When objects are fetched via `PDO::FETCH_CLASS` the object properties are assigned first, and then the constructor of the class is invoked. If `PDO::FETCH_PROPS_LATE` is also given, this order is reversed, i.e. first the constructor is called, and afterwards the properties are assigned.
```
<?php
class Person
{
private $name;
public function __construct()
{
$this->tell();
}
public function tell()
{
if (isset($this->name)) {
echo "I am {$this->name}.\n";
} else {
echo "I don't have a name yet.\n";
}
}
}
$sth = $dbh->query("SELECT * FROM people");
$sth->setFetchMode(PDO::FETCH_CLASS, 'Person');
$person = $sth->fetch();
$person->tell();
$sth->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'Person');
$person = $sth->fetch();
$person->tell();
?>
```
The above example will output something similar to:
```
I am Alice.
I am Alice.
I don't have a name yet.
I am Bob.
```
### See Also
* [PDO::prepare()](pdo.prepare) - Prepares a statement for execution and returns a statement object
* [PDOStatement::execute()](pdostatement.execute) - Executes a prepared statement
* [PDOStatement::fetchAll()](pdostatement.fetchall) - Fetches the remaining rows from a result set
* [PDOStatement::fetchColumn()](pdostatement.fetchcolumn) - Returns a single column from the next row of a result set
* [PDOStatement::fetchObject()](pdostatement.fetchobject) - Fetches the next row and returns it as an object
* [PDOStatement::setFetchMode()](pdostatement.setfetchmode) - Set the default fetch mode for this statement
| programming_docs |
php EventBufferEvent::readBuffer EventBufferEvent::readBuffer
============================
(PECL event >= 1.2.6-beta)
EventBufferEvent::readBuffer — Drains the entire contents of the input buffer and places them into buf
### Description
```
public EventBufferEvent::readBuffer( EventBuffer $buf ): bool
```
Drains the entire contents of the input buffer and places them into `buf` .
### Parameters
`buf` Target buffer
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [EventBufferEvent::read()](eventbufferevent.read) - Read buffer's data
php ibase_free_query ibase\_free\_query
==================
(PHP 5, PHP 7 < 7.4.0)
ibase\_free\_query — Free memory allocated by a prepared query
### Description
```
ibase_free_query(resource $query): bool
```
Frees a prepared query.
### Parameters
`query`
A query prepared with [ibase\_prepare()](function.ibase-prepare).
### Return Values
Returns **`true`** on success or **`false`** on failure.
php RarEntry::getStream RarEntry::getStream
===================
(PECL rar >= 2.0.0)
RarEntry::getStream — Get file handler for entry
### Description
```
public RarEntry::getStream(string $password = ?): resource|false
```
Returns a file handler that supports read operations. This handler provides on-the-fly decompression for this entry.
The handler is not invalidated by calling [rar\_close()](rararchive.close).
**Warning** The resulting stream has no integrity verification. In particular, file corruption and decryption with a wrong a key will not be detected. It is the programmer's responsability to use the entry's CRC to check for integrity, if he so wishes.
### Parameters
`password`
The password used to encrypt this entry. If the entry is not encrypted, this value will not be used and can be omitted. If this parameter is omitted and the entry is encrypted, the password given to [rar\_open()](rararchive.open), if any, will be used. If a wrong password is given, either explicitly or implicitly via [rar\_open()](rararchive.open), this method's resulting stream will produce wrong output. If no password is given and one is required, this method will fail and return **`false`**. You can check whether an entry is encrypted with [RarEntry::isEncrypted()](rarentry.isencrypted).
### Return Values
The file handler or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| PECL rar 3.0.0 | Support for RAR archives with repeated entry names is no longer defective. |
### Examples
**Example #1 **RarEntry::getStream()** example**
```
<?php
$rar_file = rar_open('example.rar');
if ($rar_file === false)
die("Failed to open Rar archive");
$entry = rar_entry_get($rar_file, 'Dir/file.txt');
if ($entry === false)
die("Failed to find such entry");
$stream = $entry->getStream();
if ($stream === false)
die("Failed to obtain stream.");
rar_close($rar_file); //stream is independent from file
while (!feof($stream)) {
$buff = fread($stream, 8192);
if ($buff !== false)
echo $buff;
else
break; //fread error
}
fclose($stream);
?>
```
### See Also
* [RarEntry::extract()](rarentry.extract) - Extract entry from the archive
* [`rar://` wrapper](https://www.php.net/manual/en/wrappers.rar.php)
php imagesetbrush imagesetbrush
=============
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
imagesetbrush — Set the brush image for line drawing
### Description
```
imagesetbrush(GdImage $image, GdImage $brush): bool
```
**imagesetbrush()** sets the brush image to be used by all line drawing functions (such as [imageline()](function.imageline) and [imagepolygon()](function.imagepolygon)) when drawing with the special colors **`IMG_COLOR_BRUSHED`** or **`IMG_COLOR_STYLEDBRUSHED`**.
**Caution** You need not take special action when you are finished with a brush, but if you destroy the brush image (or let PHP destroy it), you must not use the **`IMG_COLOR_BRUSHED`** or **`IMG_COLOR_STYLEDBRUSHED`** colors until you have set a new brush image!
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`brush`
An image object.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `image` and `brush` expect [GdImage](class.gdimage) instances now; previously, resources were expected. |
### Examples
**Example #1 **imagesetbrush()** example**
```
<?php
// Load a mini php logo
$php = imagecreatefrompng('./php.png');
// Create the main image, 100x100
$im = imagecreatetruecolor(100, 100);
// Fill the background with white
$white = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im, 0, 0, 299, 99, $white);
// Set the brush
imagesetbrush($im, $php);
// Draw a couple of brushes, each overlaying each
imageline($im, 50, 50, 50, 60, IMG_COLOR_BRUSHED);
// Output image to the browser
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
imagedestroy($php);
?>
```
The above example will output something similar to:
php ftp_nlist ftp\_nlist
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
ftp\_nlist — Returns a list of files in the given directory
### Description
```
ftp_nlist(FTP\Connection $ftp, string $directory): array|false
```
### Parameters
`ftp`
An [FTP\Connection](class.ftp-connection) instance.
`directory`
The directory to be listed. This parameter can also include arguments, eg. `ftp_nlist($ftp, "-la /your/dir");`. Note that this parameter isn't escaped so there may be some issues with filenames containing spaces and other characters.
### Return Values
Returns an array of filenames from the specified directory on success or **`false`** on error.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `ftp` parameter expects an [FTP\Connection](class.ftp-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **ftp\_nlist()** example**
```
<?php
// set up basic connection
$ftp = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($ftp, $ftp_user_name, $ftp_user_pass);
// get contents of the current directory
$contents = ftp_nlist($ftp, ".");
// output $contents
var_dump($contents);
?>
```
The above example will output something similar to:
```
array(3) {
[0]=>
string(11) "public_html"
[1]=>
string(10) "public_ftp"
[2]=>
string(3) "www"
```
### See Also
* [ftp\_rawlist()](function.ftp-rawlist) - Returns a detailed list of files in the given directory
* [ftp\_mlsd()](function.ftp-mlsd) - Returns a list of files in the given directory
php SolrParams::toString SolrParams::toString
====================
(PECL solr >= 0.9.2)
SolrParams::toString — Returns all the name-value pair parameters in the object
### Description
```
final public SolrParams::toString(bool $url_encode = false): string
```
Returns all the name-value pair parameters in the object
### Parameters
`url_encode`
Whether to return URL-encoded values
### Return Values
Returns a string on success and **`false`** on failure.
php GmagickDraw::getfillcolor GmagickDraw::getfillcolor
=========================
(PECL gmagick >= Unknown)
GmagickDraw::getfillcolor — Returns the fill color
### Description
```
public GmagickDraw::getfillcolor(): GmagickPixel
```
Returns the fill color used for drawing filled objects.
### Parameters
This function has no parameters.
### Return Values
The [GmagickPixel](class.gmagickpixel) fill color used for drawing filled objects.
php The LDAP\ResultEntry class
The LDAP\ResultEntry class
==========================
Introduction
------------
(PHP 8 >= 8.1.0)
A fully opaque class which replaces a `ldap result entry` resource as of PHP 8.1.0.
Class synopsis
--------------
final class **LDAP\ResultEntry** { }
php EvIdle::__construct EvIdle::\_\_construct
=====================
(PECL ev >= 0.2.0)
EvIdle::\_\_construct — Constructs the EvIdle watcher object
### Description
public **EvIdle::\_\_construct**( [callable](language.types.callable) `$callback` , [mixed](language.types.declarations#language.types.declarations.mixed) `$data` = ?, int `$priority` = ?) Constructs the EvIdle watcher object and starts the watcher automatically.
### Parameters
`callback` See [Watcher callbacks](https://www.php.net/manual/en/ev.watcher-callbacks.php) .
`data` Custom data associated with the watcher.
`priority` [Watcher priority](class.ev#ev.constants.watcher-pri)
### See Also
* [EvIdle::createStopped()](evidle.createstopped) - Creates instance of a stopped EvIdle watcher object
* [EvLoop::idle()](evloop.idle) - Creates EvIdle watcher object associated with the current event loop instance
php shmop_size shmop\_size
===========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
shmop\_size — Get size of shared memory block
### Description
```
shmop_size(Shmop $shmop): int
```
**shmop\_size()** is used to get the size, in bytes of the shared memory block.
### Parameters
`shmop`
The shared memory block identifier created by [shmop\_open()](function.shmop-open)
### Return Values
Returns an int, which represents the number of bytes the shared memory block occupies.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `shmop` expects a [Shmop](class.shmop) instance now; previously, a resource was expected. |
### Examples
**Example #1 Getting the size of the shared memory block**
```
<?php
$shm_size = shmop_size($shm_id);
?>
```
This example will put the size of shared memory block identified by `$shm_id` into `$shm_size`.
php The SyncSharedMemory class
The SyncSharedMemory class
==========================
Introduction
------------
(PECL sync >= 1.1.0)
A cross-platform, native, consistent implementation of named shared memory objects.
Shared memory lets two separate processes communicate without the need for complex pipes or sockets. There are several integer-based shared memory implementations for PHP. Named shared memory is an alternative.
Synchronization objects (e.g. SyncMutex) are still required to protect most uses of shared memory.
Class synopsis
--------------
class **SyncSharedMemory** { /\* Methods \*/
```
public __construct(string $name, int $size)
```
```
public first(): bool
```
```
public read(int $start = 0, int $length = ?)
```
```
public size(): int
```
```
public write(string $string = ?, int $start = 0)
```
} Table of Contents
-----------------
* [SyncSharedMemory::\_\_construct](syncsharedmemory.construct) — Constructs a new SyncSharedMemory object
* [SyncSharedMemory::first](syncsharedmemory.first) — Check to see if the object is the first instance system-wide of named shared memory
* [SyncSharedMemory::read](syncsharedmemory.read) — Copy data from named shared memory
* [SyncSharedMemory::size](syncsharedmemory.size) — Returns the size of the named shared memory
* [SyncSharedMemory::write](syncsharedmemory.write) — Copy data to named shared memory
php The OutOfRangeException class
The OutOfRangeException class
=============================
Introduction
------------
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
Exception thrown when an illegal index was requested. This represents errors that should be detected at compile time.
Class synopsis
--------------
class **OutOfRangeException** extends [LogicException](class.logicexception) { /\* Inherited properties \*/ protected string [$message](class.exception#exception.props.message) = "";
private string [$string](class.exception#exception.props.string) = "";
protected int [$code](class.exception#exception.props.code);
protected string [$file](class.exception#exception.props.file) = "";
protected int [$line](class.exception#exception.props.line);
private array [$trace](class.exception#exception.props.trace) = [];
private ?[Throwable](class.throwable) [$previous](class.exception#exception.props.previous) = null; /\* Inherited methods \*/
```
final public Exception::getMessage(): string
```
```
final public Exception::getPrevious(): ?Throwable
```
```
final public Exception::getCode(): int
```
```
final public Exception::getFile(): string
```
```
final public Exception::getLine(): int
```
```
final public Exception::getTrace(): array
```
```
final public Exception::getTraceAsString(): string
```
```
public Exception::__toString(): string
```
```
private Exception::__clone(): void
```
}
php ImagickDraw::setFillColor ImagickDraw::setFillColor
=========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setFillColor — Sets the fill color to be used for drawing filled objects
### Description
```
public ImagickDraw::setFillColor(ImagickPixel $fill_pixel): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Sets the fill color to be used for drawing filled objects.
### Parameters
`fill_pixel`
ImagickPixel to use to set the color
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::setFillColor()****
```
<?php
function setFillColor($strokeColor, $fillColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeOpacity(1);
$draw->setStrokeWidth(1.5);
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->rectangle(50, 50, 150, 150);
$draw->setFillColor("rgb(200, 32, 32)");
$draw->rectangle(200, 50, 300, 150);
$image = new \Imagick();
$image->newImage(500, 500, $backgroundColor);
$image->setImageFormat("png");
$image->drawImage($draw);
header("Content-Type: image/png");
echo $image->getImageBlob();
}
?>
```
php Collator::compare Collator::compare
=================
collator\_compare
=================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
Collator::compare -- collator\_compare — Compare two Unicode strings
### Description
Object-oriented style
```
public Collator::compare(string $string1, string $string2): int|false
```
Procedural style
```
collator_compare(Collator $object, string $string1, string $string2): int|false
```
Compare two Unicode strings according to collation rules.
### Parameters
`object`
[Collator](class.collator) object.
`string1`
The first string to compare.
`string2`
The second string to compare.
### Return Values
Return comparison result:
* 1 if `string1` is *greater* than `string2` ;
* 0 if `string1` is *equal* to `string2`;
* -1 if `string1` is *less* than `string2` .
Returns **`false`** on failure.
**Warning**This function may return Boolean **`false`**, but may also return a non-Boolean value which evaluates to **`false`**. Please read the section on [Booleans](language.types.boolean) for more information. Use [the === operator](language.operators.comparison) for testing the return value of this function.
### Examples
**Example #1 **collator\_compare()** example**
```
<?php
$s1 = 'Hello';
$s2 = 'hello';
$coll = collator_create( 'en_US' );
$res = collator_compare( $coll, $s1, $s2 );
if ($res === false) {
echo collator_get_error_message( $coll );
} else if( $res > 0 ) {
echo "s1 is greater than s2\n";
} else if( $res < 0 ) {
echo "s1 is less than s2\n";
} else {
echo "s1 is equal to s2\n";
}
?>
```
The above example will output:
s1 is greater than s2
**Example #2 Comparing strings without diacritics or case-sensitivity**
```
<?php
$c = new Collator( 'en' );
$c->setStrength( Collator::PRIMARY );
if ( $c->compare( 'Séan', 'Sean' ) == 0 )
{
echo "The same\n";
}
```
The above example will output:
The same
This example instructs the collator to compare with only taking the base characters into account. The documentation for [Collator->setStrength()](collator.setstrength) explains the different strengths.
### See Also
* [collator\_sort()](collator.sort) - Sort array using specified collator
php SolrException::getInternalInfo SolrException::getInternalInfo
==============================
(PECL solr >= 0.9.2)
SolrException::getInternalInfo — Returns internal information where the Exception was thrown
### Description
```
public SolrException::getInternalInfo(): array
```
Returns internal information where the Exception was thrown.
### Parameters
This function has no parameters.
### Return Values
Returns an array containing internal information where the error was thrown. Used only for debugging by extension developers.
php The DatePeriod class
The DatePeriod class
====================
Introduction
------------
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
Represents a date period.
A date period allows iteration over a set of dates and times, recurring at regular intervals, over a given period.
Class synopsis
--------------
class **DatePeriod** implements [IteratorAggregate](class.iteratoraggregate) { /\* Constants \*/ public const int [EXCLUDE\_START\_DATE](class.dateperiod#dateperiod.constants.exclude-start-date);
public const int [INCLUDE\_END\_DATE](class.dateperiod#dateperiod.constants.include-end-date); /\* Properties \*/
public readonly ?[DateTimeInterface](class.datetimeinterface) [$start](class.dateperiod#dateperiod.props.start);
public readonly ?[DateTimeInterface](class.datetimeinterface) [$current](class.dateperiod#dateperiod.props.current);
public readonly ?[DateTimeInterface](class.datetimeinterface) [$end](class.dateperiod#dateperiod.props.end);
public readonly ?[DateInterval](class.dateinterval) [$interval](class.dateperiod#dateperiod.props.interval);
public readonly int [$recurrences](class.dateperiod#dateperiod.props.recurrences);
public readonly bool [$include\_start\_date](class.dateperiod#dateperiod.props.include-start-date);
public readonly bool [$include\_end\_date](class.dateperiod#dateperiod.props.include-end-date); /\* Methods \*/ public [\_\_construct](dateperiod.construct)(
[DateTimeInterface](class.datetimeinterface) `$start`,
[DateInterval](class.dateinterval) `$interval`,
int `$recurrences`,
int `$options` = 0
)
public [\_\_construct](dateperiod.construct)(
[DateTimeInterface](class.datetimeinterface) `$start`,
[DateInterval](class.dateinterval) `$interval`,
[DateTimeInterface](class.datetimeinterface) `$end`,
int `$options` = 0
)
public [\_\_construct](dateperiod.construct)(string `$isostr`, int `$options` = 0)
```
public getDateInterval(): DateInterval
```
```
public getEndDate(): ?DateTimeInterface
```
```
public getRecurrences(): ?int
```
```
public getStartDate(): DateTimeInterface
```
} Predefined Constants
--------------------
**`DatePeriod::EXCLUDE_START_DATE`** Exclude start date, used in [DatePeriod::\_\_construct()](dateperiod.construct).
**`DatePeriod::INCLUDE_END_DATE`** Include end date, used in [DatePeriod::\_\_construct()](dateperiod.construct).
Properties
----------
recurrences The minimum amount of instances as retured by the iterator.
If the number of recurrences has been explicitly passed through the `$recurrences` parameter in the constructor of the **DatePeriod** instance, then this property contains this value, *plus* one if the start date has not been disabled through **`DatePeriod::EXCLUDE_START_DATE`**, *plus* one if the end date has been enabled through **`DatePeriod::INCLUDE_END_DATE`**.
If the number of recurrences has not been explicitly passed, then this property contains the minimum number of returned instances. This would be `0`, *plus* one if the start date has not been disabled through **`DatePeriod::EXCLUDE_START_DATE`**, *plus* one if the end date has been enabled through **`DatePeriod::INCLUDE_END_DATE`**.
```
<?php
$start = new DateTime('2018-12-31 00:00:00');
$end = new DateTime('2021-12-31 00:00:00');
$interval = new DateInterval('P1M');
$recurrences = 5;
// recurrences explicitly set through the constructor
$period = new DatePeriod($start, $interval, $recurrences, DatePeriod::EXCLUDE_START_DATE);
echo $period->recurrences, "\n";
$period = new DatePeriod($start, $interval, $recurrences);
echo $period->recurrences, "\n";
$period = new DatePeriod($start, $interval, $recurrences, DatePeriod::INCLUDE_END_DATE);
echo $period->recurrences, "\n";
// recurrences not set in the constructor
$period = new DatePeriod($start, $interval, $end);
echo $period->recurrences, "\n";
$period = new DatePeriod($start, $interval, $end, DatePeriod::EXCLUDE_START_DATE);
echo $period->recurrences, "\n";
?>
```
The above example will output:
5
6
7
1
0
See also [DatePeriod::getRecurrences()](dateperiod.getrecurrences).
include\_end\_date Whether to include the end date in the set of recurring dates or not.
include\_start\_date Whether to include the start date in the set of recurring dates or not.
start The start date of the period.
current During iteration this will contain the current date within the period.
end The end date of the period.
interval An ISO 8601 repeating interval specification.
Changelog
---------
| Version | Description |
| --- | --- |
| 8.2.0 | The **`DatePeriod::INCLUDE_END_DATE`** constant and include\_end\_date property have been added. |
| 8.0.0 | **DatePeriod** implements [IteratorAggregate](class.iteratoraggregate) now. Previously, [Traversable](class.traversable) was implemented instead. |
Table of Contents
-----------------
* [DatePeriod::\_\_construct](dateperiod.construct) — Creates a new DatePeriod object
* [DatePeriod::getDateInterval](dateperiod.getdateinterval) — Gets the interval
* [DatePeriod::getEndDate](dateperiod.getenddate) — Gets the end date
* [DatePeriod::getRecurrences](dateperiod.getrecurrences) — Gets the number of recurrences
* [DatePeriod::getStartDate](dateperiod.getstartdate) — Gets the start date
| programming_docs |
php SolrDisMaxQuery::setBoostQuery SolrDisMaxQuery::setBoostQuery
==============================
(No version information available, might only be in Git)
SolrDisMaxQuery::setBoostQuery — Directly Sets Boost Query Parameter (bq)
### Description
```
public SolrDisMaxQuery::setBoostQuery(string $q): SolrDisMaxQuery
```
Sets Boost Query Parameter (bq)
### Parameters
`q`
query
### Return Values
[SolrDisMaxQuery](class.solrdismaxquery)
### Examples
**Example #1 **SolrDisMaxQuery::setBoostQuery()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery("lucene");
$dismaxQuery->setBoostQuery('cat:electronics manu:local^2');
echo $dismaxQuery.PHP_EOL;
?>
```
The above example will output something similar to:
```
q=lucene&defType=edismax&bq=cat:electronics manu:local^2
```
### See Also
* [SolrDisMaxQuery::addBoostQuery()](solrdismaxquery.addboostquery) - Adds a boost query field with value and optional boost (bq parameter)
* [SolrDisMaxQuery::removeBoostQuery()](solrdismaxquery.removeboostquery) - Removes a boost query partial by field name (bq)
php Ds\Map::sorted Ds\Map::sorted
==============
(PECL ds >= 1.0.0)
Ds\Map::sorted — Returns a copy, sorted by value
### Description
```
public Ds\Map::sorted(callable $comparator = ?): Ds\Map
```
Returns a copy, sorted by value using an optional `comparator` function.
### Parameters
`comparator`
The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
```
callback(mixed $a, mixed $b): int
```
**Caution** Returning *non-integer* values from the comparison function, such as float, will result in an internal cast to int of the callback's return value. So values such as 0.99 and 0.1 will both be cast to an integer value of 0, which will compare such values as equal.
### Return Values
Returns a copy of the map, sorted by value.
### Examples
**Example #1 [Ds\Map::sort()](ds-map.sort) example**
```
<?php
$map = new \Ds\Map(["a" => 2, "b" => 3, "c" => 1]);
print_r($map->sorted());
?>
```
The above example will output something similar to:
```
Ds\Map Object
(
[0] => Ds\Pair Object
(
[key] => c
[value] => 1
)
[1] => Ds\Pair Object
(
[key] => a
[value] => 2
)
[2] => Ds\Pair Object
(
[key] => b
[value] => 3
)
)
```
**Example #2 [Ds\Map::sort()](ds-map.sort) example using a comparator**
```
<?php
$map = new \Ds\Map(["a" => 2, "b" => 3, "c" => 1]);
// Reverse
$sorted = $map->sorted(function($a, $b) {
return $b <=> $a;
});
print_r($sorted);
?>
```
The above example will output something similar to:
```
Ds\Map Object
(
[0] => Ds\Pair Object
(
[key] => b
[value] => 3
)
[1] => Ds\Pair Object
(
[key] => a
[value] => 2
)
[2] => Ds\Pair Object
(
[key] => c
[value] => 1
)
)
```
php intval intval
======
(PHP 4, PHP 5, PHP 7, PHP 8)
intval — Get the integer value of a variable
### Description
```
intval(mixed $value, int $base = 10): int
```
Returns the int value of `value`, using the specified `base` for the conversion (the default is base 10). **intval()** should not be used on objects, as doing so will emit an **`E_NOTICE`** level error and return 1.
### Parameters
`value`
The scalar value being converted to an integer
`base`
The base for the conversion
>
> **Note**:
>
>
> If `base` is 0, the base used is determined by the format of `value`:
>
>
> * if string includes a "0x" (or "0X") prefix, the base is taken as 16 (hex); otherwise,
> * if string starts with "0", the base is taken as 8 (octal); otherwise,
> * the base is taken as 10 (decimal).
>
>
### Return Values
The integer value of `value` on success, or 0 on failure. Empty arrays return 0, non-empty arrays return 1.
The maximum value depends on the system. 32 bit systems have a maximum signed integer range of -2147483648 to 2147483647. So for example on such a system, `intval('1000000000000')` will return 2147483647. The maximum signed integer value for 64 bit systems is 9223372036854775807.
Strings will most likely return 0 although this depends on the leftmost characters of the string. The common rules of [integer casting](language.types.integer#language.types.integer.casting) apply.
### Examples
**Example #1 **intval()** examples**
The following examples are based on a 32 bit system.
```
<?php
echo intval(42); // 42
echo intval(4.2); // 4
echo intval('42'); // 42
echo intval('+42'); // 42
echo intval('-42'); // -42
echo intval(042); // 34
echo intval('042'); // 42
echo intval(1e10); // 1410065408
echo intval('1e10'); // 1
echo intval(0x1A); // 26
echo intval(42000000); // 42000000
echo intval(420000000000000000000); // 0
echo intval('420000000000000000000'); // 2147483647
echo intval(42, 8); // 42
echo intval('42', 8); // 34
echo intval(array()); // 0
echo intval(array('foo', 'bar')); // 1
echo intval(false); // 0
echo intval(true); // 1
?>
```
### Notes
>
> **Note**:
>
>
> The `base` parameter has no effect unless the `value` parameter is a string.
>
>
### See Also
* [boolval()](function.boolval) - Get the boolean value of a variable
* [floatval()](function.floatval) - Get float value of a variable
* [strval()](function.strval) - Get string value of a variable
* [settype()](function.settype) - Set the type of a variable
* [is\_numeric()](function.is-numeric) - Finds whether a variable is a number or a numeric string
* [Type juggling](language.types.type-juggling)
* [BCMath Arbitrary Precision Mathematics Functions](https://www.php.net/manual/en/ref.bc.php)
php GearmanWorker::error GearmanWorker::error
====================
(PECL gearman >= 0.5.0)
GearmanWorker::error — Get the last error encountered
### Description
```
public GearmanWorker::error(): string
```
Returns an error string for the last error encountered.
### Parameters
This function has no parameters.
### Return Values
An error string.
### See Also
* [GearmanWorker::getErrno()](gearmanworker.geterrno) - Get errno
php Parle\RParser::token Parle\RParser::token
====================
(PECL parle >= 0.7.0)
Parle\RParser::token — Declare a token
### Description
```
public Parle\RParser::token(string $tok): void
```
Declare a terminal to be used in the grammar.
### Parameters
`tok`
Token name.
### Return Values
No value is returned.
php Imagick::getCompression Imagick::getCompression
=======================
(PECL imagick 2, PECL imagick 3)
Imagick::getCompression — Gets the object compression type
### Description
```
public Imagick::getCompression(): int
```
Gets the object compression type.
### Parameters
This function has no parameters.
### Return Values
Returns the compression constant
php Threaded::run Threaded::run
=============
(PECL pthreads >= 2.0.0)
Threaded::run — Execution
### Description
```
public Threaded::run(): void
```
The programmer should always implement the run method for objects that are intended for execution.
### Parameters
This function has no parameters.
### Return Values
The methods return value, if used, will be ignored
php Imagick::readimages Imagick::readimages
===================
(PECL imagick 2, PECL imagick 3)
Imagick::readimages — Description
### Description
```
public Imagick::readImages(array $filenames): bool
```
Reads image from an array of filenames. All the images are held in a single Imagick object.
### Parameters
`filenames`
### Return Values
Returns **`true`** on success.
php openal_source_create openal\_source\_create
======================
(PECL openal >= 0.1.0)
openal\_source\_create — Generate a source resource
### Description
```
openal_source_create(): resource
```
### Parameters
This function has no parameters.
### Return Values
Returns an [Open AL(Source)](https://www.php.net/manual/en/openal.resources.php) resource on success or **`false`** on failure.
### See Also
* [openal\_source\_set()](function.openal-source-set) - Set source property
* [openal\_source\_play()](function.openal-source-play) - Start playing the source
* [openal\_source\_destroy()](function.openal-source-destroy) - Destroy a source resource
php XMLWriter::startElement XMLWriter::startElement
=======================
xmlwriter\_start\_element
=========================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::startElement -- xmlwriter\_start\_element — Create start element tag
### Description
Object-oriented style
```
public XMLWriter::startElement(string $name): bool
```
Procedural style
```
xmlwriter_start_element(XMLWriter $writer, string $name): bool
```
Starts an element.
### Parameters
`writer`
Only for procedural calls. The [XMLWriter](class.xmlwriter) instance that is being modified. This object is returned from a call to [xmlwriter\_open\_uri()](xmlwriter.openuri) or [xmlwriter\_open\_memory()](xmlwriter.openmemory).
`name`
The element name.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `writer` expects an [XMLWriter](class.xmlwriter) instance now; previously, a resource was expected. |
### See Also
* [XMLWriter::endElement()](xmlwriter.endelement) - End current element
* [XMLWriter::writeElement()](xmlwriter.writeelement) - Write full element tag
php MessageFormatter::getPattern MessageFormatter::getPattern
============================
msgfmt\_get\_pattern
====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
MessageFormatter::getPattern -- msgfmt\_get\_pattern — Get the pattern used by the formatter
### Description
Object-oriented style
```
public MessageFormatter::getPattern(): string|false
```
Procedural style
```
msgfmt_get_pattern(MessageFormatter $formatter): string|false
```
Get the pattern used by the formatter
### Parameters
`formatter`
The message formatter
### Return Values
The pattern string for this message formatter, or **`false`** on failure.
### Examples
**Example #1 **msgfmt\_get\_pattern()** example**
```
<?php
$fmt = msgfmt_create( "en_US", "{0, number} monkeys on {1, number} trees" );
echo "Default pattern: '" . msgfmt_get_pattern( $fmt ) . "'\n";
echo "Formatting result: " . msgfmt_format( $fmt, array(123, 456) ) . "\n";
msgfmt_set_pattern( $fmt, "{0, number} trees hosting {1, number} monkeys" );
echo "New pattern: '" . msgfmt_get_pattern( $fmt ) . "'\n";
echo "Formatted number: " . msgfmt_format( $fmt, array(123, 456) ) . "\n";
?>
```
**Example #2 OO example**
```
<?php
$fmt = new MessageFormatter( "en_US", "{0, number} monkeys on {1, number} trees" );
echo "Default pattern: '" . $fmt->getPattern() . "'\n";
echo "Formatting result: " . $fmt->format(array(123, 456)) . "\n";
$fmt->setPattern("{0, number} trees hosting {1, number} monkeys" );
echo "New pattern: '" . $fmt->getPattern() . "'\n";
echo "Formatted number: " . $fmt->format(array(123, 456)) . "\n";
?>
```
The above example will output:
```
Default pattern: '{0,number} monkeys on {1,number} trees'
Formatting result: 123 monkeys on 456 trees
New pattern: '{0,number} trees hosting {1,number} monkeys'
Formatted number: 123 trees hosting 456 monkeys
```
### See Also
* [msgfmt\_create()](messageformatter.create) - Constructs a new Message Formatter
* [msgfmt\_set\_pattern()](messageformatter.setpattern) - Set the pattern used by the formatter
php The SolrCollapseFunction class
The SolrCollapseFunction class
==============================
Introduction
------------
(PECL solr >= 2.2.0)
Class synopsis
--------------
class **SolrCollapseFunction** { /\* Constants \*/ const string [NULLPOLICY\_IGNORE](class.solrcollapsefunction#solrcollapsefunction.constants.nullpolicy-ignore) = ignore;
const string [NULLPOLICY\_EXPAND](class.solrcollapsefunction#solrcollapsefunction.constants.nullpolicy-expand) = expand;
const string [NULLPOLICY\_COLLAPSE](class.solrcollapsefunction#solrcollapsefunction.constants.nullpolicy-collapse) = collapse; /\* Methods \*/ public [\_\_construct](solrcollapsefunction.construct)(string `$field` = ?)
```
public getField(): string
```
```
public getHint(): string
```
```
public getMax(): string
```
```
public getMin(): string
```
```
public getNullPolicy(): string
```
```
public getSize(): int
```
```
public setField(string $fieldName): SolrCollapseFunction
```
```
public setHint(string $hint): SolrCollapseFunction
```
```
public setMax(string $max): SolrCollapseFunction
```
```
public setMin(string $min): SolrCollapseFunction
```
```
public setNullPolicy(string $nullPolicy): SolrCollapseFunction
```
```
public setSize(int $size): SolrCollapseFunction
```
```
public __toString(): string
```
} Predefined Constants
--------------------
**`SolrCollapseFunction::NULLPOLICY_IGNORE`** **`SolrCollapseFunction::NULLPOLICY_EXPAND`** **`SolrCollapseFunction::NULLPOLICY_COLLAPSE`** Table of Contents
-----------------
* [SolrCollapseFunction::\_\_construct](solrcollapsefunction.construct) — Constructor
* [SolrCollapseFunction::getField](solrcollapsefunction.getfield) — Returns the field that is being collapsed on
* [SolrCollapseFunction::getHint](solrcollapsefunction.gethint) — Returns collapse hint
* [SolrCollapseFunction::getMax](solrcollapsefunction.getmax) — Returns max parameter
* [SolrCollapseFunction::getMin](solrcollapsefunction.getmin) — Returns min parameter
* [SolrCollapseFunction::getNullPolicy](solrcollapsefunction.getnullpolicy) — Returns null policy
* [SolrCollapseFunction::getSize](solrcollapsefunction.getsize) — Returns size parameter
* [SolrCollapseFunction::setField](solrcollapsefunction.setfield) — Sets the field to collapse on
* [SolrCollapseFunction::setHint](solrcollapsefunction.sethint) — Sets collapse hint
* [SolrCollapseFunction::setMax](solrcollapsefunction.setmax) — Selects the group heads by the max value of a numeric field or function query
* [SolrCollapseFunction::setMin](solrcollapsefunction.setmin) — Sets the initial size of the collapse data structures when collapsing on a numeric field only
* [SolrCollapseFunction::setNullPolicy](solrcollapsefunction.setnullpolicy) — Sets the NULL Policy
* [SolrCollapseFunction::setSize](solrcollapsefunction.setsize) — Sets the initial size of the collapse data structures when collapsing on a numeric field only
* [SolrCollapseFunction::\_\_toString](solrcollapsefunction.tostring) — Returns a string representing the constructed collapse function
php mysqli::store_result mysqli::store\_result
=====================
mysqli\_store\_result
=====================
(PHP 5, PHP 7, PHP 8)
mysqli::store\_result -- mysqli\_store\_result — Transfers a result set from the last query
### Description
Object-oriented style
```
public mysqli::store_result(int $mode = 0): mysqli_result|false
```
Procedural style
```
mysqli_store_result(mysqli $mysql, int $mode = 0): mysqli_result|false
```
Transfers the result set from the last query on the database connection represented by the `mysql` parameter to be used with the [mysqli\_data\_seek()](mysqli-result.data-seek) function.
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
`mode`
The option that you want to set. It can be one of the following values:
**Valid options**| Name | Description |
| --- | --- |
| **`MYSQLI_STORE_RESULT_COPY_DATA`** | Copy results from the internal mysqlnd buffer into the PHP variables fetched. By default, mysqlnd will use a reference logic to avoid copying and duplicating results held in memory. For certain result sets, for example, result sets with many small rows, the copy approach can reduce the overall memory usage because PHP variables holding results may be released earlier (available with mysqlnd only) |
### Return Values
Returns a buffered result object or **`false`** if an error occurred.
>
> **Note**:
>
>
> **mysqli\_store\_result()** returns **`false`** in case the query didn't return a result set (if the query was, for example an INSERT statement). This function also returns **`false`** if the reading of the result set failed. You can check if you have got an error by checking if [mysqli\_error()](mysqli.error) doesn't return an empty string, if [mysqli\_errno()](mysqli.errno) returns a non zero value, or if [mysqli\_field\_count()](mysqli.field-count) returns a non zero value. Also possible reason for this function returning **`false`** after successful call to [mysqli\_query()](mysqli.query) can be too large result set (memory for it cannot be allocated). If [mysqli\_field\_count()](mysqli.field-count) returns a non-zero value, the statement should have produced a non-empty result set.
>
>
### Examples
See [mysqli\_multi\_query()](mysqli.multi-query).
### Notes
>
> **Note**:
>
>
> Although it is always good practice to free the memory used by the result of a query using the [mysqli\_free\_result()](mysqli-result.free) function, when transferring large result sets using the **mysqli\_store\_result()** this becomes particularly important.
>
>
### See Also
* [mysqli\_real\_query()](mysqli.real-query) - Execute an SQL query
* [mysqli\_use\_result()](mysqli.use-result) - Initiate a result set retrieval
php forward_static_call forward\_static\_call
=====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
forward\_static\_call — Call a static method
### Description
```
forward_static_call(callable $callback, mixed ...$args): mixed
```
Calls a user defined function or method given by the `callback` parameter, with the following arguments. This function must be called within a method context, it can't be used outside a class. It uses the [late static binding](language.oop5.late-static-bindings).
### Parameters
`callback`
The function or method to be called. This parameter may be an array, with the name of the class, and the method, or a string, with a function name.
`args`
Zero or more parameters to be passed to the function.
### Return Values
Returns the function result, or **`false`** on error.
### Examples
**Example #1 **forward\_static\_call()** example**
```
<?php
class A
{
const NAME = 'A';
public static function test() {
$args = func_get_args();
echo static::NAME, " ".join(',', $args)." \n";
}
}
class B extends A
{
const NAME = 'B';
public static function test() {
echo self::NAME, "\n";
forward_static_call(array('A', 'test'), 'more', 'args');
forward_static_call( 'test', 'other', 'args');
}
}
B::test('foo');
function test() {
$args = func_get_args();
echo "C ".join(',', $args)." \n";
}
?>
```
The above example will output:
```
B
B more,args
C other,args
```
### See Also
* [forward\_static\_call\_array()](function.forward-static-call-array) - Call a static method and pass the arguments as array
* [call\_user\_func\_array()](function.call-user-func-array) - Call a callback with an array of parameters
* [call\_user\_func()](function.call-user-func) - Call the callback given by the first parameter
* [is\_callable()](function.is-callable) - Verify that a value can be called as a function from the current scope.
| programming_docs |
php ImagickPixelIterator::setIteratorLastRow ImagickPixelIterator::setIteratorLastRow
========================================
(PECL imagick 2, PECL imagick 3)
ImagickPixelIterator::setIteratorLastRow — Sets the pixel iterator to the last pixel row
### Description
```
public ImagickPixelIterator::setIteratorLastRow(): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Sets the pixel iterator to the last pixel row.
### Return Values
Returns **`true`** on success.
php strcoll strcoll
=======
(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)
strcoll — Locale based string comparison
### Description
```
strcoll(string $string1, string $string2): int
```
Note that this comparison is case sensitive, and unlike [strcmp()](function.strcmp) this function is not binary safe.
**strcoll()** uses the current locale for doing the comparisons. If the current locale is C or POSIX, this function is equivalent to [strcmp()](function.strcmp).
### Parameters
`string1`
The first string.
`string2`
The second string.
### Return Values
Returns < 0 if `string1` is less than `string2`; > 0 if `string1` is greater than `string2`, and 0 if they are equal.
### See Also
* [preg\_match()](function.preg-match) - Perform a regular expression match
* [strcmp()](function.strcmp) - Binary safe string comparison
* [strcasecmp()](function.strcasecmp) - Binary safe case-insensitive string comparison
* [substr()](function.substr) - Return part of a string
* [stristr()](function.stristr) - Case-insensitive strstr
* [strncasecmp()](function.strncasecmp) - Binary safe case-insensitive string comparison of the first n characters
* [strncmp()](function.strncmp) - Binary safe string comparison of the first n characters
* [strstr()](function.strstr) - Find the first occurrence of a string
* [setlocale()](function.setlocale) - Set locale information
php GearmanWorker::removeOptions GearmanWorker::removeOptions
============================
(PECL gearman >= 0.6.0)
GearmanWorker::removeOptions — Remove worker options
### Description
```
public GearmanWorker::removeOptions(int $option): bool
```
Removes (unsets) one or more worker options.
### Parameters
`option`
The options to be removed (unset)
### Return Values
Always returns **`true`**.
### See Also
* [GearmanWorker::options()](gearmanworker.options) - Get worker options
* [GearmanWorker::setOptions()](gearmanworker.setoptions) - Set worker options
* [GearmanWorker::addOptions()](gearmanworker.addoptions) - Add worker options
php None Magic Methods
-------------
Magic methods are special methods which override PHP's default's action when certain actions are performed on an object.
**Caution** All methods names starting with `__` are reserved by PHP. Therefore, it is not recommended to use such method names unless overriding PHP's behavior.
The following method names are considered magical: [\_\_construct()](language.oop5.decon#object.construct), [\_\_destruct()](language.oop5.decon#object.destruct), [\_\_call()](language.oop5.overloading#object.call), [\_\_callStatic()](language.oop5.overloading#object.callstatic), [\_\_get()](language.oop5.overloading#object.get), [\_\_set()](language.oop5.overloading#object.set), [\_\_isset()](language.oop5.overloading#object.isset), [\_\_unset()](language.oop5.overloading#object.unset), [\_\_sleep()](language.oop5.magic#object.sleep), [\_\_wakeup()](language.oop5.magic#object.wakeup), [\_\_serialize()](language.oop5.magic#object.serialize), [\_\_unserialize()](language.oop5.magic#object.unserialize), [\_\_toString()](language.oop5.magic#object.tostring), [\_\_invoke()](language.oop5.magic#object.invoke), [\_\_set\_state()](language.oop5.magic#object.set-state), [\_\_clone()](language.oop5.cloning#object.clone), and [\_\_debugInfo()](language.oop5.magic#object.debuginfo).
**Warning** All magic methods, with the exception of [\_\_construct()](language.oop5.decon#object.construct), [\_\_destruct()](language.oop5.decon#object.destruct), and [\_\_clone()](language.oop5.cloning#object.clone), *must* be declared as `public`, otherwise an **`E_WARNING`** is emitted. Prior to PHP 8.0.0, no diagnostic was emitted for the magic methods [\_\_sleep()](language.oop5.magic#object.sleep), [\_\_wakeup()](language.oop5.magic#object.wakeup), [\_\_serialize()](language.oop5.magic#object.serialize), [\_\_unserialize()](language.oop5.magic#object.unserialize), and [\_\_set\_state()](language.oop5.magic#object.set-state).
**Warning** If type declarations are used in the definition of a magic method, they must be identical to the signature described in this document. Otherwise, a fatal error is emitted. Prior to PHP 8.0.0, no diagnostic was emitted. However, [\_\_construct()](language.oop5.decon#object.construct) and [\_\_destruct()](language.oop5.decon#object.destruct) must not declare a return type; otherwise a fatal error is emitted.
### [\_\_sleep()](language.oop5.magic#object.sleep) and [\_\_wakeup()](language.oop5.magic#object.wakeup)
```
public __sleep(): array
```
```
public __wakeup(): void
```
[serialize()](function.serialize) checks if the class has a function with the magic name [\_\_sleep()](language.oop5.magic#object.sleep). If so, that function is executed prior to any serialization. It can clean up the object and is supposed to return an array with the names of all variables of that object that should be serialized. If the method doesn't return anything then **`null`** is serialized and **`E_NOTICE`** is issued.
>
> **Note**:
>
>
> It is not possible for [\_\_sleep()](language.oop5.magic#object.sleep) to return names of private properties in parent classes. Doing this will result in an **`E_NOTICE`** level error. Use [\_\_serialize()](language.oop5.magic#object.serialize) instead.
>
>
The intended use of [\_\_sleep()](language.oop5.magic#object.sleep) is to commit pending data or perform similar cleanup tasks. Also, the function is useful if a very large object doesn't need to be saved completely.
Conversely, [unserialize()](function.unserialize) checks for the presence of a function with the magic name [\_\_wakeup()](language.oop5.magic#object.wakeup). If present, this function can reconstruct any resources that the object may have.
The intended use of [\_\_wakeup()](language.oop5.magic#object.wakeup) is to reestablish any database connections that may have been lost during serialization and perform other reinitialization tasks.
**Example #1 Sleep and wakeup**
```
<?php
class Connection
{
protected $link;
private $dsn, $username, $password;
public function __construct($dsn, $username, $password)
{
$this->dsn = $dsn;
$this->username = $username;
$this->password = $password;
$this->connect();
}
private function connect()
{
$this->link = new PDO($this->dsn, $this->username, $this->password);
}
public function __sleep()
{
return array('dsn', 'username', 'password');
}
public function __wakeup()
{
$this->connect();
}
}?>
```
### [\_\_serialize()](language.oop5.magic#object.serialize) and [\_\_unserialize()](language.oop5.magic#object.unserialize)
```
public __serialize(): array
```
```
public __unserialize(array $data): void
```
[serialize()](function.serialize) checks if the class has a function with the magic name [\_\_serialize()](language.oop5.magic#object.serialize). If so, that function is executed prior to any serialization. It must construct and return an associative array of key/value pairs that represent the serialized form of the object. If no array is returned a [TypeError](class.typeerror) will be thrown.
>
> **Note**:
>
>
> If both [\_\_serialize()](language.oop5.magic#object.serialize) and [\_\_sleep()](language.oop5.magic#object.sleep) are defined in the same object, only [\_\_serialize()](language.oop5.magic#object.serialize) will be called. [\_\_sleep()](language.oop5.magic#object.sleep) will be ignored. If the object implements the [Serializable](class.serializable) interface, the interface's `serialize()` method will be ignored and [\_\_serialize()](language.oop5.magic#object.serialize) used instead.
>
>
The intended use of [\_\_serialize()](language.oop5.magic#object.serialize) is to define a serialization-friendly arbitrary representation of the object. Elements of the array may correspond to properties of the object but that is not required.
Conversely, [unserialize()](function.unserialize) checks for the presence of a function with the magic name [\_\_unserialize()](language.oop5.magic#object.unserialize). If present, this function will be passed the restored array that was returned from [\_\_serialize()](language.oop5.magic#object.serialize). It may then restore the properties of the object from that array as appropriate.
>
> **Note**:
>
>
> If both [\_\_unserialize()](language.oop5.magic#object.unserialize) and [\_\_wakeup()](language.oop5.magic#object.wakeup) are defined in the same object, only [\_\_unserialize()](language.oop5.magic#object.unserialize) will be called. [\_\_wakeup()](language.oop5.magic#object.wakeup) will be ignored.
>
>
>
> **Note**:
>
>
> This feature is available as of PHP 7.4.0.
>
>
**Example #2 Serialize and unserialize**
```
<?php
class Connection
{
protected $link;
private $dsn, $username, $password;
public function __construct($dsn, $username, $password)
{
$this->dsn = $dsn;
$this->username = $username;
$this->password = $password;
$this->connect();
}
private function connect()
{
$this->link = new PDO($this->dsn, $this->username, $this->password);
}
public function __serialize(): array
{
return [
'dsn' => $this->dsn,
'user' => $this->username,
'pass' => $this->password,
];
}
public function __unserialize(array $data): void
{
$this->dsn = $data['dsn'];
$this->username = $data['user'];
$this->password = $data['pass'];
$this->connect();
}
}?>
```
### [\_\_toString()](language.oop5.magic#object.tostring)
```
public __toString(): string
```
The [\_\_toString()](language.oop5.magic#object.tostring) method allows a class to decide how it will react when it is treated like a string. For example, what `echo $obj;` will print.
**Warning** As of PHP 8.0.0, the return value follows standard PHP type semantics, meaning it will be coerced into a string if possible and if [strict typing](language.types.declarations#language.types.declarations.strict) is disabled.
As of PHP 8.0.0, any class that contains a [\_\_toString()](language.oop5.magic#object.tostring) method will also implicitly implement the [Stringable](class.stringable) interface, and will thus pass type checks for that interface. Explicitly implementing the interface anyway is recommended.
In PHP 7.4, the returned value *must* be a string, otherwise an [Error](class.error) is thrown.
Prior to PHP 7.4.0, the returned value *must* be a string, otherwise a fatal **`E_RECOVERABLE_ERROR`** is emitted.
**Warning** It was not possible to throw an exception from within a [\_\_toString()](language.oop5.magic#object.tostring) method prior to PHP 7.4.0. Doing so will result in a fatal error.
**Example #3 Simple example**
```
<?php
// Declare a simple class
class TestClass
{
public $foo;
public function __construct($foo)
{
$this->foo = $foo;
}
public function __toString()
{
return $this->foo;
}
}
$class = new TestClass('Hello');
echo $class;
?>
```
The above example will output:
```
Hello
```
### [\_\_invoke()](language.oop5.magic#object.invoke)
```
__invoke( ...$values): mixed
```
The [\_\_invoke()](language.oop5.magic#object.invoke) method is called when a script tries to call an object as a function.
**Example #4 Using [\_\_invoke()](language.oop5.magic#object.invoke)**
```
<?php
class CallableClass
{
public function __invoke($x)
{
var_dump($x);
}
}
$obj = new CallableClass;
$obj(5);
var_dump(is_callable($obj));
?>
```
The above example will output:
```
int(5)
bool(true)
```
**Example #5 Using [\_\_invoke()](language.oop5.magic#object.invoke)**
```
<?php
class Sort
{
private $key;
public function __construct(string $key)
{
$this->key = $key;
}
public function __invoke(array $a, array $b): int
{
return $a[$this->key] <=> $b[$this->key];
}
}
$customers = [
['id' => 1, 'first_name' => 'John', 'last_name' => 'Do'],
['id' => 3, 'first_name' => 'Alice', 'last_name' => 'Gustav'],
['id' => 2, 'first_name' => 'Bob', 'last_name' => 'Filipe']
];
// sort customers by first name
usort($customers, new Sort('first_name'));
print_r($customers);
// sort customers by last name
usort($customers, new Sort('last_name'));
print_r($customers);
?>
```
The above example will output:
```
Array
(
[0] => Array
(
[id] => 3
[first_name] => Alice
[last_name] => Gustav
)
[1] => Array
(
[id] => 2
[first_name] => Bob
[last_name] => Filipe
)
[2] => Array
(
[id] => 1
[first_name] => John
[last_name] => Do
)
)
Array
(
[0] => Array
(
[id] => 1
[first_name] => John
[last_name] => Do
)
[1] => Array
(
[id] => 2
[first_name] => Bob
[last_name] => Filipe
)
[2] => Array
(
[id] => 3
[first_name] => Alice
[last_name] => Gustav
)
)
```
### [\_\_set\_state()](language.oop5.magic#object.set-state)
```
static __set_state(array $properties): object
```
This [static](language.oop5.static) method is called for classes exported by [var\_export()](function.var-export).
The only parameter of this method is an array containing exported properties in the form `['property' => value, ...]`.
**Example #6 Using [\_\_set\_state()](language.oop5.magic#object.set-state)**
```
<?php
class A
{
public $var1;
public $var2;
public static function __set_state($an_array)
{
$obj = new A;
$obj->var1 = $an_array['var1'];
$obj->var2 = $an_array['var2'];
return $obj;
}
}
$a = new A;
$a->var1 = 5;
$a->var2 = 'foo';
$b = var_export($a, true);
var_dump($b);
eval('$c = ' . $b . ';');
var_dump($c);
?>
```
The above example will output:
```
string(60) "A::__set_state(array(
'var1' => 5,
'var2' => 'foo',
))"
object(A)#2 (2) {
["var1"]=>
int(5)
["var2"]=>
string(3) "foo"
}
```
> **Note**: When exporting an object, [var\_export()](function.var-export) does not check whether [\_\_set\_state()](language.oop5.magic#object.set-state) is implemented by the object's class, so re-importing objects will result in an [Error](class.error) exception, if \_\_set\_state() is not implemented. Particularly, this affects some internal classes. It is the responsibility of the programmer to verify that only objects will be re-imported, whose class implements \_\_set\_state().
>
>
### [\_\_debugInfo()](language.oop5.magic#object.debuginfo)
```
__debugInfo(): array
```
This method is called by [var\_dump()](function.var-dump) when dumping an object to get the properties that should be shown. If the method isn't defined on an object, then all public, protected and private properties will be shown.
**Example #7 Using [\_\_debugInfo()](language.oop5.magic#object.debuginfo)**
```
<?php
class C {
private $prop;
public function __construct($val) {
$this->prop = $val;
}
public function __debugInfo() {
return [
'propSquared' => $this->prop ** 2,
];
}
}
var_dump(new C(42));
?>
```
The above example will output:
```
object(C)#1 (1) {
["propSquared"]=>
int(1764)
}
```
php IntlBreakIterator::setText IntlBreakIterator::setText
==========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlBreakIterator::setText — Set the text being scanned
### Description
```
public IntlBreakIterator::setText(string $text): ?bool
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`text`
### Return Values
php Imagick::randomThresholdImage Imagick::randomThresholdImage
=============================
(PECL imagick 2, PECL imagick 3)
Imagick::randomThresholdImage — Creates a high-contrast, two-color image
### Description
```
public Imagick::randomThresholdImage(float $low, float $high, int $channel = Imagick::CHANNEL_DEFAULT): bool
```
Changes the value of individual pixels based on the intensity of each pixel compared to threshold. The result is a high-contrast, two color image. This method is available if Imagick has been compiled against ImageMagick version 6.2.9 or newer.
### Parameters
`low`
The low point
`high`
The high point
`channel`
Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channeltype constants using bitwise operators. Refer to this list of [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel).
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::randomThresholdImage()****
```
<?php
function randomThresholdimage($imagePath, $lowThreshold, $highThreshold, $channel) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->randomThresholdimage(
$lowThreshold * \Imagick::getQuantum(),
$highThreshold * \Imagick::getQuantum(),
$channel
);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php utf8_decode utf8\_decode
============
(PHP 4, PHP 5, PHP 7, PHP 8)
utf8\_decode — Converts a string from UTF-8 to ISO-8859-1, replacing invalid or unrepresentable characters
**Warning**This function has been *DEPRECATED* as of PHP 8.2.0. Relying on this function is highly discouraged.
### Description
```
utf8_decode(string $string): string
```
This function converts the string `string` from the `UTF-8` encoding to `ISO-8859-1`. Bytes in the string which are not valid `UTF-8`, and `UTF-8` characters which do not exist in `ISO-8859-1` (that is, code points above `U+00FF`) are replaced with `?`.
>
> **Note**:
>
>
> Many web pages marked as using the `ISO-8859-1` character encoding actually use the similar `Windows-1252` encoding, and web browsers will interpret `ISO-8859-1` web pages as `Windows-1252`. `Windows-1252` features additional printable characters, such as the Euro sign (`€`) and curly quotes (`“` `”`), instead of certain `ISO-8859-1` control characters. This function will not convert such `Windows-1252` characters correctly. Use a different function if `Windows-1252` conversion is required.
>
>
### Parameters
`string`
A UTF-8 encoded string.
### Return Values
Returns the ISO-8859-1 translation of `string`.
### Changelog
| Version | Description |
| --- | --- |
| 8.2.0 | This function has been deprecated. |
| 7.2.0 | This function has been moved from the XML extension to the core of PHP. In previous versions, it was only available if the XML extension was installed. |
### Examples
**Example #1 Basic examples**
```
<?php
// Convert the string 'Zoë' from UTF-8 to ISO 8859-1
$utf8_string = "\x5A\x6F\xC3\xAB";
$iso8859_1_string = utf8_decode($utf8_string);
echo bin2hex($iso8859_1_string), "\n";
// Invalid UTF-8 sequences are replaced with '?'
$invalid_utf8_string = "\xC3";
$iso8859_1_string = utf8_decode($invalid_utf8_string);
var_dump($iso8859_1_string);
// Characters which don't exist in ISO 8859-1, such as
// '€' (Euro Sign) are also replaced with '?'
$utf8_string = "\xE2\x82\xAC";
$iso8859_1_string = utf8_decode($utf8_string);
var_dump($iso8859_1_string);
?>
```
The above example will output:
```
5a6feb
string(1) "?"
string(1) "?"
```
### See Also
* [utf8\_encode()](function.utf8-encode) - Converts a string from ISO-8859-1 to UTF-8
* [mb\_convert\_encoding()](function.mb-convert-encoding) - Convert a string from one character encoding to another
* [UConverter::transcode()](uconverter.transcode) - Convert a string from one character encoding to another
* [iconv()](function.iconv) - Convert a string from one character encoding to another
| programming_docs |
php ReflectionProperty::isProtected ReflectionProperty::isProtected
===============================
(PHP 5, PHP 7, PHP 8)
ReflectionProperty::isProtected — Checks if property is protected
### Description
```
public ReflectionProperty::isProtected(): bool
```
Checks whether the property is protected.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the property is protected, **`false`** otherwise.
### See Also
* [ReflectionProperty::isPublic()](reflectionproperty.ispublic) - Checks if property is public
* [ReflectionProperty::isPrivate()](reflectionproperty.isprivate) - Checks if property is private
* [ReflectionProperty::isReadOnly()](reflectionproperty.isreadonly) - Checks if property is readonly
* [ReflectionProperty::isStatic()](reflectionproperty.isstatic) - Checks if property is static
php ImagickDraw::pathEllipticArcAbsolute ImagickDraw::pathEllipticArcAbsolute
====================================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::pathEllipticArcAbsolute — Draws an elliptical arc
### Description
```
public ImagickDraw::pathEllipticArcAbsolute(
float $rx,
float $ry,
float $x_axis_rotation,
bool $large_arc_flag,
bool $sweep_flag,
float $x,
float $y
): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Draws an elliptical arc from the current point to (x, y) using absolute coordinates. The size and orientation of the ellipse are defined by two radii (rx, ry) and an xAxisRotation, which indicates how the ellipse as a whole is rotated relative to the current coordinate system. The center (cx, cy) of the ellipse is calculated automatically to satisfy the constraints imposed by the other parameters. largeArcFlag and sweepFlag contribute to the automatic calculations and help determine how the arc is drawn. If `large_arc_flag` is **`true`** then draw the larger of the available arcs. If `sweep_flag` is true, then draw the arc matching a clock-wise rotation.
### Parameters
`rx`
x radius
`ry`
y radius
`x_axis_rotation`
x axis rotation
`large_arc_flag`
large arc flag
`sweep_flag`
sweep flag
`x`
x coordinate
`y`
y coordinate
### Return Values
No value is returned.
php ReflectionClassConstant::getAttributes ReflectionClassConstant::getAttributes
======================================
(PHP 8)
ReflectionClassConstant::getAttributes — Gets Attributes
### Description
```
public ReflectionClassConstant::getAttributes(?string $name = null, int $flags = 0): array
```
Returns all attributes declared on this class constant as an array of [ReflectionAttribute](class.reflectionattribute).
### Parameters
`name`
`flags`
### Return Values
Array of attributes, as a [ReflectionAttribute](class.reflectionattribute) object.
### See Also
* [ReflectionClass::getAttributes()](reflectionclass.getattributes) - Gets Attributes
* [ReflectionFunctionAbstract::getAttributes()](reflectionfunctionabstract.getattributes) - Gets Attributes
* [ReflectionParameter::getAttributes()](reflectionparameter.getattributes) - Gets Attributes
* [ReflectionProperty::getAttributes()](reflectionproperty.getattributes) - Gets Attributes
php array_merge array\_merge
============
(PHP 4, PHP 5, PHP 7, PHP 8)
array\_merge — Merge one or more arrays
### Description
```
array_merge(array ...$arrays): array
```
Merges the elements of one or more arrays together so that the values of one are appended to the end of the previous one. It returns the resulting array.
If the input arrays have the same string keys, then the later value for that key will overwrite the previous one. If, however, the arrays contain numeric keys, the later value will *not* overwrite the original value, but will be appended.
Values in the input arrays with numeric keys will be renumbered with incrementing keys starting from zero in the result array.
### Parameters
`arrays`
Variable list of arrays to merge.
### Return Values
Returns the resulting array. If called without any arguments, returns an empty array.
### Changelog
| Version | Description |
| --- | --- |
| 7.4.0 | This function can now be called without any parameter. Formerly, at least one parameter has been required. |
### Examples
**Example #1 **array\_merge()** example**
```
<?php
$array1 = array("color" => "red", 2, 4);
$array2 = array("a", "b", "color" => "green", "shape" => "trapezoid", 4);
$result = array_merge($array1, $array2);
print_r($result);
?>
```
The above example will output:
```
Array
(
[color] => green
[0] => 2
[1] => 4
[2] => a
[3] => b
[shape] => trapezoid
[4] => 4
)
```
**Example #2 Simple **array\_merge()** example**
```
<?php
$array1 = array();
$array2 = array(1 => "data");
$result = array_merge($array1, $array2);
?>
```
Don't forget that numeric keys will be renumbered!
```
Array
(
[0] => data
)
```
If you want to append array elements from the second array to the first array while not overwriting the elements from the first array and not re-indexing, use the `+` array union operator:
```
<?php
$array1 = array(0 => 'zero_a', 2 => 'two_a', 3 => 'three_a');
$array2 = array(1 => 'one_b', 3 => 'three_b', 4 => 'four_b');
$result = $array1 + $array2;
var_dump($result);
?>
```
The keys from the first array will be preserved. If an array key exists in both arrays, then the element from the first array will be used and the matching key's element from the second array will be ignored.
```
array(5) {
[0]=>
string(6) "zero_a"
[2]=>
string(5) "two_a"
[3]=>
string(7) "three_a"
[1]=>
string(5) "one_b"
[4]=>
string(6) "four_b"
}
```
**Example #3 **array\_merge()** with non-array types**
```
<?php
$beginning = 'foo';
$end = array(1 => 'bar');
$result = array_merge((array)$beginning, (array)$end);
print_r($result);
?>
```
The above example will output:
```
Array
(
[0] => foo
[1] => bar
)
```
### See Also
* [array\_merge\_recursive()](function.array-merge-recursive) - Merge one or more arrays recursively
* [array\_replace()](function.array-replace) - Replaces elements from passed arrays into the first array
* [array\_combine()](function.array-combine) - Creates an array by using one array for keys and another for its values
* [array operators](language.operators.array)
php The IntlTimeZone class
The IntlTimeZone class
======================
Introduction
------------
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
Class synopsis
--------------
class **IntlTimeZone** { /\* Constants \*/ const int [DISPLAY\_SHORT](class.intltimezone#intltimezone.constants.display-short) = 1;
const int [DISPLAY\_LONG](class.intltimezone#intltimezone.constants.display-long) = 2; /\* Methods \*/ private [\_\_construct](intltimezone.construct)()
```
public static countEquivalentIDs(string $timezoneId): int|false
```
```
public static createDefault(): IntlTimeZone
```
```
public static createEnumeration(IntlTimeZone|string|int|float|null $countryOrRawOffset = null): IntlIterator|false
```
```
public static createTimeZone(string $timezoneId): ?IntlTimeZone
```
```
public static createTimeZoneIDEnumeration(int $type, ?string $region = null, ?int $rawOffset = null): IntlIterator|false
```
```
public static fromDateTimeZone(DateTimeZone $timezone): ?IntlTimeZone
```
```
public static getCanonicalID(string $timezoneId, bool &$isSystemId = null): string|false
```
```
public getDisplayName(bool $dst = false, int $style = IntlTimeZone::DISPLAY_LONG, ?string $locale = null): string|false
```
```
public getDSTSavings(): int
```
```
public static getEquivalentID(string $timezoneId, int $offset): string|false
```
```
public getErrorCode(): int|false
```
```
public getErrorMessage(): string|false
```
```
public static getGMT(): IntlTimeZone
```
```
public getID(): string|false
```
```
public static getIDForWindowsID(string $timezoneId, ?string $region = null): string|false
```
```
public getOffset(
float $timestamp,
bool $local,
int &$rawOffset,
int &$dstOffset
): bool
```
```
public getRawOffset(): int
```
```
public static getRegion(string $timezoneId): string|false
```
```
public static getTZDataVersion(): string|false
```
```
public static getUnknown(): IntlTimeZone
```
```
public static getWindowsID(string $timezoneId): string|false
```
```
public hasSameRules(IntlTimeZone $other): bool
```
```
public toDateTimeZone(): DateTimeZone|false
```
```
public useDaylightTime(): bool
```
} Predefined Constants
--------------------
**`IntlTimeZone::DISPLAY_SHORT`** **`IntlTimeZone::DISPLAY_LONG`** Table of Contents
-----------------
* [IntlTimeZone::\_\_construct](intltimezone.construct) — Private constructor to disallow direct instantiation
* [IntlTimeZone::countEquivalentIDs](intltimezone.countequivalentids) — Get the number of IDs in the equivalency group that includes the given ID
* [IntlTimeZone::createDefault](intltimezone.createdefault) — Create a new copy of the default timezone for this host
* [IntlTimeZone::createEnumeration](intltimezone.createenumeration) — Get an enumeration over time zone IDs associated with the given country or offset
* [IntlTimeZone::createTimeZone](intltimezone.createtimezone) — Create a timezone object for the given ID
* [IntlTimeZone::createTimeZoneIDEnumeration](intltimezone.createtimezoneidenumeration) — Get an enumeration over system time zone IDs with the given filter conditions
* [IntlTimeZone::fromDateTimeZone](intltimezone.fromdatetimezone) — Create a timezone object from DateTimeZone
* [IntlTimeZone::getCanonicalID](intltimezone.getcanonicalid) — Get the canonical system timezone ID or the normalized custom time zone ID for the given time zone ID
* [IntlTimeZone::getDisplayName](intltimezone.getdisplayname) — Get a name of this time zone suitable for presentation to the user
* [IntlTimeZone::getDSTSavings](intltimezone.getdstsavings) — Get the amount of time to be added to local standard time to get local wall clock time
* [IntlTimeZone::getEquivalentID](intltimezone.getequivalentid) — Get an ID in the equivalency group that includes the given ID
* [IntlTimeZone::getErrorCode](intltimezone.geterrorcode) — Get last error code on the object
* [IntlTimeZone::getErrorMessage](intltimezone.geterrormessage) — Get last error message on the object
* [IntlTimeZone::getGMT](intltimezone.getgmt) — Create GMT (UTC) timezone
* [IntlTimeZone::getID](intltimezone.getid) — Get timezone ID
* [IntlTimeZone::getIDForWindowsID](intltimezone.getidforwindowsid) — Translate a Windows timezone into a system timezone
* [IntlTimeZone::getOffset](intltimezone.getoffset) — Get the time zone raw and GMT offset for the given moment in time
* [IntlTimeZone::getRawOffset](intltimezone.getrawoffset) — Get the raw GMT offset (before taking daylight savings time into account
* [IntlTimeZone::getRegion](intltimezone.getregion) — Get the region code associated with the given system time zone ID
* [IntlTimeZone::getTZDataVersion](intltimezone.gettzdataversion) — Get the timezone data version currently used by ICU
* [IntlTimeZone::getUnknown](intltimezone.getunknown) — Get the "unknown" time zone
* [IntlTimeZone::getWindowsID](intltimezone.getwindowsid) — Translate a system timezone into a Windows timezone
* [IntlTimeZone::hasSameRules](intltimezone.hassamerules) — Check if this zone has the same rules and offset as another zone
* [IntlTimeZone::toDateTimeZone](intltimezone.todatetimezone) — Convert to DateTimeZone object
* [IntlTimeZone::useDaylightTime](intltimezone.usedaylighttime) — Check if this time zone uses daylight savings time
php DateTimeInterface::diff DateTimeInterface::diff
=======================
DateTimeImmutable::diff
=======================
DateTime::diff
==============
date\_diff
==========
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
DateTimeInterface::diff -- DateTimeImmutable::diff -- DateTime::diff -- date\_diff — Returns the difference between two DateTime objects
### Description
Object-oriented style
```
public DateTimeInterface::diff(DateTimeInterface $targetObject, bool $absolute = false): DateInterval
```
```
public DateTimeImmutable::diff(DateTimeInterface $targetObject, bool $absolute = false): DateInterval
```
```
public DateTime::diff(DateTimeInterface $targetObject, bool $absolute = false): DateInterval
```
Procedural style
```
date_diff(DateTimeInterface $baseObject, DateTimeInterface $targetObject, bool $absolute = false): DateInterval
```
Returns the difference between two [DateTimeInterface](class.datetimeinterface) objects.
### Parameters
`datetime`
The date to compare to.
`absolute`
Should the interval be forced to be positive?
### Return Values
The [DateInterval](class.dateinterval) object represents the difference between the two dates.
The return value more specifically represents the clock-time interval to apply to the original object (`$this` or `$originObject`) to arrive at the `$targetObject`. This process is not always reversible.
The method is aware of DST changeovers, and hence can return an interval of `24 hours and 30 minutes`, as per one of the examples. If you want to calculate with absolute time, you need to convert both the `$this`/`$baseObject`, and `$targetObject` to UTC first.
### Examples
**Example #1 **DateTimeImmutable::diff()** example**
Object-oriented style
```
<?php
$origin = new DateTimeImmutable('2009-10-11');
$target = new DateTimeImmutable('2009-10-13');
$interval = $origin->diff($target);
echo $interval->format('%R%a days');
?>
```
Procedural style
```
<?php
$origin = date_create('2009-10-11');
$target = date_create('2009-10-13');
$interval = date_diff($origin, $target);
echo $interval->format('%R%a days');
?>
```
The above examples will output:
```
+2 days
```
**Example #2 **DateTimeInterface::diff()** during DST changeover**
```
<?php
$originalTime = new DateTimeImmutable("2021-10-30 09:00:00 Europe/London");
$targedTime = new DateTimeImmutable("2021-10-31 08:30:00 Europe/London");
$interval = $originalTime->diff($targedTime);
echo $interval->format("%H:%I:%S (Full days: %a)"), "\n";
?>
```
The above example will output:
```
24:30:00 (Full days: 0)
```
**Example #3 [DateTime](class.datetime) object comparison**
>
> **Note**:
>
>
> [DateTimeImmutable](class.datetimeimmutable) and [DateTime](class.datetime) objects can be compared using [comparison operators](language.operators.comparison).
>
>
```
<?php
$date1 = new DateTime("now");
$date2 = new DateTime("tomorrow");
var_dump($date1 == $date2);
var_dump($date1 < $date2);
var_dump($date1 > $date2);
?>
```
The above example will output:
```
bool(false)
bool(true)
bool(false)
```
### See Also
* [DateInterval::format()](dateinterval.format) - Formats the interval
* [DateTime::add()](datetime.add) - Modifies a DateTime object, with added amount of days, months, years, hours, minutes and seconds
* [DateTime::sub()](datetime.sub) - Subtracts an amount of days, months, years, hours, minutes and seconds from a DateTime object
php Ds\Deque::reduce Ds\Deque::reduce
================
(PECL ds >= 1.0.0)
Ds\Deque::reduce — Reduces the deque to a single value using a callback function
### Description
```
public Ds\Deque::reduce(callable $callback, mixed $initial = ?): mixed
```
Reduces the deque to a single value using a callback function.
### Parameters
`callback`
```
callback(mixed $carry, mixed $value): mixed
```
`carry`
The return value of the previous callback, or `initial` if it's the first iteration.
`value`
The value of the current iteration.
`initial`
The initial value of the carry value. Can be **`null`**.
### Return Values
The return value of the final callback.
### Examples
**Example #1 **Ds\Deque::reduce()** with initial value example**
```
<?php
$deque = new \Ds\Deque([1, 2, 3]);
$callback = function($carry, $value) {
return $carry * $value;
};
var_dump($deque->reduce($callback, 5));
// Iterations:
//
// $carry = $initial = 5
//
// $carry = $carry * 1 = 5
// $carry = $carry * 2 = 10
// $carry = $carry * 3 = 30
?>
```
The above example will output something similar to:
```
int(30)
```
**Example #2 **Ds\Deque::reduce()** without an initial value example**
```
<?php
$deque = new \Ds\Deque([1, 2, 3]);
var_dump($deque->reduce(function($carry, $value) {
return $carry + $value + 5;
}));
// Iterations:
//
// $carry = $initial = null
//
// $carry = $carry + 1 + 5 = 6
// $carry = $carry + 2 + 5 = 13
// $carry = $carry + 3 + 5 = 21
?>
```
The above example will output something similar to:
```
int(21)
```
php chdir chdir
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
chdir — Change directory
### Description
```
chdir(string $directory): bool
```
Changes PHP's current directory to `directory`.
### Parameters
`directory`
The new current directory
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
Throws an error of level **`E_WARNING`** on failure.
### Examples
**Example #1 **chdir()** example**
```
<?php
// current directory
echo getcwd() . "\n";
chdir('public_html');
// current directory
echo getcwd() . "\n";
?>
```
The above example will output something similar to:
```
/home/vincent
/home/vincent/public_html
```
### Notes
**Caution** If the PHP interpreter has been built with ZTS (Zend Thread Safety) enabled, any changes to the current directory made through **chdir()** will be invisible to the operating system. All built-in PHP functions will still respect the change in current directory; but external library functions called using [FFI](https://www.php.net/manual/en/book.ffi.php) will not. You can tell whether your copy of PHP was built with ZTS enabled using **php -i** or the built-in constant **`PHP_ZTS`**.
### See Also
* [getcwd()](function.getcwd) - Gets the current working directory
php EventHttpRequest::getHost EventHttpRequest::getHost
=========================
(PECL event >= 1.4.0-beta)
EventHttpRequest::getHost — Returns the request host
### Description
```
public EventHttpRequest::getHost(): string
```
Returns the request host.
### Parameters
This function has no parameters.
### Return Values
Returns the request host.
### See Also
* [EventHttpRequest::getUri()](eventhttprequest.geturi) - Returns the request URI
* [EventHttpRequest::getCommand()](eventhttprequest.getcommand) - Returns the request command(method)
php IntlChar::charAge IntlChar::charAge
=================
(PHP 7, PHP 8)
IntlChar::charAge — Get the "age" of the code point
### Description
```
public static IntlChar::charAge(int|string $codepoint): ?array
```
Gets the "age" of the code point.
The "age" is the Unicode version when the code point was first designated (as a non-character or for Private Use) or assigned a character. This can be useful to avoid emitting code points to receiving processes that do not accept newer characters.
### Parameters
`codepoint`
The int codepoint value (e.g. `0x2603` for *U+2603 SNOWMAN*), or the character encoded as a UTF-8 string (e.g. `"\u{2603}"`)
### Return Values
The Unicode version number, as an array. For example, version *1.3.31.2* would be represented as `[1, 3, 31, 2]`. Returns **`null`** on failure.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::charage("\u{2603}"));
var_dump(IntlChar::charage("\u{1F576}"));
?>
```
The above example will output:
```
array(4) {
[0]=>
int(1)
[1]=>
int(1)
[2]=>
int(0)
[3]=>
int(0)
}
array(4) {
[0]=>
int(7)
[1]=>
int(0)
[2]=>
int(0)
[3]=>
int(0)
}
```
### See Also
* [IntlChar::getUnicodeVersion()](intlchar.getunicodeversion) - Get the Unicode version
* [IntlChar::getIntPropertyMinValue()](intlchar.getintpropertyminvalue) - Get the min value for a Unicode property
* [IntlChar::getIntPropertyValue()](intlchar.getintpropertyvalue) - Get the value for a Unicode property for a code point
| programming_docs |
php ssdeep_fuzzy_hash ssdeep\_fuzzy\_hash
===================
(PECL ssdeep >= 1.0.0)
ssdeep\_fuzzy\_hash — Create a fuzzy hash from a string
### Description
```
ssdeep_fuzzy_hash(string $to_hash): string
```
**ssdeep\_fuzzy\_hash()** calculates the hash of `to_hash` using [» context-triggered piecewise hashing](http://dfrws.org/2006/proceedings/12-Kornblum.pdf), and returns that hash.
### Parameters
`to_hash`
The input string.
### Return Values
Returns a string on success, **`false`** otherwise.
php ReflectionMethod::isPrivate ReflectionMethod::isPrivate
===========================
(PHP 5, PHP 7, PHP 8)
ReflectionMethod::isPrivate — Checks if method is private
### Description
```
public ReflectionMethod::isPrivate(): bool
```
Checks if the method is private.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the method is private, otherwise **`false`**
### See Also
* [ReflectionMethod::isPublic()](reflectionmethod.ispublic) - Checks if method is public
php gmp_mod gmp\_mod
========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_mod — Modulo operation
### Description
```
gmp_mod(GMP|int|string $num1, GMP|int|string $num2): GMP
```
Calculates `num1` modulo `num2`. The result is always non-negative, the sign of `num2` is ignored.
### Parameters
`num1`
A [GMP](class.gmp) object, an int or a numeric string.
`num2`
The modulo that is being evaluated.
A [GMP](class.gmp) object, an int or a numeric string.
### Return Values
A [GMP](class.gmp) object.
### Examples
**Example #1 **gmp\_mod()** example**
```
<?php
$mod = gmp_mod("8", "3");
echo gmp_strval($mod) . "\n";
?>
```
The above example will output:
```
2
```
php xhprof_sample_enable xhprof\_sample\_enable
======================
(PECL xhprof >= 0.9.0)
xhprof\_sample\_enable — Start XHProf profiling in sampling mode
### Description
```
xhprof_sample_enable(): void
```
Starts profiling in sample mode, which is a lighter weight version of [xhprof\_enable()](function.xhprof-enable). The sampling interval is 0.1 seconds, and samples record the full function call stack. The main use case is when lower overhead is required when doing performance monitoring and diagnostics.
### Parameters
This function has no parameters.
### Return Values
**`null`**
### See Also
* [xhprof\_sample\_disable()](function.xhprof-sample-disable) - Stops xhprof sample profiler
* [xhprof\_enable()](function.xhprof-enable) - Start xhprof profiler
* [memory\_get\_usage()](function.memory-get-usage) - Returns the amount of memory allocated to PHP
* [getrusage()](function.getrusage) - Gets the current resource usages
php apcu_dec apcu\_dec
=========
(PECL apcu >= 4.0.0)
apcu\_dec — Decrease a stored number
### Description
```
apcu_dec(
string $key,
int $step = 1,
bool &$success = ?,
int $ttl = 0
): int|false
```
Decreases a stored integer value.
### Parameters
`key`
The key of the value being decreased.
`step`
The step, or value to decrease.
`success`
Optionally pass the success or fail boolean value to this referenced variable.
`ttl`
TTL to use if the operation inserts a new value (rather than decrementing an existing one).
### Return Values
Returns the current value of `key`'s value on success, or **`false`** on failure
### Examples
**Example #1 **apcu\_dec()** example**
```
<?php
echo "Let's do something with success", PHP_EOL;
apcu_store('anumber', 42);
echo apcu_fetch('anumber'), PHP_EOL;
echo apcu_dec('anumber'), PHP_EOL;
echo apcu_dec('anumber', 10), PHP_EOL;
echo apcu_dec('anumber', 10, $success), PHP_EOL;
var_dump($success);
echo "Now, let's fail", PHP_EOL, PHP_EOL;
apcu_store('astring', 'foo');
$ret = apcu_dec('astring', 1, $fail);
var_dump($ret);
var_dump($fail);
?>
```
The above example will output something similar to:
```
Let's do something with success
42
41
31
21
bool(true)
Now, let's fail
bool(false)
bool(false)
```
### See Also
* [apcu\_inc()](function.apcu-inc) - Increase a stored number
php Fiber::getReturn Fiber::getReturn
================
(PHP 8 >= 8.1.0)
Fiber::getReturn — Gets the value returned by the Fiber
### Description
```
public Fiber::getReturn(): mixed
```
### Parameters
This function has no parameters.
### Return Values
Returns the value returned by the [callable](language.types.callable) provided to [Fiber::\_\_construct()](fiber.construct). If the fiber has not returned a value, either because it has not been started, has not terminated, or threw an exception, a [FiberError](class.fibererror) will be thrown.
php Imagick::setImageBias Imagick::setImageBias
=====================
(PECL imagick 2, PECL imagick 3)
Imagick::setImageBias — Sets the image bias for any method that convolves an image
**Warning**This function has been *DEPRECATED* as of Imagick 3.4.4. Relying on this function is highly discouraged.
### Description
```
public Imagick::setImageBias(float $bias): bool
```
Sets the image bias for any method that convolves an image (e.g. Imagick::ConvolveImage()).
### Parameters
`bias`
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::setImageBias()****
```
<?php
//requires ImageMagick version 6.9.0-1 to have an effect on convolveImage
function setImageBias($bias) {
$imagick = new \Imagick(realpath("images/stack.jpg"));
$xKernel = array(
-0.70, 0, 0.70,
-0.70, 0, 0.70,
-0.70, 0, 0.70
);
$imagick->setImageBias($bias * \Imagick::getQuantum());
$imagick->convolveImage($xKernel, \Imagick::CHANNEL_ALL);
$imagick->setImageFormat('png');
header('Content-type: image/png');
echo $imagick->getImageBlob();
}
?>
```
php IntlCalendar::toDateTime IntlCalendar::toDateTime
========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a2)
IntlCalendar::toDateTime — Convert an IntlCalendar into a DateTime object
### Description
Object-oriented style
```
public IntlCalendar::toDateTime(): DateTime|false
```
Procedural style
```
intlcal_to_date_time(IntlCalendar $calendar): DateTime|false
```
Create a [DateTime](class.datetime) object that represents the same instant (up to second precision, with a rounding error of less than 1 second) and has an analog timezone to this object (the difference being [DateTime](class.datetime)ʼs timezone will be backed by PHPʼs timezone while [IntlCalendar](class.intlcalendar)ʼs timezone is backed by ICUʼs).
### Parameters
`calendar`
An [IntlCalendar](class.intlcalendar) instance.
### Return Values
A [DateTime](class.datetime) object with the same timezone as this object (though using PHPʼs database instead of ICUʼs) and the same time, except for the smaller precision (second precision instead of millisecond). Returns **`false`** on failure.
### Examples
**Example #1 **IntlCalendar::toDateTime()****
```
<?php
ini_set('date.timezone', 'UTC');
ini_set('intl.default_locale', 'pt_PT');
$cal = IntlCalendar::createInstance('Europe/Lisbon'); //current time
$dt = $cal->toDateTime();
print_r($dt);
```
The above example will output:
```
DateTime Object
(
[date] => 2013-07-02 00:29:13
[timezone_type] => 3
[timezone] => Europe/Lisbon
)
```
### See Also
* [IntlCalendar::fromDateTime()](intlcalendar.fromdatetime) - Create an IntlCalendar from a DateTime object or string
* [IntlCalendar::getTime()](intlcalendar.gettime) - Get time currently represented by the object
* [IntlCalendar::createInstance()](intlcalendar.createinstance) - Create a new IntlCalendar
* [DateTime::\_\_construct()](datetime.construct) - Returns new DateTime object
php Gmagick::setsize Gmagick::setsize
================
(PECL gmagick >= Unknown)
Gmagick::setsize — Sets the size of the Gmagick object
### Description
```
public Gmagick::setsize(int $columns, int $rows): Gmagick
```
Sets the size of the Gmagick object. Set it before you read a raw image format such as **`Gmagick::COLORSPACE_RGB`**, **`Gmagick::COLORSPACE_GRAY`**, or **`Gmagick::COLORSPACE_CMYK`**.
### Parameters
`columns`
The width in pixels.
`rows`
The height in pixels.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php IntlTimeZone::createDefault IntlTimeZone::createDefault
===========================
intltz\_create\_default
=======================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlTimeZone::createDefault -- intltz\_create\_default — Create a new copy of the default timezone for this host
### Description
Object-oriented style (method):
```
public static IntlTimeZone::createDefault(): IntlTimeZone
```
Procedural style:
```
intltz_create_default(): IntlTimeZone
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php openssl_decrypt openssl\_decrypt
================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
openssl\_decrypt — Decrypts data
### Description
```
openssl_decrypt(
string $data,
string $cipher_algo,
string $passphrase,
int $options = 0,
string $iv = "",
?string $tag = null,
string $aad = ""
): string|false
```
Takes a raw or base64 encoded string and decrypts it using a given method and key.
### Parameters
`data`
The encrypted message to be decrypted.
`cipher_algo`
The cipher method. For a list of available cipher methods, use [openssl\_get\_cipher\_methods()](function.openssl-get-cipher-methods).
`passphrase`
The key.
`options`
`options` can be one of **`OPENSSL_RAW_DATA`**, **`OPENSSL_ZERO_PADDING`**.
`iv`
A non-NULL Initialization Vector.
`tag`
The authentication tag in AEAD cipher mode. If it is incorrect, the authentication fails and the function returns **`false`**.
**Caution** The length of the `tag` is not checked by the function. It is the caller's responsibility to ensure that the length of the tag matches the length of the tag retrieved when [openssl\_encrypt()](function.openssl-encrypt) has been called. Otherwise the decryption may succeed if the given tag only matches the start of the proper tag.
`aad`
Additional authenticated data.
### Return Values
The decrypted string on success or **`false`** on failure.
### Errors/Exceptions
Emits an **`E_WARNING`** level error if an unknown cipher algorithm is passed via the `cipher_algo` parameter.
Emits an **`E_WARNING`** level error if an empty value is passed in via the `iv` parameter.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | `tag` is now nullable. |
| 7.1.0 | The `tag` and `aad` parameters were added. |
### See Also
* [openssl\_encrypt()](function.openssl-encrypt) - Encrypts data
php ImagickDraw::getFontSize ImagickDraw::getFontSize
========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::getFontSize — Returns the font pointsize
### Description
```
public ImagickDraw::getFontSize(): float
```
**Warning**This function is currently not documented; only its argument list is available.
Returns the font pointsize used when annotating with text.
### Return Values
Returns the font size associated with the current [ImagickDraw](class.imagickdraw) object.
php ReflectionMethod::isPublic ReflectionMethod::isPublic
==========================
(PHP 5, PHP 7, PHP 8)
ReflectionMethod::isPublic — Checks if method is public
### Description
```
public ReflectionMethod::isPublic(): bool
```
Checks if the method is public.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the method is public, otherwise **`false`**
### See Also
* [ReflectionMethod::isPrivate()](reflectionmethod.isprivate) - Checks if method is private
php sqlsrv_has_rows sqlsrv\_has\_rows
=================
(No version information available, might only be in Git)
sqlsrv\_has\_rows — Indicates whether the specified statement has rows
### Description
```
sqlsrv_has_rows(resource $stmt): bool
```
Indicates whether the specified statement has rows.
### Parameters
`stmt`
A statement resource returned by [sqlsrv\_query()](function.sqlsrv-query) or [sqlsrv\_execute()](function.sqlsrv-execute).
### Return Values
Returns **`true`** if the specified statement has rows and **`false`** if the statement does not have rows or if an error occurred.
### Examples
**Example #1 **sqlsrv\_has\_rows()** example**
```
<?php
$server = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password" );
$conn = sqlsrv_connect( $server, $connectionInfo );
$stmt = sqlsrv_query( $conn, "SELECT * FROM Table_1");
if ($stmt) {
$rows = sqlsrv_has_rows( $stmt );
if ($rows === true)
echo "There are rows. <br />";
else
echo "There are no rows. <br />";
}
?>
```
### See Also
* [sqlsrv\_num\_rows()](function.sqlsrv-num-rows) - Retrieves the number of rows in a result set
* [sqlsrv\_query()](function.sqlsrv-query) - Prepares and executes a query
php ldap_t61_to_8859 ldap\_t61\_to\_8859
===================
(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)
ldap\_t61\_to\_8859 — Translate t61 characters to 8859 characters
### Description
```
ldap_t61_to_8859(string $value): string|false
```
**Warning**This function is currently not documented; only its argument list is available.
php Imagick::setImageRedPrimary Imagick::setImageRedPrimary
===========================
(PECL imagick 2, PECL imagick 3)
Imagick::setImageRedPrimary — Sets the image chromaticity red primary point
### Description
```
public Imagick::setImageRedPrimary(float $x, float $y): bool
```
Sets the image chromaticity red primary point.
### Parameters
`x`
`y`
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
php mcrypt_get_iv_size mcrypt\_get\_iv\_size
=====================
(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mcrypt\_get\_iv\_size — Returns the size of the IV belonging to a specific cipher/mode combination
**Warning**This function has been *DEPRECATED* as of PHP 7.1.0 and *REMOVED* as of PHP 7.2.0. Relying on this function is highly discouraged.
### Description
```
mcrypt_get_iv_size(string $cipher, string $mode): int
```
Gets the size of the IV belonging to a specific `cipher`/`mode` combination.
It is more useful to use the [mcrypt\_enc\_get\_iv\_size()](function.mcrypt-enc-get-iv-size) function as this uses the resource returned by [mcrypt\_module\_open()](function.mcrypt-module-open).
### Parameters
`cipher`
One of the **`MCRYPT_ciphername`** constants, or the name of the algorithm as string.
`mode`
One of the **`MCRYPT_MODE_modename`** constants, or one of the following strings: "ecb", "cbc", "cfb", "ofb", "nofb" or "stream".
The IV is ignored in ECB mode as this mode does not require it. You will need to have the same IV (think: starting point) both at encryption and decryption stages, otherwise your encryption will fail.
### Return Values
Returns the size of the Initialization Vector (IV) in bytes. On error the function returns **`false`**. If the IV is ignored in the specified cipher/mode combination zero is returned.
### Examples
**Example #1 **mcrypt\_get\_iv\_size()** Example**
```
<?php
echo mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_CFB) . "\n";
echo mcrypt_get_iv_size('des', 'ecb') . "\n";
?>
```
### See Also
* [mcrypt\_get\_block\_size()](function.mcrypt-get-block-size) - Gets the block size of the specified cipher
* [mcrypt\_enc\_get\_iv\_size()](function.mcrypt-enc-get-iv-size) - Returns the size of the IV of the opened algorithm
* [mcrypt\_create\_iv()](function.mcrypt-create-iv) - Creates an initialization vector (IV) from a random source
php SolrQuery::addMltField SolrQuery::addMltField
======================
(PECL solr >= 0.9.2)
SolrQuery::addMltField — Sets a field to use for similarity
### Description
```
public SolrQuery::addMltField(string $field): SolrQuery
```
Maps to mlt.fl. It specifies that a field should be used for similarity.
### Parameters
`field`
The name of the field
### Return Values
Returns the current SolrQuery object, if the return value is used.
php Ds\Deque::rotate Ds\Deque::rotate
================
(PECL ds >= 1.0.0)
Ds\Deque::rotate — Rotates the deque by a given number of rotations
### Description
```
public Ds\Deque::rotate(int $rotations): void
```
Rotates the deque by a given number of rotations, which is equivalent to successively calling `$deque->push($deque->shift())` if the number of rotations is positive, or `$deque->unshift($deque->pop())` if negative.
### Parameters
`rotations`
The number of times the deque should be rotated.
### Return Values
No value is returned.. The deque of the current instance will be rotated.
### Examples
**Example #1 **Ds\Deque::rotate()** example**
```
<?php
$deque = new \Ds\Deque(["a", "b", "c", "d"]);
$deque->rotate(1); // "a" is shifted, then pushed.
print_r($deque);
$deque->rotate(2); // "b" and "c" are both shifted, the pushed.
print_r($deque);
?>
```
The above example will output something similar to:
```
(
[0] => b
[1] => c
[2] => d
[3] => a
)
Ds\Deque Object
(
[0] => d
[1] => a
[2] => b
[3] => c
)
```
php curl_init curl\_init
==========
(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)
curl\_init — Initialize a cURL session
### Description
```
curl_init(?string $url = null): CurlHandle|false
```
Initializes a new session and return a cURL handle for use with the [curl\_setopt()](function.curl-setopt), [curl\_exec()](function.curl-exec), and [curl\_close()](function.curl-close) functions.
### Parameters
`url`
If provided, the **`CURLOPT_URL`** option will be set to its value. You can manually set this using the [curl\_setopt()](function.curl-setopt) function.
>
> **Note**:
>
>
> The `file` protocol is disabled by cURL if [open\_basedir](https://www.php.net/manual/en/ini.core.php#ini.open-basedir) is set.
>
>
### Return Values
Returns a cURL handle on success, **`false`** on errors.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | On success, this function returns a [CurlHandle](class.curlhandle) instance now; previously, a resource was returned. |
| 8.0.0 | `url` is nullable now. |
### Examples
**Example #1 Initializing a new cURL session and fetching a web page**
```
<?php
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);
// grab URL and pass it to the browser
curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
?>
```
### See Also
* [curl\_close()](function.curl-close) - Close a cURL session
* [curl\_multi\_init()](function.curl-multi-init) - Returns a new cURL multi handle
php The SessionIdInterface interface
The SessionIdInterface interface
================================
Introduction
------------
(PHP 5 >= 5.5.1, PHP 7, PHP 8)
**SessionIdInterface** is an interface which defines optional methods for creating a custom session handler. In order to pass a custom session handler to [session\_set\_save\_handler()](function.session-set-save-handler) using its OOP invocation, the class can implement this interface.
Note that the callback methods of classes implementing this interface are designed to be called internally by PHP and are not meant to be called from user-space code.
Interface synopsis
------------------
interface **SessionIdInterface** { /\* Methods \*/
```
public create_sid(): string
```
} Table of Contents
-----------------
* [SessionIdInterface::create\_sid](sessionidinterface.create-sid) — Create session ID
| programming_docs |
php GmagickPixel::getcolorvalue GmagickPixel::getcolorvalue
===========================
(PECL gmagick >= Unknown)
GmagickPixel::getcolorvalue — Gets the normalized value of the provided color channel
### Description
```
public GmagickPixel::getcolorvalue(int $color): float
```
Retrieves the value of the color channel specified, as a floating-point number between 0 and 1.
### Parameters
`color`
The channel to check, specified as one of the Gmagick channel constants.
### Return Values
The value of the channel, as a normalized floating-point number, throwing **GmagickPixelException** on error.
php Yaf_Config_Ini::current Yaf\_Config\_Ini::current
=========================
(Yaf >=1.0.0)
Yaf\_Config\_Ini::current — Retrieve the current value
### Description
```
public Yaf_Config_Ini::current(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php Error::getMessage Error::getMessage
=================
(PHP 7, PHP 8)
Error::getMessage — Gets the error message
### Description
```
final public Error::getMessage(): string
```
Returns the error message.
### Parameters
This function has no parameters.
### Return Values
Returns the error message as a string.
### Examples
**Example #1 **Error::getMessage()** example**
```
<?php
try {
throw new Error("Some error message");
} catch(Error $e) {
echo $e->getMessage();
}
?>
```
The above example will output something similar to:
```
Some error message
```
### See Also
* [Throwable::getMessage()](throwable.getmessage) - Gets the message
php Ds\Set::slice Ds\Set::slice
=============
(PECL ds >= 1.0.0)
Ds\Set::slice — Returns a sub-set of a given range
### Description
```
public Ds\Set::slice(int $index, int $length = ?): Ds\Set
```
Creates a sub-set of a given range.
### Parameters
`index`
The index at which the sub-set starts.
If positive, the set will start at that index in the set. If negative, the set will start that far from the end.
`length`
If a length is given and is positive, the resulting set will have up to that many values in it. If the length results in an overflow, only values up to the end of the set will be included. If a length is given and is negative, the set will stop that many values from the end. If a length is not provided, the resulting set will contain all values between the index and the end of the set.
### Return Values
A sub-set of the given range.
### Examples
**Example #1 **Ds\Set::slice()** example**
```
<?php
$set = new \Ds\Set(["a", "b", "c", "d", "e"]);
// Slice from 2 onwards
print_r($set->slice(2));
// Slice from 1, for a length of 3
print_r($set->slice(1, 3));
// Slice from 1 onwards
print_r($set->slice(1));
// Slice from 2 from the end onwards
print_r($set->slice(-2));
// Slice from 1 to 1 from the end
print_r($set->slice(1, -1));
?>
```
The above example will output something similar to:
```
Ds\Set Object
(
[0] => c
[1] => d
[2] => e
)
Ds\Set Object
(
[0] => b
[1] => c
[2] => d
)
Ds\Set Object
(
[0] => b
[1] => c
[2] => d
[3] => e
)
Ds\Set Object
(
[0] => d
[1] => e
)
Ds\Set Object
(
[0] => b
[1] => c
[2] => d
)
```
php apcu_store apcu\_store
===========
(PECL apcu >= 4.0.0)
apcu\_store — Cache a variable in the data store
### Description
```
apcu_store(string $key, mixed $var, int $ttl = 0): bool
```
```
apcu_store(array $values, mixed $unused = NULL, int $ttl = 0): array
```
Cache a variable in the data store.
> **Note**: Unlike many other mechanisms in PHP, variables stored using **apcu\_store()** will persist between requests (until the value is removed from the cache).
>
>
### Parameters
`key`
Store the variable using this name. `key`s are cache-unique, so storing a second value with the same `key` will overwrite the original value.
`var`
The variable to store
`ttl`
Time To Live; store `var` in the cache for `ttl` seconds. After the `ttl` has passed, the stored variable will be expunged from the cache (on the next request). If no `ttl` is supplied (or if the `ttl` is `0`), the value will persist until it is removed from the cache manually, or otherwise fails to exist in the cache (clear, restart, etc.).
`values`
Names in key, variables in value.
### Return Values
Returns **`true`** on success or **`false`** on failure. Second syntax returns array with error keys.
### Examples
**Example #1 A **apcu\_store()** example**
```
<?php
$bar = 'BAR';
apcu_store('foo', $bar);
var_dump(apcu_fetch('foo'));
?>
```
The above example will output:
```
string(3) "BAR"
```
### See Also
* [apcu\_add()](function.apcu-add) - Cache a new variable in the data store
* [apcu\_fetch()](function.apcu-fetch) - Fetch a stored variable from the cache
* [apcu\_delete()](function.apcu-delete) - Removes a stored variable from the cache
php Imagick::setImageOrientation Imagick::setImageOrientation
============================
(PECL imagick 2, PECL imagick 3)
Imagick::setImageOrientation — Sets the image orientation
### Description
```
public Imagick::setImageOrientation(int $orientation): bool
```
Sets the image orientation.
### Parameters
`orientation`
One of the [orientation constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.orientation)
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::setImageOrientation()****
```
<?php
//Doesn't appear to do anything
function setImageOrientation($imagePath, $orientationType) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->setImageOrientation($orientationType);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php sodium_crypto_box_keypair sodium\_crypto\_box\_keypair
============================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_box\_keypair — Randomly generate a secret key and a corresponding public key
### Description
```
sodium_crypto_box_keypair(): string
```
Generates a secret key and a public key as one string.
To get the secret key out of this unified keypair string, see [sodium\_crypto\_box\_secretkey()](function.sodium-crypto-box-secretkey). To get the public key out of this unified keypair string, see [sodium\_crypto\_box\_publickey()](function.sodium-crypto-box-publickey).
### Parameters
This function has no parameters.
### Return Values
One string containing both the X25519 secret key and corresponding X25519 public key.
php RecursiveIteratorIterator::current RecursiveIteratorIterator::current
==================================
(PHP 5, PHP 7, PHP 8)
RecursiveIteratorIterator::current — Access the current element value
### Description
```
public RecursiveIteratorIterator::current(): mixed
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
The current elements value.
php None while
-----
(PHP 4, PHP 5, PHP 7, PHP 8)
`while` loops are the simplest type of loop in PHP. They behave just like their C counterparts. The basic form of a `while` statement is:
```
while (expr)
statement
```
The meaning of a `while` statement is simple. It tells PHP to execute the nested statement(s) repeatedly, as long as the `while` expression evaluates to **`true`**. The value of the expression is checked each time at the beginning of the loop, so even if this value changes during the execution of the nested statement(s), execution will not stop until the end of the iteration (each time PHP runs the statements in the loop is one iteration). If the `while` expression evaluates to **`false`** from the very beginning, the nested statement(s) won't even be run once.
Like with the `if` statement, you can group multiple statements within the same `while` loop by surrounding a group of statements with curly braces, or by using the alternate syntax:
```
while (expr):
statement
...
endwhile;
```
The following examples are identical, and both print the numbers 1 through 10:
```
<?php
/* example 1 */
$i = 1;
while ($i <= 10) {
echo $i++; /* the printed value would be
$i before the increment
(post-increment) */
}
/* example 2 */
$i = 1;
while ($i <= 10):
echo $i;
$i++;
endwhile;
?>
```
php snmpgetnext snmpgetnext
===========
(PHP 5, PHP 7, PHP 8)
snmpgetnext — Fetch the SNMP object which follows the given object id
### Description
```
snmpgetnext(
string $hostname,
string $community,
array|string $object_id,
int $timeout = -1,
int $retries = -1
): mixed
```
The **snmpgetnext()** function is used to read the value of the SNMP object that follows the specified `object_id`.
### Parameters
`hostname`
The hostname of the SNMP agent (server).
`community`
The read community.
`object_id`
The SNMP object id which precedes the wanted one.
`timeout`
The number of microseconds until the first timeout.
`retries`
The number of times to retry if timeouts occur.
### Return Values
Returns SNMP object value on success or **`false`** on error. In case of an error, an E\_WARNING message is shown.
### Examples
**Example #1 Using **snmpgetnext()****
```
<?php
$nameOfSecondInterface = snmpgetnetxt('localhost', 'public', 'IF-MIB::ifName.1');
?>
```
### See Also
* [snmpget()](function.snmpget) - Fetch an SNMP object
* [snmpwalk()](function.snmpwalk) - Fetch all the SNMP objects from an agent
php opcache_get_configuration opcache\_get\_configuration
===========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL ZendOpcache > 7.0.2)
opcache\_get\_configuration — Get configuration information about the cache
### Description
```
opcache_get_configuration(): array|false
```
This function returns configuration information about the cache instance
### Parameters
This function has no parameters.
### Return Values
Returns an array of information, including ini, blacklist and version
### Errors/Exceptions
If `opcache.restrict_api` is in use and the current path is in violation of the rule, an E\_WARNING will be raised; no status information will be returned.
### See Also
* [opcache\_get\_status()](function.opcache-get-status) - Get status information about the cache
php mcrypt_decrypt mcrypt\_decrypt
===============
(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mcrypt\_decrypt — Decrypts crypttext with given parameters
**Warning**This function has been *DEPRECATED* as of PHP 7.1.0 and *REMOVED* as of PHP 7.2.0. Relying on this function is highly discouraged.
### Description
```
mcrypt_decrypt(
string $cipher,
string $key,
string $data,
string $mode,
string $iv = ?
): string|false
```
Decrypts the `data` and returns the unencrypted data.
### Parameters
`cipher`
One of the **`MCRYPT_ciphername`** constants, or the name of the algorithm as string.
`key`
The key with which the data was encrypted. If the provided key size is not supported by the cipher, the function will emit a warning and return **`false`**
`data`
The data that will be decrypted with the given `cipher` and `mode`. If the size of the data is not n \* blocksize, the data will be padded with '`\0`'.
`mode`
One of the **`MCRYPT_MODE_modename`** constants, or one of the following strings: "ecb", "cbc", "cfb", "ofb", "nofb" or "stream".
`iv`
Used for the initialization in CBC, CFB, OFB modes, and in some algorithms in STREAM mode. If the provided IV size is not supported by the chaining mode or no IV was provided, but the chaining mode requires one, the function will emit a warning and return **`false`**.
### Return Values
Returns the decrypted data as a string or **`false`** on failure.
### See Also
* [mcrypt\_encrypt()](function.mcrypt-encrypt) - Encrypts plaintext with given parameters
php eio_mkdir eio\_mkdir
==========
(PECL eio >= 0.0.1dev)
eio\_mkdir — Create directory
### Description
```
eio_mkdir(
string $path,
int $mode,
int $pri = EIO_PRI_DEFAULT,
callable $callback = NULL,
mixed $data = NULL
): resource
```
**eio\_mkdir()** creates directory with specified access `mode`.
### Parameters
`path`
Path for the new directory.
`mode`
Access mode, e.g. 0755
`pri`
The request priority: **`EIO_PRI_DEFAULT`**, **`EIO_PRI_MIN`**, **`EIO_PRI_MAX`**, or **`null`**. If **`null`** passed, `pri` internally is set to **`EIO_PRI_DEFAULT`**.
`callback`
`callback` function is called when the request is done. It should match the following prototype:
```
void callback(mixed $data, int $result[, resource $req]);
```
`data`
is custom data passed to the request.
`result`
request-specific result value; basically, the value returned by corresponding system call.
`req`
is optional request resource which can be used with functions like [eio\_get\_last\_error()](function.eio-get-last-error)
`data`
Arbitrary variable passed to `callback`.
### Return Values
**eio\_mkdir()** returns request resource on success, or **`false`** on failure.
### Examples
**Example #1 **eio\_mkdir()** example**
```
<?php
$temp_dirname = "eio-temp-dir";
/* Is called when eio_mkdir() finishes */
function my_mkdir_callback($data, $result) {
if ($result == 0 && is_dir($temp_dirname)
&& !is_readable($temp_dirname)
&& is_writable($temp_dirname)) {
echo "eio_mkdir_ok";
}
// Remove directory
if (file_exists($data))
rmdir($temp_dirname);
}
// Create directory with access mode 0300
eio_mkdir($temp_dirname, 0300, EIO_PRI_DEFAULT, "my_mkdir_callback", $temp_dirname);
eio_event_loop();
?>
```
The above example will output something similar to:
```
eio_mkdir_ok
```
### See Also
* [eio\_rmdir()](function.eio-rmdir) - Remove a directory
php imageresolution imageresolution
===============
(PHP 7 >= 7.2.0, PHP 8)
imageresolution — Get or set the resolution of the image
### Description
```
imageresolution(GdImage $image, ?int $resolution_x = null, ?int $resolution_y = null): array|bool
```
**imageresolution()** allows to set and get the resolution of an image in DPI (dots per inch). If the optional parameters are **`null`**, the current resolution is returned as an indexed array. If only `resolution_x` is not **`null`**, the horizontal and vertical resolution are set to this value. If none of the optional parameters are **`null`**, the horizontal and vertical resolution are set to these values, respectively.
The resolution is only used as meta information when images are read from and written to formats supporting this kind of information (curently PNG and JPEG). It does not affect any drawing operations. The default resolution for new images is 96 DPI.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`resolution_x`
The horizontal resolution in DPI.
`resolution_y`
The vertical resolution in DPI.
### Return Values
When used as getter, it returns an indexed array of the horizontal and vertical resolution on success, or **`false`** on failure. When used as setter, it returns **`true`** on success, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `resolution_x` and `resolution_y` are now nullable. |
### Examples
**Example #1 Setting and getting the resolution of an image**
```
<?php
$im = imagecreatetruecolor(100, 100);
imageresolution($im, 200);
print_r(imageresolution($im));
imageresolution($im, 300, 72);
print_r(imageresolution($im));
?>
```
The above example will output:
```
Array
(
[0] => 200
[1] => 200
)
Array
(
[0] => 300
[1] => 72
)
```
php sha1 sha1
====
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
sha1 — Calculate the sha1 hash of a string
**Warning** It is not recommended to use this function to secure passwords, due to the fast nature of this hashing algorithm. See the [Password Hashing FAQ](https://www.php.net/manual/en/faq.passwords.php#faq.passwords.fasthash) for details and best practices.
### Description
```
sha1(string $string, bool $binary = false): string
```
Calculates the sha1 hash of `string` using the [» US Secure Hash Algorithm 1](http://www.faqs.org/rfcs/rfc3174).
### Parameters
`string`
The input string.
`binary`
If the optional `binary` is set to **`true`**, then the sha1 digest is instead returned in raw binary format with a length of 20, otherwise the returned value is a 40-character hexadecimal number.
### Return Values
Returns the sha1 hash as a string.
### Examples
**Example #1 A **sha1()** example**
```
<?php
$str = 'apple';
if (sha1($str) === 'd0be2dc421be4fcd0172e5afceea3970e2f3d940') {
echo "Would you like a green or red apple?";
}
?>
```
### See Also
* [sha1\_file()](function.sha1-file) - Calculate the sha1 hash of a file
* [crc32()](function.crc32) - Calculates the crc32 polynomial of a string
* [md5()](function.md5) - Calculate the md5 hash of a string
* [hash()](function.hash) - Generate a hash value (message digest)
* [crypt()](function.crypt) - One-way string hashing
* [password\_hash()](function.password-hash) - Creates a password hash
php intl_get_error_message intl\_get\_error\_message
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
intl\_get\_error\_message — Get description of the last error
### Description
```
intl_get_error_message(): string
```
Get error message from last internationalization function called.
### Parameters
This function has no parameters.
### Return Values
Description of an error occurred in the last API function call.
### Examples
**Example #1 **intl\_get\_error\_message()** example**
```
<?php
if( Collator::getAvailableLocales() === false ) {
show_error( intl_get_error_message() );
}
?>
```
### See Also
* [intl\_error\_name()](function.intl-error-name) - Get symbolic name for a given error code
* [intl\_get\_error\_code()](function.intl-get-error-code) - Get the last error code
* [intl\_is\_failure()](function.intl-is-failure) - Check whether the given error code indicates failure
* [collator\_get\_error\_message()](collator.geterrormessage) - Get text for collator's last error code
* [numfmt\_get\_error\_message()](numberformatter.geterrormessage) - Get formatter's last error message
php None Once-only subpatterns
---------------------
With both maximizing and minimizing repetition, failure of what follows normally causes the repeated item to be re-evaluated to see if a different number of repeats allows the rest of the pattern to match. Sometimes it is useful to prevent this, either to change the nature of the match, or to cause it fail earlier than it otherwise might, when the author of the pattern knows there is no point in carrying on.
Consider, for example, the pattern \d+foo when applied to the subject line `123456bar`
After matching all 6 digits and then failing to match "foo", the normal action of the matcher is to try again with only 5 digits matching the \d+ item, and then with 4, and so on, before ultimately failing. Once-only subpatterns provide the means for specifying that once a portion of the pattern has matched, it is not to be re-evaluated in this way, so the matcher would give up immediately on failing to match "foo" the first time. The notation is another kind of special parenthesis, starting with (?> as in this example: `(?>\d+)bar`
This kind of parenthesis "locks up" the part of the pattern it contains once it has matched, and a failure further into the pattern is prevented from backtracking into it. Backtracking past it to previous items, however, works as normal.
An alternative description is that a subpattern of this type matches the string of characters that an identical standalone pattern would match, if anchored at the current point in the subject string.
Once-only subpatterns are not capturing subpatterns. Simple cases such as the above example can be thought of as a maximizing repeat that must swallow everything it can. So, while both \d+ and \d+? are prepared to adjust the number of digits they match in order to make the rest of the pattern match, (?>\d+) can only match an entire sequence of digits.
This construction can of course contain arbitrarily complicated subpatterns, and it can be nested.
Once-only subpatterns can be used in conjunction with lookbehind assertions to specify efficient matching at the end of the subject string. Consider a simple pattern such as `abcd$` when applied to a long string which does not match. Because matching proceeds from left to right, PCRE will look for each "a" in the subject and then see if what follows matches the rest of the pattern. If the pattern is specified as `^.*abcd$` then the initial .\* matches the entire string at first, but when this fails (because there is no following "a"), it backtracks to match all but the last character, then all but the last two characters, and so on. Once again the search for "a" covers the entire string, from right to left, so we are no better off. However, if the pattern is written as `^(?>.*)(?<=abcd)` then there can be no backtracking for the .\* item; it can match only the entire string. The subsequent lookbehind assertion does a single test on the last four characters. If it fails, the match fails immediately. For long strings, this approach makes a significant difference to the processing time.
When a pattern contains an unlimited repeat inside a subpattern that can itself be repeated an unlimited number of times, the use of a once-only subpattern is the only way to avoid some failing matches taking a very long time indeed. The pattern `(\D+|<\d+>)*[!?]` matches an unlimited number of substrings that either consist of non-digits, or digits enclosed in <>, followed by either ! or ?. When it matches, it runs quickly. However, if it is applied to `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` it takes a long time before reporting failure. This is because the string can be divided between the two repeats in a large number of ways, and all have to be tried. (The example used [!?] rather than a single character at the end, because both PCRE and Perl have an optimization that allows for fast failure when a single character is used. They remember the last single character that is required for a match, and fail early if it is not present in the string.) If the pattern is changed to `((?>\D+)|<\d+>)*[!?]` sequences of non-digits cannot be broken, and failure happens quickly.
| programming_docs |
php streamWrapper::stream_read streamWrapper::stream\_read
===========================
(PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8)
streamWrapper::stream\_read — Read from stream
### Description
```
public streamWrapper::stream_read(int $count): string|false
```
This method is called in response to [fread()](function.fread) and [fgets()](function.fgets).
>
> **Note**:
>
>
> Remember to update the read/write position of the stream (by the number of bytes that were successfully read).
>
>
### Parameters
`count`
How many bytes of data from the current position should be returned.
### Return Values
If there are less than `count` bytes available, as many as are available should be returned. If no more data is available, an empty string should be returned. To signal that reading failed, **`false`** should be returned.
### Errors/Exceptions
Emits **`E_WARNING`** if call to this method fails (i.e. not implemented).
>
> **Note**:
>
>
> If the return value is longer then `count` an **`E_WARNING`** error will be emitted, and excess data will be lost.
>
>
### Notes
>
> **Note**:
>
>
> [streamWrapper::stream\_eof()](streamwrapper.stream-eof) is called directly after calling **streamWrapper::stream\_read()** to check if EOF has been reached. If not implemented, EOF is assumed.
>
>
**Warning** When reading the whole file (for example, with [file\_get\_contents()](function.file-get-contents)), PHP will call **streamWrapper::stream\_read()** followed by [streamWrapper::stream\_eof()](streamwrapper.stream-eof) in a loop but as long as **streamWrapper::stream\_read()** returns a non-empty string, the return value of [streamWrapper::stream\_eof()](streamwrapper.stream-eof) is ignored.
### See Also
* [fread()](function.fread) - Binary-safe file read
* [fgets()](function.fgets) - Gets line from file pointer
php EvLoop::stat EvLoop::stat
============
(PECL ev >= 0.2.0)
EvLoop::stat — Creates EvStat watcher object associated with the current event loop instance
### Description
```
final public EvLoop::stat(
string $path ,
float $interval ,
callable $callback ,
mixed $data = null ,
int $priority = 0
): EvStat
```
Creates EvStat watcher object associated with the current event loop instance
### Parameters
All parameters have the same meaning as for [EvSignal::\_\_construct()](evsignal.construct)
### Return Values
Returns EvStat object on success
### See Also
* [EvSignal::\_\_construct()](evsignal.construct) - Constructs EvSignal watcher object
php array_is_list array\_is\_list
===============
(PHP 8 >= 8.1.0)
array\_is\_list — Checks whether a given `array` is a list
### Description
```
array_is_list(array $array): bool
```
Determines if the given `array` is a list. An array is considered a list if its keys consist of consecutive numbers from `0` to `count($array)-1`.
### Parameters
`array`
The array being evaluated.
### Return Values
Returns **`true`** if `array` is a list, **`false`** otherwise.
### Examples
**Example #1 **array\_is\_list()** example**
```
<?php
array_is_list([]); // true
array_is_list(['apple', 2, 3]); // true
array_is_list([0 => 'apple', 'orange']); // true
// The array does not start at 0
array_is_list([1 => 'apple', 'orange']); // false
// The keys are not in the correct order
array_is_list([1 => 'apple', 0 => 'orange']); // false
// Non-integer keys
array_is_list([0 => 'apple', 'foo' => 'bar']); // false
// Non-consecutive keys
array_is_list([0 => 'apple', 2 => 'bar']); // false
?>
```
### Notes
>
> **Note**:
>
>
> This function returns **`true`** on empty arrays.
>
>
### See Also
* [array\_values()](function.array-values) - Return all the values of an array
php stream_is_local stream\_is\_local
=================
(PHP 5 >= 5.2.4, PHP 7, PHP 8)
stream\_is\_local — Checks if a stream is a local stream
### Description
```
stream_is_local(resource|string $stream): bool
```
Checks if a stream, or a URL, is a local one or not.
### Parameters
`stream`
The stream resource or URL to check.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **stream\_is\_local()** example**
Basic usage example.
```
<?php
var_dump(stream_is_local("http://example.com"));
var_dump(stream_is_local("/etc"));
?>
```
The above example will output something similar to:
```
bool(false)
bool(true)
```
php Yaf_Request_Abstract::getActionName Yaf\_Request\_Abstract::getActionName
=====================================
(Yaf >=1.0.0)
Yaf\_Request\_Abstract::getActionName — The getActionName purpose
### Description
```
public Yaf_Request_Abstract::getActionName(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php Fiber::__construct Fiber::\_\_construct
====================
(PHP 8 >= 8.1.0)
Fiber::\_\_construct — Creates a new Fiber instance
### Description
public **Fiber::\_\_construct**([callable](language.types.callable) `$callback`) ### Parameters
`callback`
The [callable](language.types.callable) to invoke when starting the fiber. Arguments given to [Fiber::start()](fiber.start) will be provided as arguments to the given callable.
php SolrQuery::removeStatsField SolrQuery::removeStatsField
===========================
(PECL solr >= 0.9.2)
SolrQuery::removeStatsField — Removes one of the stats.field parameters
### Description
```
public SolrQuery::removeStatsField(string $field): SolrQuery
```
Removes one of the stats.field parameters
### Parameters
`field`
The name of the field.
### Return Values
Returns the current SolrQuery object, if the return value is used.
php Yaf_Request_Simple::getPost Yaf\_Request\_Simple::getPost
=============================
(Yaf >=1.0.0)
Yaf\_Request\_Simple::getPost — The getPost purpose
### Description
```
public Yaf_Request_Simple::getPost(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php create_function create\_function
================
(PHP 4 >= 4.0.1, PHP 5, PHP 7)
create\_function — Create a function dynamically by evaluating a string of code
**Warning**This function has been *DEPRECATED* as of PHP 7.2.0, and *REMOVED* as of PHP 8.0.0. Relying on this function is highly discouraged.
### Description
```
create_function(string $args, string $code): string
```
Creates a function dynamically from the parameters passed, and returns a unique name for it.
**Caution** This function internally performs an [eval()](function.eval) and as such has the same security issues as [eval()](function.eval). It also has bad performance and memory usage characteristics, because the created functions are global and can not be freed.
A native [anonymous function](functions.anonymous) should be used instead.
### Parameters
It is normally advisable to pass these parameters as [single quoted](language.types.string#language.types.string.syntax.single) strings. If using [double quoted](language.types.string#language.types.string.syntax.double) strings, variable names in the code need to be escaped carefully, e.g. `\$somevar`.
`args`
The function arguments, as a single comma-separated string.
`code`
The function code.
### Return Values
Returns a unique function name as a string, or **`false`** on failure. Note that the name contains a non-printable character (`"\0"`), so care should be taken when printing the name or incorporating it in any other string.
### Examples
**Example #1 Creating a function dynamically, with **create\_function()** or anonymous functions**
You can use a dynamically created function, to (for example) create a function from information gathered at run time. First, using **create\_function()**:
```
<?php
$newfunc = create_function('$a,$b', 'return "ln($a) + ln($b) = " . log($a * $b);');
echo $newfunc(2, M_E) . "\n";
?>
```
Now the same code, using an [anonymous function](functions.anonymous); note that the code and arguments are no longer contained in strings:
```
<?php
$newfunc = function($a,$b) { return "ln($a) + ln($b) = " . log($a * $b); };
echo $newfunc(2, M_E) . "\n";
?>
```
The above example will output:
```
ln(2) + ln(2.718281828459) = 1.6931471805599
```
**Example #2 Making a general processing function, with **create\_function()** or anonymous functions**
Another use could be to have general handler function that can apply a set of operations to a list of parameters:
```
<?php
function process($var1, $var2, $farr)
{
foreach ($farr as $f) {
echo $f($var1, $var2) . "\n";
}
}
// create a bunch of math functions
$farr = array(
create_function('$x,$y', 'return "some trig: ".(sin($x) + $x*cos($y));'),
create_function('$x,$y', 'return "a hypotenuse: ".sqrt($x*$x + $y*$y);'),
create_function('$a,$b', 'if ($a >=0) {return "b*a^2 = ".$b*sqrt($a);} else {return false;}'),
create_function('$a,$b', "return \"min(b^2+a, a^2,b) = \".min(\$a*\$a+\$b,\$b*\$b+\$a);"),
create_function('$a,$b', 'if ($a > 0 && $b != 0) {return "ln(a)/b = ".log($a)/$b; } else { return false; }')
);
echo "\nUsing the first array of dynamic functions\n";
echo "parameters: 2.3445, M_PI\n";
process(2.3445, M_PI, $farr);
// now make a bunch of string processing functions
$garr = array(
create_function('$b,$a', 'if (strncmp($a, $b, 3) == 0) return "** \"$a\" '.
'and \"$b\"\n** Look the same to me! (looking at the first 3 chars)";'),
create_function('$a,$b', 'return "CRCs: " . crc32($a) . ", ".crc32($b);'),
create_function('$a,$b', 'return "similar(a,b) = " . similar_text($a, $b, $p) . "($p%)";')
);
echo "\nUsing the second array of dynamic functions\n";
process("Twas brilling and the slithy toves", "Twas the night", $garr);
?>
```
Again, here is the same code using [anonymous functions](functions.anonymous). Note that variable names in the code no longer need to be escaped, because they are not enclosed in a string.
```
<?php
function process($var1, $var2, $farr)
{
foreach ($farr as $f) {
echo $f($var1, $var2) . "\n";
}
}
// create a bunch of math functions
$farr = array(
function($x,$y) { return "some trig: ".(sin($x) + $x*cos($y)); },
function($x,$y) { return "a hypotenuse: ".sqrt($x*$x + $y*$y); },
function($a,$b) { if ($a >=0) {return "b*a^2 = ".$b*sqrt($a);} else {return false;} },
function($a,$b) { return "min(b^2+a, a^2,b) = " . min($a*$a+$b, $b*$b+$a); },
function($a,$b) { if ($a > 0 && $b != 0) {return "ln(a)/b = ".log($a)/$b; } else { return false; } }
);
echo "\nUsing the first array of dynamic functions\n";
echo "parameters: 2.3445, M_PI\n";
process(2.3445, M_PI, $farr);
// now make a bunch of string processing functions
$garr = array(
function($b,$a) { if (strncmp($a, $b, 3) == 0) return "** \"$a\" " .
"and \"$b\"\n** Look the same to me! (looking at the first 3 chars)"; },
function($a,$b) { return "CRCs: " . crc32($a) . ", ".crc32($b); },
function($a,$b) { return "similar(a,b) = " . similar_text($a, $b, $p) . "($p%)"; }
);
echo "\nUsing the second array of dynamic functions\n";
process("Twas brilling and the slithy toves", "Twas the night", $garr);
?>
```
The above example will output:
```
Using the first array of dynamic functions
parameters: 2.3445, M_PI
some trig: -1.6291725057799
a hypotenuse: 3.9199852871011
b*a^2 = 4.8103313314525
min(b^2+a, a^2,b) = 8.6382729035898
ln(a)/b = 0.27122299212594
Using the second array of dynamic functions
** "Twas the night" and "Twas brilling and the slithy toves"
** Look the same to me! (looking at the first 3 chars)
CRCs: 3569586014, 342550513
similar(a,b) = 11(45.833333333333%)
```
**Example #3 Using dynamic functions as callback functions**
Perhaps the most common use for dynamic functions is to pass them as callbacks, for example when using [array\_walk()](function.array-walk) or [usort()](function.usort).
```
<?php
$av = array("the ", "a ", "that ", "this ");
array_walk($av, create_function('&$v,$k', '$v = $v . "mango";'));
print_r($av);
?>
```
Converted to an [anonymous function](functions.anonymous):
```
<?php
$av = array("the ", "a ", "that ", "this ");
array_walk($av, function(&$v,$k) { $v = $v . "mango"; });
print_r($av);
?>
```
The above example will output:
```
Array
(
[0] => the mango
[1] => a mango
[2] => that mango
[3] => this mango
)
```
Sorting strings from longest to shortest with **create\_function()**:
```
<?php
$sv = array("small", "a big string", "larger", "it is a string thing");
echo "Original:\n";
print_r($sv);
echo "Sorted:\n";
usort($sv, create_function('$a,$b','return strlen($b) - strlen($a);'));
print_r($sv);
?>
```
Converted to an [anonymous function](functions.anonymous):
```
<?php
$sv = array("small", "a big string", "larger", "it is a string thing");
echo "Original:\n";
print_r($sv);
echo "Sorted:\n";
usort($sv, function($a,$b) { return strlen($b) - strlen($a); });
print_r($sv);
?>
```
The above example will output:
```
Original:
Array
(
[0] => small
[1] => a big string
[2] => larger
[3] => it is a string thing
)
Sorted:
Array
(
[0] => it is a string thing
[1] => a big string
[2] => larger
[3] => small
)
```
### See Also
* [Anonymous functions](functions.anonymous)
php The DOMChildNode interface
The DOMChildNode interface
==========================
Interface synopsis
------------------
(PHP 8)
interface **DOMChildNode** { /\* Methods \*/
```
public after(DOMNode|string ...$nodes): void
```
```
public before(DOMNode|string ...$nodes): void
```
```
public remove(): void
```
```
public replaceWith(DOMNode|string ...$nodes): void
```
} Table of Contents
-----------------
* [DOMChildNode::after](domchildnode.after) — Adds nodes after the node
* [DOMChildNode::before](domchildnode.before) — Adds nodes before the node
* [DOMChildNode::remove](domchildnode.remove) — Removes the node
* [DOMChildNode::replaceWith](domchildnode.replacewith) — Replaces the node with new nodes
php The Yaf_Application class
The Yaf\_Application class
==========================
Introduction
------------
(No version information available, might only be in Git)
[Yaf\_Application](class.yaf-application) provides a bootstrapping facility for applications which provides reusable resources, common- and module-based bootstrap classes and dependency checking.
>
> **Note**:
>
>
> [Yaf\_Application](class.yaf-application) implements the singleton pattern, and [Yaf\_Application](class.yaf-application) can not be serialized or unserialized which will cause problem when you try to use PHPUnit to write some test case for Yaf.
>
> You may use @backupGlobals annotation of PHPUnit to control the backup and restore operations for global variables. thus can solve this problem.
>
>
Class synopsis
--------------
final class [Yaf\_Application](class.yaf-application) { /\* Properties \*/ protected [$config](class.yaf-application#yaf-application.props.config);
protected [$dispatcher](class.yaf-application#yaf-application.props.dispatcher);
protected static [$\_app](class.yaf-application#yaf-application.props.app);
protected [$\_modules](class.yaf-application#yaf-application.props.modules);
protected [$\_running](class.yaf-application#yaf-application.props.running);
protected [$\_environ](class.yaf-application#yaf-application.props.environ); /\* Methods \*/ public [\_\_construct](yaf-application.construct)([mixed](language.types.declarations#language.types.declarations.mixed) `$config`, string `$envrion` = ?)
```
public staticapp(): mixed
```
```
public bootstrap(Yaf_Bootstrap_Abstract $bootstrap = ?): void
```
```
public clearLastError(): Yaf_Application
```
```
public environ(): void
```
```
public execute(callable $entry, string ...$args): void
```
```
public getAppDirectory(): Yaf_Application
```
```
public getConfig(): Yaf_Config_Abstract
```
```
public getDispatcher(): Yaf_Dispatcher
```
```
public getLastErrorMsg(): string
```
```
public getLastErrorNo(): int
```
```
public getModules(): array
```
```
public run(): void
```
```
public setAppDirectory(string $directory): Yaf_Application
```
public [\_\_destruct](yaf-application.destruct)() } Properties
----------
config dispatcher \_app \_modules \_running \_environ Table of Contents
-----------------
* [Yaf\_Application::app](yaf-application.app) — Retrieve an Application instance
* [Yaf\_Application::bootstrap](yaf-application.bootstrap) — Call bootstrap
* [Yaf\_Application::clearLastError](yaf-application.clearlasterror) — Clear the last error info
* [Yaf\_Application::\_\_construct](yaf-application.construct) — Yaf\_Application constructor
* [Yaf\_Application::\_\_destruct](yaf-application.destruct) — The \_\_destruct purpose
* [Yaf\_Application::environ](yaf-application.environ) — Retrive environ
* [Yaf\_Application::execute](yaf-application.execute) — Execute a callback
* [Yaf\_Application::getAppDirectory](yaf-application.getappdirectory) — Get the application directory
* [Yaf\_Application::getConfig](yaf-application.getconfig) — Retrive the config instance
* [Yaf\_Application::getDispatcher](yaf-application.getdispatcher) — Get Yaf\_Dispatcher instance
* [Yaf\_Application::getLastErrorMsg](yaf-application.getlasterrormsg) — Get message of the last occurred error
* [Yaf\_Application::getLastErrorNo](yaf-application.getlasterrorno) — Get code of last occurred error
* [Yaf\_Application::getModules](yaf-application.getmodules) — Get defined module names
* [Yaf\_Application::run](yaf-application.run) — Start Yaf\_Application
* [Yaf\_Application::setAppDirectory](yaf-application.setappdirectory) — Change the application directory
php CachingIterator::valid CachingIterator::valid
======================
(PHP 5, PHP 7, PHP 8)
CachingIterator::valid — Check whether the current element is valid
### Description
```
public CachingIterator::valid(): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Check whether the current element is valid.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php Gmagick::spreadimage Gmagick::spreadimage
====================
(PECL gmagick >= Unknown)
Gmagick::spreadimage — Randomly displaces each pixel in a block
### Description
```
public Gmagick::spreadimage(float $radius): Gmagick
```
Special effects method that randomly displaces each pixel in a block defined by the radius parameter.
### Parameters
`radius`
Choose a random pixel in a neighborhood of this extent.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php SolrDisMaxQuery::useEDisMaxQueryParser SolrDisMaxQuery::useEDisMaxQueryParser
======================================
(No version information available, might only be in Git)
SolrDisMaxQuery::useEDisMaxQueryParser — Switch QueryParser to be EDisMax
### Description
```
public SolrDisMaxQuery::useEDisMaxQueryParser(): SolrDisMaxQuery
```
Switch QueryParser to be EDisMax. By default the query builder uses edismax, if it was switched using [SolrDisMaxQuery::useDisMaxQueryParser()](solrdismaxquery.usedismaxqueryparser), it can be switched back using this method.
### Parameters
This function has no parameters.
### Return Values
[SolrDisMaxQuery](class.solrdismaxquery)
### Examples
**Example #1 **SolrDisMaxQuery::useEDisMaxQueryParser()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery();
$dismaxQuery->useEDisMaxQueryParser();
echo $dismaxQuery;
?>
```
The above example will output something similar to:
```
defType=edismax
```
| programming_docs |
php PharFileInfo::getCompressedSize PharFileInfo::getCompressedSize
===============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
PharFileInfo::getCompressedSize — Returns the actual size of the file (with compression) inside the Phar archive
### Description
```
public PharFileInfo::getCompressedSize(): int
```
This returns the size of the file within the Phar archive. Uncompressed files will return the same value for getCompressedSize as they will with [filesize()](function.filesize)
### Parameters
This function has no parameters.
### Return Values
The size in bytes of the file within the Phar archive on disk.
### Examples
**Example #1 A **PharFileInfo::getCompressedSize()** example**
```
<?php
try {
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
$p['myfile.txt'] = 'hi';
$file = $p['myfile.txt'];
echo $file->getCompressedSize();
} catch (Exception $e) {
echo 'Write operations failed on my.phar: ', $e;
}
?>
```
The above example will output:
```
2
```
### See Also
* [PharFileInfo::isCompressed()](pharfileinfo.iscompressed) - Returns whether the entry is compressed
* [PharFileInfo::decompress()](pharfileinfo.decompress) - Decompresses the current Phar entry within the phar
* [PharFileInfo::compress()](pharfileinfo.compress) - Compresses the current Phar entry with either zlib or bzip2 compression
* [Phar::canCompress()](phar.cancompress) - Returns whether phar extension supports compression using either zlib or bzip2
* [Phar::isCompressed()](phar.iscompressed) - Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)
* [Phar::compress()](phar.compress) - Compresses the entire Phar archive using Gzip or Bzip2 compression
* [Phar::decompress()](phar.decompress) - Decompresses the entire Phar archive
* [Phar::getSupportedCompression()](phar.getsupportedcompression) - Return array of supported compression algorithms
* [Phar::decompressFiles()](phar.decompressfiles) - Decompresses all files in the current Phar archive
* [Phar::compressFiles()](phar.compressfiles) - Compresses all files in the current Phar archive
php ReflectionZendExtension::getVersion ReflectionZendExtension::getVersion
===================================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
ReflectionZendExtension::getVersion — Gets version
### Description
```
public ReflectionZendExtension::getVersion(): string
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php radius_put_addr radius\_put\_addr
=================
(PECL radius >= 1.1.0)
radius\_put\_addr — Attaches an IP address attribute
### Description
```
radius_put_addr(
resource $radius_handle,
int $type,
string $addr,
int $options = 0,
int $tag = ?
): bool
```
Attaches an IP address attribute to the current RADIUS request.
>
> **Note**:
>
>
> A request must be created via [radius\_create\_request()](function.radius-create-request) before this function can be called.
>
>
>
### Parameters
`radius_handle`
The RADIUS resource.
`type`
The attribute type.
`addr`
An IPv4 address in string form, such as `10.0.0.1`.
`options`
A bitmask of the attribute options. The available options include [**`RADIUS_OPTION_TAGGED`**](https://www.php.net/manual/en/radius.constants.options.php#constant.radius-option-tagged) and [**`RADIUS_OPTION_SALT`**](https://www.php.net/manual/en/radius.constants.options.php#constant.radius-option-salt).
`tag`
The attribute tag. This parameter is ignored unless the [**`RADIUS_OPTION_TAGGED`**](https://www.php.net/manual/en/radius.constants.options.php#constant.radius-option-tagged) option is set.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| PECL radius 1.3.0 | The `options` and `tag` parameters were added. |
php current current
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
current — Return the current element in an array
### Description
```
current(array|object $array): mixed
```
Every array has an internal pointer to its "current" element, which is initialized to the first element inserted into the array.
### Parameters
`array`
The array.
### Return Values
The **current()** function simply returns the value of the array element that's currently being pointed to by the internal pointer. It does not move the pointer in any way. If the internal pointer points beyond the end of the elements list or the array is empty, **current()** returns **`false`**.
**Warning**This function may return Boolean **`false`**, but may also return a non-Boolean value which evaluates to **`false`**. Please read the section on [Booleans](language.types.boolean) for more information. Use [the === operator](language.operators.comparison) for testing the return value of this function.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | Calling this function on objects is deprecated. Either use [get\_mangled\_object\_vars()](function.get-mangled-object-vars) on the object first, or use [ArrayIterator](class.arrayiterator). |
### Examples
**Example #1 Example use of **current()** and friends**
```
<?php
$transport = array('foot', 'bike', 'car', 'plane');
$mode = current($transport); // $mode = 'foot';
$mode = next($transport); // $mode = 'bike';
$mode = current($transport); // $mode = 'bike';
$mode = prev($transport); // $mode = 'foot';
$mode = end($transport); // $mode = 'plane';
$mode = current($transport); // $mode = 'plane';
$arr = array();
var_dump(current($arr)); // bool(false)
$arr = array(array());
var_dump(current($arr)); // array(0) { }
?>
```
### Notes
> **Note**: The results of calling **current()** on an empty array and on an array, whose internal pointer points beyond the end of the elements, are indistinguishable from a bool **`false`** element. To properly traverse an array which may contain **`false`** elements, see the [foreach](control-structures.foreach) control structure. To still use **current()** and properly check if the value is really an element of the array, the [key()](function.key) of the **current()** element should be checked to be strictly different from **`null`**.
>
>
### See Also
* [end()](function.end) - Set the internal pointer of an array to its last element
* [key()](function.key) - Fetch a key from an array
* [each()](function.each) - Return the current key and value pair from an array and advance the array cursor
* [prev()](function.prev) - Rewind the internal array pointer
* [reset()](function.reset) - Set the internal pointer of an array to its first element
* [next()](function.next) - Advance the internal pointer of an array
* [foreach](control-structures.foreach)
php date_modify date\_modify
============
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
date\_modify — Alias of [DateTime::modify()](datetime.modify)
### Description
This function is an alias of: [DateTime::modify()](datetime.modify)
php libxml_get_errors libxml\_get\_errors
===================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
libxml\_get\_errors — Retrieve array of errors
### Description
```
libxml_get_errors(): array
```
Retrieve array of errors.
### Parameters
This function has no parameters.
### Return Values
Returns an array with [LibXMLError](class.libxmlerror) objects if there are any errors in the buffer, or an empty array otherwise.
### Examples
**Example #1 A **libxml\_get\_errors()** example**
This example demonstrates how to build a simple libxml error handler.
```
<?php
libxml_use_internal_errors(true);
$xmlstr = <<< XML
<?xml version='1.0' standalone='yes'?>
<movies>
<movie>
<titles>PHP: Behind the Parser</title>
</movie>
</movies>
XML;
$doc = simplexml_load_string($xmlstr);
$xml = explode("\n", $xmlstr);
if ($doc === false) {
$errors = libxml_get_errors();
foreach ($errors as $error) {
echo display_xml_error($error, $xml);
}
libxml_clear_errors();
}
function display_xml_error($error, $xml)
{
$return = $xml[$error->line - 1] . "\n";
$return .= str_repeat('-', $error->column) . "^\n";
switch ($error->level) {
case LIBXML_ERR_WARNING:
$return .= "Warning $error->code: ";
break;
case LIBXML_ERR_ERROR:
$return .= "Error $error->code: ";
break;
case LIBXML_ERR_FATAL:
$return .= "Fatal Error $error->code: ";
break;
}
$return .= trim($error->message) .
"\n Line: $error->line" .
"\n Column: $error->column";
if ($error->file) {
$return .= "\n File: $error->file";
}
return "$return\n\n--------------------------------------------\n\n";
}
?>
```
The above example will output:
```
<titles>PHP: Behind the Parser</title>
----------------------------------------------^
Fatal Error 76: Opening and ending tag mismatch: titles line 4 and title
Line: 4
Column: 46
--------------------------------------------
```
### See Also
* [libxml\_get\_last\_error()](function.libxml-get-last-error) - Retrieve last error from libxml
* [libxml\_clear\_errors()](function.libxml-clear-errors) - Clear libxml error buffer
php str_split str\_split
==========
(PHP 5, PHP 7, PHP 8)
str\_split — Convert a string to an array
### Description
```
str_split(string $string, int $length = 1): array
```
Converts a string to an array.
### Parameters
`string`
The input string.
`length`
Maximum length of the chunk.
### Return Values
If the optional `length` parameter is specified, the returned array will be broken down into chunks with each being `length` in length, except the final chunk which may be shorter if the string does not divide evenly. The default `length` is `1`, meaning every chunk will be one byte in size.
### Errors/Exceptions
If `length` is less than `1`, a [ValueError](class.valueerror) will be thrown.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | If `length` is less than `1`, a [ValueError](class.valueerror) will be thrown now; previously, an error of level **`E_WARNING`** has been raised instead, and the function returned **`false`**. |
### Examples
**Example #1 Example uses of **str\_split()****
```
<?php
$str = "Hello Friend";
$arr1 = str_split($str);
$arr2 = str_split($str, 3);
print_r($arr1);
print_r($arr2);
?>
```
The above example will output:
```
Array
(
[0] => H
[1] => e
[2] => l
[3] => l
[4] => o
[5] =>
[6] => F
[7] => r
[8] => i
[9] => e
[10] => n
[11] => d
)
Array
(
[0] => Hel
[1] => lo
[2] => Fri
[3] => end
)
```
### Notes
>
> **Note**:
>
>
> **str\_split()** will split into bytes, rather than characters when dealing with a multi-byte encoded string. Use [mb\_str\_split()](function.mb-str-split) to split the string into code points.
>
>
### See Also
* [mb\_str\_split()](function.mb-str-split) - Given a multibyte string, return an array of its characters
* [chunk\_split()](function.chunk-split) - Split a string into smaller chunks
* [preg\_split()](function.preg-split) - Split string by a regular expression
* [explode()](function.explode) - Split a string by a string
* [count\_chars()](function.count-chars) - Return information about characters used in a string
* [str\_word\_count()](function.str-word-count) - Return information about words used in a string
* [for](control-structures.for)
php SVMModel::getNrClass SVMModel::getNrClass
====================
(PECL svm >= 0.1.5)
SVMModel::getNrClass — Returns the number of classes the model was trained with
### Description
```
public SVMModel::getNrClass(): int
```
Returns the number of classes the model was trained with, will return 2 for one class and regression models.
### Parameters
This function has no parameters.
### Return Values
Return an integer number of classes
php Yaf_Response_Abstract::setRedirect Yaf\_Response\_Abstract::setRedirect
====================================
(Yaf >=1.0.0)
Yaf\_Response\_Abstract::setRedirect — The setRedirect purpose
### Description
```
public Yaf_Response_Abstract::setRedirect(string $url): bool
```
### Parameters
`url`
address redircted to
### Return Values
php odbc_do odbc\_do
========
(PHP 4, PHP 5, PHP 7, PHP 8)
odbc\_do — Alias of [odbc\_exec()](function.odbc-exec)
### Description
This function is an alias of: [odbc\_exec()](function.odbc-exec).
php SplMinHeap::compare SplMinHeap::compare
===================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplMinHeap::compare — Compare elements in order to place them correctly in the heap while sifting up
### Description
```
protected SplMinHeap::compare(mixed $value1, mixed $value2): int
```
Compare `value1` with `value2`.
### Parameters
`value1`
The value of the first node being compared.
`value2`
The value of the second node being compared.
### Return Values
Result of the comparison, positive integer if `value1` is lower than `value2`, 0 if they are equal, negative integer otherwise.
>
> **Note**:
>
>
> Having multiple elements with the same value in a Heap is not recommended. They will end up in an arbitrary relative position.
>
>
php SNMP::set SNMP::set
=========
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
SNMP::set — Set the value of an SNMP object
### Description
```
public SNMP::set(array|string $objectId, array|string $type, array|string $value): bool
```
Requests remote SNMP agent setting the value of one or more SNMP objects specified by the `objectId`.
### Parameters
If `objectId` is string, both `type` and `value` must be string too. If `objectId` is array `value` must be equal-sized array containing corresponding values, `type` may be either string (it's value will be used for all `objectId`-`value` pairs) or equal-sized array with per-OID value. When any other parameters' combinations are used, a number of E\_WARNING messages may be shown with detailed description.
`objectId`
The SNMP object id
When count of OIDs in object\_id array is greater than max\_oids object property set method will have to use multiple queries to perform requested value updates. In this case type and value checks are made per-chunk so second or subsequent requests may fail due to wrong type or value for OID requested. To mark this a warning is raised when count of OIDs in object\_id array is greater than max\_oids.
`type`
The MIB defines the type of each object id. It has to be specified as a single character from the below list.
**types**| = | The type is taken from the MIB |
| i | INTEGER |
| u | INTEGER |
| s | STRING |
| x | HEX STRING |
| d | DECIMAL STRING |
| n | NULLOBJ |
| o | OBJID |
| t | TIMETICKS |
| a | IPADDRESS |
| b | BITS |
If **`OPAQUE_SPECIAL_TYPES`** was defined while compiling the SNMP library, the following are also valid:
**types**| U | unsigned int64 |
| I | signed int64 |
| F | float |
| D | double |
Most of these will use the obvious corresponding ASN.1 type. 's', 'x', 'd' and 'b' are all different ways of specifying an OCTET STRING value, and the 'u' unsigned type is also used for handling Gauge32 values.
If the MIB-Files are loaded by into the MIB Tree with "snmp\_read\_mib" or by specifying it in the libsnmp config, '=' may be used as the `type` parameter for all object ids as the type can then be automatically read from the MIB.
Note that there are two ways to set a variable of the type BITS like e.g. "SYNTAX BITS {telnet(0), ftp(1), http(2), icmp(3), snmp(4), ssh(5), https(6)}":
* Using type "b" and a list of bit numbers. This method is not recommended since GET query for the same OID would return e.g. 0xF8.
* Using type "x" and a hex number but without(!) the usual "0x" prefix.
See examples section for more details.
`value`
The new value.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
This method does not throw any exceptions by default. To enable throwing an SNMPException exception when some of library errors occur the SNMP class parameter `exceptions_enabled` should be set to a corresponding value. See [`SNMP::$exceptions_enabled` explanation](class.snmp#snmp.props.exceptions-enabled) for more details.
### Examples
**Example #1 Set single SNMP object id**
```
<?php
$session = new SNMP(SNMP::VERSION_2C, "127.0.0.1", "private");
$session->set('SNMPv2-MIB::sysContact.0', 's', "Nobody");
?>
```
**Example #2 Set multiple values using single **SNMP::set()** call**
```
<?php
$session = new SNMP(SNMP::VERSION_2C, "127.0.0.1", "private");
$session->set(array('SNMPv2-MIB::sysContact.0', 'SNMPv2-MIB::sysLocation.0'), array('s', 's'), array("Nobody", "Nowhere"));
// or
$session->set(array('SNMPv2-MIB::sysContact.0', 'SNMPv2-MIB::sysLocation.0'), 's', array("Nobody", "Nowhere"));
?>
```
**Example #3 Using **SNMP::set()** for setting BITS SNMP object id**
```
<?php
$session = new SNMP(SNMP::VERSION_2C, "127.0.0.1", "private");
$session->set('FOO-MIB::bar.42', 'b', '0 1 2 3 4');
// or
$session->set('FOO-MIB::bar.42', 'x', 'F0');
?>
```
### See Also
* [SNMP::get()](snmp.get) - Fetch an SNMP object
php DateTimeInterface::getTimezone DateTimeInterface::getTimezone
==============================
DateTimeImmutable::getTimezone
==============================
DateTime::getTimezone
=====================
date\_timezone\_get
===================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
DateTimeInterface::getTimezone -- DateTimeImmutable::getTimezone -- DateTime::getTimezone -- date\_timezone\_get — Return time zone relative to given DateTime
### Description
Object-oriented style
```
public DateTimeInterface::getTimezone(): DateTimeZone|false
```
```
public DateTimeImmutable::getTimezone(): DateTimeZone|false
```
```
public DateTime::getTimezone(): DateTimeZone|false
```
Procedural style
```
date_timezone_get(DateTimeInterface $object): DateTimeZone|false
```
Return time zone relative to given DateTime.
### Parameters
`object`
Procedural style only: A [DateTime](class.datetime) object returned by [date\_create()](function.date-create)
### Return Values
Returns a [DateTimeZone](class.datetimezone) object on success or **`false`** on failure.
### Examples
**Example #1 **DateTime::getTimezone()** example**
Object-oriented style
```
<?php
$date = new DateTimeImmutable(null, new DateTimeZone('Europe/London'));
$tz = $date->getTimezone();
echo $tz->getName();
?>
```
Procedural style
```
<?php
$date = date_create(null, timezone_open('Europe/London'));
$tz = date_timezone_get($date);
echo timezone_name_get($tz);
?>
```
The above examples will output:
```
Europe/London
```
### See Also
* [DateTime::setTimezone()](datetime.settimezone) - Sets the time zone for the DateTime object
php $_POST $\_POST
=======
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
$\_POST — HTTP POST variables
### Description
An associative array of variables passed to the current script via the HTTP POST method when using `application/x-www-form-urlencoded` or `multipart/form-data` as the HTTP Content-Type in the request.
### Examples
**Example #1 $\_POST example**
```
<?php
echo 'Hello ' . htmlspecialchars($_POST["name"]) . '!';
?>
```
Assuming the user POSTed name=Hannes
The above example will output something similar to:
```
Hello Hannes!
```
### Notes
>
> **Note**:
>
>
> This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. There is no need to do **global $variable;** to access it within functions or methods.
>
>
>
### See Also
* [Handling external variables](language.variables.external)
* [The filter extension](https://www.php.net/manual/en/book.filter.php)
| programming_docs |
php ImagickDraw::setFillRule ImagickDraw::setFillRule
========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setFillRule — Sets the fill rule to use while drawing polygons
### Description
```
public ImagickDraw::setFillRule(int $fill_rule): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Sets the fill rule to use while drawing polygons.
### Parameters
`fill_rule`
One of the [FILLRULE](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.fillrule) constant (`imagick::FILLRULE_*`).
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::setFillRule()** example**
```
<?php
function setFillRule($fillColor, $strokeColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeWidth(1);
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$fillRules = [\Imagick::FILLRULE_NONZERO, \Imagick::FILLRULE_EVENODD];
$points = 11;
$size = 150;
$draw->translate(175, 160);
for ($x = 0; $x < 2; $x++) {
$draw->setFillRule($fillRules[$x]);
$draw->pathStart();
for ($n = 0; $n < $points * 2; $n++) {
if ($n >= $points) {
$angle = fmod($n * 360 * 4 / $points, 360) * pi() / 180;
}
else {
$angle = fmod($n * 360 * 3 / $points, 360) * pi() / 180;
}
$positionX = $size * sin($angle);
$positionY = $size * cos($angle);
if ($n == 0) {
$draw->pathMoveToAbsolute($positionX, $positionY);
}
else {
$draw->pathLineToAbsolute($positionX, $positionY);
}
}
$draw->pathClose();
$draw->pathFinish();
$draw->translate(325, 0);
}
$image = new \Imagick();
$image->newImage(700, 320, $backgroundColor);
$image->setImageFormat("png");
$image->drawImage($draw);
header("Content-Type: image/png");
echo $image->getImageBlob();
}
?>
```
php Ds\Sequence::join Ds\Sequence::join
=================
(PECL ds >= 1.0.0)
Ds\Sequence::join — Joins all values together as a string
### Description
```
abstract public Ds\Sequence::join(string $glue = ?): string
```
Joins all values together as a string using an optional separator between each value.
### Parameters
`glue`
An optional string to separate each value.
### Return Values
All values of the sequence joined together as a string.
### Examples
**Example #1 **Ds\Sequence::join()** example using a separator string**
```
<?php
$sequence = new \Ds\Vector(["a", "b", "c", 1, 2, 3]);
var_dump($sequence->join("|"));
?>
```
The above example will output something similar to:
```
string(11) "a|b|c|1|2|3"
```
**Example #2 **Ds\Sequence::join()** example without a separator string**
```
<?php
$sequence = new \Ds\Vector(["a", "b", "c", 1, 2, 3]);
var_dump($sequence->join());
?>
```
The above example will output something similar to:
```
string(11) "abc123"
```
php SolrDocument::next SolrDocument::next
==================
(PECL solr >= 0.9.2)
SolrDocument::next — Moves the internal pointer to the next field
### Description
```
public SolrDocument::next(): void
```
Moves the internal pointer to the next field.
### Parameters
This function has no parameters.
### Return Values
This method has no return value.
php SolrQuery::setShowDebugInfo SolrQuery::setShowDebugInfo
===========================
(PECL solr >= 0.9.2)
SolrQuery::setShowDebugInfo — Flag to show debug information
### Description
```
public SolrQuery::setShowDebugInfo(bool $flag): SolrQuery
```
Whether to show debug info
### Parameters
`flag`
Whether to show debug info. **`true`** or **`false`**
### Return Values
Returns the current SolrQuery object, if the return value is used.
php ibase_backup ibase\_backup
=============
(PHP 5, PHP 7 < 7.4.0)
ibase\_backup — Initiates a backup task in the service manager and returns immediately
### Description
```
ibase_backup(
resource $service_handle,
string $source_db,
string $dest_file,
int $options = 0,
bool $verbose = false
): mixed
```
This function passes the arguments to the (remote) database server. There it starts a new backup process. Therefore you won't get any responses.
### Parameters
`service_handle`
A previously opened connection to the database server.
`source_db`
The absolute file path to the database on the database server. You can also use a database alias.
`dest_file`
The path to the backup file on the database server.
`options`
Additional options to pass to the database server for backup. The `options` parameter can be a combination of the following constants: **`IBASE_BKP_IGNORE_CHECKSUMS`**, **`IBASE_BKP_IGNORE_LIMBO`**, **`IBASE_BKP_METADATA_ONLY`**, **`IBASE_BKP_NO_GARBAGE_COLLECT`**, **`IBASE_BKP_OLD_DESCRIPTIONS`**, **`IBASE_BKP_NON_TRANSPORTABLE`** or **`IBASE_BKP_CONVERT`**. Read the section about [Predefined Constants](https://www.php.net/manual/en/ibase.constants.php) for further information.
`verbose`
Since the backup process is done on the database server, you don't have any chance to get its output. This argument is useless.
### Return Values
Returns **`true`** on success or **`false`** on failure.
Since the backup process is done on the (remote) server, this function just passes the arguments to it. While the arguments are legal, you won't get **`false`**.
### Examples
**Example #1 **ibase\_backup()** example**
```
<?php
// Attach to database server by ip address and port
$service = ibase_service_attach ('10.1.11.200/3050', 'sysdba', 'masterkey');
// Start the backup process on database server
// Backup employee database using full path to /srv/backup/employees.fbk
// Don't use any special arguments
ibase_backup($service, '/srv/firebird/employees.fdb', '/srv/backup/employees.fbk');
// Free the attached connection
ibase_service_detach ($service);
?>
```
**Example #2 **ibase\_backup()** example with arguments**
```
<?php
// Attach to database server by name and default port
$service = ibase_service_attach ('fb-server.contoso.local', 'sysdba', 'masterkey');
// Start the backup process on database server
// Backup employee database using alias to /srv/backup/employees.fbk.
// Backup only the metadata. Don't create a transportable backup.
ibase_backup($service, 'employees.fdb', '/srv/backup/employees.fbk', IBASE_BKP_METADATA_ONLY | IBASE_BKP_NON_TRANSPORTABLE);
// Free the attached connection
ibase_service_detach ($service);
?>
```
### See Also
* [ibase\_restore()](function.ibase-restore) - Initiates a restore task in the service manager and returns immediately
php gmp_cmp gmp\_cmp
========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_cmp — Compare numbers
### Description
```
gmp_cmp(GMP|int|string $num1, GMP|int|string $num2): int
```
Compares two numbers.
### Parameters
`num1`
A [GMP](class.gmp) object, an int or a numeric string.
`num2`
A [GMP](class.gmp) object, an int or a numeric string.
### Return Values
Returns a positive value if `a > b`, zero if `a = b` and a negative value if `a <
b`.
### Examples
**Example #1 **gmp\_cmp()** example**
```
<?php
$cmp1 = gmp_cmp("1234", "1000"); // greater than
$cmp2 = gmp_cmp("1000", "1234"); // less than
$cmp3 = gmp_cmp("1234", "1234"); // equal to
echo "$cmp1 $cmp2 $cmp3\n";
?>
```
The above example will output:
```
1 -1 0
```
php IntlCalendar::getAvailableLocales IntlCalendar::getAvailableLocales
=================================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::getAvailableLocales — Get array of locales for which there is data
### Description
Object-oriented style
```
public static IntlCalendar::getAvailableLocales(): array
```
Procedural style
```
intlcal_get_available_locales(): array
```
Gives the list of locales for which calendars are installed. As of ICU 51, this is the list of all installed ICU locales.
### Parameters
This function has no parameters.
### Return Values
An array of strings, one for which locale.
### Examples
**Example #1 **IntlCalendar::getAvailableLocales()****
```
<?php
print_r(IntlCalendar::getAvailableLocales());
```
The above example will output:
```
Array
(
[0] => af
[1] => af_NA
[2] => af_ZA
[3] => agq
[4] => agq_CM
[5] => ak
[6] => ak_GH
[7] => am
[8] => am_ET
[9] => ar
[10] => ar_001
[11] => ar_AE
[12] => ar_BH
[13] => ar_DJ
… output abbreviated …
[595] => zh_Hant_HK
[596] => zh_Hant_MO
[597] => zh_Hant_TW
[598] => zu
[599] => zu_ZA
)
```
php SplQueue::__construct SplQueue::\_\_construct
=======================
(PHP 5 >= 5.3.0, PHP 7)
SplQueue::\_\_construct — Constructs a new queue implemented using a doubly linked list
### Description
public **SplQueue::\_\_construct**() This constructs a new empty queue.
>
> **Note**:
>
>
> This method automatically sets the iterator mode to SplDoublyLinkedList::IT\_MODE\_FIFO.
>
>
### Parameters
This function has no parameters.
### Examples
**Example #1 **SplQueue::\_\_construct()** example**
```
<?php
$q = new SplQueue();
$q[] = 1;
$q[] = 2;
$q[] = 3;
foreach ($q as $elem) {
echo $elem."\n";
}
?>
```
The above example will output:
```
1
2
3
```
**Example #2 Efficiently handling tasks with [SplQueue](class.splqueue)**
```
<?php
$q = new SplQueue();
$q->setIteratorMode(SplQueue::IT_MODE_DELETE);
// ... enqueue some tasks on the queue ...
// process them
foreach ($q as $task) {
// ... process $task ...
// add new tasks on the queue
$q[] = $newTask;
// ...
}
?>
```
php bzerror bzerror
=======
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
bzerror — Returns the bzip2 error number and error string in an array
### Description
```
bzerror(resource $bz): array
```
Returns the error number and error string of any bzip2 error returned by the given file pointer.
### Parameters
`bz`
The file pointer. It must be valid and must point to a file successfully opened by [bzopen()](function.bzopen).
### Return Values
Returns an associative array, with the error code in the `errno` entry, and the error message in the `errstr` entry.
### Examples
**Example #1 **bzerror()** example**
```
<?php
$error = bzerror($bz);
echo $error["errno"];
echo $error["errstr"];
?>
```
### See Also
* [bzerrno()](function.bzerrno) - Returns a bzip2 error number
* [bzerrstr()](function.bzerrstr) - Returns a bzip2 error string
php DOMNode::lookupNamespaceUri DOMNode::lookupNamespaceUri
===========================
(PHP 5, PHP 7, PHP 8)
DOMNode::lookupNamespaceUri — Gets the namespace URI of the node based on the prefix
### Description
```
public DOMNode::lookupNamespaceUri(string $prefix): string
```
Gets the namespace URI of the node based on the `prefix`.
### Parameters
`prefix`
The prefix of the namespace.
### Return Values
The namespace URI of the node.
### See Also
* [DOMNode::lookupPrefix()](domnode.lookupprefix) - Gets the namespace prefix of the node based on the namespace URI
php ImagickDraw::getFontWeight ImagickDraw::getFontWeight
==========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::getFontWeight — Returns the font weight
### Description
```
public ImagickDraw::getFontWeight(): int
```
**Warning**This function is currently not documented; only its argument list is available.
Returns the font weight used when annotating with text.
### Return Values
Returns an int on success and 0 if no weight is set.
php date_default_timezone_get date\_default\_timezone\_get
============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
date\_default\_timezone\_get — Gets the default timezone used by all date/time functions in a script
### Description
```
date_default_timezone_get(): string
```
In order of preference, this function returns the default timezone by:
* Reading the timezone set using the [date\_default\_timezone\_set()](function.date-default-timezone-set) function (if any)
* Reading the value of the [date.timezone](https://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone) ini option (if set)
If none of the above succeed, **date\_default\_timezone\_get()** will return a default timezone of `UTC`.
### Parameters
This function has no parameters.
### Return Values
Returns a string.
### Examples
**Example #1 Getting the default timezone**
```
<?php
date_default_timezone_set('Europe/London');
if (date_default_timezone_get()) {
echo 'date_default_timezone_set: ' . date_default_timezone_get() . '<br />';
}
if (ini_get('date.timezone')) {
echo 'date.timezone: ' . ini_get('date.timezone');
}
?>
```
The above example will output something similar to:
```
date_default_timezone_set: Europe/London
date.timezone: Europe/London
```
**Example #2 Getting the abbreviation of a timezone**
```
<?php
date_default_timezone_set('America/Los_Angeles');
echo date_default_timezone_get() . ' => ' . date('e') . ' => ' . date('T');
?>
```
The above example will output:
```
America/Los_Angeles => America/Los_Angeles => PST
```
### See Also
* [date\_default\_timezone\_set()](function.date-default-timezone-set) - Sets the default timezone used by all date/time functions in a script
* [List of Supported Timezones](https://www.php.net/manual/en/timezones.php)
php SolrInputDocument::getFieldCount SolrInputDocument::getFieldCount
================================
(PECL solr >= 0.9.2)
SolrInputDocument::getFieldCount — Returns the number of fields in the document
### Description
```
public SolrInputDocument::getFieldCount(): int|false
```
Returns the number of fields in the document.
### Parameters
This function has no parameters.
### Return Values
Returns an integer on success or **`false`** on failure.
php pg_send_prepare pg\_send\_prepare
=================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
pg\_send\_prepare — Sends a request to create a prepared statement with the given parameters, without waiting for completion
### Description
```
pg_send_prepare(PgSql\Connection $connection, string $statement_name, string $query): int|bool
```
Sends a request to create a prepared statement with the given parameters, without waiting for completion.
This is an asynchronous version of [pg\_prepare()](function.pg-prepare): it returns **`true`** if it was able to dispatch the request, and **`false`** if not. After a successful call, call [pg\_get\_result()](function.pg-get-result) to determine whether the server successfully created the prepared statement. The function's parameters are handled identically to [pg\_prepare()](function.pg-prepare). Like [pg\_prepare()](function.pg-prepare), it will not work on pre-7.4 versions of PostgreSQL.
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance.
`statement_name`
The name to give the prepared statement. Must be unique per-connection. If "" is specified, then an unnamed statement is created, overwriting any previously defined unnamed statement.
`query`
The parameterized SQL statement. Must contain only a single statement. (multiple statements separated by semi-colons are not allowed.) If any parameters are used, they are referred to as $1, $2, etc.
### Return Values
Returns **`true`** on success, **`false`** or `0` on failure. Use [pg\_get\_result()](function.pg-get-result) to determine the query result.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 Using **pg\_send\_prepare()****
```
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
// Prepare a query for execution
if (!pg_connection_busy($dbconn)) {
pg_send_prepare($dbconn, "my_query", 'SELECT * FROM shops WHERE name = $1');
$res1 = pg_get_result($dbconn);
}
// Execute the prepared query. Note that it is not necessary to escape
// the string "Joe's Widgets" in any way
if (!pg_connection_busy($dbconn)) {
pg_send_execute($dbconn, "my_query", array("Joe's Widgets"));
$res2 = pg_get_result($dbconn);
}
// Execute the same prepared query, this time with a different parameter
if (!pg_connection_busy($dbconn)) {
pg_send_execute($dbconn, "my_query", array("Clothes Clothes Clothes"));
$res3 = pg_get_result($dbconn);
}
?>
```
### See Also
* [pg\_connect()](function.pg-connect) - Open a PostgreSQL connection
* [pg\_pconnect()](function.pg-pconnect) - Open a persistent PostgreSQL connection
* [pg\_execute()](function.pg-execute) - Sends a request to execute a prepared statement with given parameters, and waits for the result
* [pg\_send\_execute()](function.pg-send-execute) - Sends a request to execute a prepared statement with given parameters, without waiting for the result(s)
* [pg\_send\_query\_params()](function.pg-send-query-params) - Submits a command and separate parameters to the server without waiting for the result(s)
php ReflectionExtension::isTemporary ReflectionExtension::isTemporary
================================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
ReflectionExtension::isTemporary — Returns whether this extension is temporary
### Description
```
public ReflectionExtension::isTemporary(): bool
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** for extensions loaded by [dl()](function.dl), **`false`** otherwise.
### See Also
* [ReflectionExtension::isPersistent()](reflectionextension.ispersistent) - Returns whether this extension is persistent
php ldap_sasl_bind ldap\_sasl\_bind
================
(PHP 5, PHP 7, PHP 8)
ldap\_sasl\_bind — Bind to LDAP directory using SASL
### Description
```
ldap_sasl_bind(
LDAP\Connection $ldap,
?string $dn = null,
?string $password = null,
?string $mech = null,
?string $realm = null,
?string $authc_id = null,
?string $authz_id = null,
?string $props = null
): bool
```
**Warning**This function is currently not documented; only its argument list is available.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `ldap` parameter expects an [LDAP\Connection](class.ldap-connection) instance now; previously, a [resource](language.types.resource) was expected. |
| 8.0.0 | `dn`, `password`, `mech`, `realm`, `authc_id`, `authz_id` and `props` are nullable now. |
### Notes
> **Note**: **Requirement**
> **ldap\_sasl\_bind()** requires SASL support (sasl.h). Be sure `--with-ldap-sasl` is used when configuring PHP otherwise this function will be undefined.
>
>
php Fiber::resume Fiber::resume
=============
(PHP 8 >= 8.1.0)
Fiber::resume — Resumes execution of the fiber with a value
### Description
```
public Fiber::resume(mixed $value = null): mixed
```
Resumes the fiber using the given value as the result of the current [Fiber::suspend()](fiber.suspend) call.
If the fiber is not suspended when this method is called, a [FiberError](class.fibererror) will be thrown.
### Parameters
`value`
The value to resume the fiber. This value will be the return value of the current [Fiber::suspend()](fiber.suspend) call.
### Return Values
The value provided to the next call to [Fiber::suspend()](fiber.suspend) or **`null`** if the fiber returns. If the fiber throws an exception before suspending, it will be thrown from the call to this method.
| programming_docs |
php gnupg_clearsignkeys gnupg\_clearsignkeys
====================
(PECL gnupg >= 0.5)
gnupg\_clearsignkeys — Removes all keys which were set for signing before
### Description
```
gnupg_clearsignkeys(resource $identifier): bool
```
### Parameters
`identifier`
The gnupg identifier, from a call to [gnupg\_init()](function.gnupg-init) or **gnupg**.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Procedural **gnupg\_clearsignkeys()** example**
```
<?php
$res = gnupg_init();
gnupg_clearsignkeys($res);
?>
```
**Example #2 OO **gnupg\_clearsignkeys()** example**
```
<?php
$gpg = new gnupg();
$gpg->clearsignkeys();
?>
```
php get_magic_quotes_runtime get\_magic\_quotes\_runtime
===========================
(PHP 4, PHP 5, PHP 7)
get\_magic\_quotes\_runtime — Gets the current active configuration setting of magic\_quotes\_runtime
**Warning**This function has been *DEPRECATED* as of PHP 7.4.0, and *REMOVED* as of PHP 8.0.0. Relying on this function is highly discouraged.
### Description
```
get_magic_quotes_runtime(): bool
```
Returns the current active configuration setting of [magic\_quotes\_runtime](https://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime).
### Parameters
This function has no parameters.
### Return Values
Returns 0 if magic\_quotes\_runtime is off, 1 otherwise. Or always returns **`false`** as of PHP 5.4.0.
### Changelog
| Version | Description |
| --- | --- |
| 7.4.0 | This function has been deprecated. |
### Examples
**Example #1 **get\_magic\_quotes\_runtime()** example**
```
<?php
// Check if magic_quotes_runtime is active
if(get_magic_quotes_runtime())
{
// Deactivate
set_magic_quotes_runtime(false);
}
?>
```
### See Also
* [get\_magic\_quotes\_gpc()](function.get-magic-quotes-gpc) - Gets the current configuration setting of magic\_quotes\_gpc
php SolrQuery::getHighlightAlternateField SolrQuery::getHighlightAlternateField
=====================================
(PECL solr >= 0.9.2)
SolrQuery::getHighlightAlternateField — Returns the highlight field to use as backup or default
### Description
```
public SolrQuery::getHighlightAlternateField(string $field_override = ?): string
```
Returns the highlight field to use as backup or default. It accepts an optional override.
### Parameters
`field_override`
The name of the field
### Return Values
Returns a string on success and **`null`** if not set.
php serialize serialize
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
serialize — Generates a storable representation of a value
### Description
```
serialize(mixed $value): string
```
Generates a storable representation of a value.
This is useful for storing or passing PHP values around without losing their type and structure.
To make the serialized string into a PHP value again, use [unserialize()](function.unserialize).
### Parameters
`value`
The value to be serialized. **serialize()** handles all types, except the resource-type and some objects (see note below). You can even **serialize()** arrays that contain references to itself. Circular references inside the array/object you are serializing will also be stored. Any other reference will be lost.
When serializing objects, PHP will attempt to call the member functions [\_\_serialize()](language.oop5.magic#object.serialize) or [\_\_sleep()](language.oop5.magic#object.sleep) prior to serialization. This is to allow the object to do any last minute clean-up, etc. prior to being serialized. Likewise, when the object is restored using [unserialize()](function.unserialize) the [\_\_unserialize()](language.oop5.magic#object.unserialize) or [\_\_wakeup()](language.oop5.magic#object.wakeup) member function is called.
>
> **Note**:
>
>
> Object's private members have the class name prepended to the member name; protected members have a '\*' prepended to the member name. These prepended values have null bytes on either side.
>
>
### Return Values
Returns a string containing a byte-stream representation of `value` that can be stored anywhere.
Note that this is a binary string which may include null bytes, and needs to be stored and handled as such. For example, **serialize()** output should generally be stored in a BLOB field in a database, rather than a CHAR or TEXT field.
### Examples
**Example #1 **serialize()** example**
```
<?php
// $session_data contains a multi-dimensional array with session
// information for the current user. We use serialize() to store
// it in a database at the end of the request.
$conn = odbc_connect("webdb", "php", "chicken");
$stmt = odbc_prepare($conn,
"UPDATE sessions SET data = ? WHERE id = ?");
$sqldata = array (serialize($session_data), $_SERVER['PHP_AUTH_USER']);
if (!odbc_execute($stmt, $sqldata)) {
$stmt = odbc_prepare($conn,
"INSERT INTO sessions (id, data) VALUES(?, ?)");
if (!odbc_execute($stmt, array_reverse($sqldata))) {
/* Something went wrong.. */
}
}
?>
```
### Notes
>
> **Note**:
>
>
> Note that many built-in PHP objects cannot be serialized. However, those with this ability either implement the [Serializable](class.serializable) interface or the magic [\_\_serialize()](language.oop5.magic#object.serialize)/[\_\_unserialize()](language.oop5.magic#object.unserialize) or [\_\_sleep()](language.oop5.magic#object.sleep)/[\_\_wakeup()](language.oop5.magic#object.wakeup) methods. If an internal class does not fulfill any of those requirements, it cannot reliably be serialized.
>
> There are some historical exceptions to the above rule, where some internal objects could be serialized without implementing the interface or exposing the methods.
>
>
**Warning** When **serialize()** serializes objects, the leading backslash is not included in the class name of namespaced classes for maximum compatibility.
### See Also
* [unserialize()](function.unserialize) - Creates a PHP value from a stored representation
* [var\_export()](function.var-export) - Outputs or returns a parsable string representation of a variable
* [json\_encode()](function.json-encode) - Returns the JSON representation of a value
* [Serializing Objects](language.oop5.serialization)
* [\_\_sleep()](language.oop5.magic#object.sleep)
* [\_\_wakeup()](language.oop5.magic#object.wakeup)
* [\_\_serialize()](language.oop5.magic#object.serialize)
* [\_\_unserialize()](language.oop5.magic#object.unserialize)
php ArrayObject::setIteratorClass ArrayObject::setIteratorClass
=============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
ArrayObject::setIteratorClass — Sets the iterator classname for the ArrayObject
### Description
```
public ArrayObject::setIteratorClass(string $iteratorClass): void
```
Sets the classname of the array iterator that is used by [ArrayObject::getIterator()](arrayobject.getiterator).
### Parameters
`iteratorClass`
The classname of the array iterator to use when iterating over this object.
### Return Values
No value is returned.
### Examples
**Example #1 **ArrayObject::setIteratorClass()** example**
```
<?php
// Custom ArrayIterator (inherits from ArrayIterator)
class MyArrayIterator extends ArrayIterator {
// custom implementation
}
// Array of available fruits
$fruits = array("lemons" => 1, "oranges" => 4, "bananas" => 5, "apples" => 10);
$fruitsArrayObject = new ArrayObject($fruits);
// Set the iterator classname to the newly
$fruitsArrayObject->setIteratorClass('MyArrayIterator');
print_r($fruitsArrayObject->getIterator());
?>
```
The above example will output:
```
MyArrayIterator Object
(
[lemons] => 1
[oranges] => 4
[bananas] => 5
[apples] => 10
)
```
php posix_mknod posix\_mknod
============
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
posix\_mknod — Create a special or ordinary file (POSIX.1)
### Description
```
posix_mknod(
string $filename,
int $flags,
int $major = 0,
int $minor = 0
): bool
```
Creates a special or ordinary file.
### Parameters
`filename`
The file to create
`flags`
This parameter is constructed by a bitwise OR between file type (one of the following constants: **`POSIX_S_IFREG`**, **`POSIX_S_IFCHR`**, **`POSIX_S_IFBLK`**, **`POSIX_S_IFIFO`** or **`POSIX_S_IFSOCK`**) and permissions.
`major`
The major device kernel identifier (required to pass when using **`S_IFCHR`** or **`S_IFBLK`**).
`minor`
The minor device kernel identifier.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 A **posix\_mknod()** example**
```
<?php
$file = '/tmp/tmpfile'; // file name
$type = POSIX_S_IFBLK; // file type
$permissions = 0777; // octal
$major = 1;
$minor = 8; // /dev/random
if (!posix_mknod($file, $type | $permissions, $major, $minor)) {
die('Error ' . posix_get_last_error() . ': ' . posix_strerror(posix_get_last_error()));
}
?>
```
### See Also
* [posix\_mkfifo()](function.posix-mkfifo) - Create a fifo special file (a named pipe)
php stats_dens_pmf_negative_binomial stats\_dens\_pmf\_negative\_binomial
====================================
(PECL stats >= 1.0.0)
stats\_dens\_pmf\_negative\_binomial — Probability mass function of the negative binomial distribution
### Description
```
stats_dens_pmf_negative_binomial(float $x, float $n, float $pi): float
```
Returns the probability mass at `x`, where the random variable follows the negative binomial distribution of which the number of the success is `n` and the success rate is `pi`.
### Parameters
`x`
The value at which the probability mass is calculated
`n`
The number of the success of the distribution
`pi`
The success rate of the distribution
### Return Values
The probability mass at `x` or **`false`** for failure.
php jddayofweek jddayofweek
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
jddayofweek — Returns the day of the week
### Description
```
jddayofweek(int $julian_day, int $mode = CAL_DOW_DAYNO): int|string
```
Returns the day of the week. Can return a string or an integer depending on the mode.
### Parameters
`julian_day`
A julian day number as integer
`mode`
**Calendar week modes**| Mode | Meaning |
| --- | --- |
| 0 (Default) | Return the day number as an int (0=Sunday, 1=Monday, etc) |
| 1 | Returns string containing the day of week (English-Gregorian) |
| 2 | Return a string containing the abbreviated day of week (English-Gregorian) |
### Return Values
The gregorian weekday as either an integer or string.
php LimitIterator::getInnerIterator LimitIterator::getInnerIterator
===============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
LimitIterator::getInnerIterator — Get inner iterator
### Description
```
public LimitIterator::getInnerIterator(): Iterator
```
Gets the inner [Iterator](class.iterator).
### Parameters
This function has no parameters.
### Return Values
The inner iterator passed to [LimitIterator::\_\_construct()](limititerator.construct).
### See Also
* [LimitIterator::\_\_construct()](limititerator.construct) - Construct a LimitIterator
* [IteratorIterator::getInnerIterator()](iteratoriterator.getinneriterator) - Get the inner iterator
php SolrCollapseFunction::setField SolrCollapseFunction::setField
==============================
(PECL solr >= 2.2.0)
SolrCollapseFunction::setField — Sets the field to collapse on
### Description
```
public SolrCollapseFunction::setField(string $fieldName): SolrCollapseFunction
```
The field name to collapse on. In order to collapse a result. The field type must be a single valued String, Int or Float.
### Parameters
`fieldName`
### Return Values
[SolrCollapseFunction](class.solrcollapsefunction)
php The LogicException class
The LogicException class
========================
Introduction
------------
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
Exception that represents error in the program logic. This kind of exception should lead directly to a fix in your code.
Class synopsis
--------------
class **LogicException** extends [Exception](class.exception) { /\* Inherited properties \*/ protected string [$message](class.exception#exception.props.message) = "";
private string [$string](class.exception#exception.props.string) = "";
protected int [$code](class.exception#exception.props.code);
protected string [$file](class.exception#exception.props.file) = "";
protected int [$line](class.exception#exception.props.line);
private array [$trace](class.exception#exception.props.trace) = [];
private ?[Throwable](class.throwable) [$previous](class.exception#exception.props.previous) = null; /\* Inherited methods \*/
```
final public Exception::getMessage(): string
```
```
final public Exception::getPrevious(): ?Throwable
```
```
final public Exception::getCode(): int
```
```
final public Exception::getFile(): string
```
```
final public Exception::getLine(): int
```
```
final public Exception::getTrace(): array
```
```
final public Exception::getTraceAsString(): string
```
```
public Exception::__toString(): string
```
```
private Exception::__clone(): void
```
}
php The ReflectionEnumBackedCase class
The ReflectionEnumBackedCase class
==================================
Introduction
------------
(PHP 8 >= 8.1.0)
The **ReflectionEnumBackedCase** class reports information about an Enum backed case, which has a scalar equivalent.
Class synopsis
--------------
class **ReflectionEnumBackedCase** extends [ReflectionEnumUnitCase](class.reflectionenumunitcase) { /\* Inherited constants \*/ public const int [ReflectionClassConstant::IS\_PUBLIC](class.reflectionclassconstant#reflectionclassconstant.constants.is-public);
public const int [ReflectionClassConstant::IS\_PROTECTED](class.reflectionclassconstant#reflectionclassconstant.constants.is-protected);
public const int [ReflectionClassConstant::IS\_PRIVATE](class.reflectionclassconstant#reflectionclassconstant.constants.is-private);
public const int [ReflectionClassConstant::IS\_FINAL](class.reflectionclassconstant#reflectionclassconstant.constants.is-final); /\* Inherited properties \*/
public string [$name](class.reflectionclassconstant#reflectionclassconstant.props.name);
public string [$class](class.reflectionclassconstant#reflectionclassconstant.props.class); /\* Methods \*/ public [\_\_construct](reflectionenumbackedcase.construct)(object|string `$class`, string `$constant`)
```
public getBackingValue(): int|string
```
/\* Inherited methods \*/
```
public ReflectionEnumUnitCase::getEnum(): ReflectionEnum
```
```
public ReflectionEnumUnitCase::getValue(): UnitEnum
```
```
public static ReflectionClassConstant::export(mixed $class, string $name, bool $return = ?): string
```
```
public ReflectionClassConstant::getAttributes(?string $name = null, int $flags = 0): array
```
```
public ReflectionClassConstant::getDeclaringClass(): ReflectionClass
```
```
public ReflectionClassConstant::getDocComment(): string|false
```
```
public ReflectionClassConstant::getModifiers(): int
```
```
public ReflectionClassConstant::getName(): string
```
```
public ReflectionClassConstant::getValue(): mixed
```
```
public ReflectionClassConstant::isEnumCase(): bool
```
```
public ReflectionClassConstant::isFinal(): bool
```
```
public ReflectionClassConstant::isPrivate(): bool
```
```
public ReflectionClassConstant::isProtected(): bool
```
```
public ReflectionClassConstant::isPublic(): bool
```
```
public ReflectionClassConstant::__toString(): string
```
} See Also
--------
* [Enumerations](https://www.php.net/manual/en/language.enumerations.php)
* [ReflectionEnumUnitCase](class.reflectionenumunitcase)
Table of Contents
-----------------
* [ReflectionEnumBackedCase::\_\_construct](reflectionenumbackedcase.construct) — Instantiates a ReflectionEnumBackedCase object
* [ReflectionEnumBackedCase::getBackingValue](reflectionenumbackedcase.getbackingvalue) — Gets the scalar value backing this Enum case
php streamWrapper::url_stat streamWrapper::url\_stat
========================
(PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8)
streamWrapper::url\_stat — Retrieve information about a file
### Description
```
public streamWrapper::url_stat(string $path, int $flags): array|false
```
This method is called in response to all [stat()](function.stat) related functions, such as:
* [copy()](function.copy)
* [fileperms()](function.fileperms)
* [fileinode()](function.fileinode)
* [filesize()](function.filesize)
* [fileowner()](function.fileowner)
* [filegroup()](function.filegroup)
* [fileatime()](function.fileatime)
* [filemtime()](function.filemtime)
* [filectime()](function.filectime)
* [filetype()](function.filetype)
* [is\_writable()](function.is-writable)
* [is\_readable()](function.is-readable)
* [is\_executable()](function.is-executable)
* [is\_file()](function.is-file)
* [is\_dir()](function.is-dir)
* [is\_link()](function.is-link)
* [file\_exists()](function.file-exists)
* [lstat()](function.lstat)
* [stat()](function.stat)
* [SplFileInfo::getPerms()](splfileinfo.getperms)
* [SplFileInfo::getInode()](splfileinfo.getinode)
* [SplFileInfo::getSize()](splfileinfo.getsize)
* [SplFileInfo::getOwner()](splfileinfo.getowner)
* [SplFileInfo::getGroup()](splfileinfo.getgroup)
* [SplFileInfo::getATime()](splfileinfo.getatime)
* [SplFileInfo::getMTime()](splfileinfo.getmtime)
* [SplFileInfo::getCTime()](splfileinfo.getctime)
* [SplFileInfo::getType()](splfileinfo.gettype)
* [SplFileInfo::isWritable()](splfileinfo.iswritable)
* [SplFileInfo::isReadable()](splfileinfo.isreadable)
* [SplFileInfo::isExecutable()](splfileinfo.isexecutable)
* [SplFileInfo::isFile()](splfileinfo.isfile)
* [SplFileInfo::isDir()](splfileinfo.isdir)
* [SplFileInfo::isLink()](splfileinfo.islink)
* [RecursiveDirectoryIterator::hasChildren()](recursivedirectoryiterator.haschildren)
### Parameters
`path`
The file path or URL to stat. Note that in the case of a URL, it must be a :// delimited URL. Other URL forms are not supported.
`flags`
Holds additional flags set by the streams API. It can hold one or more of the following values OR'd together.
| Flag | Description |
| --- | --- |
| STREAM\_URL\_STAT\_LINK | For resources with the ability to link to other resource (such as an HTTP Location: forward, or a filesystem symlink). This flag specified that only information about the link itself should be returned, not the resource pointed to by the link. This flag is set in response to calls to [lstat()](function.lstat), [is\_link()](function.is-link), or [filetype()](function.filetype). |
| STREAM\_URL\_STAT\_QUIET | If this flag is set, your wrapper should not raise any errors. If this flag is not set, you are responsible for reporting errors using the [trigger\_error()](function.trigger-error) function during stating of the path. |
### Return Values
Should return an array with the same elements as [stat()](function.stat) does. Unknown or unavailable values should be set to a rational value (usually **`0`**). Special attention should be payed to `mode` as documented under [stat()](function.stat). Should return **`false`** on failure.
### Errors/Exceptions
Emits **`E_WARNING`** if call to this method fails (i.e. not implemented).
### Notes
>
> **Note**:
>
>
> The streamWrapper::$context property is updated if a valid context is passed to the caller function.
>
>
>
### See Also
* [stat()](function.stat) - Gives information about a file
* [streamwrapper::stream\_stat()](streamwrapper.stream-stat) - Retrieve information about a file resource
| programming_docs |
php GearmanClient::__construct GearmanClient::\_\_construct
============================
(PECL gearman >= 0.5.0)
GearmanClient::\_\_construct — Create a GearmanClient instance
### Description
```
public GearmanClient::__construct()
```
Creates a [GearmanClient](class.gearmanclient) instance representing a client that connects to the job server and submits tasks to complete.
### Parameters
This function has no parameters.
### Return Values
A [GearmanClient](class.gearmanclient) object.
### See Also
* [GearmanClient::clone()](gearmanclient.clone) - Create a copy of a GearmanClient object
php pg_copy_from pg\_copy\_from
==============
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg\_copy\_from — Insert records into a table from an array
### Description
```
pg_copy_from(
PgSql\Connection $connection,
string $table_name,
array $rows,
string $separator = "\t",
string $null_as = "\\\\N"
): bool
```
**pg\_copy\_from()** inserts records into a table from `rows`. It issues a `COPY FROM` SQL command internally to insert records.
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance.
`table_name`
Name of the table into which to copy the `rows`.
`rows`
An array of data to be copied into `table_name`. Each value in `rows` becomes a row in `table_name`. Each value in `rows` should be a delimited string of the values to insert into each field. Values should be linefeed terminated.
`separator`
The token that separates values for each field in each element of `rows`. Default is `\t`.
`null_as`
How SQL `NULL` values are represented in the `rows`. Default is `\\N` (`"\\\\N"`).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **pg\_copy\_from()** example**
```
<?php
$db = pg_connect("dbname=publisher") or die("Could not connect");
$rows = pg_copy_to($db, $table_name);
pg_query($db, "DELETE FROM $table_name");
pg_copy_from($db, $table_name, $rows);
?>
```
### See Also
* [pg\_copy\_to()](function.pg-copy-to) - Copy a table to an array
php The UnitEnum interface
The UnitEnum interface
======================
Introduction
------------
(PHP 8 >= 8.1.0)
The **UnitEnum** interface is automatically applied to all enumerations by the engine. It may not be implemented by user-defined classes. Enumerations may not override its methods, as default implementations are provided by the engine. It is available only for type checks.
Interface synopsis
------------------
interface **UnitEnum** { /\* Methods \*/
```
public static cases(): array
```
} Table of Contents
-----------------
* [UnitEnum::cases](unitenum.cases) — Generates a list of cases on an enum
php IntlPartsIterator::getBreakIterator IntlPartsIterator::getBreakIterator
===================================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlPartsIterator::getBreakIterator — Get IntlBreakIterator backing this parts iterator
### Description
```
public IntlPartsIterator::getBreakIterator(): IntlBreakIterator
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php ReflectionClass::getMethods ReflectionClass::getMethods
===========================
(PHP 5, PHP 7, PHP 8)
ReflectionClass::getMethods — Gets an array of methods
### Description
```
public ReflectionClass::getMethods(?int $filter = null): array
```
Gets an array of methods for the class.
### Parameters
`filter`
Filter the results to include only methods with certain attributes. Defaults to no filtering.
Any bitwise disjunction of **`ReflectionMethod::IS_STATIC`**, **`ReflectionMethod::IS_PUBLIC`**, **`ReflectionMethod::IS_PROTECTED`**, **`ReflectionMethod::IS_PRIVATE`**, **`ReflectionMethod::IS_ABSTRACT`**, **`ReflectionMethod::IS_FINAL`**, so that all methods with *any* of the given attributes will be returned.
> **Note**: Note that other bitwise operations, for instance `~` will not work as expected. In other words, it is not possible to retrieve all non-static methods, for example.
>
>
### Return Values
An array of [ReflectionMethod](class.reflectionmethod) objects reflecting each method.
### Changelog
| Version | Description |
| --- | --- |
| 7.2.0 | `filter` is nullable now. |
### Examples
**Example #1 Basic usage of **ReflectionClass::getMethods()****
```
<?php
class Apple {
public function firstMethod() { }
final protected function secondMethod() { }
private static function thirdMethod() { }
}
$class = new ReflectionClass('Apple');
$methods = $class->getMethods();
var_dump($methods);
?>
```
The above example will output:
```
array(3) {
[0]=>
object(ReflectionMethod)#2 (2) {
["name"]=>
string(11) "firstMethod"
["class"]=>
string(5) "Apple"
}
[1]=>
object(ReflectionMethod)#3 (2) {
["name"]=>
string(12) "secondMethod"
["class"]=>
string(5) "Apple"
}
[2]=>
object(ReflectionMethod)#4 (2) {
["name"]=>
string(11) "thirdMethod"
["class"]=>
string(5) "Apple"
}
}
```
**Example #2 Filtering results from **ReflectionClass::getMethods()****
```
<?php
class Apple {
public function firstMethod() { }
final protected function secondMethod() { }
private static function thirdMethod() { }
}
$class = new ReflectionClass('Apple');
$methods = $class->getMethods(ReflectionMethod::IS_STATIC | ReflectionMethod::IS_FINAL);
var_dump($methods);
?>
```
The above example will output:
```
array(2) {
[0]=>
object(ReflectionMethod)#2 (2) {
["name"]=>
string(12) "secondMethod"
["class"]=>
string(5) "Apple"
}
[1]=>
object(ReflectionMethod)#3 (2) {
["name"]=>
string(11) "thirdMethod"
["class"]=>
string(5) "Apple"
}
}
```
### See Also
* [ReflectionClass::getMethod()](reflectionclass.getmethod) - Gets a ReflectionMethod for a class method
* [get\_class\_methods()](function.get-class-methods) - Gets the class methods' names
php RecursiveTreeIterator::setPrefixPart RecursiveTreeIterator::setPrefixPart
====================================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
RecursiveTreeIterator::setPrefixPart — Set a part of the prefix
### Description
```
public RecursiveTreeIterator::setPrefixPart(int $part, string $value): void
```
Sets a part of the prefix used in the graphic tree.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`part`
One of the [RecursiveTreeIterator::PREFIX\_\*](class.recursivetreeiterator#recursivetreeiterator.constants) constants.
`value`
The value to assign to the part of the prefix specified in `part`.
### Return Values
No value is returned.
php GmagickDraw::ellipse GmagickDraw::ellipse
====================
(PECL gmagick >= Unknown)
GmagickDraw::ellipse — Draws an ellipse on the image
### Description
```
public GmagickDraw::ellipse(
float $ox,
float $oy,
float $rx,
float $ry,
float $start,
float $end
): GmagickDraw
```
Draws an ellipse on the image.
### Parameters
`ox`
origin x ordinate
`oy`
origin y ordinate
`rx`
radius in x
`ry`
radius in y
`start`
starting rotation in degrees
`end`
ending rotation in degrees
### Return Values
The [GmagickDraw](class.gmagickdraw) object.
php Ds\Stack::__construct Ds\Stack::\_\_construct
=======================
(PECL ds >= 1.0.0)
Ds\Stack::\_\_construct — Creates a new instance
### Description
public **Ds\Stack::\_\_construct**([mixed](language.types.declarations#language.types.declarations.mixed) `$values` = ?) Creates a new instance, using either a [traversable](class.traversable) object or an array for the initial `values`.
### Parameters
`values`
A traversable object or an array to use for the initial values.
### Examples
**Example #1 **Ds\Stack::\_\_construct()** example**
```
<?php
$stack = new \Ds\Stack();
print_r($stack);
$stack = new \Ds\Stack([1, 2, 3]);
print_r($stack);
?>
```
The above example will output something similar to:
```
Ds\Stack Object
(
)
Ds\Stack Object
(
[0] => 3
[1] => 2
[2] => 1
)
```
php GmagickDraw::getfontweight GmagickDraw::getfontweight
==========================
(PECL gmagick >= Unknown)
GmagickDraw::getfontweight — Returns the font weight
### Description
```
public GmagickDraw::getfontweight(): int
```
Returns the font weight used when annotating with text.
### Parameters
This function has no parameters.
### Return Values
Returns an int on success and 0 if no weight is set.
php Yaf_Session::__isset Yaf\_Session::\_\_isset
=======================
(Yaf >=1.0.0)
Yaf\_Session::\_\_isset — The \_\_isset purpose
### Description
```
public Yaf_Session::__isset(string $name): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`name`
### Return Values
php EvStat::set EvStat::set
===========
(PECL ev >= 0.2.0)
EvStat::set — Configures the watcher
### Description
```
public EvStat::set( string $path , float $interval ): void
```
Configures the watcher.
### Parameters
`path` The path to wait for status changes on.
`interval` Hint on how quickly a change is expected to be detected and should normally be specified as **`0.0`** to let *libev* choose a suitable value.
### Return Values
No value is returned.
php IntlCalendar::getErrorCode IntlCalendar::getErrorCode
==========================
intlcal\_get\_error\_code
=========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::getErrorCode -- intlcal\_get\_error\_code — Get last error code on the object
### Description
Object-oriented style (method):
```
public IntlCalendar::getErrorCode(): int|false
```
Procedural style:
```
intlcal_get_error_code(IntlCalendar $calendar): int|false
```
Returns the numeric ICU error code for the last call on this object (including cloning) or the [IntlCalendar](class.intlcalendar) given for the `calendar` parameter (in the procedural‒style version). This may indicate only a warning (negative error code) or no error at all (**`U_ZERO_ERROR`**). The actual presence of an error can be tested with [intl\_is\_failure()](function.intl-is-failure).
Invalid arguments detected on the PHP side (before invoking functions of the ICU library) are not recorded for the purposes of this function.
The last error that occurred in any call to a function of the intl extension, including early argument errors, can be obtained with [intl\_get\_error\_code()](function.intl-get-error-code). This function resets the global error code, but not the objectʼs error code.
### Parameters
`calendar`
The calendar object, on the procedural style interface.
### Return Values
An ICU error code indicating either success, failure or a warning. Returns **`false`** on failure.
### Examples
**Example #1 **IntlCalendar::getErrorCode()** and [IntlCalendar::getErrorMessage()](intlcalendar.geterrormessage)**
```
<?php
ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
$intlcal = new IntlGregorianCalendar(2012, 1, 29);
var_dump(
$intlcal->getErrorCode(),
$intlcal->getErrorMessage()
);
$intlcal->fieldDifference(-1e100, IntlCalendar::FIELD_SECOND);
var_dump(
$intlcal->getErrorCode(),
$intlcal->getErrorMessage()
);
```
The above example will output:
```
int(0)
string(12) "U_ZERO_ERROR"
Warning: IntlCalendar::fieldDifference(): intlcal_field_difference: Call to ICU method has failed in /home/glopes/php/ws/example.php on line 10
int(1)
string(81) "intlcal_field_difference: Call to ICU method has failed: U_ILLEGAL_ARGUMENT_ERROR"
```
### See Also
* [IntlCalendar::getErrorMessage()](intlcalendar.geterrormessage) - Get last error message on the object
* [intl\_is\_failure()](function.intl-is-failure) - Check whether the given error code indicates failure
* [intl\_error\_name()](function.intl-error-name) - Get symbolic name for a given error code
* [intl\_get\_error\_code()](function.intl-get-error-code) - Get the last error code
* [intl\_get\_error\_message()](function.intl-get-error-message) - Get description of the last error
php The ParentIterator class
The ParentIterator class
========================
Introduction
------------
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
This extended [FilterIterator](class.filteriterator) allows a recursive iteration using [RecursiveIteratorIterator](class.recursiveiteratoriterator) that only shows those elements which have children.
Class synopsis
--------------
class **ParentIterator** extends [RecursiveFilterIterator](class.recursivefilteriterator) { /\* Methods \*/ public [\_\_construct](parentiterator.construct)([RecursiveIterator](class.recursiveiterator) `$iterator`)
```
public accept(): bool
```
```
public getChildren(): ParentIterator
```
```
public hasChildren(): bool
```
```
public next(): void
```
```
public rewind(): void
```
/\* Inherited methods \*/
```
public RecursiveFilterIterator::getChildren(): ?RecursiveFilterIterator
```
```
public RecursiveFilterIterator::hasChildren(): bool
```
```
public FilterIterator::accept(): bool
```
```
public FilterIterator::current(): mixed
```
```
public FilterIterator::getInnerIterator(): Iterator
```
```
public FilterIterator::key(): mixed
```
```
public FilterIterator::next(): void
```
```
public FilterIterator::rewind(): void
```
```
public FilterIterator::valid(): bool
```
```
public IteratorIterator::current(): mixed
```
```
public IteratorIterator::getInnerIterator(): ?Iterator
```
```
public IteratorIterator::key(): mixed
```
```
public IteratorIterator::next(): void
```
```
public IteratorIterator::rewind(): void
```
```
public IteratorIterator::valid(): bool
```
} Table of Contents
-----------------
* [ParentIterator::accept](parentiterator.accept) — Determines acceptability
* [ParentIterator::\_\_construct](parentiterator.construct) — Constructs a ParentIterator
* [ParentIterator::getChildren](parentiterator.getchildren) — Return the inner iterator's children contained in a ParentIterator
* [ParentIterator::hasChildren](parentiterator.haschildren) — Check whether the inner iterator's current element has children
* [ParentIterator::next](parentiterator.next) — Move the iterator forward
* [ParentIterator::rewind](parentiterator.rewind) — Rewind the iterator
php imap_fetch_overview imap\_fetch\_overview
=====================
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_fetch\_overview — Read an overview of the information in the headers of the given message
### Description
```
imap_fetch_overview(IMAP\Connection $imap, string $sequence, int $flags = 0): array|false
```
This function fetches mail headers for the given `sequence` and returns an overview of their contents.
### Parameters
`imap`
An [IMAP\Connection](class.imap-connection) instance.
`sequence`
A message sequence description. You can enumerate desired messages with the `X,Y` syntax, or retrieve all messages within an interval with the `X:Y` syntax
`flags`
`sequence` will contain a sequence of message indices or UIDs, if this parameter is set to **`FT_UID`**.
### Return Values
Returns an array of objects describing one message header each. The object will only define a property if it exists. The possible properties are:
* `subject` - the messages subject
* `from` - who sent it
* `to` - recipient
* `date` - when was it sent
* `message_id` - Message-ID
* `references` - is a reference to this message id
* `in_reply_to` - is a reply to this message id
* `size` - size in bytes
* `uid` - UID the message has in the mailbox
* `msgno` - message sequence number in the mailbox
* `recent` - this message is flagged as recent
* `flagged` - this message is flagged
* `answered` - this message is flagged as answered
* `deleted` - this message is flagged for deletion
* `seen` - this message is flagged as already read
* `draft` - this message is flagged as being a draft
* `udate` - the UNIX timestamp of the arrival date
The function returns **`false`** on failure. ### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `imap` parameter expects an [IMAP\Connection](class.imap-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **imap\_fetch\_overview()** example**
```
<?php
$mbox = imap_open("{imap.example.org:143}INBOX", "username", "password")
or die("can't connect: " . imap_last_error());
$MC = imap_check($mbox);
// Fetch an overview for all messages in INBOX
$result = imap_fetch_overview($mbox,"1:{$MC->Nmsgs}",0);
foreach ($result as $overview) {
echo "#{$overview->msgno} ({$overview->date}) - From: {$overview->from}
{$overview->subject}\n";
}
imap_close($mbox);
?>
```
### See Also
* [imap\_fetchheader()](function.imap-fetchheader) - Returns header for a message
php array_fill_keys array\_fill\_keys
=================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
array\_fill\_keys — Fill an array with values, specifying keys
### Description
```
array_fill_keys(array $keys, mixed $value): array
```
Fills an array with the value of the `value` parameter, using the values of the `keys` array as keys.
### Parameters
`keys`
Array of values that will be used as keys. Illegal values for key will be converted to string.
`value`
Value to use for filling
### Return Values
Returns the filled array
### Examples
**Example #1 **array\_fill\_keys()** example**
```
<?php
$keys = array('foo', 5, 10, 'bar');
$a = array_fill_keys($keys, 'banana');
print_r($a);
?>
```
The above example will output:
```
Array
(
[foo] => banana
[5] => banana
[10] => banana
[bar] => banana
)
```
### See Also
* [array\_fill()](function.array-fill) - Fill an array with values
* [array\_combine()](function.array-combine) - Creates an array by using one array for keys and another for its values
php ftp_quit ftp\_quit
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
ftp\_quit — Alias of [ftp\_close()](function.ftp-close)
### Description
This function is an alias of: [ftp\_close()](function.ftp-close).
php Imagick::importImagePixels Imagick::importImagePixels
==========================
(PECL imagick 2 >= 2.3.0, PECL imagick 3)
Imagick::importImagePixels — Imports image pixels
### Description
```
public Imagick::importImagePixels(
int $x,
int $y,
int $width,
int $height,
string $map,
int $storage,
array $pixels
): bool
```
Imports pixels from an array into an image. The `map` is usually 'RGB'. This method imposes the following constraints for the parameters: amount of pixels in the array must match `width` x `height` x length of the map. This method is available if Imagick has been compiled against ImageMagick version 6.4.5 or newer.
### Parameters
`x`
The image x position
`y`
The image y position
`width`
The image width
`height`
The image height
`map`
Map of pixel ordering as a string. This can be for example `RGB`. The value can be any combination or order of R = red, G = green, B = blue, A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan, Y = yellow, M = magenta, K = black, I = intensity (for grayscale), P = pad.
`storage`
The pixel storage method. Refer to this list of [pixel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.pixel).
`pixels`
The array of pixels
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::importImagePixels()** example**
```
<?php
/* Generate array of pixels. 2000 pixels per color stripe */
$count = 2000 * 3;
$pixels =
array_merge(array_pad(array(), $count, 0),
array_pad(array(), $count, 255),
array_pad(array(), $count, 0),
array_pad(array(), $count, 255),
array_pad(array(), $count, 0));
/* Width and height. The area is amount of pixels divided
by three. Three comes from 'RGB', three values per pixel */
$width = $height = pow((count($pixels) / 3), 0.5);
/* Create empty image */
$im = new Imagick();
$im->newImage($width, $height, 'gray');
/* Import the pixels into image.
width * height * strlen("RGB") must match count($pixels) */
$im->importImagePixels(0, 0, $width, $height, "RGB", Imagick::PIXEL_CHAR, $pixels);
/* output as jpeg image */
$im->setImageFormat('jpg');
header("Content-Type: image/jpg");
echo $im;
?>
```
The above example will output something similar to:
| programming_docs |
php The SyncMutex class
The SyncMutex class
===================
Introduction
------------
(PECL sync >= 1.0.0)
A cross-platform, native implementation of named and unnamed countable mutex objects.
A mutex is a mutual exclusion object that restricts access to a shared resource (e.g. a file) to a single instance. Countable mutexes acquire the mutex a single time and internally track the number of times the mutex is locked. The mutex is unlocked as soon as it goes out of scope or is unlocked the same number of times that it was locked.
Class synopsis
--------------
class **SyncMutex** { /\* Methods \*/
```
public __construct(string $name = ?)
```
```
public lock(int $wait = -1): bool
```
```
public unlock(bool $all = false): bool
```
} Table of Contents
-----------------
* [SyncMutex::\_\_construct](syncmutex.construct) — Constructs a new SyncMutex object
* [SyncMutex::lock](syncmutex.lock) — Waits for an exclusive lock
* [SyncMutex::unlock](syncmutex.unlock) — Unlocks the mutex
php SolrDocument::__set SolrDocument::\_\_set
=====================
(PECL solr >= 0.9.2)
SolrDocument::\_\_set — Adds another field to the document
### Description
```
public SolrDocument::__set(string $fieldName, string $fieldValue): bool
```
Adds another field to the document. Used to set the fields as new properties.
### Parameters
`fieldName`
Name of the field.
`fieldValue`
Field value.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php V8Js::__construct V8Js::\_\_construct
===================
(PECL v8js >= 0.1.0)
V8Js::\_\_construct — Construct a new [V8Js](class.v8js) object
### Description
public **V8Js::\_\_construct**(
string `$object_name` = "PHP",
array `$variables` = array(),
array `$extensions` = array(),
bool `$report_uncaught_exceptions` = **`true`**
) Constructs a new [V8Js](class.v8js) object.
### Parameters
`object_name`
The name of the object passed to Javascript.
`variables`
Map of PHP variables that will be available in Javascript. Must be an associative array in format `array("name-for-js" => "name-of-php-variable")`. Defaults to empty array.
`extensions`
List of extensions registered using [V8Js::registerExtension()](v8js.registerextension) which should be available in the Javascript context of the created [V8Js](class.v8js) object.
>
> **Note**:
>
>
> Extensions registered to be enabled automatically do not need to be listed in this array. Also if an extension has dependencies, those dependencies can be omitted as well. Defaults to empty array.
>
>
`report_uncaught_exceptions`
Controls whether uncaught Javascript exceptions are reported immediately or not. Defaults to **`true`**. If set to **`false`** the uncaught exception can be accessed using [V8Js::getPendingException()](v8js.getpendingexception).
php XMLWriter::endDtdAttlist XMLWriter::endDtdAttlist
========================
xmlwriter\_end\_dtd\_attlist
============================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::endDtdAttlist -- xmlwriter\_end\_dtd\_attlist — End current DTD AttList
### Description
Object-oriented style
```
public XMLWriter::endDtdAttlist(): bool
```
Procedural style
```
xmlwriter_end_dtd_attlist(XMLWriter $writer): bool
```
Ends the current DTD attribute list.
### Parameters
`writer`
Only for procedural calls. The [XMLWriter](class.xmlwriter) instance that is being modified. This object is returned from a call to [xmlwriter\_open\_uri()](xmlwriter.openuri) or [xmlwriter\_open\_memory()](xmlwriter.openmemory).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `writer` expects an [XMLWriter](class.xmlwriter) instance now; previously, a resource was expected. |
### See Also
* [XMLWriter::startDtdAttlist()](xmlwriter.startdtdattlist) - Create start DTD AttList
* [XMLWriter::writeDtdAttlist()](xmlwriter.writedtdattlist) - Write full DTD AttList tag
php runkit7_constant_add runkit7\_constant\_add
======================
(PECL runkit7 >= Unknown)
runkit7\_constant\_add — Similar to define(), but allows defining in class definitions as well
### Description
```
runkit7_constant_add(string $constant_name, mixed $value, int $newVisibility = ?): bool
```
### Parameters
`constant_name`
Name of constant to declare. Either a string to indicate a global constant, or `classname::constname` to indicate a class constant.
`value`
NULL, Bool, Long, Double, String, Array, or Resource value to store in the new constant.
`newVisibility`
Visibility of the constant, for class constants. Public by default. One of the **`RUNKIT7_ACC_*`** constants.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [define()](function.define) - Defines a named constant
* [runkit7\_constant\_redefine()](function.runkit7-constant-redefine) - Redefine an already defined constant
* [runkit7\_constant\_remove()](function.runkit7-constant-remove) - Remove/Delete an already defined constant
php IteratorAggregate::getIterator IteratorAggregate::getIterator
==============================
(PHP 5, PHP 7, PHP 8)
IteratorAggregate::getIterator — Retrieve an external iterator
### Description
```
public IteratorAggregate::getIterator(): Traversable
```
Returns an external iterator.
### Parameters
This function has no parameters.
### Return Values
An instance of an object implementing [Iterator](class.iterator) or [Traversable](class.traversable)
### Errors/Exceptions
Throws an [Exception](class.exception) on failure.
php RecursiveIterator::getChildren RecursiveIterator::getChildren
==============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
RecursiveIterator::getChildren — Returns an iterator for the current entry
### Description
```
public RecursiveIterator::getChildren(): ?RecursiveIterator
```
Returns an iterator for the current iterator entry.
### Parameters
This function has no parameters.
### Return Values
Returns an iterator for the current entry if it exists, or **`null`** otherwise.
### See Also
* [RecursiveIterator::hasChildren()](recursiveiterator.haschildren) - Returns if an iterator can be created for the current entry
php XMLReader::setRelaxNGSchema XMLReader::setRelaxNGSchema
===========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
XMLReader::setRelaxNGSchema — Set the filename or URI for a RelaxNG Schema
### Description
```
public XMLReader::setRelaxNGSchema(?string $filename): bool
```
Set the filename or URI for the RelaxNG Schema to use for validation.
### Parameters
`filename`
filename or URI pointing to a RelaxNG Schema.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [XMLReader::setRelaxNGSchemaSource()](xmlreader.setrelaxngschemasource) - Set the data containing a RelaxNG Schema
* [XMLReader::setSchema()](xmlreader.setschema) - Validate document against XSD
* [XMLReader::isValid()](xmlreader.isvalid) - Indicates if the parsed document is valid
php ImagickPixel::destroy ImagickPixel::destroy
=====================
(PECL imagick 2, PECL imagick 3)
ImagickPixel::destroy — Deallocates resources associated with this object
### Description
```
public ImagickPixel::destroy(): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Deallocates any resources used by the ImagickPixel object, and unsets any associated color. The object should not be used after the destroy function has been called.
### Return Values
Returns **`true`** on success.
php IntlChar::isalpha IntlChar::isalpha
=================
(PHP 7, PHP 8)
IntlChar::isalpha — Check if code point is a letter character
### Description
```
public static IntlChar::isalpha(int|string $codepoint): ?bool
```
Determines whether the specified code point is a letter character. **`true`** for general categories "L" (letters).
### Parameters
`codepoint`
The int codepoint value (e.g. `0x2603` for *U+2603 SNOWMAN*), or the character encoded as a UTF-8 string (e.g. `"\u{2603}"`)
### Return Values
Returns **`true`** if `codepoint` is a letter character, **`false`** if not. Returns **`null`** on failure.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::isalpha("A"));
var_dump(IntlChar::isalpha("1"));
var_dump(IntlChar::isalpha("\u{2603}"));
?>
```
The above example will output:
```
bool(true)
bool(false)
bool(false)
```
### See Also
* [IntlChar::isalnum()](intlchar.isalnum) - Check if code point is an alphanumeric character
* [IntlChar::isdigit()](intlchar.isdigit) - Check if code point is a digit character
php SplFileObject::flock SplFileObject::flock
====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::flock — Portable file locking
### Description
```
public SplFileObject::flock(int $operation, int &$wouldBlock = null): bool
```
Locks or unlocks the file in the same portable way as [flock()](function.flock).
### Parameters
`operation`
`operation` is one of the following:
* **`LOCK_SH`** to acquire a shared lock (reader).
* **`LOCK_EX`** to acquire an exclusive lock (writer).
* **`LOCK_UN`** to release a lock (shared or exclusive).
It is also possible to add **`LOCK_NB`** as a bitmask to one of the above operations, if [flock()](function.flock) should not block during the locking attempt.
`wouldBlock`
Set to **`true`** if the lock would block (EWOULDBLOCK errno condition).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **SplFileObject::flock()** example**
```
<?php
$file = new SplFileObject("/tmp/lock.txt", "w");
if ($file->flock(LOCK_EX)) { // do an exclusive lock
$file->ftruncate(0); // truncate file
$file->fwrite("Write something here\n");
$file->flock(LOCK_UN); // release the lock
} else {
echo "Couldn't get the lock!";
}
?>
```
### See Also
* [flock()](function.flock) - Portable advisory file locking
php PharData::addEmptyDir PharData::addEmptyDir
=====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
PharData::addEmptyDir — Add an empty directory to the tar/zip archive
### Description
```
public PharData::addEmptyDir(string $directory): void
```
With this method, an empty directory is created with path `dirname`. This method is similar to [ZipArchive::addEmptyDir()](ziparchive.addemptydir).
### Parameters
`directory`
The name of the empty directory to create in the phar archive
### Return Values
no return value, exception is thrown on failure.
### Examples
**Example #1 A **PharData::addEmptyDir()** example**
```
<?php
try {
$a = new PharData('/path/to/my.tar');
$a->addEmptyDir('/full/path/to/file');
// demonstrates how this file is stored
$b = $a['full/path/to/file']->isDir();
} catch (Exception $e) {
// handle errors here
}
?>
```
### See Also
* [Phar::addEmptyDir()](phar.addemptydir) - Add an empty directory to the phar archive
* [PharData::addFile()](phardata.addfile) - Add a file from the filesystem to the tar/zip archive
* [PharData::addFromString()](phardata.addfromstring) - Add a file from the filesystem to the tar/zip archive
php mailparse_msg_get_part_data mailparse\_msg\_get\_part\_data
===============================
(PECL mailparse >= 0.9.0)
mailparse\_msg\_get\_part\_data — Returns an associative array of info about the message
### Description
```
mailparse_msg_get_part_data(resource $mimemail): array
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`mimemail`
A valid `MIME` resource.
php ssh2_sftp_lstat ssh2\_sftp\_lstat
=================
(PECL ssh2 >= 0.9.0)
ssh2\_sftp\_lstat — Stat a symbolic link
### Description
```
ssh2_sftp_lstat(resource $sftp, string $path): array
```
Stats a symbolic link on the remote filesystem *without* following the link.
This function is similar to using the [lstat()](function.lstat) function with the [ssh2.sftp://](https://www.php.net/manual/en/wrappers.ssh2.php) wrapper and returns the same values.
### Parameters
`sftp`
An SSH2 SFTP resource opened by [ssh2\_sftp()](function.ssh2-sftp).
`path`
Path to the remote symbolic link.
### Return Values
See the documentation for [stat()](function.stat) for details on the values which may be returned.
### Examples
**Example #1 Stating a symbolic link via SFTP**
```
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$sftp = ssh2_sftp($connection);
$statinfo = ssh2_sftp_lstat($sftp, '/path/to/symlink');
$filesize = $statinfo['size'];
$group = $statinfo['gid'];
$owner = $statinfo['uid'];
$atime = $statinfo['atime'];
$mtime = $statinfo['mtime'];
$mode = $statinfo['mode'];
?>
```
### See Also
* [ssh2\_sftp\_stat()](function.ssh2-sftp-stat) - Stat a file on a remote filesystem
* [lstat()](function.lstat) - Gives information about a file or symbolic link
* [stat()](function.stat) - Gives information about a file
php readline readline
========
(PHP 4, PHP 5, PHP 7, PHP 8)
readline — Reads a line
### Description
```
readline(?string $prompt = null): string|false
```
Reads a single line from the user. You must add this line to the history yourself using [readline\_add\_history()](function.readline-add-history).
### Parameters
`prompt`
You may specify a string with which to prompt the user.
### Return Values
Returns a single string from the user. The line returned has the ending newline removed. If there is no more data to read, then **`false`** is returned.
### Examples
**Example #1 **readline()** Example**
```
<?php
//get 3 commands from user
for ($i=0; $i < 3; $i++) {
$line = readline("Command: ");
readline_add_history($line);
}
//dump history
print_r(readline_list_history());
//dump variables
print_r(readline_info());
?>
```
php fdf_get_value fdf\_get\_value
===============
(PHP 4, PHP 5 < 5.3.0, PECL fdf SVN)
fdf\_get\_value — Get the value of a field
### Description
```
fdf_get_value(resource $fdf_document, string $fieldname, int $which = -1): mixed
```
Gets the value for the requested field.
### Parameters
`fdf_document`
The FDF document handle, returned by [fdf\_create()](function.fdf-create), [fdf\_open()](function.fdf-open) or [fdf\_open\_string()](function.fdf-open-string).
`fieldname`
Name of the FDF field, as a string.
`which`
Elements of an array field can be retrieved by passing this optional parameter, starting at zero. For non-array fields, this parameter will be ignored.
### Return Values
Returns the field value.
### Changelog
| Version | Description |
| --- | --- |
| 4.3.0 | Support for arrays and the `which` parameter were added. |
### See Also
* [fdf\_set\_value()](function.fdf-set-value) - Set the value of a field
php Gmagick::setimagefilename Gmagick::setimagefilename
=========================
(PECL gmagick >= Unknown)
Gmagick::setimagefilename — Sets the filename of a particular image in a sequence
### Description
```
public Gmagick::setimagefilename(string $filename): Gmagick
```
Sets the filename of a particular image in a sequence.
### Parameters
`filename`
The image filename.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php None Enumeration static methods
--------------------------
Enumerations may also have static methods. The use for static methods on the enumeration itself is primarily for alternative constructors. E.g.:
```
<?php
enum Size
{
case Small;
case Medium;
case Large;
public static function fromLength(int $cm): static
{
return match(true) {
$cm < 50 => static::Small,
$cm < 100 => static::Medium,
default => static::Large,
};
}
}
?>
```
Static methods may be public, private, or protected, although in practice private and protected are equivalent as inheritance is not allowed.
php stats_standard_deviation stats\_standard\_deviation
==========================
(PECL stats >= 1.0.0)
stats\_standard\_deviation — Returns the standard deviation
### Description
```
stats_standard_deviation(array $a, bool $sample = false): float
```
Returns the standard deviation of the values in `a`.
### Parameters
`a`
The array of data to find the standard deviation for. Note that all values of the array will be cast to float.
`sample`
Indicates if `a` represents a sample of the population; defaults to **`false`**.
### Return Values
Returns the standard deviation on success; **`false`** on failure.
### Errors/Exceptions
Raises an **`E_WARNING`** when there are fewer than 2 values in `a`.
php idn_to_ascii idn\_to\_ascii
==============
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.2, PECL idn >= 0.1)
idn\_to\_ascii — Convert domain name to IDNA ASCII form
### Description
Procedural style
```
idn_to_ascii(
string $domain,
int $flags = IDNA_DEFAULT,
int $variant = INTL_IDNA_VARIANT_UTS46,
array &$idna_info = null
): string|false
```
This function converts a Unicode domain name to an IDNA ASCII-compatible format.
### Parameters
`domain`
The domain to convert, which must be UTF-8 encoded.
`flags`
Conversion options - combination of IDNA\_\* constants (except IDNA\_ERROR\_\* constants).
`variant`
Either **`INTL_IDNA_VARIANT_2003`** (deprecated as of PHP 7.2.0) for IDNA 2003 or **`INTL_IDNA_VARIANT_UTS46`** (only available as of ICU 4.6) for UTS #46.
`idna_info`
This parameter can be used only if **`INTL_IDNA_VARIANT_UTS46`** was used for `variant`. In that case, it will be filled with an array with the keys `'result'`, the possibly illegal result of the transformation, `'isTransitionalDifferent'`, a boolean indicating whether the usage of the transitional mechanisms of UTS #46 either has or would have changed the result and `'errors'`, which is an int representing a bitset of the error constants IDNA\_ERROR\_\*.
### Return Values
The domain name encoded in ASCII-compatible form, or **`false`** on failure
### Changelog
| Version | Description |
| --- | --- |
| 7.4.0 | The default value of `variant` is now **`INTL_IDNA_VARIANT_UTS46`** instead of the deprecated **`INTL_IDNA_VARIANT_2003`**. |
| 7.2.0 | **`INTL_IDNA_VARIANT_2003`** has been deprecated; use **`INTL_IDNA_VARIANT_UTS46`** instead. |
### Examples
**Example #1 **idn\_to\_ascii()** example**
```
<?php
echo idn_to_ascii('täst.de');
?>
```
The above example will output:
```
xn--tst-qla.de
```
### See Also
* [idn\_to\_utf8()](function.idn-to-utf8) - Convert domain name from IDNA ASCII to Unicode
php wincache_rplist_meminfo wincache\_rplist\_meminfo
=========================
(PECL wincache >= 1.0.0)
wincache\_rplist\_meminfo — Retrieves information about memory usage by the resolve file path cache
### Description
```
wincache_rplist_meminfo(): array|false
```
Retrieves information about memory usage by resolve file path cache.
### Parameters
This function has no parameters.
### Return Values
Array of meta data that describes memory usage by resolve file path cache. or **`false`** on failure
The array returned by this function contains the following elements:
* `memory_total` - amount of memory in bytes allocated for the resolve file path cache
* `memory_free` - amount of free memory in bytes available for the resolve file path cache
* `num_used_blks` - number of memory blocks used by the resolve file path cache
* `num_free_blks` - number of free memory blocks available for the resolve file path cache
* `memory_overhead` - amount of memory in bytes used for the internal structures of resolve file path cache
### Examples
**Example #1 A **wincache\_rplist\_meminfo()** example**
```
<pre>
<?php
print_r(wincache_rplist_meminfo());
?>
</pre>
```
The above example will output:
```
Array
(
[memory_total] => 9437184
[memory_free] => 9416744
[num_used_blks] => 23
[num_free_blks] => 1
[memory_overhead] => 416
)
```
### See Also
* [wincache\_fcache\_fileinfo()](function.wincache-fcache-fileinfo) - Retrieves information about files cached in the file cache
* [wincache\_fcache\_meminfo()](function.wincache-fcache-meminfo) - Retrieves information about file cache memory usage
* [wincache\_ocache\_fileinfo()](function.wincache-ocache-fileinfo) - Retrieves information about files cached in the opcode cache
* [wincache\_ocache\_meminfo()](function.wincache-ocache-meminfo) - Retrieves information about opcode cache memory usage
* [wincache\_rplist\_fileinfo()](function.wincache-rplist-fileinfo) - Retrieves information about resolve file path cache
* [wincache\_refresh\_if\_changed()](function.wincache-refresh-if-changed) - Refreshes the cache entries for the cached files
* [wincache\_ucache\_meminfo()](function.wincache-ucache-meminfo) - Retrieves information about user cache memory usage
* [wincache\_ucache\_info()](function.wincache-ucache-info) - Retrieves information about data stored in the user cache
* [wincache\_scache\_info()](function.wincache-scache-info) - Retrieves information about files cached in the session cache
* [wincache\_scache\_meminfo()](function.wincache-scache-meminfo) - Retrieves information about session cache memory usage
| programming_docs |
php zip_open zip\_open
=========
(PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.0.0)
zip\_open — Open a ZIP file archive
**Warning**This function has been *DEPRECATED* as of PHP 8.0.0. Relying on this function is highly discouraged.
### Description
```
zip_open(string $filename): resource|int|false
```
Opens a new zip archive for reading.
### Parameters
`filename`
The file name of the ZIP archive to open.
### Return Values
Returns a resource handle for later use with [zip\_read()](function.zip-read) and [zip\_close()](function.zip-close) or returns either **`false`** or the number of error if `filename` does not exist or in case of other error.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function is deprecated in favor of the Object API, see [ZipArchive::open()](ziparchive.open). |
### See Also
* [zip\_read()](function.zip-read) - Read next entry in a ZIP file archive
* [zip\_close()](function.zip-close) - Close a ZIP file archive
php SNMP::setSecurity SNMP::setSecurity
=================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
SNMP::setSecurity — Configures security-related SNMPv3 session parameters
### Description
```
public SNMP::setSecurity(
string $securityLevel,
string $authProtocol = "",
string $authPassphrase = "",
string $privacyProtocol = "",
string $privacyPassphrase = "",
string $contextName = "",
string $contextEngineId = ""
): bool
```
setSecurity configures security-related session parameters used in SNMP protocol version 3
### Parameters
`securityLevel`
the security level (noAuthNoPriv|authNoPriv|authPriv)
`authProtocol`
the authentication protocol (MD5 or SHA)
`authPassphrase`
the authentication pass phrase
`privacyProtocol`
the privacy protocol (DES or AES)
`privacyPassphrase`
the privacy pass phrase
`contextName`
the context name
`contextEngineId`
the context EngineID
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **SNMP::setSecurity()** example**
```
<?php
$session = new SNMP(SNMP::VERSION_3, $hostname, $rwuser, $timeout, $retries);
$session->setSecurity('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '', 'aeeeff');
?>
```
### See Also
* [SNMP::\_\_construct()](snmp.construct) - Creates SNMP instance representing session to remote SNMP agent
php posix_errno posix\_errno
============
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
posix\_errno — Alias of [posix\_get\_last\_error()](function.posix-get-last-error)
### Description
This function is an alias of: [posix\_get\_last\_error()](function.posix-get-last-error).
php SolrClient::getById SolrClient::getById
===================
(PECL solr >= 2.2.0)
SolrClient::getById — Get Document By Id. Utilizes Solr Realtime Get (RTG)
### Description
```
public SolrClient::getById(string $id): SolrQueryResponse
```
Get Document By Id. Utilizes Solr Realtime Get (RTG).
### Parameters
`id`
Document ID
### Return Values
[SolrQueryResponse](class.solrqueryresponse)
### Examples
**Example #1 **SolrClient::getById()** example**
```
<?php
include "bootstrap.php";
$options = array
(
'hostname' => SOLR_SERVER_HOSTNAME,
'login' => SOLR_SERVER_USERNAME,
'password' => SOLR_SERVER_PASSWORD,
'port' => SOLR_SERVER_PORT,
'path' => SOLR_SERVER_PATH
);
$client = new SolrClient($options);
$response = $client->getById('GB18030TEST');
print_r($response->getResponse());
?>
```
The above example will output something similar to:
```
SolrObject Object
(
[doc] => SolrObject Object
(
[id] => GB18030TEST
[name] => Array
(
[0] => Test with some GB18030 encoded characters
)
[features] => Array
(
[0] => No accents here
[1] => 这是一个功能
[2] => This is a feature (translated)
[3] => 这份文件是很有光泽
[4] => This document is very shiny (translated)
)
[price] => Array
(
[0] => 0
)
[inStock] => Array
(
[0] => 1
)
[_version_] => 1510294336239042560
)
)
```
### See Also
* [SolrClient::getByIds()](solrclient.getbyids) - Get Documents by their Ids. Utilizes Solr Realtime Get (RTG)
php ibase_num_params ibase\_num\_params
==================
(PHP 5, PHP 7 < 7.4.0)
ibase\_num\_params — Return the number of parameters in a prepared query
### Description
```
ibase_num_params(resource $query): int
```
This function returns the number of parameters in the prepared query specified by `query`. This is the number of binding arguments that must be present when calling [ibase\_execute()](function.ibase-execute).
### Parameters
`query`
The prepared query handle.
### Return Values
Returns the number of parameters as an integer.
### See Also
* [ibase\_prepare()](function.ibase-prepare) - Prepare a query for later binding of parameter placeholders and execution
* [ibase\_param\_info()](function.ibase-param-info) - Return information about a parameter in a prepared query
php imap_last_error imap\_last\_error
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_last\_error — Gets the last IMAP error that occurred during this page request
### Description
```
imap_last_error(): string|false
```
Gets the full text of the last IMAP error message that occurred on the current page. The error stack is untouched; calling **imap\_last\_error()** subsequently, with no intervening errors, will return the same error.
### Parameters
This function has no parameters.
### Return Values
Returns the full text of the last IMAP error message that occurred on the current page. Returns **`false`** if no error messages are available.
### See Also
* [imap\_errors()](function.imap-errors) - Returns all of the IMAP errors that have occurred
php None Delimiters
----------
When using the PCRE functions, it is required that the pattern is enclosed by *delimiters*. A delimiter can be any non-alphanumeric, non-backslash, non-whitespace character. Leading whitespace before a valid delimiter is silently ignored.
Often used delimiters are forward slashes (`/`), hash signs (`#`) and tildes (`~`). The following are all examples of valid delimited patterns.
```
/foo bar/
#^[^0-9]$#
+php+
%[a-zA-Z0-9_-]%
```
It is also possible to use bracket style delimiters where the opening and closing brackets are the starting and ending delimiter, respectively. `()`, `{}`, `[]` and `<>` are all valid bracket style delimiter pairs.
```
(this [is] a (pattern))
{this [is] a (pattern)}
[this [is] a (pattern)]
<this [is] a (pattern)>
```
Bracket style delimiters do not need to be escaped when they are used as meta characters within the pattern, but as with other delimiters they must be escaped when they are used as literal characters. If the delimiter needs to be matched inside the pattern it must be escaped using a backslash. If the delimiter appears often inside the pattern, it is a good idea to choose another delimiter in order to increase readability.
```
/http:\/\//
#http://#
```
The [preg\_quote()](function.preg-quote) function may be used to escape a string for injection into a pattern and its optional second parameter may be used to specify the delimiter to be escaped. You may add [pattern modifiers](reference.pcre.pattern.modifiers) after the ending delimiter. The following is an example of case-insensitive matching:
```
#[a-z]#i
```
php None Operator Precedence
-------------------
The precedence of an operator specifies how "tightly" it binds two expressions together. For example, in the expression `1 +
5 * 3`, the answer is `16` and not `18` because the multiplication ("\*") operator has a higher precedence than the addition ("+") operator. Parentheses may be used to force precedence, if necessary. For instance: `(1 + 5) * 3` evaluates to `18`.
When operators have equal precedence their associativity decides how the operators are grouped. For example "-" is left-associative, so `1 - 2 - 3` is grouped as `(1 - 2) - 3` and evaluates to `-4`. "=" on the other hand is right-associative, so `$a = $b = $c` is grouped as `$a = ($b = $c)`.
Operators of equal precedence that are non-associative cannot be used next to each other, for example `1 < 2 > 1` is illegal in PHP. The expression `1 <= 1 == 1` on the other hand is legal, because the `==` operator has a lower precedence than the `<=` operator.
Associativity is only meaningful for binary (and ternary) operators. Unary operators are either prefix or postfix so this notion is not applicable. For example `!!$a` can only be grouped as `!(!$a)`.
Use of parentheses, even when not strictly necessary, can often increase readability of the code by making grouping explicit rather than relying on the implicit operator precedence and associativity.
The following table lists the operators in order of precedence, with the highest-precedence ones at the top. Operators on the same line have equal precedence, in which case associativity decides grouping.
**Operator Precedence**| Associativity | Operators | Additional Information |
| --- | --- | --- |
| (n/a) | `clone` `new` | [clone](language.oop5.cloning) and [new](language.oop5.basic#language.oop5.basic.new) |
| right | `**` | [arithmetic](language.operators.arithmetic) |
| (n/a) | `+` `-` `++` `--` `~` `(int)` `(float)` `(string)` `(array)` `(object)` `(bool)` `@` | [arithmetic](language.operators.arithmetic) (unary `+` and `-`), [increment/decrement](language.operators.increment), [bitwise](language.operators.bitwise), [type casting](language.types.type-juggling#language.types.typecasting) and [error control](language.operators.errorcontrol) |
| left | `instanceof` | [type](language.operators.type) |
| (n/a) | `!` | [logical](language.operators.logical) |
| left | `*` `/` `%` | [arithmetic](language.operators.arithmetic) |
| left | `+` `-` `.` | [arithmetic](language.operators.arithmetic) (binary `+` and `-`), [array](language.operators.array) and [string](language.operators.string) (`.` prior to PHP 8.0.0) |
| left | `<<` `>>` | [bitwise](language.operators.bitwise) |
| left | `.` | [string](language.operators.string) (as of PHP 8.0.0) |
| non-associative | `<` `<=` `>` `>=` | [comparison](language.operators.comparison) |
| non-associative | `==` `!=` `===` `!==` `<>` `<=>` | [comparison](language.operators.comparison) |
| left | `&` | [bitwise](language.operators.bitwise) and [references](https://www.php.net/manual/en/language.references.php) |
| left | `^` | [bitwise](language.operators.bitwise) |
| left | `|` | [bitwise](language.operators.bitwise) |
| left | `&&` | [logical](language.operators.logical) |
| left | `||` | [logical](language.operators.logical) |
| right | `??` | [null coalescing](language.operators.comparison#language.operators.comparison.coalesce) |
| non-associative | `? :` | [ternary](language.operators.comparison#language.operators.comparison.ternary) (left-associative prior to PHP 8.0.0) |
| right | `=` `+=` `-=` `*=` `**=` `/=` `.=` `%=` `&=` `|=` `^=` `<<=` `>>=` `??=` | [assignment](language.operators.assignment) |
| (n/a) | `yield from` | [yield from](language.generators.syntax#control-structures.yield.from) |
| (n/a) | `yield` | [yield](language.generators.syntax#control-structures.yield) |
| (n/a) | `print` | [print](function.print) |
| left | `and` | [logical](language.operators.logical) |
| left | `xor` | [logical](language.operators.logical) |
| left | `or` | [logical](language.operators.logical) |
**Example #1 Associativity**
```
<?php
$a = 3 * 3 % 5; // (3 * 3) % 5 = 4
// ternary operator associativity differs from C/C++
$a = true ? 0 : true ? 1 : 2; // (true ? 0 : true) ? 1 : 2 = 2 (prior to PHP 8.0.0)
$a = 1;
$b = 2;
$a = $b += 3; // $a = ($b += 3) -> $a = 5, $b = 5
?>
```
Operator precedence and associativity only determine how expressions are grouped, they do not specify an order of evaluation. PHP does not (in the general case) specify in which order an expression is evaluated and code that assumes a specific order of evaluation should be avoided, because the behavior can change between versions of PHP or depending on the surrounding code.
**Example #2 Undefined order of evaluation**
```
<?php
$a = 1;
echo $a + $a++; // may print either 2 or 3
$i = 1;
$array[$i] = $i++; // may set either index 1 or 2
?>
```
**Example #3 `+`, `-` and `.` have the same precedence (prior to PHP 8.0.0)**
```
<?php
$x = 4;
// this line might result in unexpected output:
echo "x minus one equals " . $x-1 . ", or so I hope\n";
// because it is evaluated like this line (prior to PHP 8.0.0):
echo (("x minus one equals " . $x) - 1) . ", or so I hope\n";
// the desired precedence can be enforced by using parentheses:
echo "x minus one equals " . ($x-1) . ", or so I hope\n";
?>
```
The above example will output:
```
-1, or so I hope
-1, or so I hope
x minus one equals 3, or so I hope
```
>
> **Note**:
>
>
> Although `=` has a lower precedence than most other operators, PHP will still allow expressions similar to the following: `if (!$a = foo())`, in which case the return value of `foo()` is put into $a.
>
>
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | String concatenation (`.`) now has a lower precedence than arithmetic addition/subtraction (`+` and `-`) and bitwise shift left/right (`<<` and `>>`); previously it had the same precedence as `+` and `-` and a higher precedence than `<<` and `>>`. |
| 8.0.0 | The ternary operator (`? :`) is non-associative now; previously it was left-associative. |
| 7.4.0 | Relying on the precedence of string concatenation (`.`) relative to arithmetic addition/subtraction (`+` or `-`) or bitwise shift left/right (`<<` or `>>`), i.e. using them together in an unparenthesized expression, is deprecated. |
| 7.4.0 | Relying on left-associativity of the ternary operator (`? :`), i.e. nesting multiple unparenthesized ternary operators, is deprecated. |
php SolrDocument::hasChildDocuments SolrDocument::hasChildDocuments
===============================
(PECL solr >= 2.3.0)
SolrDocument::hasChildDocuments — Checks whether the document has any child documents
### Description
```
public SolrDocument::hasChildDocuments(): bool
```
Checks whether the document has any child documents
### Parameters
This function has no parameters.
### Return Values
### See Also
* [SolrDocument::getChildDocuments()](solrdocument.getchilddocuments) - Returns an array of child documents (SolrDocument)
* [SolrDocument::getChildDocumentsCount()](solrdocument.getchilddocumentscount) - Returns the number of child documents
php PhpToken::is PhpToken::is
============
(PHP 8)
PhpToken::is — Tells whether the token is of given kind.
### Description
```
public PhpToken::is(int|string|array $kind): bool
```
Tells whether the token is of given `kind`.
### Parameters
`kind`
Either a single value to match the token's id or textual content, or an array thereof.
### Return Values
A boolean value whether the token is of given kind.
### Examples
**Example #1 **PhpToken::is()** example**
```
<?php
$token = new PhpToken(T_ECHO, 'echo');
var_dump($token->is(T_ECHO)); // -> bool(true)
var_dump($token->is('echo')); // -> bool(true)
var_dump($token->is(T_FOREACH)); // -> bool(false)
var_dump($token->is('foreach')); // -> bool(false)
```
**Example #2 Usage with array**
```
<?php
function isClassType(PhpToken $token): bool {
return $token->is([T_CLASS, T_INTERFACE, T_TRAIT]);
}
$interface = new PhpToken(T_INTERFACE, 'interface');
var_dump(isClassType($interface)); // -> bool(true)
$function = new PhpToken(T_FUNCTION, 'function');
var_dump(isClassType($function)); // -> bool(false)
```
### See Also
* [token\_name()](function.token-name) - Get the symbolic name of a given PHP token
php OAuth::getLastResponseInfo OAuth::getLastResponseInfo
==========================
(PECL OAuth >= 0.99.1)
OAuth::getLastResponseInfo — Get HTTP information about the last response
### Description
```
public OAuth::getLastResponseInfo(): array
```
Get HTTP information about the last response.
### Parameters
This function has no parameters.
### Return Values
Returns an array containing the response information for the last request. Constants from [curl\_getinfo()](function.curl-getinfo) may be used.
### See Also
* [OAuth::fetch()](oauth.fetch) - Fetch an OAuth protected resource
* [OAuth::getLastResponse()](oauth.getlastresponse) - Get the last response
php imagecolorset imagecolorset
=============
(PHP 4, PHP 5, PHP 7, PHP 8)
imagecolorset — Set the color for the specified palette index
### Description
```
imagecolorset(
GdImage $image,
int $color,
int $red,
int $green,
int $blue,
int $alpha = 0
): ?false
```
This sets the specified index in the palette to the specified color. This is useful for creating flood-fill-like effects in palleted images without the overhead of performing the actual flood-fill.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`color`
An index in the palette.
`red`
Value of red component.
`green`
Value of green component.
`blue`
Value of blue component.
`alpha`
Value of alpha component.
### Return Values
The function returns **`null`** on success, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 **imagecolorset()** example**
```
<?php
// Create a 300x100 image
$im = imagecreate(300, 100);
// Set the background to be red
imagecolorallocate($im, 255, 0, 0);
// Get the color index for the background
$bg = imagecolorat($im, 0, 0);
// Set the backgrund to be blue
imagecolorset($im, $bg, 0, 0, 255);
// Output the image to the browser
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>
```
### See Also
* [imagecolorat()](function.imagecolorat) - Get the index of the color of a pixel
php uopz_get_property uopz\_get\_property
===================
(PECL uopz 5, PECL uopz 6, PECL uopz 7)
uopz\_get\_property — Gets value of class or instance property
### Description
```
uopz_get_property(string $class, string $property): mixed
```
```
uopz_get_property(object $instance, string $property): mixed
```
Gets the value of a static class property, if `class` is given, or the value of an instance property, if `instance` is given.
### Parameters
`class`
The name of the class.
`instance`
The object instance.
`property`
The name of the property.
### Return Values
Returns the value of the class or instance property, or **`null`** if the property is not defined.
### Examples
**Example #1 Basic **uopz\_get\_property()** Usage**
```
<?php
class Foo {
private static $staticBar = 10;
private $bar = 100;
}
$foo = new Foo;
var_dump(uopz_get_property('Foo', 'staticBar'));
var_dump(uopz_get_property($foo, 'bar'));
?>
```
The above example will output something similar to:
```
int(10)
int(100)
```
### See Also
* [uopz\_set\_property()](function.uopz-set-property) - Sets value of existing class or instance property
| programming_docs |
php mysqli::$thread_id mysqli::$thread\_id
===================
mysqli\_thread\_id
==================
(PHP 5, PHP 7, PHP 8)
mysqli::$thread\_id -- mysqli\_thread\_id — Returns the thread ID for the current connection
### Description
Object-oriented style
int [$mysqli->thread\_id](mysqli.thread-id); Procedural style
```
mysqli_thread_id(mysqli $mysql): int
```
The **mysqli\_thread\_id()** function returns the thread ID for the current connection which can then be killed using the [mysqli\_kill()](mysqli.kill) function. If the connection is lost and you reconnect with [mysqli\_ping()](mysqli.ping), the thread ID will be other. Therefore you should get the thread ID only when you need it.
>
> **Note**:
>
>
> The thread ID is assigned on a connection-by-connection basis. Hence, if the connection is broken and then re-established a new thread ID will be assigned.
>
> To kill a running query you can use the SQL command `KILL QUERY processid`.
>
>
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
### Return Values
Returns the Thread ID for the current connection.
### Examples
**Example #1 $mysqli->thread\_id example**
Object-oriented style
```
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* determine our thread id */
$thread_id = $mysqli->thread_id;
/* Kill connection */
$mysqli->kill($thread_id);
/* This should produce an error */
if (!$mysqli->query("CREATE TABLE myCity LIKE City")) {
printf("Error: %s\n", $mysqli->error);
exit;
}
/* close connection */
$mysqli->close();
?>
```
Procedural style
```
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
/* determine our thread id */
$thread_id = mysqli_thread_id($link);
/* Kill connection */
mysqli_kill($link, $thread_id);
/* This should produce an error */
if (!mysqli_query($link, "CREATE TABLE myCity LIKE City")) {
printf("Error: %s\n", mysqli_error($link));
exit;
}
/* close connection */
mysqli_close($link);
?>
```
The above examples will output:
```
Error: MySQL server has gone away
```
### See Also
* [mysqli\_kill()](mysqli.kill) - Asks the server to kill a MySQL thread
php Yaf_Request_Abstract::setActionName Yaf\_Request\_Abstract::setActionName
=====================================
(Yaf >=1.0.0)
Yaf\_Request\_Abstract::setActionName — Set action name
### Description
```
public Yaf_Request_Abstract::setActionName(string $action, bool $format_name = true): void
```
set action name to request, this is usually used by custom router to set route result controller name.
### Parameters
`action`
string, action name, it should in lower case style, like "index" or "foo\_bar"
`format_name`
this is introduced in Yaf 3.2.0, by default Yaf will format the name into lower case style, if this is set to **`false`** , Yaf will set the original name to request.
### Return Values
php FilterIterator::__construct FilterIterator::\_\_construct
=============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
FilterIterator::\_\_construct — Construct a filterIterator
### Description
public **FilterIterator::\_\_construct**([Iterator](class.iterator) `$iterator`) Constructs a new [FilterIterator](class.filteriterator), which consists of a passed in `iterator` with filters applied to it.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`iterator`
The iterator that is being filtered.
### See Also
* [LimitIterator::\_\_construct()](limititerator.construct) - Construct a LimitIterator
php Error::__toString Error::\_\_toString
===================
(PHP 7, PHP 8)
Error::\_\_toString — String representation of the error
### Description
```
public Error::__toString(): string
```
Returns the string representation of the error.
### Parameters
This function has no parameters.
### Return Values
Returns the string representation of the error.
### Examples
**Example #1 **Error::\_\_toString()** example**
```
<?php
try {
throw new Error("Some error message");
} catch(Error $e) {
echo $e;
}
?>
```
The above example will output something similar to:
```
Error: Some error message in /home/bjori/tmp/ex.php:3
Stack trace:
#0 {main}
```
### See Also
* [Throwable::\_\_toString()](throwable.tostring) - Gets a string representation of the thrown object
php Iterator::rewind Iterator::rewind
================
(PHP 5, PHP 7, PHP 8)
Iterator::rewind — Rewind the Iterator to the first element
### Description
```
public Iterator::rewind(): void
```
Rewinds back to the first element of the Iterator.
>
> **Note**:
>
>
> This is the *first* method called when starting a [foreach](control-structures.foreach) loop. It will *not* be executed *after* [foreach](control-structures.foreach) loops.
>
>
### Parameters
This function has no parameters.
### Return Values
Any returned value is ignored.
php Yaf_Action_Abstract::getControllerName Yaf\_Action\_Abstract::getControllerName
========================================
(No version information available, might only be in Git)
Yaf\_Action\_Abstract::getControllerName — Get controller name
### Description
```
public Yaf_Action_Abstract::getControllerName(): string
```
get the controller's name
### Parameters
This function has no parameters.
### Return Values
string, controller name
php Threaded::isRunning Threaded::isRunning
===================
(PECL pthreads >= 2.0.0)
Threaded::isRunning — State Detection
### Description
```
public Threaded::isRunning(): bool
```
Tell if the referenced object is executing
### Parameters
This function has no parameters.
### Return Values
A boolean indication of state
>
> **Note**:
>
>
> A object is considered running while executing the run method
>
>
### Examples
**Example #1 Detect the state of the referenced object**
```
<?php
class My extends Thread {
public function run() {
$this->synchronized(function($thread){
if (!$thread->done)
$thread->wait();
}, $this);
}
}
$my = new My();
$my->start();
var_dump($my->isRunning());
$my->synchronized(function($thread){
$thread->done = true;
$thread->notify();
}, $my);
?>
```
The above example will output:
```
bool(true)
```
php Gmagick::magnifyimage Gmagick::magnifyimage
=====================
(PECL gmagick >= Unknown)
Gmagick::magnifyimage — Scales an image proportionally 2x
### Description
```
public Gmagick::magnifyimage(): mixed
```
Conveniently scales an image proportionally to twice its original size.
### Parameters
This function has no parameters.
### Return Values
Magnified [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php GmagickDraw::setfontstyle GmagickDraw::setfontstyle
=========================
(PECL gmagick >= Unknown)
GmagickDraw::setfontstyle — Sets the font style to use when annotating with text
### Description
```
public GmagickDraw::setfontstyle(int $style): GmagickDraw
```
Sets the font style to use when annotating with text. The AnyStyle enumeration acts as a wild-card "don't care" option.
### Parameters
`style`
Font style (NormalStyle, ItalicStyle, ObliqueStyle, AnyStyle)
### Return Values
The [GmagickDraw](class.gmagickdraw) object.
php geoip_id_by_name geoip\_id\_by\_name
===================
(PECL geoip >= 0.2.0)
geoip\_id\_by\_name — Get the Internet connection type
### Description
```
geoip_id_by_name(string $hostname): int
```
The **geoip\_id\_by\_name()** function will return the Internet connection type corresponding to a hostname or an IP address.
The return value is numeric and can be compared to the following constants:
* GEOIP\_UNKNOWN\_SPEED
* GEOIP\_DIALUP\_SPEED
* GEOIP\_CABLEDSL\_SPEED
* GEOIP\_CORPORATE\_SPEED
### Parameters
`hostname`
The hostname or IP address whose connection type is to be looked-up.
### Return Values
Returns the connection type.
### Examples
**Example #1 A **geoip\_id\_by\_name()** example**
This will output the connection type of the host example.com.
```
<?php
$netspeed = geoip_id_by_name('www.example.com');
echo 'The connection type is ';
switch ($netspeed) {
case GEOIP_DIALUP_SPEED:
echo 'dial-up';
break;
case GEOIP_CABLEDSL_SPEED:
echo 'cable or DSL';
break;
case GEOIP_CORPORATE_SPEED:
echo 'corporate';
break;
case GEOIP_UNKNOWN_SPEED:
default:
echo 'unknown';
}
?>
```
The above example will output:
```
The connection type is corporate
```
php Phar::addFile Phar::addFile
=============
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
Phar::addFile — Add a file from the filesystem to the phar archive
### Description
```
public Phar::addFile(string $filename, ?string $localName = null): void
```
>
> **Note**:
>
>
> This method requires the php.ini setting `phar.readonly` to be set to `0` in order to work for [Phar](class.phar) objects. Otherwise, a [PharException](class.pharexception) will be thrown.
>
>
>
With this method, any file or URL can be added to the phar archive. If the optional second parameter `localName` is a string, the file will be stored in the archive with that name, otherwise the `file` parameter is used as the path to store within the archive. URLs must have a localname or an exception is thrown. This method is similar to [ZipArchive::addFile()](ziparchive.addfile).
### Parameters
`filename`
Full or relative path to a file on disk to be added to the phar archive.
`localName`
Path that the file will be stored in the archive.
### Return Values
no return value, exception is thrown on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `localName` is now nullable. |
### Examples
**Example #1 A **Phar::addFile()** example**
```
<?php
try {
$a = new Phar('/path/to/phar.phar');
$a->addFile('/full/path/to/file');
// demonstrates how this file is stored
$b = $a['full/path/to/file']->getContent();
$a->addFile('/full/path/to/file', 'my/file.txt');
$c = $a['my/file.txt']->getContent();
// demonstrate URL usage
$a->addFile('http://www.example.com', 'example.html');
} catch (Exception $e) {
// handle errors here
}
?>
```
### Notes
> **Note**: **Phar::addFile()**, [Phar::addFromString()](phar.addfromstring) and [Phar::offsetSet()](phar.offsetset) save a new phar archive each time they are called. If performance is a concern, [Phar::buildFromDirectory()](phar.buildfromdirectory) or [Phar::buildFromIterator()](phar.buildfromiterator) should be used instead.
>
>
### See Also
* [Phar::offsetSet()](phar.offsetset) - Set the contents of an internal file to those of an external file
* [PharData::addFile()](phardata.addfile) - Add a file from the filesystem to the tar/zip archive
* [Phar::addFromString()](phar.addfromstring) - Add a file from a string to the phar archive
* [Phar::addEmptyDir()](phar.addemptydir) - Add an empty directory to the phar archive
php imagegd imagegd
=======
(PHP 4 >= 4.0.7, PHP 5, PHP 7, PHP 8)
imagegd — Output GD image to browser or file
### Description
```
imagegd(GdImage $image, ?string $file = null): bool
```
Outputs a GD image to the given `file`.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`file`
The path or an open stream resource (which is automatically closed after this function returns) to save the file to. If not set or **`null`**, the raw image stream will be output directly.
### Return Values
Returns **`true`** on success or **`false`** on failure.
**Caution**However, if libgd fails to output the image, this function returns **`true`**.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.3 | `file` is now nullable. |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
| 7.2.0 | **imagegd()** now allows to output truecolor images. Formerly, these have been implicitly converted to palette. |
### Examples
**Example #1 Outputting a GD image**
```
<?php
// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
// Output the image
imagegd($im);
// Free up memory
imagedestroy($im);
?>
```
**Example #2 Saving a GD image**
```
<?php
// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
// Save the gd image
// The file format for GD images is .gd, see http://www.libgd.org/GdFileFormats
imagegd($im, 'simple.gd');
// Free up memory
imagedestroy($im);
?>
```
### Notes
>
> **Note**:
>
>
> The GD format is commonly used to allow fast loading of parts of images. Note that the GD format is only usable in GD-compatible applications.
>
>
**Warning**The GD and GD2 image formats are proprietary image formats of libgd. They have to be regarded *obsolete*, and should only be used for development and testing purposes.
### See Also
* [imagegd2()](function.imagegd2) - Output GD2 image to browser or file
php OAuth::setAuthType OAuth::setAuthType
==================
(PECL OAuth >= 0.99.1)
OAuth::setAuthType — Set authorization type
### Description
```
public OAuth::setAuthType(int $auth_type): bool
```
Set where the OAuth parameters should be passed.
### Parameters
`auth_type`
`auth_type` can be one of the following flags (in order of decreasing preference as per OAuth 1.0 section 5.2):
**`OAUTH_AUTH_TYPE_AUTHORIZATION`**
Pass the OAuth parameters in the HTTP `Authorization` header. **`OAUTH_AUTH_TYPE_FORM`**
Append the OAuth parameters to the HTTP POST request body. **`OAUTH_AUTH_TYPE_URI`**
Append the OAuth parameters to the request URI. **`OAUTH_AUTH_TYPE_NONE`**
None. ### Return Values
Returns **`true`** if a parameter is correctly set, otherwise **`false`** (e.g., if an invalid `auth_type` is passed in.)
### Changelog
| Version | Description |
| --- | --- |
| PECL oauth 1.0.0 | Previously returned **`null`** on failure, instead of **`false`**. |
php GmagickDraw::setfont GmagickDraw::setfont
====================
(PECL gmagick >= Unknown)
GmagickDraw::setfont — Sets the fully-specified font to use when annotating with text
### Description
```
public GmagickDraw::setfont(string $font): GmagickDraw
```
Sets the fully-specified font to use when annotating with text
### Parameters
`font`
font name
### Return Values
The [GmagickDraw](class.gmagickdraw) object.
php ImagickDraw::getFontStyle ImagickDraw::getFontStyle
=========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::getFontStyle — Returns the font style
### Description
```
public ImagickDraw::getFontStyle(): int
```
**Warning**This function is currently not documented; only its argument list is available.
Returns the font style used when annotating with text.
### Return Values
Returns a [STYLE](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.styles) constant (`imagick::STYLE_*`) associated with the [ImagickDraw](class.imagickdraw) object or 0 if no style is set.
php array_push array\_push
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
array\_push — Push one or more elements onto the end of array
### Description
```
array_push(array &$array, mixed ...$values): int
```
**array\_push()** treats `array` as a stack, and pushes the passed variables onto the end of `array`. The length of `array` increases by the number of variables pushed. Has the same effect as:
```
<?php
$array[] = $var;
?>
```
repeated for each passed value.
> **Note**: If you use **array\_push()** to add one element to the array, it's better to use `$array[] =` because in that way there is no overhead of calling a function.
>
>
> **Note**: **array\_push()** will raise a warning if the first argument is not an array. This differed from the `$var[]` behaviour where a new array was created, prior to PHP 7.1.0.
>
>
### Parameters
`array`
The input array.
`values`
The values to push onto the end of the `array`.
### Return Values
Returns the new number of elements in the array.
### Changelog
| Version | Description |
| --- | --- |
| 7.3.0 | This function can now be called with only one parameter. Formerly, at least two parameters have been required. |
### Examples
**Example #1 **array\_push()** example**
```
<?php
$stack = array("orange", "banana");
array_push($stack, "apple", "raspberry");
print_r($stack);
?>
```
The above example will output:
```
Array
(
[0] => orange
[1] => banana
[2] => apple
[3] => raspberry
)
```
### See Also
* [array\_pop()](function.array-pop) - Pop the element off the end of array
* [array\_shift()](function.array-shift) - Shift an element off the beginning of array
* [array\_unshift()](function.array-unshift) - Prepend one or more elements to the beginning of an array
php GmagickDraw::arc GmagickDraw::arc
================
(PECL gmagick >= Unknown)
GmagickDraw::arc — Draws an arc
### Description
```
public GmagickDraw::arc(
float $sx,
float $sy,
float $ex,
float $ey,
float $sd,
float $ed
): GmagickDraw
```
Draws an arc falling within a specified bounding rectangle on the image.
### Parameters
`sx`
starting x ordinate of bounding rectangle
`sy`
starting y ordinate of bounding rectangle
`ex`
ending x ordinate of bounding rectangle
`ey`
ending y ordinate of bounding rectangle
`sd`
starting degrees of rotation
`ed`
ending degrees of rotation
### Return Values
The [GmagickDraw](class.gmagickdraw) object.
php SolrInputDocument::clear SolrInputDocument::clear
========================
(PECL solr >= 0.9.2)
SolrInputDocument::clear — Resets the input document
### Description
```
public SolrInputDocument::clear(): bool
```
Resets the document by dropping all the fields and resets the document boost to zero.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php sodium_crypto_generichash_update sodium\_crypto\_generichash\_update
===================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_generichash\_update — Add message to a hash
### Description
```
sodium_crypto_generichash_update(string &$state, string $message): bool
```
Appends a message to the internal hash state.
### Parameters
`state`
The return value of [sodium\_crypto\_generichash\_init()](function.sodium-crypto-generichash-init).
`message`
Data to append to the hashing state.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **sodium\_crypto\_generichash\_update()** example**
```
<?php
$messages = [random_bytes(32), random_bytes(32), random_bytes(16)];
$state = sodium_crypto_generichash_init();
foreach ($messages as $message) {
sodium_crypto_generichash_update($state, $message);
}
$final = sodium_crypto_generichash_final($state);
var_dump(sodium_bin2hex($final));
$allAtOnce = sodium_crypto_generichash(implode('', $messages));
var_dump(sodium_bin2hex($allAtOnce));
?>
```
The above example will output something similar to:
```
string(64) "e16e28bbbbcc39d9f5b1cbc33c41f1d217808640103e57a41f24870f79831e04"
string(64) "e16e28bbbbcc39d9f5b1cbc33c41f1d217808640103e57a41f24870f79831e04"
```
| programming_docs |
php Ds\Map::clear Ds\Map::clear
=============
(PECL ds >= 1.0.0)
Ds\Map::clear — Removes all values
### Description
```
public Ds\Map::clear(): void
```
Removes all values from the map.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Map::clear()** example**
```
<?php
$map = new \Ds\Map([
"a" => 1,
"b" => 2,
"c" => 3,
]);
print_r($map);
$map->clear();
print_r($map);
?>
```
The above example will output something similar to:
```
Ds\Map Object
(
[0] => Ds\Pair Object
(
[key] => a
[value] => 1
)
[1] => Ds\Pair Object
(
[key] => b
[value] => 2
)
[2] => Ds\Pair Object
(
[key] => c
[value] => 3
)
)
Ds\Map Object
(
)
```
php Imagick::setFirstIterator Imagick::setFirstIterator
=========================
(PECL imagick 2, PECL imagick 3)
Imagick::setFirstIterator — Sets the Imagick iterator to the first image
### Description
```
public Imagick::setFirstIterator(): bool
```
Sets the Imagick iterator to the first image.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success.
php GmagickPixel::setcolorvalue GmagickPixel::setcolorvalue
===========================
(PECL gmagick >= Unknown)
GmagickPixel::setcolorvalue — Sets the normalized value of one of the channels
### Description
```
public GmagickPixel::setcolorvalue(int $color, float $value): GmagickPixel
```
Sets the value of the specified channel of this object to the provided value, which should be between 0 and 1. This function can be used to provide an opacity channel to a [GmagickPixel](class.gmagickpixel) object.
### Parameters
`color`
One of the Gmagick channel color constants.
`value`
The value to set this channel to, ranging from 0 to 1.
### Return Values
The [GmagickPixel](class.gmagickpixel) object.
php Event::setPriority Event::setPriority
==================
(PECL event >= 1.2.6-beta)
Event::setPriority — Set event priority
### Description
```
public Event::setPriority( int $priority ): bool
```
Set event priority.
### Parameters
`priority` The event priority.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php XMLWriter::endPi XMLWriter::endPi
================
xmlwriter\_end\_pi
==================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::endPi -- xmlwriter\_end\_pi — End current PI
### Description
Object-oriented style
```
public XMLWriter::endPi(): bool
```
Procedural style
```
xmlwriter_end_pi(XMLWriter $writer): bool
```
Ends the current processing instruction.
### Parameters
`writer`
Only for procedural calls. The [XMLWriter](class.xmlwriter) instance that is being modified. This object is returned from a call to [xmlwriter\_open\_uri()](xmlwriter.openuri) or [xmlwriter\_open\_memory()](xmlwriter.openmemory).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `writer` expects an [XMLWriter](class.xmlwriter) instance now; previously, a resource was expected. |
### See Also
* [XMLWriter::startPi()](xmlwriter.startpi) - Create start PI tag
* [XMLWriter::writePi()](xmlwriter.writepi) - Writes a PI
php SQLite3Result::finalize SQLite3Result::finalize
=======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3Result::finalize — Closes the result set
### Description
```
public SQLite3Result::finalize(): bool
```
Closes the result set.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`**.
php EventBase::gotExit EventBase::gotExit
==================
(PECL event >= 1.2.6-beta)
EventBase::gotExit — Checks if the event loop was told to exit
### Description
```
public EventBase::gotExit(): bool
```
Checks if the event loop was told to exit by [EventBase::exit()](eventbase.exit) .
### Parameters
This function has no parameters.
### Return Values
Returns **`true`**, event loop was told to exit by [EventBase::exit()](eventbase.exit) . Otherwise **`false`**.
### See Also
* [EventBase::exit()](eventbase.exit) - Stop dispatching events
* [EventBase::stop()](eventbase.stop) - Tells event\_base to stop dispatching events
* [EventBase::gotStop()](eventbase.gotstop) - Checks if the event loop was told to exit
php ArrayIterator::offsetUnset ArrayIterator::offsetUnset
==========================
(PHP 5, PHP 7, PHP 8)
ArrayIterator::offsetUnset — Unset value for an offset
### Description
```
public ArrayIterator::offsetUnset(mixed $key): void
```
Unsets a value for an offset.
If iteration is in progress, and **ArrayIterator::offsetUnset()** is used to unset the current index of iteration, the iteration position will be advanced to the next index. Since the iteration position is also advanced at the end of a [foreach](control-structures.foreach) loop body, use of **ArrayIterator::offsetUnset()** inside a [`foreach`](control-structures.foreach) loop may result in indices being skipped.
### Parameters
`key`
The offset to unset.
### Return Values
No value is returned.
### See Also
* [ArrayIterator::offsetGet()](arrayiterator.offsetget) - Get value for an offset
* [ArrayIterator::offsetSet()](arrayiterator.offsetset) - Set value for an offset
php ReflectionProperty::getDocComment ReflectionProperty::getDocComment
=================================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
ReflectionProperty::getDocComment — Gets the property doc comment
### Description
```
public ReflectionProperty::getDocComment(): string|false
```
Gets the doc comment for a property.
### Parameters
This function has no parameters.
### Return Values
The doc comment if it exists, otherwise **`false`**.
### Examples
**Example #1 **ReflectionProperty::getDocComment()** example**
```
<?php
class Str
{
/**
* @var int The length of the string
*/
public $length = 5;
}
$prop = new ReflectionProperty('Str', 'length');
var_dump($prop->getDocComment());
?>
```
The above example will output something similar to:
```
string(53) "/**
* @var int The length of the string
*/"
```
**Example #2 Multiple property declarations**
If multiple property declarations are preceeded by a single doc comment, the doc comment refers to the first property only.
```
<?php
class Foo
{
/** @var string */
public $a, $b;
}
$class = new \ReflectionClass('Foo');
foreach ($class->getProperties() as $property) {
echo $property->getName() . ': ' . var_export($property->getDocComment(), true) . PHP_EOL;
}
?>
```
The above example will output:
```
a: '/** @var string */'
b: false
```
### See Also
* [ReflectionProperty::getModifiers()](reflectionproperty.getmodifiers) - Gets the property modifiers
* [ReflectionProperty::getName()](reflectionproperty.getname) - Gets property name
* [ReflectionProperty::getValue()](reflectionproperty.getvalue) - Gets value
php None Performance
-----------
Certain items that may appear in patterns are more efficient than others. It is more efficient to use a character class like [aeiou] than a set of alternatives such as (a|e|i|o|u). In general, the simplest construction that provides the required behaviour is usually the most efficient. Jeffrey Friedl's book contains a lot of discussion about optimizing regular expressions for efficient performance.
When a pattern begins with .\* and the [PCRE\_DOTALL](reference.pcre.pattern.modifiers) option is set, the pattern is implicitly anchored by PCRE, since it can match only at the start of a subject string. However, if [PCRE\_DOTALL](reference.pcre.pattern.modifiers) is not set, PCRE cannot make this optimization, because the . metacharacter does not then match a newline, and if the subject string contains newlines, the pattern may match from the character immediately following one of them instead of from the very start. For example, the pattern `(.*) second` matches the subject "first\nand second" (where \n stands for a newline character) with the first captured substring being "and". In order to do this, PCRE has to retry the match starting after every newline in the subject.
If you are using such a pattern with subject strings that do not contain newlines, the best performance is obtained by setting [PCRE\_DOTALL](reference.pcre.pattern.modifiers), or starting the pattern with ^.\* to indicate explicit anchoring. That saves PCRE from having to scan along the subject looking for a newline to restart at.
Beware of patterns that contain nested indefinite repeats. These can take a long time to run when applied to a string that does not match. Consider the pattern fragment `(a+)*`
This can match "aaaa" in 33 different ways, and this number increases very rapidly as the string gets longer. (The \* repeat can match 0, 1, 2, 3, or 4 times, and for each of those cases other than 0, the + repeats can match different numbers of times.) When the remainder of the pattern is such that the entire match is going to fail, PCRE has in principle to try every possible variation, and this can take an extremely long time.
An optimization catches some of the more simple cases such as `(a+)*b` where a literal character follows. Before embarking on the standard matching procedure, PCRE checks that there is a "b" later in the subject string, and if there is not, it fails the match immediately. However, when there is no following literal this optimization cannot be used. You can see the difference by comparing the behaviour of `(a+)*\d` with the pattern above. The former gives a failure almost instantly when applied to a whole line of "a" characters, whereas the latter takes an appreciable time with strings longer than about 20 characters.
php Reflector::__toString Reflector::\_\_toString
=======================
(PHP 5, PHP 7, PHP 8)
Reflector::\_\_toString — To string
### Description
```
public Reflector::__toString(): string
```
To string.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
### See Also
* [ReflectionProperty::export()](reflectionproperty.export) - Export
* [\_\_toString()](language.oop5.magic#object.tostring)
php xml_parser_create xml\_parser\_create
===================
(PHP 4, PHP 5, PHP 7, PHP 8)
xml\_parser\_create — Create an XML parser
### Description
```
xml_parser_create(?string $encoding = null): XMLParser
```
**xml\_parser\_create()** creates a new XML parser and returns a [XMLParser](class.xmlparser) instance to be used by the other XML functions.
### Parameters
`encoding`
The input encoding is automatically detected, so that the `encoding` parameter specifies only the output encoding. If empty string is passed, the parser attempts to identify which encoding the document is encoded in by looking at the heading 3 or 4 bytes. The default output charset is UTF-8. The supported encodings are `ISO-8859-1`, `UTF-8` and `US-ASCII`.
### Return Values
Returns a new [XMLParser](class.xmlparser) instance.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function returns an [XMLParser](class.xmlparser) instance now; previously, a resource was returned, or **`false`** on failure. |
| 8.0.0 | `encoding` is nullable now. |
### See Also
* [xml\_parser\_create\_ns()](function.xml-parser-create-ns) - Create an XML parser with namespace support
* [xml\_parser\_free()](function.xml-parser-free) - Free an XML parser
php imap_sort imap\_sort
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_sort — Gets and sort messages
### Description
```
imap_sort(
IMAP\Connection $imap,
int $criteria,
bool $reverse,
int $flags = 0,
?string $search_criteria = null,
?string $charset = null
): array|false
```
Gets and sorts message numbers by the given parameters.
### Parameters
`imap`
An [IMAP\Connection](class.imap-connection) instance.
`criteria`
Criteria can be one (and only one) of the following:
* **`SORTDATE`** - message Date
* **`SORTARRIVAL`** - arrival date
* **`SORTFROM`** - mailbox in first From address
* **`SORTSUBJECT`** - message subject
* **`SORTTO`** - mailbox in first To address
* **`SORTCC`** - mailbox in first cc address
* **`SORTSIZE`** - size of message in octets
`reverse`
Whether to sort in reverse order.
`flags`
The `flags` are a bitmask of one or more of the following:
* **`SE_UID`** - Return UIDs instead of sequence numbers
* **`SE_NOPREFETCH`** - Don't prefetch searched messages
`search_criteria`
IMAP2-format search criteria string. For details see [imap\_search()](function.imap-search).
`charset`
MIME character set to use when sorting strings.
### Return Values
Returns an array of message numbers sorted by the given parameters, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `imap` parameter expects an [IMAP\Connection](class.imap-connection) instance now; previously, a [resource](language.types.resource) was expected. |
| 8.0.0 | `reverse` is now bool instead of int. |
| 8.0.0 | `search_criteria` and `charset` are now nullable. |
php SoapClient::__getCookies SoapClient::\_\_getCookies
==========================
(PHP 5 >= 5.4.30, PHP 7, PHP 8)
SoapClient::\_\_getCookies — Get list of cookies
### Description
```
public SoapClient::__getCookies(): array
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php stristr stristr
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
stristr — Case-insensitive [strstr()](function.strstr)
### Description
```
stristr(string $haystack, string $needle, bool $before_needle = false): string|false
```
Returns all of `haystack` starting from and including the first occurrence of `needle` to the end.
### Parameters
`haystack`
The string to search in
`needle`
Prior to PHP 8.0.0, if `needle` is not a string, it is converted to an integer and applied as the ordinal value of a character. This behavior is deprecated as of PHP 7.3.0, and relying on it is highly discouraged. Depending on the intended behavior, the `needle` should either be explicitly cast to string, or an explicit call to [chr()](function.chr) should be performed.
`before_needle`
If **`true`**, **stristr()** returns the part of the `haystack` before the first occurrence of the `needle` (excluding needle).
`needle` and `haystack` are examined in a case-insensitive manner.
### Return Values
Returns the matched substring. If `needle` is not found, returns **`false`**.
### Changelog
| Version | Description |
| --- | --- |
| 8.2.0 | Case folding no longer depends on the locale set with [setlocale()](function.setlocale). Only ASCII case folding will be done. Non-ASCII bytes will be compared by their byte value. |
| 8.0.0 | Passing an int as `needle` is no longer supported. |
| 7.3.0 | Passing an int as `needle` has been deprecated. |
### Examples
**Example #1 **stristr()** example**
```
<?php
$email = '[email protected]';
echo stristr($email, 'e'); // outputs [email protected]
echo stristr($email, 'e', true); // outputs US
?>
```
**Example #2 Testing if a string is found or not**
```
<?php
$string = 'Hello World!';
if(stristr($string, 'earth') === FALSE) {
echo '"earth" not found in string';
}
// outputs: "earth" not found in string
?>
```
**Example #3 Using a non "string" needle**
```
<?php
$string = 'APPLE';
echo stristr($string, 97); // 97 = lowercase a
// outputs: APPLE
?>
```
### Notes
> **Note**: This function is binary-safe.
>
>
### See Also
* [strstr()](function.strstr) - Find the first occurrence of a string
* [strrchr()](function.strrchr) - Find the last occurrence of a character in a string
* [stripos()](function.stripos) - Find the position of the first occurrence of a case-insensitive substring in a string
* [strpbrk()](function.strpbrk) - Search a string for any of a set of characters
* [preg\_match()](function.preg-match) - Perform a regular expression match
php fdf_open_string fdf\_open\_string
=================
(PHP 4 >= 4.3.0, PHP 5 < 5.3.0, PECL fdf SVN)
fdf\_open\_string — Read a FDF document from a string
### Description
```
fdf_open_string(string $fdf_data): resource
```
Reads form data from a string.
You can use **fdf\_open\_string()** together with $HTTP\_FDF\_DATA to process FDF form input from a remote client.
### Parameters
`fdf_data`
The data as returned from a PDF form or created using [fdf\_create()](function.fdf-create) and [fdf\_save\_string()](function.fdf-save-string).
### Return Values
Returns a FDF document handle, or **`false`** on error.
### Examples
**Example #1 Accessing the form data**
```
<?php
$fdf = fdf_open_string($HTTP_FDF_DATA);
/* ... */
fdf_close($fdf);
?>
```
### See Also
* [fdf\_open()](function.fdf-open) - Open a FDF document
* [fdf\_close()](function.fdf-close) - Close an FDF document
* [fdf\_create()](function.fdf-create) - Create a new FDF document
* [fdf\_save\_string()](function.fdf-save-string) - Returns the FDF document as a string
php SoapClient::__doRequest SoapClient::\_\_doRequest
=========================
(PHP 5, PHP 7, PHP 8)
SoapClient::\_\_doRequest — Performs a SOAP request
### Description
```
public SoapClient::__doRequest(
string $request,
string $location,
string $action,
int $version,
bool $oneWay = false
): ?string
```
Performs SOAP request over HTTP.
This method can be overridden in subclasses to implement different transport layers, perform additional XML processing or other purpose.
### Parameters
`request`
The XML SOAP request.
`location`
The URL to request.
`action`
The SOAP action.
`version`
The SOAP version.
`oneWay`
If `one_way` is set to 1, this method returns nothing. Use this where a response is not expected.
### Return Values
The XML SOAP response.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | The type of `oneWay` is bool now; formerly it was int. |
### Examples
**Example #1 **SoapClient::\_\_doRequest()** example**
```
<?php
function Add($x,$y) {
return $x+$y;
}
class LocalSoapClient extends SoapClient {
function __construct($wsdl, $options) {
parent::__construct($wsdl, $options);
$this->server = new SoapServer($wsdl, $options);
$this->server->addFunction('Add');
}
function __doRequest($request, $location, $action, $version, $one_way = 0) {
ob_start();
$this->server->handle($request);
$response = ob_get_contents();
ob_end_clean();
return $response;
}
}
$x = new LocalSoapClient(NULL,array('location'=>'test://',
'uri'=>'http://testuri.org'));
var_dump($x->Add(3,4));
?>
```
php SolrQuery::getStart SolrQuery::getStart
===================
(PECL solr >= 0.9.2)
SolrQuery::getStart — Returns the offset in the complete result set
### Description
```
public SolrQuery::getStart(): int
```
Returns the offset in the complete result set for the queries where the set of returned documents should begin.
### Parameters
This function has no parameters.
### Return Values
Returns an integer on success and **`null`** if not set.
| programming_docs |
php Phar::isFileFormat Phar::isFileFormat
==================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
Phar::isFileFormat — Returns true if the phar archive is based on the tar/phar/zip file format depending on the parameter
### Description
```
public Phar::isFileFormat(int $format): bool
```
### Parameters
`format`
Either `Phar::PHAR`, `Phar::TAR`, or `Phar::ZIP` to test for the format of the archive.
### Return Values
Returns **`true`** if the phar archive matches the file format requested by the parameter
### Errors/Exceptions
[PharException](class.pharexception) is thrown if the parameter is an unknown file format specifier.
### See Also
* [Phar::convertToExecutable()](phar.converttoexecutable) - Convert a phar archive to another executable phar archive file format
* [Phar::convertToData()](phar.converttodata) - Convert a phar archive to a non-executable tar or zip file
php Ds\Stack::count Ds\Stack::count
===============
(PECL ds >= 1.0.0)
Ds\Stack::count — Returns the number of values in the stack
See [Countable::count()](countable.count)
php fbird_blob_get fbird\_blob\_get
================
(PHP 5, PHP 7 < 7.4.0)
fbird\_blob\_get — Alias of [ibase\_blob\_get()](function.ibase-blob-get)
### Description
This function is an alias of: [ibase\_blob\_get()](function.ibase-blob-get).
### See Also
* [fbird\_blob\_open()](function.fbird-blob-open) - Alias of ibase\_blob\_open
* [fbird\_blob\_close()](function.fbird-blob-close) - Alias of ibase\_blob\_close
* [fbird\_blob\_echo()](function.fbird-blob-echo) - Alias of ibase\_blob\_echo
php dba_firstkey dba\_firstkey
=============
(PHP 4, PHP 5, PHP 7, PHP 8)
dba\_firstkey — Fetch first key
### Description
```
dba_firstkey(resource $dba): string|false
```
**dba\_firstkey()** returns the first key of the database and resets the internal key pointer. This permits a linear search through the whole database.
### Parameters
`dba`
The database handler, returned by [dba\_open()](function.dba-open) or [dba\_popen()](function.dba-popen).
### Return Values
Returns the key on success or **`false`** on failure.
### See Also
* [dba\_nextkey()](function.dba-nextkey) - Fetch next key
* [dba\_key\_split()](function.dba-key-split) - Splits a key in string representation into array representation
* Example 2 in the [DBA examples](https://www.php.net/manual/en/dba.examples.php)
php uopz_undefine uopz\_undefine
==============
(PECL uopz 1, PECL uopz 2, PECL uopz 5, PECL uopz 6, PECL uopz 7)
uopz\_undefine — Undefine a constant
### Description
```
uopz_undefine(string $constant): bool
```
```
uopz_undefine(string $class, string $constant): bool
```
Removes the constant at runtime
### Parameters
`class`
The name of the class containing `constant`
`constant`
The name of an existing constant
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **uopz\_undefine()** example**
```
<?php
define("MY", true);
uopz_undefine("MY");
var_dump(defined("MY"));
?>
```
The above example will output:
```
bool(false)
```
php Ds\Set::sum Ds\Set::sum
===========
(PECL ds >= 1.0.0)
Ds\Set::sum — Returns the sum of all values in the set
### Description
```
public Ds\Set::sum(): int|float
```
Returns the sum of all values in the set.
>
> **Note**:
>
>
> Arrays and objects are considered equal to zero when calculating the sum.
>
>
### Parameters
This function has no parameters.
### Return Values
The sum of all the values in the set as either a float or int depending on the values in the set.
### Examples
**Example #1 **Ds\Set::sum()** integer example**
```
<?php
$set = new \Ds\Set([1, 2, 3]);
var_dump($set->sum());
?>
```
The above example will output something similar to:
```
int(6)
```
**Example #2 **Ds\Set::sum()** float example**
```
<?php
$set = new \Ds\Set([1, 2.5, 3]);
var_dump($set->sum());
?>
```
The above example will output something similar to:
```
float(6.5)
```
php SQLite3::busyTimeout SQLite3::busyTimeout
====================
(PHP 5 >= 5.3.3, PHP 7, PHP 8)
SQLite3::busyTimeout — Sets the busy connection handler
### Description
```
public SQLite3::busyTimeout(int $milliseconds): bool
```
Sets a busy handler that will sleep until the database is not locked or the timeout is reached.
### Parameters
`milliseconds`
The milliseconds to sleep. Setting this value to a value less than or equal to zero, will turn off an already set timeout handler.
### Return Values
Returns **`true`** on success, or **`false`** on failure.
php posix_mkfifo posix\_mkfifo
=============
(PHP 4, PHP 5, PHP 7, PHP 8)
posix\_mkfifo — Create a fifo special file (a named pipe)
### Description
```
posix_mkfifo(string $filename, int $permissions): bool
```
**posix\_mkfifo()** creates a special `FIFO` file which exists in the file system and acts as a bidirectional communication endpoint for processes.
### Parameters
`filename`
Path to the `FIFO` file.
`permissions`
The second parameter `permissions` has to be given in octal notation (e.g. 0644). The permission of the newly created `FIFO` also depends on the setting of the current [umask()](function.umask). The permissions of the created file are (mode & ~umask).
### Return Values
Returns **`true`** on success or **`false`** on failure.
php Imagick::setResourceLimit Imagick::setResourceLimit
=========================
(PECL imagick 2, PECL imagick 3)
Imagick::setResourceLimit — Sets the limit for a particular resource
### Description
```
public static Imagick::setResourceLimit(int $type, int $limit): bool
```
This method is used to modify the resource limits of the underlying ImageMagick library.
### Parameters
`type`
Refer to the list of [resourcetype constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.resourcetypes).
`limit`
One of the [resourcetype constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.resourcetypes). The unit depends on the type of the resource being limited.
### Return Values
Returns **`true`** on success.
### See Also
* [Imagick::getResourceLimit()](imagick.getresourcelimit) - Returns the specified resource limit
php curl_multi_exec curl\_multi\_exec
=================
(PHP 5, PHP 7, PHP 8)
curl\_multi\_exec — Run the sub-connections of the current cURL handle
### Description
```
curl_multi_exec(CurlMultiHandle $multi_handle, int &$still_running): int
```
Processes each of the handles in the stack. This method can be called whether or not a handle needs to read or write data.
### Parameters
`multi_handle` A cURL multi handle returned by [curl\_multi\_init()](function.curl-multi-init).
`still_running`
A reference to a flag to tell whether the operations are still running.
### Return Values
A cURL code defined in the cURL [Predefined Constants](https://www.php.net/manual/en/curl.constants.php).
>
> **Note**:
>
>
> This only returns errors regarding the whole multi stack. There might still have occurred problems on individual transfers even when this function returns **`CURLM_OK`**.
>
>
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `multi_handle` expects a [CurlMultiHandle](class.curlmultihandle) instance now; previously, a resource was expected. |
### Examples
**Example #1 **curl\_multi\_exec()** example**
This example will create two cURL handles, add them to a multi handle, and process them asynchronously.
```
<?php
// create both cURL resources
$ch1 = curl_init();
$ch2 = curl_init();
// set URL and other appropriate options
curl_setopt($ch1, CURLOPT_URL, "http://example.com/");
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/");
curl_setopt($ch2, CURLOPT_HEADER, 0);
//create the multiple cURL handle
$mh = curl_multi_init();
//add the two handles
curl_multi_add_handle($mh,$ch1);
curl_multi_add_handle($mh,$ch2);
//execute the multi handle
do {
$status = curl_multi_exec($mh, $active);
if ($active) {
// Wait a short time for more activity
curl_multi_select($mh);
}
} while ($active && $status == CURLM_OK);
//close the handles
curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);
?>
```
### See Also
* [curl\_multi\_init()](function.curl-multi-init) - Returns a new cURL multi handle
* [curl\_multi\_select()](function.curl-multi-select) - Wait for activity on any curl\_multi connection
* [curl\_exec()](function.curl-exec) - Perform a cURL session
php Imagick::resampleImage Imagick::resampleImage
======================
(PECL imagick 2, PECL imagick 3)
Imagick::resampleImage — Resample image to desired resolution
### Description
```
public Imagick::resampleImage(
float $x_resolution,
float $y_resolution,
int $filter,
float $blur
): bool
```
Resample image to desired resolution.
### Parameters
`x_resolution`
`y_resolution`
`filter`
`blur`
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::resampleImage()****
```
<?php
function resampleImage($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->resampleImage(200, 200, \Imagick::FILTER_LANCZOS, 1);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php openal_source_pause openal\_source\_pause
=====================
(PECL openal >= 0.1.0)
openal\_source\_pause — Pause the source
### Description
```
openal_source_pause(resource $source): bool
```
### Parameters
`source`
An [Open AL(Source)](https://www.php.net/manual/en/openal.resources.php) resource (previously created by [openal\_source\_create()](function.openal-source-create)).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [openal\_source\_stop()](function.openal-source-stop) - Stop playing the source
* [openal\_source\_play()](function.openal-source-play) - Start playing the source
* [openal\_source\_rewind()](function.openal-source-rewind) - Rewind the source
php SyncMutex::unlock SyncMutex::unlock
=================
(PECL sync >= 1.0.0)
SyncMutex::unlock — Unlocks the mutex
### Description
```
public SyncMutex::unlock(bool $all = false): bool
```
Decreases the internal counter of a [SyncMutex](class.syncmutex) object. When the internal counter reaches zero, the actual lock on the object is released.
### Parameters
`all`
Specifies whether or not to set the internal counter to zero and therefore release the lock.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **SyncMutex::unlock()** example**
```
<?php
$mutex = new SyncMutex("UniqueName");
$mutex->lock();
/* ... */
$mutex->unlock();
?>
```
### See Also
* [SyncMutex::lock()](syncmutex.lock) - Waits for an exclusive lock
php SplObjectStorage::detach SplObjectStorage::detach
========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplObjectStorage::detach — Removes an object from the storage
### Description
```
public SplObjectStorage::detach(object $object): void
```
Removes the object from the storage.
### Parameters
`object`
The object to remove.
### Return Values
No value is returned.
### Examples
**Example #1 **SplObjectStorage::detach()** example**
```
<?php
$o = new StdClass;
$s = new SplObjectStorage();
$s->attach($o);
var_dump(count($s));
$s->detach($o);
var_dump(count($s));
?>
```
The above example will output something similar to:
```
int(1)
int(0)
```
### See Also
* [SplObjectStorage::attach()](splobjectstorage.attach) - Adds an object in the storage
* [SplObjectStorage::removeAll()](splobjectstorage.removeall) - Removes objects contained in another storage from the current storage
php ReflectionProperty::getValue ReflectionProperty::getValue
============================
(PHP 5, PHP 7, PHP 8)
ReflectionProperty::getValue — Gets value
### Description
```
public ReflectionProperty::getValue(?object $object = null): mixed
```
Gets the property's value.
### Parameters
`object`
If the property is non-static an object must be provided to fetch the property from. If you want to fetch the default property without providing an object use [ReflectionClass::getDefaultProperties()](reflectionclass.getdefaultproperties) instead.
### Return Values
The current value of the property.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | Private and protected properties can be accessed by **ReflectionProperty::getValue()** right away. Previously, they needed to be made accessible by calling [ReflectionProperty::setAccessible()](reflectionproperty.setaccessible); otherwise a [ReflectionException](class.reflectionexception) was thrown. |
| 8.0.0 | `object` is nullable now. |
### Examples
**Example #1 **ReflectionProperty::getValue()** example**
```
<?php
class Foo {
public static $staticProperty = 'foobar';
public $property = 'barfoo';
protected $privateProperty = 'foofoo';
}
$reflectionClass = new ReflectionClass('Foo');
var_dump($reflectionClass->getProperty('staticProperty')->getValue());
var_dump($reflectionClass->getProperty('property')->getValue(new Foo));
$reflectionProperty = $reflectionClass->getProperty('privateProperty');
$reflectionProperty->setAccessible(true); // only required prior to PHP 8.1.0
var_dump($reflectionProperty->getValue(new Foo));
?>
```
The above example will output:
```
string(6) "foobar"
string(6) "barfoo"
string(6) "foofoo"
```
### See Also
* [ReflectionProperty::setValue()](reflectionproperty.setvalue) - Set property value
* [ReflectionProperty::setAccessible()](reflectionproperty.setaccessible) - Set property accessibility
* [ReflectionClass::getDefaultProperties()](reflectionclass.getdefaultproperties) - Gets default properties
* [ReflectionClass::getStaticPropertyValue()](reflectionclass.getstaticpropertyvalue) - Gets static property value
php XMLReader::getParserProperty XMLReader::getParserProperty
============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
XMLReader::getParserProperty — Indicates if specified property has been set
### Description
```
public XMLReader::getParserProperty(int $property): bool
```
Indicates if specified property has been set.
### Parameters
`property`
One of the [parser option constants](class.xmlreader#xmlreader.constants).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [XMLReader::setParserProperty()](xmlreader.setparserproperty) - Set parser options
php ssh2_scp_send ssh2\_scp\_send
===============
(PECL ssh2 >= 0.9.0)
ssh2\_scp\_send — Send a file via SCP
### Description
```
ssh2_scp_send(
resource $session,
string $local_file,
string $remote_file,
int $create_mode = 0644
): bool
```
Copy a file from the local filesystem to the remote server using the SCP protocol.
### Parameters
`session`
An SSH connection link identifier, obtained from a call to [ssh2\_connect()](function.ssh2-connect).
`local_file`
Path to the local file.
`remote_file`
Path to the remote file.
`create_mode`
The file will be created with the mode specified by `create_mode`.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Uploading a file via SCP**
```
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
ssh2_scp_send($connection, '/local/filename', '/remote/filename', 0644);
?>
```
### See Also
* [ssh2\_scp\_recv()](function.ssh2-scp-recv) - Request a file via SCP
* [copy()](function.copy) - Copies file
php DOMCharacterData::insertData DOMCharacterData::insertData
============================
(PHP 5, PHP 7, PHP 8)
DOMCharacterData::insertData — Insert a string at the specified 16-bit unit offset
### Description
```
public DOMCharacterData::insertData(int $offset, string $data): bool
```
Inserts string `data` at position `offset`.
### Parameters
`offset`
The character offset at which to insert.
`data`
The string to insert.
### Return Values
No value is returned.
### Errors/Exceptions
**`DOM_INDEX_SIZE_ERR`**
Raised if `offset` is negative or greater than the number of 16-bit units in data.
### See Also
* [DOMCharacterData::appendData()](domcharacterdata.appenddata) - Append the string to the end of the character data of the node
* [DOMCharacterData::deleteData()](domcharacterdata.deletedata) - Remove a range of characters from the node
* [DOMCharacterData::replaceData()](domcharacterdata.replacedata) - Replace a substring within the DOMCharacterData node
* [DOMCharacterData::substringData()](domcharacterdata.substringdata) - Extracts a range of data from the node
php imagecolorresolvealpha imagecolorresolvealpha
======================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
imagecolorresolvealpha — Get the index of the specified color + alpha or its closest possible alternative
### Description
```
imagecolorresolvealpha(
GdImage $image,
int $red,
int $green,
int $blue,
int $alpha
): int
```
This function is guaranteed to return a color index for a requested color, either the exact color or the closest possible alternative.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`red`
Value of red component.
`green`
Value of green component.
`blue`
Value of blue component.
`alpha`
A value between `0` and `127`. `0` indicates completely opaque while `127` indicates completely transparent.
The colors parameters are integers between 0 and 255 or hexadecimals between 0x00 and 0xFF. ### Return Values
Returns a color index.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 Using **imagecoloresolvealpha()** to get colors from an image**
```
<?php
// Load an image
$im = imagecreatefromgif('phplogo.gif');
// Get closest colors from the image
$colors = array();
$colors[] = imagecolorresolvealpha($im, 255, 255, 255, 0);
$colors[] = imagecolorresolvealpha($im, 0, 0, 200, 127);
// Output
print_r($colors);
imagedestroy($im);
?>
```
The above example will output something similar to:
```
Array
(
[0] => 89
[1] => 85
)
```
### See Also
* [imagecolorclosestalpha()](function.imagecolorclosestalpha) - Get the index of the closest color to the specified color + alpha
php sodium_compare sodium\_compare
===============
(PHP 7 >= 7.2.0, PHP 8)
sodium\_compare — Compare large numbers
### Description
```
sodium_compare(string $string1, string $string2): int
```
Compare two strings as if they were arbitrary-length, unsigned little-endian integers, without side-channel leakage.
### Parameters
`string1`
Left operand
`string2`
Right operand
### Return Values
Returns `-1` if `string1` is less than `string2`.
Returns `1` if `string1` is greater than `string2`.
Returns `0` if both strings are equal.
php set_file_buffer set\_file\_buffer
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
set\_file\_buffer — Alias of [stream\_set\_write\_buffer()](function.stream-set-write-buffer)
### Description
This function is an alias of: [stream\_set\_write\_buffer()](function.stream-set-write-buffer).
| programming_docs |
php Exception::getTrace Exception::getTrace
===================
(PHP 5, PHP 7, PHP 8)
Exception::getTrace — Gets the stack trace
### Description
```
final public Exception::getTrace(): array
```
Returns the Exception stack trace.
### Parameters
This function has no parameters.
### Return Values
Returns the Exception stack trace as an array.
### Examples
**Example #1 **Exception::getTrace()** example**
```
<?php
function test() {
throw new Exception;
}
try {
test();
} catch(Exception $e) {
var_dump($e->getTrace());
}
?>
```
The above example will output something similar to:
```
array(1) {
[0]=>
array(4) {
["file"]=>
string(22) "/home/bjori/tmp/ex.php"
["line"]=>
int(7)
["function"]=>
string(4) "test"
["args"]=>
array(0) {
}
}
}
```
### See Also
* [Throwable::getTrace()](throwable.gettrace) - Gets the stack trace
php ssh2_methods_negotiated ssh2\_methods\_negotiated
=========================
(PECL ssh2 >= 0.9.0)
ssh2\_methods\_negotiated — Return list of negotiated methods
### Description
```
ssh2_methods_negotiated(resource $session): array
```
Returns list of negotiated methods.
### Parameters
`session`
An SSH connection link identifier, obtained from a call to [ssh2\_connect()](function.ssh2-connect).
### Return Values
### Examples
**Example #1 Determining what methods were negotiated**
```
<?php
$connection = ssh2_connect('shell.example.com', 22);
$methods = ssh2_methods_negotiated($connection);
echo "Encryption keys were negotiated using: {$methods['kex']}\n";
echo "Server identified using an {$methods['hostkey']} with ";
echo "fingerprint: " . ssh2_fingerprint($connection) . "\n";
echo "Client to Server packets will use methods:\n";
echo "\tCrypt: {$methods['client_to_server']['crypt']}\n";
echo "\tComp: {$methods['client_to_server']['comp']}\n";
echo "\tMAC: {$methods['client_to_server']['mac']}\n";
echo "Server to Client packets will use methods:\n";
echo "\tCrypt: {$methods['server_to_client']['crypt']}\n";
echo "\tComp: {$methods['server_to_client']['comp']}\n";
echo "\tMAC: {$methods['server_to_client']['mac']}\n";
?>
```
### See Also
* [ssh2\_connect()](function.ssh2-connect) - Connect to an SSH server
php socket_set_option socket\_set\_option
===================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
socket\_set\_option — Sets socket options for the socket
### Description
```
socket_set_option(
Socket $socket,
int $level,
int $option,
array|string|int $value
): bool
```
The **socket\_set\_option()** function sets the option specified by the `option` parameter, at the specified protocol `level`, to the value pointed to by the `value` parameter for the `socket`.
### Parameters
`socket`
A [Socket](class.socket) instance created with [socket\_create()](function.socket-create) or [socket\_accept()](function.socket-accept).
`level`
The `level` parameter specifies the protocol level at which the option resides. For example, to set options at the socket level, a `level` parameter of **`SOL_SOCKET`** would be used. Other levels, such as TCP, can be used by specifying the protocol number of that level. Protocol numbers can be found by using the [getprotobyname()](function.getprotobyname) function.
`option`
The available socket options are the same as those for the [socket\_get\_option()](function.socket-get-option) function.
`value`
The option value.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `socket` is a [Socket](class.socket) instance now; previously, it was a resource. |
### Examples
**Example #1 **socket\_set\_option()** example**
```
<?php
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (!is_resource($socket)) {
echo 'Unable to create socket: '. socket_strerror(socket_last_error()) . PHP_EOL;
}
if (!socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1)) {
echo 'Unable to set option on socket: '. socket_strerror(socket_last_error()) . PHP_EOL;
}
if (!socket_bind($socket, '127.0.0.1', 1223)) {
echo 'Unable to bind socket: '. socket_strerror(socket_last_error()) . PHP_EOL;
}
$rval = socket_get_option($socket, SOL_SOCKET, SO_REUSEADDR);
if ($rval === false) {
echo 'Unable to get socket option: '. socket_strerror(socket_last_error()) . PHP_EOL;
} else if ($rval !== 0) {
echo 'SO_REUSEADDR is set on socket !' . PHP_EOL;
}
?>
```
### See Also
* [socket\_create()](function.socket-create) - Create a socket (endpoint for communication)
* [socket\_bind()](function.socket-bind) - Binds a name to a socket
* [socket\_strerror()](function.socket-strerror) - Return a string describing a socket error
* [socket\_last\_error()](function.socket-last-error) - Returns the last error on the socket
* [socket\_get\_option()](function.socket-get-option) - Gets socket options for the socket
php GmagickDraw::setfontweight GmagickDraw::setfontweight
==========================
(PECL gmagick >= Unknown)
GmagickDraw::setfontweight — Sets the font weight
### Description
```
public GmagickDraw::setfontweight(int $weight): GmagickDraw
```
Sets the font weight to use when annotating with text.
### Parameters
`weight`
Font weight (valid range 100-900)
### Return Values
The [GmagickDraw](class.gmagickdraw) object.
php flock flock
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
flock — Portable advisory file locking
### Description
```
flock(resource $stream, int $operation, int &$would_block = null): bool
```
**flock()** allows you to perform a simple reader/writer model which can be used on virtually every platform (including most Unix derivatives and even Windows).
The lock is released also by [fclose()](function.fclose), or when `stream` is garbage collected.
PHP supports a portable way of locking complete files in an advisory way (which means all accessing programs have to use the same way of locking or it will not work). By default, this function will block until the requested lock is acquired; this may be controlled with the **`LOCK_NB`** option documented below.
### Parameters
`stream`
A file system pointer resource that is typically created using [fopen()](function.fopen).
`operation`
`operation` is one of the following:
* **`LOCK_SH`** to acquire a shared lock (reader).
* **`LOCK_EX`** to acquire an exclusive lock (writer).
* **`LOCK_UN`** to release a lock (shared or exclusive).
It is also possible to add **`LOCK_NB`** as a bitmask to one of the above operations, if **flock()** should not block during the locking attempt.
`would_block`
The optional third argument is set to 1 if the lock would block (EWOULDBLOCK errno condition).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **flock()** example**
```
<?php
$fp = fopen("/tmp/lock.txt", "r+");
if (flock($fp, LOCK_EX)) { // acquire an exclusive lock
ftruncate($fp, 0); // truncate file
fwrite($fp, "Write something here\n");
fflush($fp); // flush output before releasing the lock
flock($fp, LOCK_UN); // release the lock
} else {
echo "Couldn't get the lock!";
}
fclose($fp);
?>
```
**Example #2 **flock()** using the **`LOCK_NB`** option**
```
<?php
$fp = fopen('/tmp/lock.txt', 'r+');
/* Activate the LOCK_NB option on an LOCK_EX operation */
if(!flock($fp, LOCK_EX | LOCK_NB)) {
echo 'Unable to obtain lock';
exit(-1);
}
/* ... */
fclose($fp);
?>
```
### Notes
>
> **Note**:
>
>
> **flock()** uses mandatory locking instead of advisory locking on Windows. Mandatory locking is also supported on Linux and System V based operating systems via the usual mechanism supported by the fcntl() system call: that is, if the file in question has the setgid permission bit set and the group execution bit cleared. On Linux, the file system will also need to be mounted with the mand option for this to work.
>
>
>
> **Note**:
>
>
> Because **flock()** requires a file pointer, you may have to use a special lock file to protect access to a file that you intend to truncate by opening it in write mode (with a "w" or "w+" argument to [fopen()](function.fopen)).
>
>
>
> **Note**:
>
>
> May only be used on file pointers returned by [fopen()](function.fopen) for local files, or file pointers pointing to userspace streams that implement the [streamWrapper::stream\_lock()](streamwrapper.stream-lock) method.
>
>
**Warning** Assigning another value to `stream` argument in subsequent code will release the lock.
**Warning** On some operating systems **flock()** is implemented at the process level. When using a multithreaded server API you may not be able to rely on **flock()** to protect files against other PHP scripts running in parallel threads of the same server instance!
**flock()** is not supported on antiquated filesystems like `FAT` and its derivates and will therefore always return **`false`** under these environments.
>
> **Note**:
>
>
> On Windows, if the locking process opens the file a second time, it cannot access the file through this second handle until it unlocks the file.
>
>
php IntlCalendar::add IntlCalendar::add
=================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::add — Add a (signed) amount of time to a field
### Description
Object-oriented style
```
public IntlCalendar::add(int $field, int $value): bool
```
Procedural style
```
intlcal_add(IntlCalendar $calendar, int $field, int $value): bool
```
Add a signed amount to a field. Adding a positive amount allows advances in time, even if the numeric value of the field decreases (e.g. when working with years in BC dates).
Other fields may need to adjusted – for instance, adding a month to the 31st of January will result in the 28th (or 29th) of February. Contrary to [IntlCalendar::roll()](intlcalendar.roll), when a value wraps around, more significant fields may change. For instance, adding a day to the 31st of January will result in the 1st of February, not the 1st of January.
### Parameters
`calendar`
An [IntlCalendar](class.intlcalendar) instance.
`field`
One of the [IntlCalendar](class.intlcalendar) date/time [field constants](class.intlcalendar#intlcalendar.constants). These are integer values between `0` and **`IntlCalendar::FIELD_COUNT`**.
`value`
The signed amount to add to the current field. If the amount is positive, the instant will be moved forward; if it is negative, the instant will be moved into the past. The unit is implicit to the field type. For instance, hours for **`IntlCalendar::FIELD_HOUR_OF_DAY`**.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **IntlCalendar::add()****
```
<?php
ini_set('intl.default_locale', 'fr_FR');
ini_set('date.timezone', 'UTC');
$cal = new IntlGregorianCalendar(2012, 0 /* January */, 31);
echo IntlDateFormatter::formatObject($cal), "\n";
$cal->add(IntlCalendar::FIELD_MONTH, 1);
echo IntlDateFormatter::formatObject($cal), "\n";
$cal->add(IntlCalendar::FIELD_DAY_OF_MONTH, 1);
echo IntlDateFormatter::formatObject($cal), "\n";
```
The above example will output:
```
31 janv. 2012 00:00:00
29 févr. 2012 00:00:00
1 mars 2012 00:00:00
```
php OAuthProvider::isRequestTokenEndpoint OAuthProvider::isRequestTokenEndpoint
=====================================
(PECL OAuth >= 1.0.0)
OAuthProvider::isRequestTokenEndpoint — Sets isRequestTokenEndpoint
### Description
```
public OAuthProvider::isRequestTokenEndpoint(bool $will_issue_request_token): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`will_issue_request_token`
Sets whether or not it will issue a request token, thus determining if [OAuthProvider::tokenHandler()](oauthprovider.tokenhandler) needs to be called.
### Return Values
No value is returned.
### See Also
* [OAuthProvider::setRequestTokenPath()](oauthprovider.setrequesttokenpath) - Set request token path
* [OAuthProvider::reportProblem()](oauthprovider.reportproblem) - Report a problem
php SplFileObject::rewind SplFileObject::rewind
=====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::rewind — Rewind the file to the first line
### Description
```
public SplFileObject::rewind(): void
```
Rewinds the file back to the first line.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Errors/Exceptions
Throws a [RuntimeException](class.runtimeexception) if cannot be rewound.
### Examples
**Example #1 **SplFileObject::rewind()** example**
```
<?php
$file = new SplFileObject("misc.txt");
// Loop over whole file
foreach ($file as $line) { }
// Rewind to first line
$file->rewind();
// Output first line
echo $file->current();
?>
```
### See Also
* [SplFileObject::current()](splfileobject.current) - Retrieve current line of file
* [SplFileObject::key()](splfileobject.key) - Get line number
* [SplFileObject::seek()](splfileobject.seek) - Seek to specified line
* [SplFileObject::next()](splfileobject.next) - Read next line
* [SplFileObject::valid()](splfileobject.valid) - Not at EOF
php ReflectionMethod::setAccessible ReflectionMethod::setAccessible
===============================
(PHP 5 >= 5.3.2, PHP 7, PHP 8)
ReflectionMethod::setAccessible — Set method accessibility
### Description
```
public ReflectionMethod::setAccessible(bool $accessible): void
```
Enables invoking of a protected or private method via the [ReflectionMethod::invoke()](reflectionmethod.invoke) method.
> **Note**: As of PHP 8.1.0, calling this method has no effect; all methods are invokable by default.
>
>
### Parameters
`accessible`
**`true`** to allow accessibility, or **`false`**.
### Return Values
No value is returned.
### Examples
**Example #1 Simple Class definition**
```
<?php
class MyClass
{
private function foo()
{
return 'bar';
}
}
$method = new ReflectionMethod("MyClass", "foo");
$method->setAccessible(true);
$obj = new MyClass();
echo $method->invoke($obj);
echo $obj->foo();
?>
```
The above example will output something similar to:
```
bar
Fatal error: Uncaught Error: Call to private method MyClass::foo() from global scope in /in/qdaZS:16
```
### See Also
* [ReflectionMethod::isPrivate()](reflectionmethod.isprivate) - Checks if method is private
* [ReflectionMethod::isProtected()](reflectionmethod.isprotected) - Checks if method is protected
php apcu_delete apcu\_delete
============
(PECL apcu >= 4.0.0)
apcu\_delete — Removes a stored variable from the cache
### Description
```
apcu_delete(mixed $key): mixed
```
Removes a stored variable from the cache.
### Parameters
`key`
A `key` used to store the value as a string for a single key, or as an array of strings for several keys, or as an [APCUIterator](class.apcuiterator) object.
### Return Values
If `key` is an array, an indexed array of the keys is returned. Otherwise **`true`** is returned on success, or **`false`** on failure.
### Examples
**Example #1 A **apcu\_delete()** example**
```
<?php
$bar = 'BAR';
apcu_store('foo', $bar);
apcu_delete('foo');
// this is obviously useless in this form
// Alternatively delete multiple keys.
apcu_delete(['foo', 'bar', 'baz']);
// Or use an Iterator with a regular expression.
apcu_delete(new APCUIterator('#^myprefix_#'));
?>
```
### See Also
* [apcu\_store()](function.apcu-store) - Cache a variable in the data store
* [apcu\_fetch()](function.apcu-fetch) - Fetch a stored variable from the cache
* [apcu\_clear\_cache()](function.apcu-clear-cache) - Clears the APCu cache
* [APCUIterator](class.apcuiterator)
php PDO::exec PDO::exec
=========
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0)
PDO::exec — Execute an SQL statement and return the number of affected rows
### Description
```
public PDO::exec(string $statement): int|false
```
**PDO::exec()** executes an SQL statement in a single function call, returning the number of rows affected by the statement.
**PDO::exec()** does not return results from a SELECT statement. For a SELECT statement that you only need to issue once during your program, consider issuing [PDO::query()](pdo.query). For a statement that you need to issue multiple times, prepare a PDOStatement object with [PDO::prepare()](pdo.prepare) and issue the statement with [PDOStatement::execute()](pdostatement.execute).
### Parameters
`statement`
The SQL statement to prepare and execute.
Data inside the query should be [properly escaped](pdo.quote).
### Return Values
**PDO::exec()** returns the number of rows that were modified or deleted by the SQL statement you issued. If no rows were affected, **PDO::exec()** returns `0`.
**Warning**This function may return Boolean **`false`**, but may also return a non-Boolean value which evaluates to **`false`**. Please read the section on [Booleans](language.types.boolean) for more information. Use [the === operator](language.operators.comparison) for testing the return value of this function.
The following example incorrectly relies on the return value of **PDO::exec()**, wherein a statement that affected 0 rows results in a call to [die()](function.die):
```
<?php
$db->exec() or die(print_r($db->errorInfo(), true)); // incorrect
?>
```
### Examples
**Example #1 Issuing a DELETE statement**
Count the number of rows deleted by a DELETE statement with no WHERE clause.
```
<?php
$dbh = new PDO('odbc:sample', 'db2inst1', 'ibmdb2');
/* Delete all rows from the FRUIT table */
$count = $dbh->exec("DELETE FROM fruit");
/* Return number of rows that were deleted */
print("Deleted $count rows.\n");
?>
```
The above example will output:
```
Deleted 1 rows.
```
### See Also
* [PDO::prepare()](pdo.prepare) - Prepares a statement for execution and returns a statement object
* [PDO::query()](pdo.query) - Prepares and executes an SQL statement without placeholders
* [PDOStatement::execute()](pdostatement.execute) - Executes a prepared statement
php gzread gzread
======
(PHP 4, PHP 5, PHP 7, PHP 8)
gzread — Binary-safe gz-file read
### Description
```
gzread(resource $stream, int $length): string|false
```
**gzread()** reads up to `length` bytes from the given gz-file pointer. Reading stops when `length` (uncompressed) bytes have been read or EOF is reached, whichever comes first.
### Parameters
`stream`
The gz-file pointer. It must be valid, and must point to a file successfully opened by [gzopen()](function.gzopen).
`length`
The number of bytes to read.
### Return Values
The data that have been read, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 7.4.0 | This functions returns **`false`** on failure now; previously `0` was returned. |
### Examples
**Example #1 **gzread()** example**
```
<?php
// get contents of a gz-file into a string
$filename = "/usr/local/something.txt.gz";
$zd = gzopen($filename, "r");
$contents = gzread($zd, 10000);
gzclose($zd);
?>
```
### See Also
* [gzwrite()](function.gzwrite) - Binary-safe gz-file write
* [gzopen()](function.gzopen) - Open gz-file
* [gzgets()](function.gzgets) - Get line from file pointer
* [gzgetss()](function.gzgetss) - Get line from gz-file pointer and strip HTML tags
* [gzfile()](function.gzfile) - Read entire gz-file into an array
* [gzpassthru()](function.gzpassthru) - Output all remaining data on a gz-file pointer
| programming_docs |
php Thread::getThreadId Thread::getThreadId
===================
(PECL pthreads >= 2.0.0)
Thread::getThreadId — Identification
### Description
```
public Thread::getThreadId(): int
```
Will return the identity of the referenced Thread
### Parameters
This function has no parameters.
### Return Values
A numeric identity
### Examples
**Example #1 Return the identity of the referenced Thread**
```
<?php
class My extends Thread {
public function run() {
printf("%s is Thread #%lu\n", __CLASS__, $this->getThreadId());
}
}
$my = new My();
$my->start();
?>
```
The above example will output:
```
My is Thread #123456778899
```
php Ds\Deque::shift Ds\Deque::shift
===============
(PECL ds >= 1.0.0)
Ds\Deque::shift — Removes and returns the first value
### Description
```
public Ds\Deque::shift(): mixed
```
Removes and returns the first value.
### Parameters
This function has no parameters.
### Return Values
The first value, which was removed.
### Errors/Exceptions
[UnderflowException](class.underflowexception) if empty.
### Examples
**Example #1 **Ds\Deque::shift()** example**
```
<?php
$deque = new \Ds\Deque(["a", "b", "c"]);
var_dump($deque->shift());
var_dump($deque->shift());
var_dump($deque->shift());
?>
```
The above example will output something similar to:
```
string(1) "a"
string(1) "b"
string(1) "c"
```
php Phar::addEmptyDir Phar::addEmptyDir
=================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
Phar::addEmptyDir — Add an empty directory to the phar archive
### Description
```
public Phar::addEmptyDir(string $directory): void
```
>
> **Note**:
>
>
> This method requires the php.ini setting `phar.readonly` to be set to `0` in order to work for [Phar](class.phar) objects. Otherwise, a [PharException](class.pharexception) will be thrown.
>
>
>
With this method, an empty directory is created with path `dirname`. This method is similar to [ZipArchive::addEmptyDir()](ziparchive.addemptydir).
### Parameters
`directory`
The name of the empty directory to create in the phar archive
### Return Values
no return value, exception is thrown on failure.
### Examples
**Example #1 A **Phar::addEmptyDir()** example**
```
<?php
try {
$a = new Phar('/path/to/phar.phar');
$a->addEmptyDir('/full/path/to/file');
// demonstrates how this file is stored
$b = $a['full/path/to/file']->isDir();
} catch (Exception $e) {
// handle errors here
}
?>
```
### See Also
* [PharData::addEmptyDir()](phardata.addemptydir) - Add an empty directory to the tar/zip archive
* [Phar::addFile()](phar.addfile) - Add a file from the filesystem to the phar archive
* [Phar::addFromString()](phar.addfromstring) - Add a file from a string to the phar archive
php RarArchive::getEntry RarArchive::getEntry
====================
rar\_entry\_get
===============
(PECL rar >= 2.0.0)
RarArchive::getEntry -- rar\_entry\_get — Get entry object from the RAR archive
### Description
Object-oriented style (method):
```
public RarArchive::getEntry(string $entryname): RarEntry|false
```
Procedural style:
```
rar_entry_get(RarArchive $rarfile, string $entryname): RarEntry|false
```
Get entry object (file or directory) from the RAR archive.
>
> **Note**:
>
>
> You can also get entry objects using [RarArchive::getEntries()](rararchive.getentries).
>
> Note that a RAR archive can have multiple entries with the same name; this method will retrieve only the first.
>
>
### Parameters
`rarfile`
A [RarArchive](class.rararchive) object, opened with [rar\_open()](rararchive.open).
`entryname`
Path to the entry within the RAR archive.
>
> **Note**:
>
>
> The path must be the same returned by [RarEntry::getName()](rarentry.getname).
>
>
### Return Values
Returns the matching [RarEntry](class.rarentry) object or **`false`** on failure.
### Examples
**Example #1 Object-oriented style**
```
<?php
$rar_arch = RarArchive::open('solid.rar');
if ($rar_arch === FALSE)
die("Could not open RAR archive.");
$rar_entry = $rar_arch->getEntry('tese.txt');
if ($rar_entry === FALSE)
die("Could not get such entry");
echo get_class($rar_entry)."\n";
echo $rar_entry;
$rar_arch->close();
?>
```
The above example will output something similar to:
```
RarEntry
RarEntry for file "tese.txt" (23b93a7a)
```
**Example #2 Procedural style**
```
<?php
$rar_arch = rar_open('solid.rar');
if ($rar_arch === FALSE)
die("Could not open RAR archive.");
$rar_entry = rar_entry_get($rar_arch, 'tese.txt');
if ($rar_entry === FALSE)
die("Could not get such entry");
echo get_class($rar_entry)."\n";
echo $rar_entry;
rar_close($rar_arch);
?>
```
### See Also
* [RarArchive::getEntries()](rararchive.getentries) - Get full list of entries from the RAR archive
* [`rar://` wrapper](https://www.php.net/manual/en/wrappers.rar.php)
php The DOMNamedNodeMap class
The DOMNamedNodeMap class
=========================
Class synopsis
--------------
(PHP 5, PHP 7, PHP 8)
class **DOMNamedNodeMap** implements [IteratorAggregate](class.iteratoraggregate), [Countable](class.countable) { /\* Properties \*/ public readonly int [$length](class.domnamednodemap#domnamednodemap.props.length); /\* Methods \*/
```
public count(): int
```
```
public getNamedItem(string $qualifiedName): ?DOMNode
```
```
public getNamedItemNS(?string $namespace, string $localName): ?DOMNode
```
```
public item(int $index): ?DOMNode
```
} Properties
----------
length The number of nodes in the map. The range of valid child node indices is `0` to `length - 1` inclusive.
Changelog
---------
| Version | Description |
| --- | --- |
| 8.0.0 | The unimplemented methods **DOMNamedNodeMap::setNamedItem()**, **DOMNamedNodeMap::removeNamedItem()**, **DOMNamedNodeMap::setNamedItemNS()** and **DOMNamedNodeMap::removeNamedItem()** have been removed. |
| 8.0.0 | **DOMNamedNodeMap** implements [IteratorAggregate](class.iteratoraggregate) now. Previously, [Traversable](class.traversable) was implemented instead. |
Table of Contents
-----------------
* [DOMNamedNodeMap::count](domnamednodemap.count) — Get number of nodes in the map
* [DOMNamedNodeMap::getNamedItem](domnamednodemap.getnameditem) — Retrieves a node specified by name
* [DOMNamedNodeMap::getNamedItemNS](domnamednodemap.getnameditemns) — Retrieves a node specified by local name and namespace URI
* [DOMNamedNodeMap::item](domnamednodemap.item) — Retrieves a node specified by index
php pg_fetch_result pg\_fetch\_result
=================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg\_fetch\_result — Returns values from a result instance
### Description
```
pg_fetch_result(PgSql\Result $result, int $row, mixed $field): string|false|null
```
```
pg_fetch_result(PgSql\Result $result, mixed $field): string|false|null
```
**pg\_fetch\_result()** returns the value of a particular row and field (column) in an [PgSql\Result](class.pgsql-result) instance.
>
> **Note**:
>
>
> This function used to be called **pg\_result()**.
>
>
### Parameters
`result`
An [PgSql\Result](class.pgsql-result) instance, returned by [pg\_query()](function.pg-query), [pg\_query\_params()](function.pg-query-params) or [pg\_execute()](function.pg-execute)(among others).
`row`
Row number in result to fetch. Rows are numbered from 0 upwards. If omitted, next row is fetched.
`field`
A string representing the name of the field (column) to fetch, otherwise an int representing the field number to fetch. Fields are numbered from 0 upwards.
### Return Values
Boolean is returned as "t" or "f". All other types, including arrays are returned as strings formatted in the same default PostgreSQL manner that you would see in the **psql** program. Database `NULL` values are returned as **`null`**.
**`false`** is returned if `row` exceeds the number of rows in the set, or on any other error.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `result` parameter expects an [PgSql\Result](class.pgsql-result) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **pg\_fetch\_result()** example**
```
<?php
$db = pg_connect("dbname=users user=me") || die();
$res = pg_query($db, "SELECT 1 UNION ALL SELECT 2");
$val = pg_fetch_result($res, 1, 0);
echo "First field in the second row is: ", $val, "\n";
?>
```
The above example will output:
```
First field in the second row is: 2
```
### See Also
* [pg\_query()](function.pg-query) - Execute a query
* [pg\_fetch\_array()](function.pg-fetch-array) - Fetch a row as an array
php EvWatcher::keepalive EvWatcher::keepalive
====================
(PECL ev >= 0.2.0)
EvWatcher::keepalive — Configures whether to keep the loop from returning
### Description
```
public EvWatcher::keepalive( bool $value = ?): bool
```
Configures whether to keep the loop from returning. With keepalive `value` set to **`false`** the watcher won't keep [Ev::run()](ev.run) / [EvLoop::run()](evloop.run) from returning even though the watcher is active.
Watchers have keepalive `value` **`true`** by default.
Clearing keepalive status is useful when returning from [Ev::run()](ev.run) / [EvLoop::run()](evloop.run) just because of the watcher is undesirable. It could be a long running UDP socket watcher or so.
### Parameters
`value` With keepalive `value` set to **`false`** the watcher won't keep [Ev::run()](ev.run) / [EvLoop::run()](evloop.run) from returning even though the watcher is active.
### Return Values
Returns the previous state.
### Examples
**Example #1 Register an I/O watcher for some UDP socket but do not keep the event loop from running just because of that watcher.**
```
<?php
$udp_socket = ...
$udp_watcher = new EvIo($udp_socket, Ev::READ, function () { /* ... */ });
$udp_watcher->keepalive(FALSE);
?>
```
php Ds\Vector::jsonSerialize Ds\Vector::jsonSerialize
========================
(PECL ds >= 1.0.0)
Ds\Vector::jsonSerialize — Returns a representation that can be converted to JSON
See [JsonSerializable::jsonSerialize()](jsonserializable.jsonserialize)
>
> **Note**:
>
>
> You should never need to call this directly.
>
>
php The SolrQueryResponse class
The SolrQueryResponse class
===========================
Introduction
------------
(PECL solr >= 0.9.2)
Represents a response to a query request.
Class synopsis
--------------
final class **SolrQueryResponse** extends [SolrResponse](class.solrresponse) { /\* Constants \*/ const int [PARSE\_SOLR\_OBJ](class.solrqueryresponse#solrqueryresponse.constants.parse-solr-obj) = 0;
const int [PARSE\_SOLR\_DOC](class.solrqueryresponse#solrqueryresponse.constants.parse-solr-doc) = 1; /\* Inherited properties \*/
const int [SolrResponse::PARSE\_SOLR\_OBJ](class.solrresponse#solrresponse.constants.parse-solr-obj) = 0;
const int [SolrResponse::PARSE\_SOLR\_DOC](class.solrresponse#solrresponse.constants.parse-solr-doc) = 1;
protected int [$http\_status](class.solrresponse#solrresponse.props.http-status);
protected int [$parser\_mode](class.solrresponse#solrresponse.props.parser-mode);
protected bool [$success](class.solrresponse#solrresponse.props.success);
protected string [$http\_status\_message](class.solrresponse#solrresponse.props.http-status-message);
protected string [$http\_request\_url](class.solrresponse#solrresponse.props.http-request-url);
protected string [$http\_raw\_request\_headers](class.solrresponse#solrresponse.props.http-raw-request-headers);
protected string [$http\_raw\_request](class.solrresponse#solrresponse.props.http-raw-request);
protected string [$http\_raw\_response\_headers](class.solrresponse#solrresponse.props.http-raw-response-headers);
protected string [$http\_raw\_response](class.solrresponse#solrresponse.props.http-raw-response);
protected string [$http\_digested\_response](class.solrresponse#solrresponse.props.http-digested-response); /\* Methods \*/ public [\_\_construct](solrqueryresponse.construct)()
public [\_\_destruct](solrqueryresponse.destruct)() /\* Inherited methods \*/
```
public SolrResponse::getDigestedResponse(): string
```
```
public SolrResponse::getHttpStatus(): int
```
```
public SolrResponse::getHttpStatusMessage(): string
```
```
public SolrResponse::getRawRequest(): string
```
```
public SolrResponse::getRawRequestHeaders(): string
```
```
public SolrResponse::getRawResponse(): string
```
```
public SolrResponse::getRawResponseHeaders(): string
```
```
public SolrResponse::getRequestUrl(): string
```
```
public SolrResponse::getResponse(): SolrObject
```
```
public SolrResponse::setParseMode(int $parser_mode = 0): bool
```
```
public SolrResponse::success(): bool
```
} Predefined Constants
--------------------
SolrQueryResponse Class constants
---------------------------------
**`SolrQueryResponse::PARSE_SOLR_OBJ`** Documents should be parsed as SolrObject instances
**`SolrQueryResponse::PARSE_SOLR_DOC`** Documents should be parsed as SolrDocument instances.
Table of Contents
-----------------
* [SolrQueryResponse::\_\_construct](solrqueryresponse.construct) — Constructor
* [SolrQueryResponse::\_\_destruct](solrqueryresponse.destruct) — Destructor
php Yar_Client::__construct Yar\_Client::\_\_construct
==========================
(PECL yar >= 1.0.0)
Yar\_Client::\_\_construct — Create a client
### Description
```
final public Yar_Client::__construct(string $url, array $options = ?)
```
Create a [Yar\_Client](class.yar-client) to a [Yar\_Server](class.yar-server).
### Parameters
`url`
Yar Server URL.
### Return Values
[Yar\_Client](class.yar-client) instance.
### Examples
**Example #1 **Yar\_Client::\_\_construct()** example**
```
<?php
$client = new Yar_Client("http://host/api/");
?>
```
The above example will output something similar to:
### See Also
* [Yar\_Client::\_\_call()](yar-client.call) - Call service
* [Yar\_Client::setOpt()](yar-client.setopt) - Set calling contexts
php ImagickDraw::pathLineToVerticalRelative ImagickDraw::pathLineToVerticalRelative
=======================================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::pathLineToVerticalRelative — Draws a vertical line path
### Description
```
public ImagickDraw::pathLineToVerticalRelative(float $y): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Draws a vertical line path from the current point to the target point using relative coordinates. The target point then becomes the new current point.
### Parameters
`y`
y coordinate
### Return Values
No value is returned.
php The mysqli_warning class
The mysqli\_warning class
=========================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
Represents a MySQL warning.
Class synopsis
--------------
final class **mysqli\_warning** { /\* Properties \*/ public string [$message](class.mysqli-warning#mysqli-warning.props.message);
public string [$sqlstate](class.mysqli-warning#mysqli-warning.props.sqlstate);
public int [$errno](class.mysqli-warning#mysqli-warning.props.errno); /\* Methods \*/ private [\_\_construct](mysqli-warning.construct)()
```
public next(): bool
```
} Properties
----------
message Message string
sqlstate SQL state
errno Error number
Table of Contents
-----------------
* [mysqli\_warning::\_\_construct](mysqli-warning.construct) — Private constructor to disallow direct instantiation
* [mysqli\_warning::next](mysqli-warning.next) — Fetch next warning
php SplFixedArray::count SplFixedArray::count
====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplFixedArray::count — Returns the size of the array
### Description
```
public SplFixedArray::count(): int
```
Returns the size of the array.
### Parameters
This function has no parameters.
### Return Values
Returns the size of the array.
### Examples
**Example #1 **SplFixedArray::count()** example**
```
<?php
$array = new SplFixedArray(5);
echo $array->count() . "\n";
echo count($array) . "\n";
?>
```
The above example will output:
```
5
5
```
### Notes
>
> **Note**:
>
>
> This method is functionally equivalent to [SplFixedArray::getSize()](splfixedarray.getsize).
>
>
>
> **Note**:
>
>
> The count of elements is always equal to the set size because all values are initially initialized with **`null`**.
>
>
### See Also
* [SplFixedArray::getSize()](splfixedarray.getsize) - Gets the size of the array
php ReflectionNamedType::getName ReflectionNamedType::getName
============================
(PHP 7 >= 7.1.0, PHP 8)
ReflectionNamedType::getName — Get the name of the type as a string
### Description
```
public ReflectionNamedType::getName(): string
```
### Parameters
This function has no parameters.
### Return Values
Returns the name of the type being reflected.
### See Also
* [ReflectionType::\_\_toString()](reflectiontype.tostring) - To string
php Threaded::extend Threaded::extend
================
(PECL pthreads >= 2.0.8)
Threaded::extend — Runtime Manipulation
### Description
```
public Threaded::extend(string $class): bool
```
Makes thread safe standard class at runtime
### Parameters
`class`
The class to extend
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Runtime inheritance**
```
<?php
class My {}
Threaded::extend(My::class);
$my = new My();
var_dump($my instanceof Threaded);
?>
```
The above example will output:
```
bool(true)
```
php curl_multi_select curl\_multi\_select
===================
(PHP 5, PHP 7, PHP 8)
curl\_multi\_select — Wait for activity on any curl\_multi connection
### Description
```
curl_multi_select(CurlMultiHandle $multi_handle, float $timeout = 1.0): int
```
Blocks until there is activity on any of the curl\_multi connections.
### Parameters
`multi_handle` A cURL multi handle returned by [curl\_multi\_init()](function.curl-multi-init).
`timeout`
Time, in seconds, to wait for a response.
### Return Values
On success, returns the number of descriptors contained in the descriptor sets. This may be 0 if there was no activity on any of the descriptors. On failure, this function will return -1 on a select failure (from the underlying select system call).
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `multi_handle` expects a [CurlMultiHandle](class.curlmultihandle) instance now; previously, a resource was expected. |
### See Also
* [curl\_multi\_init()](function.curl-multi-init) - Returns a new cURL multi handle
php LimitIterator::getPosition LimitIterator::getPosition
==========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
LimitIterator::getPosition — Return the current position
### Description
```
public LimitIterator::getPosition(): int
```
Gets the current zero-based position of the inner [Iterator](class.iterator).
### Parameters
This function has no parameters.
### Return Values
The current position.
### Examples
**Example #1 **LimitIterator::getPosition()** example**
```
<?php
$fruits = array(
'a' => 'apple',
'b' => 'banana',
'c' => 'cherry',
'd' => 'damson',
'e' => 'elderberry'
);
$array_it = new ArrayIterator($fruits);
$limit_it = new LimitIterator($array_it, 2, 3);
foreach ($limit_it as $item) {
echo $limit_it->getPosition() . ' ' . $item . "\n";
}
?>
```
The above example will output:
```
2 cherry
3 damson
4 elderberry
```
### See Also
* [FilterIterator::key()](filteriterator.key) - Get the current key
| programming_docs |
php get_object_vars get\_object\_vars
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
get\_object\_vars — Gets the properties of the given object
### Description
```
get_object_vars(object $object): array
```
Gets the accessible non-static properties of the given `object` according to scope.
### Parameters
`object`
An object instance.
### Return Values
Returns an associative array of defined object accessible non-static properties for the specified `object` in scope.
### Examples
**Example #1 Use of **get\_object\_vars()****
```
<?php
class foo {
private $a;
public $b = 1;
public $c;
private $d;
static $e;
public function test() {
var_dump(get_object_vars($this));
}
}
$test = new foo;
var_dump(get_object_vars($test));
$test->test();
?>
```
The above example will output:
```
array(2) {
["b"]=>
int(1)
["c"]=>
NULL
}
array(4) {
["a"]=>
NULL
["b"]=>
int(1)
["c"]=>
NULL
["d"]=>
NULL
}
```
>
> **Note**:
>
>
> Uninitialized properties are considered inaccessible, and thus will not be included in the array.
>
>
### See Also
* [get\_class\_methods()](function.get-class-methods) - Gets the class methods' names
* [get\_class\_vars()](function.get-class-vars) - Get the default properties of the class
php RecursiveTreeIterator::beginIteration RecursiveTreeIterator::beginIteration
=====================================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
RecursiveTreeIterator::beginIteration — Begin iteration
### Description
```
public RecursiveTreeIterator::beginIteration(): RecursiveIterator
```
Called when iteration begins (after the first [RecursiveTreeIterator::rewind()](recursivetreeiterator.rewind) call).
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
A [RecursiveIterator](class.recursiveiterator).
php InternalIterator::valid InternalIterator::valid
=======================
(PHP 8)
InternalIterator::valid — Check if current position is valid
### Description
```
public InternalIterator::valid(): bool
```
Checks if current position is valid.
### Parameters
This function has no parameters.
### Return Values
Returns whether the current position is valid.
php SessionHandlerInterface::destroy SessionHandlerInterface::destroy
================================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
SessionHandlerInterface::destroy — Destroy a session
### Description
```
public SessionHandlerInterface::destroy(string $id): bool
```
Destroys a session. Called by [session\_regenerate\_id()](function.session-regenerate-id) (with $destroy = **`true`**), [session\_destroy()](function.session-destroy) and when [session\_decode()](function.session-decode) fails.
### Parameters
`id`
The session ID being destroyed.
### Return Values
The return value (usually **`true`** on success, **`false`** on failure). Note this value is returned internally to PHP for processing.
php Ds\Sequence::sort Ds\Sequence::sort
=================
(PECL ds >= 1.0.0)
Ds\Sequence::sort — Sorts the sequence in-place
### Description
```
abstract public Ds\Sequence::sort(callable $comparator = ?): void
```
Sorts the sequence in-place, using an optional `comparator` function.
### Parameters
`comparator`
The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
```
callback(mixed $a, mixed $b): int
```
**Caution** Returning *non-integer* values from the comparison function, such as float, will result in an internal cast to int of the callback's return value. So values such as 0.99 and 0.1 will both be cast to an integer value of 0, which will compare such values as equal.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Sequence::sort()** example**
```
<?php
$sequence = new \Ds\Vector([4, 5, 1, 3, 2]);
$sequence->sort();
print_r($sequence);
?>
```
The above example will output something similar to:
```
Ds\Vector Object
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
)
```
**Example #2 **Ds\Sequence::sort()** example using a comparator**
```
<?php
$sequence = new \Ds\Vector([4, 5, 1, 3, 2]);
$sequence->sort(function($a, $b) {
return $b <=> $a;
});
print_r($sequence);
?>
```
The above example will output something similar to:
```
Ds\Vector Object
(
[0] => 5
[1] => 4
[2] => 3
[3] => 2
[4] => 1
)
```
php MultipleIterator::rewind MultipleIterator::rewind
========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
MultipleIterator::rewind — Rewinds all attached iterator instances
### Description
```
public MultipleIterator::rewind(): void
```
Rewinds all attached iterator instances.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### See Also
* [MultipleIterator::next()](multipleiterator.next) - Moves all attached iterator instances forward
php QuickHashIntSet::add QuickHashIntSet::add
====================
(PECL quickhash >= Unknown)
QuickHashIntSet::add — This method adds a new entry to the set
### Description
```
public QuickHashIntSet::add(int $key): bool
```
This method adds a new entry to the set, and returns whether the entry was added. Entries are by default always added unless **`QuickHashIntSet::CHECK_FOR_DUPES`** has been passed when the set was created.
### Parameters
`key`
The key of the entry to add.
### Return Values
**`true`** when the entry was added, and **`false`** if the entry was not added.
### Examples
**Example #1 **QuickHashIntSet::add()** example**
```
<?php
echo "without dupe checking\n";
$set = new QuickHashIntSet( 1024 );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
echo "\nwith dupe checking\n";
$set = new QuickHashIntSet( 1024, QuickHashIntSet::CHECK_FOR_DUPES );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
?>
```
The above example will output something similar to:
```
without dupe checking
bool(false)
bool(true)
bool(true)
bool(true)
with dupe checking
bool(false)
bool(true)
bool(true)
bool(false)
```
php mcrypt_module_is_block_algorithm_mode mcrypt\_module\_is\_block\_algorithm\_mode
==========================================
(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mcrypt\_module\_is\_block\_algorithm\_mode — Returns if the specified module is a block algorithm or not
**Warning**This function has been *DEPRECATED* as of PHP 7.1.0 and *REMOVED* as of PHP 7.2.0. Relying on this function is highly discouraged.
### Description
```
mcrypt_module_is_block_algorithm_mode(string $mode, string $lib_dir = ?): bool
```
This function returns **`true`** if the mode is for use with block algorithms, otherwise it returns **`false`**. (e.g. **`false`** for stream, and **`true`** for cbc, cfb, ofb).
### Parameters
`mode`
The mode to check.
`lib_dir`
The optional `lib_dir` parameter can contain the location where the algorithm module is on the system.
### Return Values
This function returns **`true`** if the mode is for use with block algorithms, otherwise it returns **`false`**. (e.g. **`false`** for stream, and **`true`** for cbc, cfb, ofb).
php stream_set_timeout stream\_set\_timeout
====================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
stream\_set\_timeout — Set timeout period on a stream
### Description
```
stream_set_timeout(resource $stream, int $seconds, int $microseconds = 0): bool
```
Sets the timeout value on `stream`, expressed in the sum of `seconds` and `microseconds`.
When the stream times out, the 'timed\_out' key of the array returned by [stream\_get\_meta\_data()](function.stream-get-meta-data) is set to **`true`**, although no error/warning is generated.
### Parameters
`stream`
The target stream.
`seconds`
The seconds part of the timeout to be set.
`microseconds`
The microseconds part of the timeout to be set.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **stream\_set\_timeout()** example**
```
<?php
$fp = fsockopen("www.example.com", 80);
if (!$fp) {
echo "Unable to open\n";
} else {
fwrite($fp, "GET / HTTP/1.0\r\n\r\n");
stream_set_timeout($fp, 2);
$res = fread($fp, 2000);
$info = stream_get_meta_data($fp);
fclose($fp);
if ($info['timed_out']) {
echo 'Connection timed out!';
} else {
echo $res;
}
}
?>
```
### Notes
>
> **Note**:
>
>
> This function doesn't work with advanced operations like [stream\_socket\_recvfrom()](function.stream-socket-recvfrom), use [stream\_select()](function.stream-select) with timeout parameter instead.
>
>
This function was previously called as **set\_socket\_timeout()** and later [socket\_set\_timeout()](function.socket-set-timeout) but this usage is deprecated.
### See Also
* [fsockopen()](function.fsockopen) - Open Internet or Unix domain socket connection
* [fopen()](function.fopen) - Opens file or URL
php Parle\RParser::dump Parle\RParser::dump
===================
(PECL parle >= 0.7.0)
Parle\RParser::dump — Dump the grammar
### Description
```
public Parle\RParser::dump(): void
```
Dump the current grammar to stdout.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php strlen strlen
======
(PHP 4, PHP 5, PHP 7, PHP 8)
strlen — Get string length
### Description
```
strlen(string $string): int
```
Returns the length of the given `string`.
### Parameters
`string`
The string being measured for length.
### Return Values
The length of the `string` on success, and `0` if the `string` is empty.
### Examples
**Example #1 A **strlen()** example**
```
<?php
$str = 'abcdef';
echo strlen($str); // 6
$str = ' ab cd ';
echo strlen($str); // 7
?>
```
### Notes
>
> **Note**:
>
>
> **strlen()** returns the number of bytes rather than the number of characters in a string.
>
>
>
> **Note**:
>
>
> **strlen()** returns **`null`** when executed on arrays, and an **`E_WARNING`** level error is emitted.
>
>
### See Also
* [count()](function.count) - Counts all elements in an array or in a Countable object
* [grapheme\_strlen()](function.grapheme-strlen) - Get string length in grapheme units
* [iconv\_strlen()](function.iconv-strlen) - Returns the character count of string
* [mb\_strlen()](function.mb-strlen) - Get string length
php XSLTProcessor::getParameter XSLTProcessor::getParameter
===========================
(PHP 5, PHP 7, PHP 8)
XSLTProcessor::getParameter — Get value of a parameter
### Description
```
public XSLTProcessor::getParameter(string $namespace, string $name): string|false
```
Gets a parameter if previously set by [XSLTProcessor::setParameter()](xsltprocessor.setparameter).
### Parameters
`namespace`
The namespace URI of the XSLT parameter.
`name`
The local name of the XSLT parameter.
### Return Values
The value of the parameter (as a string), or **`false`** if it's not set.
### See Also
* [XSLTProcessor::setParameter()](xsltprocessor.setparameter) - Set value for a parameter
* [XSLTProcessor::removeParameter()](xsltprocessor.removeparameter) - Remove parameter
php fgetss fgetss
======
(PHP 4, PHP 5, PHP 7)
fgetss — Gets line from file pointer and strip HTML tags
**Warning**This function has been *DEPRECATED* as of PHP 7.3.0, and *REMOVED* as of PHP 8.0.0. Relying on this function is highly discouraged.
### Description
```
fgetss(resource $handle, int $length = ?, string $allowable_tags = ?): string
```
Identical to [fgets()](function.fgets), except that **fgetss()** attempts to strip any NUL bytes, HTML and PHP tags from the text it reads. The function retains the parsing state from call to call, and as such is not equivalent to calling [strip\_tags()](function.strip-tags) on the return value of [fgets()](function.fgets).
### Parameters
`handle`
The file pointer must be valid, and must point to a file successfully opened by [fopen()](function.fopen) or [fsockopen()](function.fsockopen) (and not yet closed by [fclose()](function.fclose)).
`length`
Length of the data to be retrieved.
`allowable_tags`
You can use the optional third parameter to specify tags which should not be stripped. See [strip\_tags()](function.strip-tags) for details regarding `allowable_tags`.
### Return Values
Returns a string of up to `length` - 1 bytes read from the file pointed to by `handle`, with all HTML and PHP code stripped.
If an error occurs, returns **`false`**.
### Examples
**Example #1 Reading a PHP file line-by-line**
```
<?php
$str = <<<EOD
<html><body>
<p>Welcome! Today is the <?php echo(date('jS')); ?> of <?= date('F'); ?>.</p>
</body></html>
Text outside of the HTML block.
EOD;
file_put_contents('sample.php', $str);
$handle = @fopen("sample.php", "r");
if ($handle) {
while (!feof($handle)) {
$buffer = fgetss($handle, 4096);
echo $buffer;
}
fclose($handle);
}
?>
```
The above example will output something similar to:
```
Welcome! Today is the of .
Text outside of the HTML block.
```
### Notes
> **Note**: If PHP is not properly recognizing the line endings when reading files either on or created by a Macintosh computer, enabling the [auto\_detect\_line\_endings](https://www.php.net/manual/en/filesystem.configuration.php#ini.auto-detect-line-endings) run-time configuration option may help resolve the problem.
>
>
### See Also
* [fgets()](function.fgets) - Gets line from file pointer
* [fopen()](function.fopen) - Opens file or URL
* [popen()](function.popen) - Opens process file pointer
* [fsockopen()](function.fsockopen) - Open Internet or Unix domain socket connection
* [strip\_tags()](function.strip-tags) - Strip HTML and PHP tags from a string
* [SplFileObject::fgetss()](splfileobject.fgetss) - Gets line from file and strip HTML tags
* The [string.strip\_tags](https://www.php.net/manual/en/filters.string.php#filters.string.strip_tags) filter
php uopz_implement uopz\_implement
===============
(PECL uopz 1, PECL uopz 2, PECL uopz 5, PECL uopz 6, PECL uopz 7 < 7.1.0)
uopz\_implement — Implements an interface at runtime
### Description
```
uopz_implement(string $class, string $interface): bool
```
Makes `class` implement `interface`
### Parameters
`class`
`interface`
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
As of PHP 7.4.0, **uopz\_implements()** throws a [RuntimeException](class.runtimeexception), if [OPcache](https://www.php.net/manual/en/book.opcache.php) is enabled, and the class entry of `class` is immutable.
### Examples
**Example #1 **uopz\_implement()** example**
```
<?php
interface myInterface {}
class myClass {}
uopz_implement(myClass::class, myInterface::class);
var_dump(class_implements(myClass::class));
?>
```
The above example will output:
```
array(1) {
["myInterface"]=>
string(11) "myInterface"
}
```
php ImagickDraw::setFontWeight ImagickDraw::setFontWeight
==========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setFontWeight — Sets the font weight
### Description
```
public ImagickDraw::setFontWeight(int $font_weight): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Sets the font weight to use when annotating with text.
### Parameters
`font_weight`
### Return Values
### Examples
**Example #1 **ImagickDraw::setFontWeight()** example**
```
<?php
function setFontWeight($fillColor, $strokeColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(1);
$draw->setFontSize(36);
$draw->setFontWeight(100);
$draw->annotation(50, 50, "Lorem Ipsum!");
$draw->setFontWeight(200);
$draw->annotation(50, 100, "Lorem Ipsum!");
$draw->setFontWeight(400);
$draw->annotation(50, 150, "Lorem Ipsum!");
$draw->setFontWeight(800);
$draw->annotation(50, 200, "Lorem Ipsum!");
$imagick = new \Imagick();
$imagick->newImage(500, 500, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
php compact compact
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
compact — Create array containing variables and their values
### Description
```
compact(array|string $var_name, array|string ...$var_names): array
```
Creates an array containing variables and their values.
For each of these, **compact()** looks for a variable with that name in the current symbol table and adds it to the output array such that the variable name becomes the key and the contents of the variable become the value for that key. In short, it does the opposite of [extract()](function.extract).
>
> **Note**:
>
>
> Before PHP 7.3, any strings that are not set will silently be skipped.
>
>
### Parameters
`var_name`
`var_names`
**compact()** takes a variable number of parameters. Each parameter can be either a string containing the name of the variable, or an array of variable names. The array can contain other arrays of variable names inside it; **compact()** handles it recursively.
### Return Values
Returns the output array with all the variables added to it.
### Errors/Exceptions
**compact()** issues an E\_NOTICE level error if a given string refers to an unset variable.
### Changelog
| Version | Description |
| --- | --- |
| 7.3.0 | **compact()** now issues an E\_NOTICE level error if a given string refers to an unset variable. Formerly, such strings have been silently skipped. |
### Examples
**Example #1 **compact()** example**
```
<?php
$city = "San Francisco";
$state = "CA";
$event = "SIGGRAPH";
$location_vars = array("city", "state");
$result = compact("event", $location_vars);
print_r($result);
?>
```
The above example will output:
```
Array
(
[event] => SIGGRAPH
[city] => San Francisco
[state] => CA
)
```
### Notes
>
> **Note**: **Gotcha**
>
>
>
> Because [variable variables](language.variables.variable) may not be used with PHP's [Superglobal arrays](language.variables.superglobals) within functions, the Superglobal arrays may not be passed into **compact()**.
>
>
### See Also
* [extract()](function.extract) - Import variables into the current symbol table from an array
php Yaf_Loader::getInstance Yaf\_Loader::getInstance
========================
(Yaf >=1.0.0)
Yaf\_Loader::getInstance — The getInstance purpose
### Description
```
public static Yaf_Loader::getInstance(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php The Fiber class
The Fiber class
===============
Introduction
------------
(PHP 8 >= 8.1.0)
Fibers represent full-stack, interruptible functions. Fibers may be suspended from anywhere in the call-stack, pausing execution within the fiber until the fiber is resumed at a later time.
Class synopsis
--------------
final class **Fiber** { /\* Methods \*/ public [\_\_construct](fiber.construct)([callable](language.types.callable) `$callback`)
```
public start(mixed ...$args): mixed
```
```
public resume(mixed $value = null): mixed
```
```
public throw(Throwable $exception): mixed
```
```
public getReturn(): mixed
```
```
public isStarted(): bool
```
```
public isSuspended(): bool
```
```
public isRunning(): bool
```
```
public isTerminated(): bool
```
```
public static suspend(mixed $value = null): mixed
```
```
public static getCurrent(): ?Fiber
```
} See Also
--------
[Fibers overview](language.fibers)
Table of Contents
-----------------
* [Fiber::\_\_construct](fiber.construct) — Creates a new Fiber instance
* [Fiber::start](fiber.start) — Start execution of the fiber
* [Fiber::resume](fiber.resume) — Resumes execution of the fiber with a value
* [Fiber::throw](fiber.throw) — Resumes execution of the fiber with an exception
* [Fiber::getReturn](fiber.getreturn) — Gets the value returned by the Fiber
* [Fiber::isStarted](fiber.isstarted) — Determines if the fiber has started
* [Fiber::isSuspended](fiber.issuspended) — Determines if the fiber is suspended
* [Fiber::isRunning](fiber.isrunning) — Determines if the fiber is running
* [Fiber::isTerminated](fiber.isterminated) — Determines if the fiber has terminated
* [Fiber::suspend](fiber.suspend) — Suspends execution of the current fiber
* [Fiber::getCurrent](fiber.getcurrent) — Gets the currently executing Fiber instance
| programming_docs |
php Ds\Sequence::reverse Ds\Sequence::reverse
====================
(PECL ds >= 1.0.0)
Ds\Sequence::reverse — Reverses the sequence in-place
### Description
```
abstract public Ds\Sequence::reverse(): void
```
Reverses the sequence in-place.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Sequence::reverse()** example**
```
<?php
$sequence = new \Ds\Vector(["a", "b", "c"]);
$sequence->reverse();
print_r($sequence);
?>
```
The above example will output something similar to:
```
Ds\Vector Object
(
[0] => c
[1] => b
[2] => a
)
```
php streamWrapper::rename streamWrapper::rename
=====================
(PHP 5, PHP 7, PHP 8)
streamWrapper::rename — Renames a file or directory
### Description
```
public streamWrapper::rename(string $path_from, string $path_to): bool
```
This method is called in response to [rename()](function.rename).
Should attempt to rename `path_from` to `path_to`
>
> **Note**:
>
>
> In order for the appropriate error message to be returned this method should *not* be defined if the wrapper does not support renaming files.
>
>
### Parameters
`path_from`
The URL to the current file.
`path_to`
The URL which the `path_from` should be renamed to.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
Emits **`E_WARNING`** if call to this method fails (i.e. not implemented).
### Notes
>
> **Note**:
>
>
> The streamWrapper::$context property is updated if a valid context is passed to the caller function.
>
>
>
### See Also
* [rename()](function.rename) - Renames a file or directory
php date_parse date\_parse
===========
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
date\_parse — Returns associative array with detailed info about given date/time
### Description
```
date_parse(string $datetime): array
```
**date\_parse()** parses the given `datetime` string according to the same rules as [strtotime()](function.strtotime) and [DateTimeImmutable::\_\_construct()](datetimeimmutable.construct). Instead of returning a Unix timestamp (with [strtotime()](function.strtotime)) or a [DateTimeImmutable](class.datetimeimmutable) object (with [DateTimeImmutable::\_\_construct()](datetimeimmutable.construct)), it returns an associative array with the information that it could detect in the given `datetime` string.
If no information about a certain group of elements can be found, these array elements will be set to **`false`** or are missing. If needed for constructing a timestamp or [DateTimeImmutable](class.datetimeimmutable) object from the same `datetime` string, more fields can be set to a non-**`false`** value. See the examples for cases where that happens.
### Parameters
`datetime`
Date/time in format accepted by [DateTimeImmutable::\_\_construct()](datetimeimmutable.construct).
### Return Values
Returns array with information about the parsed date/time on success or **`false`** on failure.
The returned array has keys for `year`, `month`, `day`, `hour`, `minute`, `second`, `fraction`, and `is_localtime`.
If `is_localtime` is present then `zone_type` indicates the type of timezone. For type `1` (UTC offset) the `zone`, `is_dst` fields are added; for type `2` (abbreviation) the fields `tz_abbr`, `is_dst` are added; and for type `3` (timezone identifier) the `tz_abbr`, `tz_id` are added.
If relative time elements are present in the `datetime` string such as `+3 days`, the then returned array includes a nested array with the key `relative`. This array then contains the keys `year`, `month`, `day`, `hour`, `minute`, `second`, and if necessary `weekday`, and `weekdays`, depending on the string that was passed in.
The array includes `warning_count` and `warnings` fields. The first one indicate how many warnings there were. The keys of elements `warnings` array indicate the position in the given `datetime` where the warning occurred, with the string value describing the warning itself.
The array also contains `error_count` and `errors` fields. The first one indicate how many errors were found. The keys of elements `errors` array indicate the position in the given `datetime` where the error occurred, with the string value describing the error itself.
**Warning** The number of array elements in the `warnings` and `errors` arrays might be less than `warning_count` or `error_count` if they occurred at the same position.
### Errors/Exceptions
In case the date/time format has an error, the element 'errors' will contain the error messages.
### Changelog
| Version | Description |
| --- | --- |
| 7.2.0 | The `zone` element of the returned array represents seconds instead of minutes now, and its sign is inverted. For instance `-120` is now `7200`. |
### Examples
**Example #1 A **date\_parse()** example with a comprehensive `datetime` string**
```
<?php
var_dump(date_parse("2006-12-12 10:00:00.5"));
?>
```
The above example will output:
```
array(12) {
["year"]=>
int(2006)
["month"]=>
int(12)
["day"]=>
int(12)
["hour"]=>
int(10)
["minute"]=>
int(0)
["second"]=>
int(0)
["fraction"]=>
float(0.5)
["warning_count"]=>
int(0)
["warnings"]=>
array(0) {
}
["error_count"]=>
int(0)
["errors"]=>
array(0) {
}
["is_localtime"]=>
bool(false)
}
```
The timezone elements only show up if they are included in the given `datetime` string. In that case there will always be a `zone_type` element and a few more depending on its value.
**Example #2 **date\_parse()** with timezone abbreviation information**
```
<?php
var_dump(date_parse("June 2nd, 2022, 10:28:17 BST"));
?>
```
The above example will output:
```
array(16) {
["year"]=>
int(2022)
["month"]=>
int(6)
["day"]=>
int(2)
["hour"]=>
int(10)
["minute"]=>
int(28)
["second"]=>
int(17)
["fraction"]=>
float(0)
["warning_count"]=>
int(0)
["warnings"]=>
array(0) {
}
["error_count"]=>
int(0)
["errors"]=>
array(0) {
}
["is_localtime"]=>
bool(true)
["zone_type"]=>
int(2)
["zone"]=>
int(0)
["is_dst"]=>
bool(true)
["tz_abbr"]=>
string(3) "BST"
}
```
**Example #3 **date\_parse()** with timezone identifier information**
```
<?php
var_dump(date_parse("June 2nd, 2022, 10:28:17 Europe/London"));
?>
```
The above example will output:
```
array(14) {
["year"]=>
int(2022)
["month"]=>
int(6)
["day"]=>
int(2)
["hour"]=>
int(10)
["minute"]=>
int(28)
["second"]=>
int(17)
["fraction"]=>
float(0)
["warning_count"]=>
int(0)
["warnings"]=>
array(0) {
}
["error_count"]=>
int(0)
["errors"]=>
array(0) {
}
["is_localtime"]=>
bool(true)
["zone_type"]=>
int(3)
["tz_id"]=>
string(13) "Europe/London"
}
```
If a more minimal `datetime` string is parsed, less information is available. In this example, all the time parts are returned as **`false`**.
**Example #4 **date\_parse()** with a minimal string**
```
<?php
var_dump(date_parse("June 2nd, 2022"));
?>
```
The above example will output:
```
array(12) {
["year"]=>
int(2022)
["month"]=>
int(6)
["day"]=>
int(2)
["hour"]=>
bool(false)
["minute"]=>
bool(false)
["second"]=>
bool(false)
["fraction"]=>
bool(false)
["warning_count"]=>
int(0)
["warnings"]=>
array(0) {
}
["error_count"]=>
int(0)
["errors"]=>
array(0) {
}
["is_localtime"]=>
bool(false)
}
```
[Relative formats](https://www.php.net/manual/en/datetime.formats.relative.php) do not influence the values parsed from absolute formats, but are parsed into the "relative" element.
**Example #5 **date\_parse()** with relative formats**
```
<?php
var_dump(date_parse("2006-12-12 10:00:00.5 +1 week +1 hour"));
?>
```
The above example will output:
```
array(13) {
["year"]=>
int(2006)
["month"]=>
int(12)
["day"]=>
int(12)
["hour"]=>
int(10)
["minute"]=>
int(0)
["second"]=>
int(0)
["fraction"]=>
float(0.5)
["warning_count"]=>
int(0)
["warnings"]=>
array(0) {
}
["error_count"]=>
int(0)
["errors"]=>
array(0) {
}
["is_localtime"]=>
bool(false)
["relative"]=>
array(6) {
["year"]=>
int(0)
["month"]=>
int(0)
["day"]=>
int(7)
["hour"]=>
int(1)
["minute"]=>
int(0)
["second"]=>
int(0)
}
}
```
Some stanzas, such as `Thursday` will set the time portion of the string to `0`. If `Thursday` is passed to [DateTimeImmutable::\_\_construct()](datetimeimmutable.construct) it would also have resulted in the hour, minute, second, and fraction being set to `0`. In the example below, the year element is however left as **`false`**.
**Example #6 **date\_parse()** with side-effects**
```
<?php
var_dump(date_parse("Thursday, June 2nd"));
?>
```
The above example will output:
```
array(13) {
["year"]=>
bool(false)
["month"]=>
int(6)
["day"]=>
int(2)
["hour"]=>
int(0)
["minute"]=>
int(0)
["second"]=>
int(0)
["fraction"]=>
float(0)
["warning_count"]=>
int(0)
["warnings"]=>
array(0) {
}
["error_count"]=>
int(0)
["errors"]=>
array(0) {
}
["is_localtime"]=>
bool(false)
["relative"]=>
array(7) {
["year"]=>
int(0)
["month"]=>
int(0)
["day"]=>
int(0)
["hour"]=>
int(0)
["minute"]=>
int(0)
["second"]=>
int(0)
["weekday"]=>
int(4)
}
}
```
### See Also
* [date\_parse\_from\_format()](function.date-parse-from-format) - Get info about given date formatted according to the specified format for parsing a `datetime` with a specific given format
* [checkdate()](function.checkdate) - Validate a Gregorian date for Gregorian date validation
* [getdate()](function.getdate) - Get date/time information
php inotify_queue_len inotify\_queue\_len
===================
(PECL inotify >= 0.1.2)
inotify\_queue\_len — Return a number upper than zero if there are pending events
### Description
```
inotify_queue_len(resource $inotify_instance): int
```
This function allows to know if [inotify\_read()](function.inotify-read) will block or not. If a number upper than zero is returned, there are pending events and [inotify\_read()](function.inotify-read) will not block.
### Parameters
`inotify_instance`
Resource returned by [inotify\_init()](function.inotify-init)
### Return Values
Returns a number upper than zero if there are pending events.
### See Also
* [inotify\_init()](function.inotify-init) - Initialize an inotify instance
* [stream\_select()](function.stream-select) - Runs the equivalent of the select() system call on the given arrays of streams with a timeout specified by seconds and microseconds
* [stream\_set\_blocking()](function.stream-set-blocking) - Set blocking/non-blocking mode on a stream
php Normalizer::getRawDecomposition Normalizer::getRawDecomposition
===============================
normalizer\_get\_raw\_decomposition
===================================
(PHP 7 >= 7.3, PHP 8)
Normalizer::getRawDecomposition -- normalizer\_get\_raw\_decomposition — Gets the Decomposition\_Mapping property for the given UTF-8 encoded code point
### Description
Object-oriented style
```
public static Normalizer::getRawDecomposition(string $string, int $form = Normalizer::FORM_C): ?string
```
Procedural style
```
normalizer_get_raw_decomposition(string $string, int $form = Normalizer::FORM_C): ?string
```
Gets the Decomposition\_Mapping property, as specified in the Unicode Character Database (UCD), for the given UTF-8 encoded code point.
### Parameters
`string`
The input string, which should be a single, UTF-8 encoded, code point.
### Return Values
Returns a string containing the Decomposition\_Mapping property, if present in the UCD.
Returns **`null`** if there is no Decomposition\_Mapping property for the character.
### Examples
**Example #1 **Normalizer::getRawDecomposition()** example**
```
<?php
$result = "";
$strings = [
"a",
"\u{FFDA}",
"\u{FDFA}",
"",
"aa",
"\xF5",
];
foreach ($strings as $string) {
$decomposition = Normalizer::getRawDecomposition($string);
// $decomposition = normalizer_get_raw_decomposition($string); Procedural way
$error_code = intl_get_error_code();
$error_message = intl_get_error_message();
$string_hex = bin2hex($string);
$result .= "---------------------\n";
if ($decomposition === null) {
$result .= "'$string_hex' has no decomposition mapping\n" ;
} else {
$result .= "'$string_hex' has the decomposition mapping '" . bin2hex($decomposition) . "'\n" ;
}
$result .= "error info: '$error_message' ($error_code)\n";
}
echo $result;
?>
```
The above example will output:
```
---------------------
'61' has no decomposition mapping
error info: 'U_ZERO_ERROR' (0)
---------------------
'efbf9a' has the decomposition mapping 'e385a1'
error info: 'U_ZERO_ERROR' (0)
---------------------
'efb7ba' has the decomposition mapping 'd8b5d984d98920d8a7d984d984d98720d8b9d984d98ad98720d988d8b3d984d985'
error info: 'U_ZERO_ERROR' (0)
---------------------
'' has no decomposition mapping
error info: 'Input string must be exactly one UTF-8 encoded code point long.: U_ILLEGAL_ARGUMENT_ERROR' (1)
---------------------
'6161' has no decomposition mapping
error info: 'Input string must be exactly one UTF-8 encoded code point long.: U_ILLEGAL_ARGUMENT_ERROR' (1)
---------------------
'f5' has no decomposition mapping
error info: 'Code point out of range: U_ILLEGAL_ARGUMENT_ERROR' (1)
```
### See Also
* [Normalizer::normalize()](normalizer.normalize) - Normalizes the input provided and returns the normalized string
* [Normalizer::isNormalized()](normalizer.isnormalized) - Checks if the provided string is already in the specified normalization form
php None Serialization
-------------
Enumerations are serialized differently from objects. Specifically, they have a new serialization code, `"E"`, that specifies the name of the enum case. The deserialization routine is then able to use that to set a variable to the existing singleton value. That ensures that:
```
<?php
Suit::Hearts === unserialize(serialize(Suit::Hearts));
print serialize(Suit::Hearts);
// E:11:"Suit:Hearts";
?>
```
On deserialization, if an enum and case cannot be found to match a serialized value a warning will be issued and `false` returned.
If a Pure Enum is serialized to JSON, an error will be thrown. If a Backed Enum is serialized to JSON, it will be represented by its value scalar only, in the appropriate type. The behavior of both may be overridden by implementing [JsonSerializable](class.jsonserializable).
For [print\_r()](function.print-r), the output of an enum case is slightly different from objects to minimize confusion.
```
<?php
enum Foo {
case Bar;
}
enum Baz: int {
case Beep = 5;
}
print_r(Foo::Bar);
print_r(Baz::Beep);
/* Produces
Foo Enum (
[name] => Bar
)
Baz Enum:int {
[name] => Beep
[value] => 5
}
*/
?>
```
php easter_days easter\_days
============
(PHP 4, PHP 5, PHP 7, PHP 8)
easter\_days — Get number of days after March 21 on which Easter falls for a given year
### Description
```
easter_days(?int $year = null, int $mode = CAL_EASTER_DEFAULT): int
```
Returns the number of days after March 21 on which Easter falls for a given year. If no year is specified, the current year is assumed.
This function can be used instead of [easter\_date()](function.easter-date) to calculate Easter for years which fall outside the range of Unix timestamps (i.e. before 1970 or after 2037).
The date of Easter Day was defined by the Council of Nicaea in AD325 as the Sunday after the first full moon which falls on or after the Spring Equinox. The Equinox is assumed to always fall on 21st March, so the calculation reduces to determining the date of the full moon and the date of the following Sunday. The algorithm used here was introduced around the year 532 by Dionysius Exiguus. Under the Julian Calendar (for years before 1753) a simple 19-year cycle is used to track the phases of the Moon. Under the Gregorian Calendar (for years after 1753 - devised by Clavius and Lilius, and introduced by Pope Gregory XIII in October 1582, and into Britain and its then colonies in September 1752) two correction factors are added to make the cycle more accurate.
### Parameters
`year`
The year as a positive number. If omitted or **`null`**, defaults to the current year according to the local time.
`mode`
Allows Easter dates to be calculated based on the Gregorian calendar during the years 1582 - 1752 when set to **`CAL_EASTER_ROMAN`**. See the [calendar constants](https://www.php.net/manual/en/calendar.constants.php) for more valid constants.
### Return Values
The number of days after March 21st that the Easter Sunday is in the given `year`.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `year` is nullable now. |
### Examples
**Example #1 **easter\_days()** example**
```
<?php
echo easter_days(1999); // 14, i.e. April 4
echo easter_days(1492); // 32, i.e. April 22
echo easter_days(1913); // 2, i.e. March 23
?>
```
### See Also
* [easter\_date()](function.easter-date) - Get Unix timestamp for midnight on Easter of a given year
php ImagickPixel::isPixelSimilar ImagickPixel::isPixelSimilar
============================
(PECL imagick 3 >= 3.3.0)
ImagickPixel::isPixelSimilar — Check the distance between this color and another
### Description
```
public ImagickPixel::isPixelSimilar(ImagickPixel $color, float $fuzz): bool
```
Checks the distance between the color described by this ImagickPixel object and that of the provided object, by plotting their RGB values on the color cube. If the distance between the two points is less than the fuzz value given, the colors are similar. This method replaces [ImagickPixel::isSimilar()](imagickpixel.issimilar) and correctly normalises the fuzz value to ImageMagick QuantumRange.
### Parameters
`color`
The ImagickPixel object to compare this object against.
`fuzz`
The maximum distance within which to consider these colors as similar. The theoretical maximum for this value is the square root of three (1.732).
### Return Values
Returns **`true`** on success.
php Imagick::getImageColorspace Imagick::getImageColorspace
===========================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageColorspace — Gets the image colorspace
### Description
```
public Imagick::getImageColorspace(): int
```
Gets the image colorspace.
### Parameters
This function has no parameters.
### Return Values
Returns an integer which can be compared against [COLORSPACE constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.colorspace).
php RecursiveTreeIterator::getEntry RecursiveTreeIterator::getEntry
===============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
RecursiveTreeIterator::getEntry — Get current entry
### Description
```
public RecursiveTreeIterator::getEntry(): string
```
Gets the part of the tree built for the current element.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
Returns the part of the tree built for the current element.
php SolrQuery::setTermsIncludeUpperBound SolrQuery::setTermsIncludeUpperBound
====================================
(PECL solr >= 0.9.2)
SolrQuery::setTermsIncludeUpperBound — Include the upper bound term in the result set
### Description
```
public SolrQuery::setTermsIncludeUpperBound(bool $flag): SolrQuery
```
Include the upper bound term in the result set.
### Parameters
`flag`
**`true`** or **`false`**
### Return Values
Returns the current SolrQuery object, if the return value is used.
| programming_docs |
php None Overloading
-----------
Overloading in PHP provides means to dynamically create properties and methods. These dynamic entities are processed via magic methods one can establish in a class for various action types.
The overloading methods are invoked when interacting with properties or methods that have not been declared or are not [visible](language.oop5.visibility) in the current scope. The rest of this section will use the terms inaccessible properties and inaccessible methods to refer to this combination of declaration and visibility.
All overloading methods must be defined as `public`.
>
> **Note**:
>
>
> None of the arguments of these magic methods can be [passed by reference](functions.arguments#functions.arguments.by-reference).
>
>
>
> **Note**:
>
>
> PHP's interpretation of overloading is different than most object-oriented languages. Overloading traditionally provides the ability to have multiple methods with the same name but different quantities and types of arguments.
>
>
### Property overloading
```
public __set(string $name, mixed $value): void
```
```
public __get(string $name): mixed
```
```
public __isset(string $name): bool
```
```
public __unset(string $name): void
```
[\_\_set()](language.oop5.overloading#object.set) is run when writing data to inaccessible (protected or private) or non-existing properties.
[\_\_get()](language.oop5.overloading#object.get) is utilized for reading data from inaccessible (protected or private) or non-existing properties.
[\_\_isset()](language.oop5.overloading#object.isset) is triggered by calling [isset()](function.isset) or [empty()](function.empty) on inaccessible (protected or private) or non-existing properties.
[\_\_unset()](language.oop5.overloading#object.unset) is invoked when [unset()](function.unset) is used on inaccessible (protected or private) or non-existing properties.
The $name argument is the name of the property being interacted with. The [\_\_set()](language.oop5.overloading#object.set) method's $value argument specifies the value the $name'ed property should be set to.
Property overloading only works in object context. These magic methods will not be triggered in static context. Therefore these methods should not be declared [static](language.oop5.static). A warning is issued if one of the magic overloading methods is declared `static`.
>
> **Note**:
>
>
> The return value of [\_\_set()](language.oop5.overloading#object.set) is ignored because of the way PHP processes the assignment operator. Similarly, [\_\_get()](language.oop5.overloading#object.get) is never called when chaining assignments together like this: ````
> $a = $obj->b = 8;
> ````
>
>
>
> **Note**:
>
>
> PHP will not call an overloaded method from within the same overloaded method. That means, for example, writing `return $this->foo` inside of [\_\_get()](language.oop5.overloading#object.get) will return `null` and raise an **`E_WARNING`** if there is no `foo` property defined, rather than calling [\_\_get()](language.oop5.overloading#object.get) a second time. However, overload methods may invoke other overload methods implicitly (such as [\_\_set()](language.oop5.overloading#object.set) triggering [\_\_get()](language.oop5.overloading#object.get)).
>
>
**Example #1 Overloading properties via the [\_\_get()](language.oop5.overloading#object.get), [\_\_set()](language.oop5.overloading#object.set), [\_\_isset()](language.oop5.overloading#object.isset) and [\_\_unset()](language.oop5.overloading#object.unset) methods**
```
<?php
class PropertyTest
{
/** Location for overloaded data. */
private $data = array();
/** Overloading not used on declared properties. */
public $declared = 1;
/** Overloading only used on this when accessed outside the class. */
private $hidden = 2;
public function __set($name, $value)
{
echo "Setting '$name' to '$value'\n";
$this->data[$name] = $value;
}
public function __get($name)
{
echo "Getting '$name'\n";
if (array_key_exists($name, $this->data)) {
return $this->data[$name];
}
$trace = debug_backtrace();
trigger_error(
'Undefined property via __get(): ' . $name .
' in ' . $trace[0]['file'] .
' on line ' . $trace[0]['line'],
E_USER_NOTICE);
return null;
}
public function __isset($name)
{
echo "Is '$name' set?\n";
return isset($this->data[$name]);
}
public function __unset($name)
{
echo "Unsetting '$name'\n";
unset($this->data[$name]);
}
/** Not a magic method, just here for example. */
public function getHidden()
{
return $this->hidden;
}
}
echo "<pre>\n";
$obj = new PropertyTest;
$obj->a = 1;
echo $obj->a . "\n\n";
var_dump(isset($obj->a));
unset($obj->a);
var_dump(isset($obj->a));
echo "\n";
echo $obj->declared . "\n\n";
echo "Let's experiment with the private property named 'hidden':\n";
echo "Privates are visible inside the class, so __get() not used...\n";
echo $obj->getHidden() . "\n";
echo "Privates not visible outside of class, so __get() is used...\n";
echo $obj->hidden . "\n";
?>
```
The above example will output:
```
Setting 'a' to '1'
Getting 'a'
1
Is 'a' set?
bool(true)
Unsetting 'a'
Is 'a' set?
bool(false)
1
Let's experiment with the private property named 'hidden':
Privates are visible inside the class, so __get() not used...
2
Privates not visible outside of class, so __get() is used...
Getting 'hidden'
Notice: Undefined property via __get(): hidden in <file> on line 70 in <file> on line 29
```
### Method overloading
```
public __call(string $name, array $arguments): mixed
```
```
public static __callStatic(string $name, array $arguments): mixed
```
[\_\_call()](language.oop5.overloading#object.call) is triggered when invoking inaccessible methods in an object context.
[\_\_callStatic()](language.oop5.overloading#object.callstatic) is triggered when invoking inaccessible methods in a static context.
The $name argument is the name of the method being called. The $arguments argument is an enumerated array containing the parameters passed to the $name'ed method.
**Example #2 Overloading methods via the [\_\_call()](language.oop5.overloading#object.call) and [\_\_callStatic()](language.oop5.overloading#object.callstatic) methods**
```
<?php
class MethodTest
{
public function __call($name, $arguments)
{
// Note: value of $name is case sensitive.
echo "Calling object method '$name' "
. implode(', ', $arguments). "\n";
}
public static function __callStatic($name, $arguments)
{
// Note: value of $name is case sensitive.
echo "Calling static method '$name' "
. implode(', ', $arguments). "\n";
}
}
$obj = new MethodTest;
$obj->runTest('in object context');
MethodTest::runTest('in static context');
?>
```
The above example will output:
```
Calling object method 'runTest' in object context
Calling static method 'runTest' in static context
```
php The ReflectionEnum class
The ReflectionEnum class
========================
Introduction
------------
(PHP 8 >= 8.1.0)
The **ReflectionEnum** class reports information about an Enum.
Class synopsis
--------------
class **ReflectionEnum** extends [ReflectionClass](class.reflectionclass) { /\* Inherited constants \*/ public const int [ReflectionClass::IS\_IMPLICIT\_ABSTRACT](class.reflectionclass#reflectionclass.constants.is-implicit-abstract);
public const int [ReflectionClass::IS\_EXPLICIT\_ABSTRACT](class.reflectionclass#reflectionclass.constants.is-explicit-abstract);
public const int [ReflectionClass::IS\_FINAL](class.reflectionclass#reflectionclass.constants.is-final);
public const int [ReflectionClass::IS\_READONLY](class.reflectionclass#reflectionclass.constants.is-readonly); /\* Inherited properties \*/
public string [$name](class.reflectionclass#reflectionclass.props.name); /\* Methods \*/ public [\_\_construct](reflectionenum.construct)(object|string `$objectOrClass`)
```
public getBackingType(): ?ReflectionNamedType
```
```
public getCase(string $name): ReflectionEnumUnitCase
```
```
public getCases(): array
```
```
public hasCase(string $name): bool
```
```
public isBacked(): bool
```
/\* Inherited methods \*/
```
public static ReflectionClass::export(mixed $argument, bool $return = false): string
```
```
public ReflectionClass::getAttributes(?string $name = null, int $flags = 0): array
```
```
public ReflectionClass::getConstant(string $name): mixed
```
```
public ReflectionClass::getConstants(?int $filter = null): array
```
```
public ReflectionClass::getConstructor(): ?ReflectionMethod
```
```
public ReflectionClass::getDefaultProperties(): array
```
```
public ReflectionClass::getDocComment(): string|false
```
```
public ReflectionClass::getEndLine(): int|false
```
```
public ReflectionClass::getExtension(): ?ReflectionExtension
```
```
public ReflectionClass::getExtensionName(): string|false
```
```
public ReflectionClass::getFileName(): string|false
```
```
public ReflectionClass::getInterfaceNames(): array
```
```
public ReflectionClass::getInterfaces(): array
```
```
public ReflectionClass::getMethod(string $name): ReflectionMethod
```
```
public ReflectionClass::getMethods(?int $filter = null): array
```
```
public ReflectionClass::getModifiers(): int
```
```
public ReflectionClass::getName(): string
```
```
public ReflectionClass::getNamespaceName(): string
```
```
public ReflectionClass::getParentClass(): ReflectionClass|false
```
```
public ReflectionClass::getProperties(?int $filter = null): array
```
```
public ReflectionClass::getProperty(string $name): ReflectionProperty
```
```
public ReflectionClass::getReflectionConstant(string $name): ReflectionClassConstant|false
```
```
public ReflectionClass::getReflectionConstants(?int $filter = null): array
```
```
public ReflectionClass::getShortName(): string
```
```
public ReflectionClass::getStartLine(): int|false
```
```
public ReflectionClass::getStaticProperties(): ?array
```
```
public ReflectionClass::getStaticPropertyValue(string $name, mixed &$def_value = ?): mixed
```
```
public ReflectionClass::getTraitAliases(): array
```
```
public ReflectionClass::getTraitNames(): array
```
```
public ReflectionClass::getTraits(): array
```
```
public ReflectionClass::hasConstant(string $name): bool
```
```
public ReflectionClass::hasMethod(string $name): bool
```
```
public ReflectionClass::hasProperty(string $name): bool
```
```
public ReflectionClass::implementsInterface(ReflectionClass|string $interface): bool
```
```
public ReflectionClass::inNamespace(): bool
```
```
public ReflectionClass::isAbstract(): bool
```
```
public ReflectionClass::isAnonymous(): bool
```
```
public ReflectionClass::isCloneable(): bool
```
```
public ReflectionClass::isEnum(): bool
```
```
public ReflectionClass::isFinal(): bool
```
```
public ReflectionClass::isInstance(object $object): bool
```
```
public ReflectionClass::isInstantiable(): bool
```
```
public ReflectionClass::isInterface(): bool
```
```
public ReflectionClass::isInternal(): bool
```
```
public ReflectionClass::isIterable(): bool
```
```
public ReflectionClass::isReadOnly(): bool
```
```
public ReflectionClass::isSubclassOf(ReflectionClass|string $class): bool
```
```
public ReflectionClass::isTrait(): bool
```
```
public ReflectionClass::isUserDefined(): bool
```
```
public ReflectionClass::newInstance(mixed ...$args): object
```
```
public ReflectionClass::newInstanceArgs(array $args = []): ?object
```
```
public ReflectionClass::newInstanceWithoutConstructor(): object
```
```
public ReflectionClass::setStaticPropertyValue(string $name, mixed $value): void
```
```
public ReflectionClass::__toString(): string
```
} See Also
--------
* [Enumerations](https://www.php.net/manual/en/language.enumerations.php)
Table of Contents
-----------------
* [ReflectionEnum::\_\_construct](reflectionenum.construct) — Instantiates a ReflectionEnum object
* [ReflectionEnum::getBackingType](reflectionenum.getbackingtype) — Gets the backing type of an Enum, if any
* [ReflectionEnum::getCase](reflectionenum.getcase) — Returns a specific case of an Enum
* [ReflectionEnum::getCases](reflectionenum.getcases) — Returns a list of all cases on an Enum
* [ReflectionEnum::hasCase](reflectionenum.hascase) — Checks for a case on an Enum
* [ReflectionEnum::isBacked](reflectionenum.isbacked) — Determines if an Enum is a Backed Enum
php SplTempFileObject::__construct SplTempFileObject::\_\_construct
================================
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
SplTempFileObject::\_\_construct — Construct a new temporary file object
### Description
public **SplTempFileObject::\_\_construct**(int `$maxMemory` = 2 \* 1024 \* 1024) Construct a new temporary file object.
### Parameters
`maxMemory`
The maximum amount of memory (in bytes, default is 2 MB) for the temporary file to use. If the temporary file exceeds this size, it will be moved to a file in the system's temp directory.
If `maxMemory` is negative, only memory will be used. If `maxMemory` is zero, no memory will be used.
### Errors/Exceptions
Throws a [RuntimeException](class.runtimeexception) if an error occurs.
### Examples
**Example #1 **SplTempFileObject()** example**
This example writes a temporary file in memory which can be written to and read from.
```
<?php
$temp = new SplTempFileObject();
$temp->fwrite("This is the first line\n");
$temp->fwrite("And this is the second.\n");
echo "Written " . $temp->ftell() . " bytes to temporary file.\n\n";
// Rewind and read what was written
$temp->rewind();
foreach ($temp as $line) {
echo $line;
}
?>
```
The above example will output something similar to:
```
Written 47 bytes to temporary file.
This is the first line
And this is the second.
```
### See Also
* [SplFileObject](class.splfileobject)
* [PHP input/output streams](https://www.php.net/manual/en/wrappers.php.php) (for `php://temp` and `php://memory`)
php SolrQuery::setHighlightRegexMaxAnalyzedChars SolrQuery::setHighlightRegexMaxAnalyzedChars
============================================
(PECL solr >= 0.9.2)
SolrQuery::setHighlightRegexMaxAnalyzedChars — Specify the maximum number of characters to analyze
### Description
```
public SolrQuery::setHighlightRegexMaxAnalyzedChars(int $maxAnalyzedChars): SolrQuery
```
Specify the maximum number of characters to analyze from a field when using the regex fragmenter
### Parameters
`maxAnalyzedChars`
The maximum number of characters to analyze from a field when using the regex fragmenter
### Return Values
Returns the current SolrQuery object, if the return value is used.
php EventHttpRequest::getBufferEvent EventHttpRequest::getBufferEvent
================================
(PECL event >= 1.8.0)
EventHttpRequest::getBufferEvent — Returns EventBufferEvent object
### Description
```
public EventHttpRequest::closeConnection(): EventBufferEvent
```
Returns [EventBufferEvent](class.eventbufferevent) object which represents buffer event that the connection is using.
**Warning** The reference counter of the returned object will be incremented by one to protect internal structures against premature destruction when the method is called from a user callback. So the [EventBufferEvent](class.eventbufferevent) object should be freed explicitly with [EventBufferEvent::free()](eventbufferevent.free) method. Otherwise memory will leak.
### Parameters
This function has no parameters.
### Return Values
Returns [EventBufferEvent](class.eventbufferevent) object.
### See Also
* [EventHttpRequest::getConnection()](eventhttprequest.getconnection) - Returns EventHttpConnection object
php Gmagick::getimagecompose Gmagick::getimagecompose
========================
(PECL gmagick >= Unknown)
Gmagick::getimagecompose — Returns the composite operator associated with the image
### Description
```
public Gmagick::getimagecompose(): int
```
Returns the composite operator associated with the image.
### Parameters
This function has no parameters.
### Return Values
Returns the composite operator associated with the image.
### Errors/Exceptions
Throws an **GmagickException** on error.
php IntlDateFormatter::getCalendarObject IntlDateFormatter::getCalendarObject
====================================
datefmt\_get\_calendar\_object
==============================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL intl >= 3.0.0)
IntlDateFormatter::getCalendarObject -- datefmt\_get\_calendar\_object — Get copy of formatterʼs calendar object
### Description
Object-oriented style
```
public IntlDateFormatter::getCalendarObject(): IntlCalendar|false|null
```
Procedural style
```
datefmt_get_calendar_object(IntlDateFormatter $formatter): IntlCalendar|false|null
```
Obtain a copy of the calendar object used internally by this formatter. This calendar will have a type (as in gregorian, japanese, buddhist, roc, persian, islamic, etc.) and a timezone that match the type and timezone used by the formatter. The date/time of the object is unspecified.
### Parameters
This function has no parameters.
### Return Values
A copy of the internal calendar object used by this formatter, or **`null`** if none has been set, or **`false`** on failure.
### Examples
**Example #1 **IntlDateFormatter::getCalendarObject()** example**
```
<?php
$formatter = IntlDateFormatter::create(
"fr_FR@calendar=islamic",
NULL,
NULL,
"GMT-01:00",
IntlDateFormatter::TRADITIONAL
);
$cal = $formatter->getCalendarObject();
var_dump(
$cal->getType(),
$cal->getTimeZone(),
$cal->getLocale(Locale::VALID_LOCALE)
);
```
The above example will output:
```
string(7) "islamic"
object(IntlTimeZone)#3 (4) {
["valid"]=>
bool(true)
["id"]=>
string(9) "GMT-01:00"
["rawOffset"]=>
int(-3600000)
["currentOffset"]=>
int(-3600000)
}
string(5) "fr_FR"
```
### See Also
* [IntlDateFormatter::getCalendar()](intldateformatter.getcalendar) - Get the calendar type used for the IntlDateFormatter
* [IntlDateFormatter::setCalendar()](intldateformatter.setcalendar) - Sets the calendar type used by the formatter
* [IntlCalendar](class.intlcalendar)
php Zookeeper::setAcl Zookeeper::setAcl
=================
(PECL zookeeper >= 0.1.0)
Zookeeper::setAcl — Sets the acl associated with a node synchronously
### Description
```
public Zookeeper::setAcl(string $path, int $version, array $acl): bool
```
### Parameters
`path`
The name of the node. Expressed as a file name with slashes separating ancestors of the node.
`version`
The expected version of the path.
`acl`
The acl to be set on the path.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
This method emits PHP error/warning when parameters count or types are wrong or fail to set ACL for a node.
**Caution** Since version 0.3.0, this method emits [ZookeeperException](class.zookeeperexception) and it's derivatives.
### Examples
**Example #1 **Zookeeper::setAcl()** example**
Set ACL for a node.
```
<?php
$zookeeper = new Zookeeper('locahost:2181');
$aclArray = array(
array(
'perms' => Zookeeper::PERM_ALL,
'scheme' => 'world',
'id' => 'anyone',
)
);
$path = '/path/to/newnode';
$zookeeper->setAcl($path, $aclArray);
$r = $zookeeper->getAcl($path);
if ($r)
var_dump($r);
else
echo 'ERR';
?>
```
The above example will output:
```
array(1) {
[0]=>
array(3) {
["perms"]=>
int(31)
["scheme"]=>
string(5) "world"
["id"]=>
string(6) "anyone"
}
}
```
### See Also
* [Zookeeper::create()](zookeeper.create) - Create a node synchronously
* [Zookeeper::getAcl()](zookeeper.getacl) - Gets the acl associated with a node synchronously
* [ZooKeeper Permissions](class.zookeeper#zookeeper.class.constants.perms)
* [ZookeeperException](class.zookeeperexception)
| programming_docs |
php phpinfo phpinfo
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
phpinfo — Outputs information about PHP's configuration
### Description
```
phpinfo(int $flags = INFO_ALL): bool
```
Outputs a large amount of information about the current state of PHP. This includes information about PHP compilation options and extensions, the PHP version, server information and environment (if compiled as a module), the PHP environment, OS version information, paths, master and local values of configuration options, HTTP headers, and the PHP License.
Because every system is setup differently, **phpinfo()** is commonly used to check [configuration settings](https://www.php.net/manual/en/configuration.php) and for available [predefined variables](language.variables.predefined) on a given system.
**phpinfo()** is also a valuable debugging tool as it contains all EGPCS (Environment, GET, POST, Cookie, Server) data.
### Parameters
`flags`
The output may be customized by passing one or more of the following *constants* bitwise values summed together in the optional `flags` parameter. One can also combine the respective constants or bitwise values together with the [bitwise or operator](language.operators.bitwise).
****phpinfo()** options**| Name (constant) | Value | Description |
| --- | --- | --- |
| INFO\_GENERAL | 1 | The configuration line, php.ini location, build date, Web Server, System and more. |
| INFO\_CREDITS | 2 | PHP Credits. See also [phpcredits()](function.phpcredits). |
| INFO\_CONFIGURATION | 4 | Current Local and Master values for PHP directives. See also [ini\_get()](function.ini-get). |
| INFO\_MODULES | 8 | Loaded modules and their respective settings. See also [get\_loaded\_extensions()](function.get-loaded-extensions). |
| INFO\_ENVIRONMENT | 16 | Environment Variable information that's also available in [$\_ENV](reserved.variables.environment). |
| INFO\_VARIABLES | 32 | Shows all [predefined variables](language.variables.predefined) from EGPCS (Environment, GET, POST, Cookie, Server). |
| INFO\_LICENSE | 64 | PHP License information. See also the [» license FAQ](https://www.php.net/license/). |
| INFO\_ALL | -1 | Shows all of the above. |
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **phpinfo()** Example**
```
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);
?>
```
### Notes
>
> **Note**:
>
>
> In versions of PHP before 5.5, parts of the information displayed are disabled when the [expose\_php](https://www.php.net/manual/en/ini.core.php#ini.expose-php) configuration setting is set to `off`. This includes the PHP and Zend logos, and the credits.
>
>
>
> **Note**:
>
>
> **phpinfo()** outputs plain text instead of HTML when using the CLI mode.
>
>
### See Also
* [phpversion()](function.phpversion) - Gets the current PHP version
* [phpcredits()](function.phpcredits) - Prints out the credits for PHP
* [ini\_get()](function.ini-get) - Gets the value of a configuration option
* [ini\_set()](function.ini-set) - Sets the value of a configuration option
* [get\_loaded\_extensions()](function.get-loaded-extensions) - Returns an array with the names of all modules compiled and loaded
* [Predefined Variables](language.variables.predefined)
php SolrQuery::setMltMaxNumTokens SolrQuery::setMltMaxNumTokens
=============================
(PECL solr >= 0.9.2)
SolrQuery::setMltMaxNumTokens — Specifies the maximum number of tokens to parse
### Description
```
public SolrQuery::setMltMaxNumTokens(int $value): SolrQuery
```
Specifies the maximum number of tokens to parse in each example doc field that is not stored with TermVector support.
### Parameters
`value`
The maximum number of tokens to parse
### Return Values
Returns the current SolrQuery object, if the return value is used.
php SolrDocument::__get SolrDocument::\_\_get
=====================
(PECL solr >= 0.9.2)
SolrDocument::\_\_get — Access the field as a property
### Description
```
public SolrDocument::__get(string $fieldName): SolrDocumentField
```
Magic method for accessing the field as a property.
### Parameters
`fieldName`
The name of the field.
### Return Values
Returns a SolrDocumentField instance.
php Ds\Set::jsonSerialize Ds\Set::jsonSerialize
=====================
(PECL ds >= 1.0.0)
Ds\Set::jsonSerialize — Returns a representation that can be converted to JSON
See [JsonSerializable::jsonSerialize()](jsonserializable.jsonserialize)
>
> **Note**:
>
>
> You should never need to call this directly.
>
>
php Throwable
Throwable
=========
Introduction
------------
(PHP 7, PHP 8)
**Throwable** is the base interface for any object that can be thrown via a [`throw`](language.exceptions) statement, including [Error](class.error) and [Exception](class.exception).
>
> **Note**:
>
>
> PHP classes cannot implement the **Throwable** interface directly, and must instead extend [Exception](class.exception).
>
>
Interface synopsis
------------------
interface **Throwable** extends [Stringable](class.stringable) { /\* Methods \*/
```
public getMessage(): string
```
```
public getCode(): int
```
```
public getFile(): string
```
```
public getLine(): int
```
```
public getTrace(): array
```
```
public getTraceAsString(): string
```
```
public getPrevious(): ?Throwable
```
```
public __toString(): string
```
/\* Inherited methods \*/
```
public Stringable::__toString(): string
```
} Changelog
---------
| Version | Description |
| --- | --- |
| 8.0.0 | **Throwable** implements [Stringable](class.stringable) now. |
Table of Contents
-----------------
* [Throwable::getMessage](throwable.getmessage) — Gets the message
* [Throwable::getCode](throwable.getcode) — Gets the exception code
* [Throwable::getFile](throwable.getfile) — Gets the file in which the object was created
* [Throwable::getLine](throwable.getline) — Gets the line on which the object was instantiated
* [Throwable::getTrace](throwable.gettrace) — Gets the stack trace
* [Throwable::getTraceAsString](throwable.gettraceasstring) — Gets the stack trace as a string
* [Throwable::getPrevious](throwable.getprevious) — Returns the previous Throwable
* [Throwable::\_\_toString](throwable.tostring) — Gets a string representation of the thrown object
php odbc_binmode odbc\_binmode
=============
(PHP 4, PHP 5, PHP 7, PHP 8)
odbc\_binmode — Handling of binary column data
### Description
```
odbc_binmode(resource $statement, int $mode): bool
```
Controls handling of binary column data. ODBC SQL types affected are `BINARY`, `VARBINARY`, and `LONGVARBINARY`. The default mode can be set using the [uodbc.defaultbinmode](https://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.defaultbinmode) php.ini directive.
When binary SQL data is converted to character C data (**`ODBC_BINMODE_CONVERT`**), each byte (8 bits) of source data is represented as two ASCII characters. These characters are the ASCII character representation of the number in its hexadecimal form. For example, a binary `00000001` is converted to `"01"` and a binary `11111111` is converted to `"FF"`.
While the handling of `BINARY` and `VARBINARY` columns only depend on the binmode, the handling of `LONGVARBINARY` columns also depends on the longreadlen as well:
**LONGVARBINARY handling**| binmode | longreadlen | result |
| --- | --- | --- |
| **`ODBC_BINMODE_PASSTHRU`** | 0 | passthru |
| **`ODBC_BINMODE_RETURN`** | 0 | passthru |
| **`ODBC_BINMODE_CONVERT`** | 0 | passthru |
| **`ODBC_BINMODE_PASSTHRU`** | >0 | passthru |
| **`ODBC_BINMODE_RETURN`** | >0 | return as is |
| **`ODBC_BINMODE_CONVERT`** | >0 | return as char |
If [odbc\_fetch\_into()](function.odbc-fetch-into) is used, passthru means that an empty string is returned for these columns. If [odbc\_result()](function.odbc-result) is used, passthru means that the data are sent directly to the client (i.e. printed).
### Parameters
`statement`
The result identifier.
If `statement` is `0`, the settings apply as default for new results.
`mode`
Possible values for `mode` are:
* **`ODBC_BINMODE_PASSTHRU`**: Passthru BINARY data
* **`ODBC_BINMODE_RETURN`**: Return as is
* **`ODBC_BINMODE_CONVERT`**: Convert to char and return
> **Note**: Handling of binary long columns is also affected by [odbc\_longreadlen()](function.odbc-longreadlen).
>
>
### Return Values
Returns **`true`** on success or **`false`** on failure.
php eio_close eio\_close
==========
(PECL eio >= 0.0.1dev)
eio\_close — Close file
### Description
```
eio_close(
mixed $fd,
int $pri = EIO_PRI_DEFAULT,
callable $callback = NULL,
mixed $data = NULL
): resource
```
**eio\_close()** closes file specified by `fd`.
### Parameters
`fd`
Stream, Socket resource, or numeric file descriptor
`pri`
The request priority: **`EIO_PRI_DEFAULT`**, **`EIO_PRI_MIN`**, **`EIO_PRI_MAX`**, or **`null`**. If **`null`** passed, `pri` internally is set to **`EIO_PRI_DEFAULT`**.
`callback`
`callback` function is called when the request is done. It should match the following prototype:
```
void callback(mixed $data, int $result[, resource $req]);
```
`data`
is custom data passed to the request.
`result`
request-specific result value; basically, the value returned by corresponding system call.
`req`
is optional request resource which can be used with functions like [eio\_get\_last\_error()](function.eio-get-last-error)
`data`
Arbitrary variable passed to `callback`.
### Return Values
**eio\_close()** returns request resource on success, or **`false`** on failure.
### See Also
* [eio\_open()](function.eio-open) - Opens a file
php The IteratorAggregate interface
The IteratorAggregate interface
===============================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
Interface to create an external Iterator.
Interface synopsis
------------------
interface **IteratorAggregate** extends [Traversable](class.traversable) { /\* Methods \*/
```
public getIterator(): Traversable
```
} **Example #1 Basic usage**
```
<?php
class myData implements IteratorAggregate {
public $property1 = "Public property one";
public $property2 = "Public property two";
public $property3 = "Public property three";
public function __construct() {
$this->property4 = "last property";
}
public function getIterator() {
return new ArrayIterator($this);
}
}
$obj = new myData;
foreach($obj as $key => $value) {
var_dump($key, $value);
echo "\n";
}
?>
```
The above example will output something similar to:
```
string(9) "property1"
string(19) "Public property one"
string(9) "property2"
string(19) "Public property two"
string(9) "property3"
string(21) "Public property three"
string(9) "property4"
string(13) "last property"
```
Table of Contents
-----------------
* [IteratorAggregate::getIterator](iteratoraggregate.getiterator) — Retrieve an external iterator
php PDOStatement::getIterator PDOStatement::getIterator
=========================
(PHP 8)
PDOStatement::getIterator — Gets result set iterator
### Description
```
public PDOStatement::getIterator(): Iterator
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php mb_split mb\_split
=========
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
mb\_split — Split multibyte string using regular expression
### Description
```
mb_split(string $pattern, string $string, int $limit = -1): array|false
```
Split a multibyte `string` using regular expression `pattern` and returns the result as an array.
### Parameters
`pattern`
The regular expression pattern.
`string`
The string being split.
`limit`
If optional parameter `limit` is specified, it will be split in `limit` elements as maximum. ### Return Values
The result as an array, or **`false`** on failure.
### Notes
>
> **Note**:
>
>
> The character encoding specified by [mb\_regex\_encoding()](function.mb-regex-encoding) will be used as the character encoding for this function by default.
>
>
>
### See Also
* [mb\_regex\_encoding()](function.mb-regex-encoding) - Set/Get character encoding for multibyte regex
* [mb\_ereg()](function.mb-ereg) - Regular expression match with multibyte support
php DateTime::sub DateTime::sub
=============
date\_sub
=========
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
DateTime::sub -- date\_sub — Subtracts an amount of days, months, years, hours, minutes and seconds from a DateTime object
### Description
Object-oriented style
```
public DateTime::sub(DateInterval $interval): DateTime
```
Procedural style
```
date_sub(DateTime $object, DateInterval $interval): DateTime
```
Modifies the specified DateTime object, by subtracting the specified [DateInterval](class.dateinterval) object.
Like [DateTimeImmutable::sub()](datetimeimmutable.sub) but works with [DateTime](class.datetime).
The procedural version takes the [DateTime](class.datetime) object as its first argument.
### Parameters
`object`
Procedural style only: A [DateTime](class.datetime) object returned by [date\_create()](function.date-create). The function modifies this object.
`interval` A [DateInterval](class.dateinterval) object
### Return Values
Returns the modified [DateTime](class.datetime) object for method chaining.
### See Also
* [DateTimeImmutable::sub()](datetimeimmutable.sub) - Subtracts an amount of days, months, years, hours, minutes and seconds
php ZipArchive::setEncryptionIndex ZipArchive::setEncryptionIndex
==============================
(PHP >= 7.2.0, PHP 8, PECL zip >= 1.14.0)
ZipArchive::setEncryptionIndex — Set the encryption method of an entry defined by its index
### Description
```
public ZipArchive::setEncryptionIndex(int $index, int $method, ?string $password = null): bool
```
Set the encryption method of an entry defined by its index.
### Parameters
`index`
Index of the entry.
`method`
The encryption method defined by one of the ZipArchive::EM\_ constants.
`password`
Optional password, default used when missing.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `password` is now nullable. |
### Notes
>
> **Note**:
>
>
> This function is only available if built against libzip ≥ 1.2.0.
>
>
### See Also
* [ZipArchive::setPassword()](ziparchive.setpassword) - Set the password for the active archive
* [ZipArchive::setEncryptionName()](ziparchive.setencryptionname) - Set the encryption method of an entry defined by its name
php ini_alter ini\_alter
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
ini\_alter — Alias of [ini\_set()](function.ini-set)
### Description
This function is an alias of: [ini\_set()](function.ini-set).
php xml_set_object xml\_set\_object
================
(PHP 4, PHP 5, PHP 7, PHP 8)
xml\_set\_object — Use XML Parser within an object
### Description
```
xml_set_object(XMLParser $parser, object $object): bool
```
This function allows to use `parser` inside `object`. All callback functions could be set with [xml\_set\_element\_handler()](function.xml-set-element-handler) etc and assumed to be methods of `object`.
### Parameters
`parser`
A reference to the XML parser to use inside the object.
`object`
The object where to use the XML parser.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `parser` expects an [XMLParser](class.xmlparser) instance now; previously, a resource was expected. |
### Examples
**Example #1 **xml\_set\_object()** example**
```
<?php
class XMLParser
{
private $parser;
function __construct()
{
$this->parser = xml_parser_create();
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, "tag_open", "tag_close");
xml_set_character_data_handler($this->parser, "cdata");
}
function __destruct()
{
xml_parser_free($this->parser);
unset($this->parser);
}
function parse($data)
{
xml_parse($this->parser, $data);
}
function tag_open($parser, $tag, $attributes)
{
var_dump($tag, $attributes);
}
function cdata($parser, $cdata)
{
var_dump($cdata);
}
function tag_close($parser, $tag)
{
var_dump($tag);
}
}
$xml_parser = new XMLParser();
$xml_parser->parse("<A ID='hallo'>PHP</A>");
?>
```
The above example will output:
```
string(1) "A"
array(1) {
["ID"]=>
string(5) "hallo"
}
string(3) "PHP"
string(1) "A"
```
php ArrayIterator::current ArrayIterator::current
======================
(PHP 5, PHP 7, PHP 8)
ArrayIterator::current — Return current array entry
### Description
```
public ArrayIterator::current(): mixed
```
Get the current array entry.
### Parameters
This function has no parameters.
### Return Values
The current array entry.
### Examples
**Example #1 **ArrayIterator::current()** example**
```
<?php
$array = array('1' => 'one',
'2' => 'two',
'3' => 'three');
$arrayobject = new ArrayObject($array);
for($iterator = $arrayobject->getIterator();
$iterator->valid();
$iterator->next()) {
echo $iterator->key() . ' => ' . $iterator->current() . "\n";
}
?>
```
The above example will output:
```
1 => one
2 => two
3 => three
```
php None Predefined constants
--------------------
PHP provides a large number of [predefined constants](https://www.php.net/manual/en/reserved.constants.php) to any script which it runs. Many of these constants, however, are created by various extensions, and will only be present when those extensions are available, either via dynamic loading or because they have been compiled in.
php date_default_timezone_set date\_default\_timezone\_set
============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
date\_default\_timezone\_set — Sets the default timezone used by all date/time functions in a script
### Description
```
date_default_timezone_set(string $timezoneId): bool
```
**date\_default\_timezone\_set()** sets the default timezone used by all date/time functions.
Instead of using this function to set the default timezone in your script, you can also use the INI setting [date.timezone](https://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone) to set the default timezone.
### Parameters
`timezoneId`
The timezone identifier, like `UTC`, `Africa/Lagos`, `Asia/Hong_Kong`, or `Europe/Lisbon`. The list of valid identifiers is available in the [List of Supported Timezones](https://www.php.net/manual/en/timezones.php).
### Return Values
This function returns **`false`** if the `timezoneId` isn't valid, or **`true`** otherwise.
### Examples
**Example #1 Getting the default timezone**
```
<?php
date_default_timezone_set('America/Los_Angeles');
$script_tz = date_default_timezone_get();
if (strcmp($script_tz, ini_get('date.timezone'))){
echo 'Script timezone differs from ini-set timezone.';
} else {
echo 'Script timezone and ini-set timezone match.';
}
?>
```
### See Also
* [date\_default\_timezone\_get()](function.date-default-timezone-get) - Gets the default timezone used by all date/time functions in a script
* [List of Supported Timezones](https://www.php.net/manual/en/timezones.php)
| programming_docs |
php array_column array\_column
=============
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
array\_column — Return the values from a single column in the input array
### Description
```
array_column(array $array, int|string|null $column_key, int|string|null $index_key = null): array
```
**array\_column()** returns the values from a single column of the `array`, identified by the `column_key`. Optionally, an `index_key` may be provided to index the values in the returned array by the values from the `index_key` column of the input array.
### Parameters
`array`
A multi-dimensional array or an array of objects from which to pull a column of values from. If an array of objects is provided, then public properties can be directly pulled. In order for protected or private properties to be pulled, the class must implement both the **\_\_get()** and **\_\_isset()** magic methods.
`column_key`
The column of values to return. This value may be an integer key of the column you wish to retrieve, or it may be a string key name for an associative array or property name. It may also be **`null`** to return complete arrays or objects (this is useful together with `index_key` to reindex the array).
`index_key`
The column to use as the index/keys for the returned array. This value may be the integer key of the column, or it may be the string key name. The value is [cast](language.types.array#language.types.array.key-casts) as usual for array keys (however, prior to PHP 8.0.0, objects supporting conversion to string were also allowed).
### Return Values
Returns an array of values representing a single column from the input array.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Objects in columns indicated by `index_key` parameter will no longer be cast to string and will now throw a [TypeError](class.typeerror) instead. |
### Examples
**Example #1 Get the column of first names from a recordset**
```
<?php
// Array representing a possible record set returned from a database
$records = array(
array(
'id' => 2135,
'first_name' => 'John',
'last_name' => 'Doe',
),
array(
'id' => 3245,
'first_name' => 'Sally',
'last_name' => 'Smith',
),
array(
'id' => 5342,
'first_name' => 'Jane',
'last_name' => 'Jones',
),
array(
'id' => 5623,
'first_name' => 'Peter',
'last_name' => 'Doe',
)
);
$first_names = array_column($records, 'first_name');
print_r($first_names);
?>
```
The above example will output:
```
Array
(
[0] => John
[1] => Sally
[2] => Jane
[3] => Peter
)
```
**Example #2 Get the column of last names from a recordset, indexed by the "id" column**
```
<?php
// Using the $records array from Example #1
$last_names = array_column($records, 'last_name', 'id');
print_r($last_names);
?>
```
The above example will output:
```
Array
(
[2135] => Doe
[3245] => Smith
[5342] => Jones
[5623] => Doe
)
```
**Example #3 Get the column of usernames from the public "username" property of an object**
```
<?php
class User
{
public $username;
public function __construct(string $username)
{
$this->username = $username;
}
}
$users = [
new User('user 1'),
new User('user 2'),
new User('user 3'),
];
print_r(array_column($users, 'username'));
?>
```
The above example will output:
```
Array
(
[0] => user 1
[1] => user 2
[2] => user 3
)
```
**Example #4 Get the column of names from the private "name" property of an object using the magic **\_\_get()** method.**
```
<?php
class Person
{
private $name;
public function __construct(string $name)
{
$this->name = $name;
}
public function __get($prop)
{
return $this->$prop;
}
public function __isset($prop) : bool
{
return isset($this->$prop);
}
}
$people = [
new Person('Fred'),
new Person('Jane'),
new Person('John'),
];
print_r(array_column($people, 'name'));
?>
```
The above example will output:
```
Array
(
[0] => Fred
[1] => Jane
[2] => John
)
```
If **\_\_isset()** is not provided, then an empty array will be returned.
php ssh2_auth_pubkey_file ssh2\_auth\_pubkey\_file
========================
(PECL ssh2 >= 0.9.0)
ssh2\_auth\_pubkey\_file — Authenticate using a public key
### Description
```
ssh2_auth_pubkey_file(
resource $session,
string $username,
string $pubkeyfile,
string $privkeyfile,
string $passphrase = ?
): bool
```
Authenticate using a public key read from a file.
### Parameters
`session`
An SSH connection link identifier, obtained from a call to [ssh2\_connect()](function.ssh2-connect).
`username`
`pubkeyfile`
The public key file needs to be in OpenSSH's format. It should look something like:
ssh-rsa AAAAB3NzaC1yc2EAAA....NX6sqSnHA8= rsa-key-20121110
`privkeyfile`
`passphrase`
If `privkeyfile` is encrypted (which it should be), the `passphrase` must be provided.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Authentication using a public key**
```
<?php
$connection = ssh2_connect('shell.example.com', 22, array('hostkey'=>'ssh-rsa'));
if (ssh2_auth_pubkey_file($connection, 'username',
'/home/username/.ssh/id_rsa.pub',
'/home/username/.ssh/id_rsa', 'secret')) {
echo "Public Key Authentication Successful\n";
} else {
die('Public Key Authentication Failed');
}
?>
```
### Notes
>
> **Note**:
>
>
> The underlying libssh library doesn't support partial auths very cleanly That is, if you need to supply both a public key and a password it will appear as if this function has failed. In this particular case a failure from this call may just mean that auth hasn't been completed yet. You would need to ignore this failure and continue on and call [ssh2\_auth\_password()](function.ssh2-auth-password) in order to complete authentication.
>
>
php DirectoryIterator::getPathname DirectoryIterator::getPathname
==============================
(PHP 5, PHP 7, PHP 8)
DirectoryIterator::getPathname — Return path and file name of current DirectoryIterator item
### Description
```
public DirectoryIterator::getPathname(): string
```
Get the path and file name of the current file.
### Parameters
This function has no parameters.
### Return Values
Returns the path and file name of current file. Directories do not have a trailing slash.
### Examples
**Example #1 **DirectoryIterator::getPathname()** example**
```
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
foreach ($iterator as $fileinfo) {
echo $fileinfo->getPathname() . "\n";
}
?>
```
The above example will output something similar to:
```
/home/examples/.
/home/examples/..
/home/examples/apple.jpg
/home/examples/banana.jpg
/home/examples/getpathname.php
/home/examples/pear.jpg
```
### See Also
* [DirectoryIterator::getBasename()](directoryiterator.getbasename) - Get base name of current DirectoryIterator item
* [DirectoryIterator::getFilename()](directoryiterator.getfilename) - Return file name of current DirectoryIterator item
* [DirectoryIterator::getPath()](directoryiterator.getpath) - Get path of current Iterator item without filename
* [pathinfo()](function.pathinfo) - Returns information about a file path
php AppendIterator::current AppendIterator::current
=======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
AppendIterator::current — Gets the current value
### Description
```
public AppendIterator::current(): mixed
```
Gets the current value.
### Parameters
This function has no parameters.
### Return Values
The current value if it is valid or **`null`** otherwise.
### See Also
* [Iterator::current()](iterator.current) - Return the current element
* [AppendIterator::key()](appenditerator.key) - Gets the current key
* [AppendIterator::valid()](appenditerator.valid) - Checks validity of the current element
* [AppendIterator::next()](appenditerator.next) - Moves to the next element
* [AppendIterator::rewind()](appenditerator.rewind) - Rewinds the Iterator
php ibase_num_fields ibase\_num\_fields
==================
(PHP 5, PHP 7 < 7.4.0)
ibase\_num\_fields — Get the number of fields in a result set
### Description
```
ibase_num_fields(resource $result_id): int
```
Get the number of fields in a result set.
### Parameters
`result_id`
An InterBase result identifier.
### Return Values
Returns the number of fields as an integer.
### Examples
**Example #1 **ibase\_num\_fields()** example**
```
<?php
$rs = ibase_query("SELECT * FROM tablename");
$coln = ibase_num_fields($rs);
for ($i = 0; $i < $coln; $i++) {
$col_info = ibase_field_info($rs, $i);
echo "name: " . $col_info['name'] . "\n";
echo "alias: " . $col_info['alias'] . "\n";
echo "relation: " . $col_info['relation'] . "\n";
echo "length: " . $col_info['length'] . "\n";
echo "type: " . $col_info['type'] . "\n";
}
?>
```
### See Also
* [ibase\_field\_info()](function.ibase-field-info) - Get information about a field
php zlib_decode zlib\_decode
============
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
zlib\_decode — Uncompress any raw/gzip/zlib encoded data
### Description
```
zlib_decode(string $data, int $max_length = 0): string|false
```
Uncompress any raw/gzip/zlib encoded data.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`data`
`max_length`
### Return Values
Returns the uncompressed data, or **`false`** on failure.
### See Also
* [zlib\_encode()](function.zlib-encode) - Compress data with the specified encoding
php svn_fs_delete svn\_fs\_delete
===============
(PECL svn >= 0.2.0)
svn\_fs\_delete — Deletes a file or a directory
### Description
```
svn_fs_delete(resource $root, string $path): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Deletes a file or a directory.
### Parameters
`root`
`path`
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Notes
**Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
php array_diff_uassoc array\_diff\_uassoc
===================
(PHP 5, PHP 7, PHP 8)
array\_diff\_uassoc — Computes the difference of arrays with additional index check which is performed by a user supplied callback function
### Description
```
array_diff_uassoc(array $array, array ...$arrays, callable $key_compare_func): array
```
Compares `array` against `arrays` and returns the difference. Unlike [array\_diff()](function.array-diff) the array keys are used in the comparison.
Unlike [array\_diff\_assoc()](function.array-diff-assoc) a user supplied callback function is used for the indices comparison, not internal function.
### Parameters
`array`
The array to compare from
`arrays`
Arrays to compare against
`key_compare_func`
The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
```
callback(mixed $a, mixed $b): int
```
### Return Values
Returns an array containing all the entries from `array` that are not present in any of the other arrays.
### Examples
**Example #1 **array\_diff\_uassoc()** example**
The `"a" => "green"` pair is present in both arrays and thus it is not in the output from the function. Unlike this, the pair `0 => "red"` is in the output because in the second argument `"red"` has key which is `1`.
```
<?php
function key_compare_func($a, $b)
{
if ($a === $b) {
return 0;
}
return ($a > $b)? 1:-1;
}
$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array2 = array("a" => "green", "yellow", "red");
$result = array_diff_uassoc($array1, $array2, "key_compare_func");
print_r($result);
?>
```
The above example will output:
```
Array
(
[b] => brown
[c] => blue
[0] => red
)
```
The equality of 2 indices is checked by the user supplied callback function.
### Notes
>
> **Note**:
>
>
> This function only checks one dimension of a n-dimensional array. Of course you can check deeper dimensions by using, for example, `array_diff_uassoc($array1[0], $array2[0], "key_compare_func");`.
>
>
### See Also
* [array\_diff()](function.array-diff) - Computes the difference of arrays
* [array\_diff\_assoc()](function.array-diff-assoc) - Computes the difference of arrays with additional index check
* [array\_udiff()](function.array-udiff) - Computes the difference of arrays by using a callback function for data comparison
* [array\_udiff\_assoc()](function.array-udiff-assoc) - Computes the difference of arrays with additional index check, compares data by a callback function
* [array\_udiff\_uassoc()](function.array-udiff-uassoc) - Computes the difference of arrays with additional index check, compares data and indexes by a callback function
* [array\_intersect()](function.array-intersect) - Computes the intersection of arrays
* [array\_intersect\_assoc()](function.array-intersect-assoc) - Computes the intersection of arrays with additional index check
* [array\_uintersect()](function.array-uintersect) - Computes the intersection of arrays, compares data by a callback function
* [array\_uintersect\_assoc()](function.array-uintersect-assoc) - Computes the intersection of arrays with additional index check, compares data by a callback function
* [array\_uintersect\_uassoc()](function.array-uintersect-uassoc) - Computes the intersection of arrays with additional index check, compares data and indexes by separate callback functions
php The EventHttp class
The EventHttp class
===================
Introduction
------------
(PECL event >= 1.4.0-beta)
Represents HTTP server.
Class synopsis
--------------
final class **EventHttp** { /\* Methods \*/
```
public accept( mixed $socket ): bool
```
```
public addServerAlias( string $alias ): bool
```
```
public bind( string $address , int $port ): void
```
```
public __construct( EventBase $base , EventSslContext $ctx = null )
```
```
public removeServerAlias( string $alias ): bool
```
```
public setAllowedMethods( int $methods ): void
```
```
public setCallback( string $path , string $cb , string $arg = ?): void
```
```
public setDefaultCallback( string $cb , string $arg = ?): void
```
```
public setMaxBodySize( int $value ): void
```
```
public setMaxHeadersSize( int $value ): void
```
```
public setTimeout( int $value ): void
```
} Table of Contents
-----------------
* [EventHttp::accept](eventhttp.accept) — Makes an HTTP server accept connections on the specified socket stream or resource
* [EventHttp::addServerAlias](eventhttp.addserveralias) — Adds a server alias to the HTTP server object
* [EventHttp::bind](eventhttp.bind) — Binds an HTTP server on the specified address and port
* [EventHttp::\_\_construct](eventhttp.construct) — Constructs EventHttp object(the HTTP server)
* [EventHttp::removeServerAlias](eventhttp.removeserveralias) — Removes server alias
* [EventHttp::setAllowedMethods](eventhttp.setallowedmethods) — Sets the what HTTP methods are supported in requests accepted by this server, and passed to user callbacks
* [EventHttp::setCallback](eventhttp.setcallback) — Sets a callback for specified URI
* [EventHttp::setDefaultCallback](eventhttp.setdefaultcallback) — Sets default callback to handle requests that are not caught by specific callbacks
* [EventHttp::setMaxBodySize](eventhttp.setmaxbodysize) — Sets maximum request body size
* [EventHttp::setMaxHeadersSize](eventhttp.setmaxheaderssize) — Sets maximum HTTP header size
* [EventHttp::setTimeout](eventhttp.settimeout) — Sets the timeout for an HTTP request
php chown chown
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
chown — Changes file owner
### Description
```
chown(string $filename, string|int $user): bool
```
Attempts to change the owner of the file `filename` to user `user`. Only the superuser may change the owner of a file.
### Parameters
`filename`
Path to the file.
`user`
A user name or number.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Simple **chown()** usage**
```
<?php
// File name and username to use
$file_name= "foo.php";
$path = "/home/sites/php.net/public_html/sandbox/" . $file_name ;
$user_name = "root";
// Set the user
chown($path, $user_name);
// Check the result
$stat = stat($path);
print_r(posix_getpwuid($stat['uid']));
?>
```
The above example will output something similar to:
```
Array
(
[name] => root
[passwd] => x
[uid] => 0
[gid] => 0
[gecos] => root
[dir] => /root
[shell] => /bin/bash
)
```
### Notes
> **Note**: This function will not work on [remote files](https://www.php.net/manual/en/features.remote-files.php) as the file to be examined must be accessible via the server's filesystem.
>
>
> **Note**: On Windows, this function fails silently when applied on a regular file.
>
>
### See Also
* [chmod()](function.chmod) - Changes file mode
* [chgrp()](function.chgrp) - Changes file group
php SolrQuery::setGroupTruncate SolrQuery::setGroupTruncate
===========================
(PECL solr >= 2.2.0)
SolrQuery::setGroupTruncate — If true, facet counts are based on the most relevant document of each group matching the query
### Description
```
public SolrQuery::setGroupTruncate(bool $value): SolrQuery
```
If true, facet counts are based on the most relevant document of each group matching the query. The server default value is false. group.truncate parameter
### Parameters
`value`
### Return Values
### See Also
* [SolrQuery::setGroup()](solrquery.setgroup) - Enable/Disable result grouping (group parameter)
* [SolrQuery::addGroupField()](solrquery.addgroupfield) - Add a field to be used to group results
* [SolrQuery::addGroupFunction()](solrquery.addgroupfunction) - Allows grouping results based on the unique values of a function query (group.func parameter)
* [SolrQuery::addGroupQuery()](solrquery.addgroupquery) - Allows grouping of documents that match the given query
* [SolrQuery::addGroupSortField()](solrquery.addgroupsortfield) - Add a group sort field (group.sort parameter)
* [SolrQuery::setGroupFacet()](solrquery.setgroupfacet) - Sets group.facet parameter
* [SolrQuery::setGroupOffset()](solrquery.setgroupoffset) - Sets the group.offset parameter
* [SolrQuery::setGroupLimit()](solrquery.setgrouplimit) - Specifies the number of results to return for each group. The server default value is 1
* [SolrQuery::setGroupMain()](solrquery.setgroupmain) - If true, the result of the first field grouping command is used as the main result list in the response, using group.format=simple
* [SolrQuery::setGroupNGroups()](solrquery.setgroupngroups) - If true, Solr includes the number of groups that have matched the query in the results
* [SolrQuery::setGroupFormat()](solrquery.setgroupformat) - Sets the group format, result structure (group.format parameter)
* [SolrQuery::setGroupCachePercent()](solrquery.setgroupcachepercent) - Enables caching for result grouping
php The DOMAttr class
The DOMAttr class
=================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
**DOMAttr** represents an attribute in the [DOMElement](class.domelement) object.
Class synopsis
--------------
class **DOMAttr** extends [DOMNode](class.domnode) { /\* Properties \*/ public readonly string [$name](class.domattr#domattr.props.name);
public readonly bool [$specified](class.domattr#domattr.props.specified) = true;
public string [$value](class.domattr#domattr.props.value);
public readonly ?[DOMElement](class.domelement) [$ownerElement](class.domattr#domattr.props.ownerelement);
public readonly [mixed](language.types.declarations#language.types.declarations.mixed) [$schemaTypeInfo](class.domattr#domattr.props.schematypeinfo) = null; /\* Inherited properties \*/
public readonly string [$nodeName](class.domnode#domnode.props.nodename);
public ?string [$nodeValue](class.domnode#domnode.props.nodevalue);
public readonly int [$nodeType](class.domnode#domnode.props.nodetype);
public readonly ?[DOMNode](class.domnode) [$parentNode](class.domnode#domnode.props.parentnode);
public readonly [DOMNodeList](class.domnodelist) [$childNodes](class.domnode#domnode.props.childnodes);
public readonly ?[DOMNode](class.domnode) [$firstChild](class.domnode#domnode.props.firstchild);
public readonly ?[DOMNode](class.domnode) [$lastChild](class.domnode#domnode.props.lastchild);
public readonly ?[DOMNode](class.domnode) [$previousSibling](class.domnode#domnode.props.previoussibling);
public readonly ?[DOMNode](class.domnode) [$nextSibling](class.domnode#domnode.props.nextsibling);
public readonly ?[DOMNamedNodeMap](class.domnamednodemap) [$attributes](class.domnode#domnode.props.attributes);
public readonly ?[DOMDocument](class.domdocument) [$ownerDocument](class.domnode#domnode.props.ownerdocument);
public readonly ?string [$namespaceURI](class.domnode#domnode.props.namespaceuri);
public string [$prefix](class.domnode#domnode.props.prefix);
public readonly ?string [$localName](class.domnode#domnode.props.localname);
public readonly ?string [$baseURI](class.domnode#domnode.props.baseuri);
public string [$textContent](class.domnode#domnode.props.textcontent); /\* Methods \*/ public [\_\_construct](domattr.construct)(string `$name`, string `$value` = "")
```
public isId(): bool
```
/\* Inherited methods \*/
```
public DOMNode::appendChild(DOMNode $node): DOMNode|false
```
```
public DOMNode::C14N(
bool $exclusive = false,
bool $withComments = false,
?array $xpath = null,
?array $nsPrefixes = null
): string|false
```
```
public DOMNode::C14NFile(
string $uri,
bool $exclusive = false,
bool $withComments = false,
?array $xpath = null,
?array $nsPrefixes = null
): int|false
```
```
public DOMNode::cloneNode(bool $deep = false): DOMNode|false
```
```
public DOMNode::getLineNo(): int
```
```
public DOMNode::getNodePath(): ?string
```
```
public DOMNode::hasAttributes(): bool
```
```
public DOMNode::hasChildNodes(): bool
```
```
public DOMNode::insertBefore(DOMNode $node, ?DOMNode $child = null): DOMNode|false
```
```
public DOMNode::isDefaultNamespace(string $namespace): bool
```
```
public DOMNode::isSameNode(DOMNode $otherNode): bool
```
```
public DOMNode::isSupported(string $feature, string $version): bool
```
```
public DOMNode::lookupNamespaceUri(string $prefix): string
```
```
public DOMNode::lookupPrefix(string $namespace): ?string
```
```
public DOMNode::normalize(): void
```
```
public DOMNode::removeChild(DOMNode $child): DOMNode|false
```
```
public DOMNode::replaceChild(DOMNode $node, DOMNode $child): DOMNode|false
```
} Properties
----------
name The name of the attribute.
ownerElement The element which contains the attribute or **`null`**.
schemaTypeInfo Not implemented yet, always is **`null`**.
specified Not implemented yet, always is **`true`**.
value The value of the attribute.
See Also
--------
* [» W3C specification of Attr](http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-637646024)
Table of Contents
-----------------
* [DOMAttr::\_\_construct](domattr.construct) — Creates a new DOMAttr object
* [DOMAttr::isId](domattr.isid) — Checks if attribute is a defined ID
| programming_docs |
php Generator::__wakeup Generator::\_\_wakeup
=====================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
Generator::\_\_wakeup — Serialize callback
### Description
```
public Generator::__wakeup(): void
```
Throws an exception as generators can't be serialized.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php ucwords ucwords
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
ucwords — Uppercase the first character of each word in a string
### Description
```
ucwords(string $string, string $separators = " \t\r\n\f\v"): string
```
Returns a string with the first character of each word in `string` capitalized, if that character is an ASCII character between `"a"` (0x61) and `"z"` (0x7a).
For this function, a word is a string of characters that are not listed in the `separators` parameter. By default, these are: space, horizontal tab, carriage return, newline, form-feed and vertical tab.
To do a similar conversion on multibyte strings, use [mb\_convert\_case()](function.mb-convert-case) with the **`MB_CASE_TITLE`** mode.
### Parameters
`string`
The input string.
`separators`
The optional `separators` contains the word separator characters.
### Return Values
Returns the modified string.
### Changelog
| Version | Description |
| --- | --- |
| 8.2.0 | Case conversion no longer depends on the locale set with [setlocale()](function.setlocale). Only ASCII characters will be converted. |
### Examples
**Example #1 **ucwords()** example**
```
<?php
$foo = 'hello world!';
$foo = ucwords($foo); // Hello World!
$bar = 'HELLO WORLD!';
$bar = ucwords($bar); // HELLO WORLD!
$bar = ucwords(strtolower($bar)); // Hello World!
?>
```
**Example #2 **ucwords()** example with custom delimiter**
```
<?php
$foo = 'hello|world!';
$bar = ucwords($foo); // Hello|world!
$baz = ucwords($foo, "|"); // Hello|World!
?>
```
**Example #3 **ucwords()** example with additional delimiters**
```
<?php
$foo = "mike o'hara";
$bar = ucwords($foo); // Mike O'hara
$baz = ucwords($foo, " \t\r\n\f\v'"); // Mike O'Hara
?>
```
### Notes
> **Note**: This function is binary-safe.
>
>
### See Also
* [strtoupper()](function.strtoupper) - Make a string uppercase
* [strtolower()](function.strtolower) - Make a string lowercase
* [ucfirst()](function.ucfirst) - Make a string's first character uppercase
* [mb\_convert\_case()](function.mb-convert-case) - Perform case folding on a string
php The SolrResponse class
The SolrResponse class
======================
Introduction
------------
(PECL solr >= 0.9.2)
Represents a response from the Solr server.
Class synopsis
--------------
abstract class **SolrResponse** { /\* Constants \*/ const int [PARSE\_SOLR\_OBJ](class.solrresponse#solrresponse.constants.parse-solr-obj) = 0;
const int [PARSE\_SOLR\_DOC](class.solrresponse#solrresponse.constants.parse-solr-doc) = 1; /\* Properties \*/
protected int [$http\_status](class.solrresponse#solrresponse.props.http-status);
protected int [$parser\_mode](class.solrresponse#solrresponse.props.parser-mode);
protected bool [$success](class.solrresponse#solrresponse.props.success);
protected string [$http\_status\_message](class.solrresponse#solrresponse.props.http-status-message);
protected string [$http\_request\_url](class.solrresponse#solrresponse.props.http-request-url);
protected string [$http\_raw\_request\_headers](class.solrresponse#solrresponse.props.http-raw-request-headers);
protected string [$http\_raw\_request](class.solrresponse#solrresponse.props.http-raw-request);
protected string [$http\_raw\_response\_headers](class.solrresponse#solrresponse.props.http-raw-response-headers);
protected string [$http\_raw\_response](class.solrresponse#solrresponse.props.http-raw-response);
protected string [$http\_digested\_response](class.solrresponse#solrresponse.props.http-digested-response); /\* Methods \*/
```
public getDigestedResponse(): string
```
```
public getHttpStatus(): int
```
```
public getHttpStatusMessage(): string
```
```
public getRawRequest(): string
```
```
public getRawRequestHeaders(): string
```
```
public getRawResponse(): string
```
```
public getRawResponseHeaders(): string
```
```
public getRequestUrl(): string
```
```
public getResponse(): SolrObject
```
```
public setParseMode(int $parser_mode = 0): bool
```
```
public success(): bool
```
} Properties
----------
http\_status The http status of the response.
parser\_mode Whether to parse the solr documents as SolrObject or SolrDocument instances.
success Was there an error during the request
http\_status\_message Detailed message on http status
http\_request\_url The request URL
http\_raw\_request\_headers A string of raw headers sent during the request.
http\_raw\_request The raw request sent to the server
http\_raw\_response\_headers Response headers from the Solr server.
http\_raw\_response The response message from the server.
http\_digested\_response The response in PHP serialized format.
Predefined Constants
--------------------
SolrResponse Class Constants
----------------------------
**`SolrResponse::PARSE_SOLR_OBJ`** Documents should be parsed as SolrObject instances
**`SolrResponse::PARSE_SOLR_DOC`** Documents should be parsed as SolrDocument instances.
Table of Contents
-----------------
* [SolrResponse::getDigestedResponse](solrresponse.getdigestedresponse) — Returns the XML response as serialized PHP data
* [SolrResponse::getHttpStatus](solrresponse.gethttpstatus) — Returns the HTTP status of the response
* [SolrResponse::getHttpStatusMessage](solrresponse.gethttpstatusmessage) — Returns more details on the HTTP status
* [SolrResponse::getRawRequest](solrresponse.getrawrequest) — Returns the raw request sent to the Solr server
* [SolrResponse::getRawRequestHeaders](solrresponse.getrawrequestheaders) — Returns the raw request headers sent to the Solr server
* [SolrResponse::getRawResponse](solrresponse.getrawresponse) — Returns the raw response from the server
* [SolrResponse::getRawResponseHeaders](solrresponse.getrawresponseheaders) — Returns the raw response headers from the server
* [SolrResponse::getRequestUrl](solrresponse.getrequesturl) — Returns the full URL the request was sent to
* [SolrResponse::getResponse](solrresponse.getresponse) — Returns a SolrObject representing the XML response from the server
* [SolrResponse::setParseMode](solrresponse.setparsemode) — Sets the parse mode
* [SolrResponse::success](solrresponse.success) — Was the request a success
php mysqli_result::field_seek mysqli\_result::field\_seek
===========================
mysqli\_field\_seek
===================
(PHP 5, PHP 7, PHP 8)
mysqli\_result::field\_seek -- mysqli\_field\_seek — Set result pointer to a specified field offset
### Description
Object-oriented style
```
public mysqli_result::field_seek(int $index): bool
```
Procedural style
```
mysqli_field_seek(mysqli_result $result, int $index): bool
```
Sets the field cursor to the given offset. The next call to [mysqli\_fetch\_field()](mysqli-result.fetch-field) will retrieve the field definition of the column associated with that offset.
>
> **Note**:
>
>
> To seek to the beginning of a row, pass an offset value of zero.
>
>
### Parameters
`result`
Procedural style only: A [mysqli\_result](class.mysqli-result) object returned by [mysqli\_query()](mysqli.query), [mysqli\_store\_result()](mysqli.store-result), [mysqli\_use\_result()](mysqli.use-result) or [mysqli\_stmt\_get\_result()](mysqli-stmt.get-result).
`index`
The field number. This value must be in the range from `0` to `number of fields - 1`.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Object-oriented style**
```
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";
if ($result = $mysqli->query($query)) {
/* Get field information for 2nd column */
$result->field_seek(1);
$finfo = $result->fetch_field();
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n\n", $finfo->type);
$result->close();
}
/* close connection */
$mysqli->close();
?>
```
**Example #2 Procedural style**
```
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, SurfaceArea from Country ORDER BY Code LIMIT 5";
if ($result = mysqli_query($link, $query)) {
/* Get field information for 2nd column */
mysqli_field_seek($result, 1);
$finfo = mysqli_fetch_field($result);
printf("Name: %s\n", $finfo->name);
printf("Table: %s\n", $finfo->table);
printf("max. Len: %d\n", $finfo->max_length);
printf("Flags: %d\n", $finfo->flags);
printf("Type: %d\n\n", $finfo->type);
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
```
The above examples will output:
```
Name: SurfaceArea
Table: Country
max. Len: 10
Flags: 32769
Type: 4
```
### See Also
* [mysqli\_fetch\_field()](mysqli-result.fetch-field) - Returns the next field in the result set
php EvLoop::defaultLoop EvLoop::defaultLoop
===================
(PECL ev >= 0.2.0)
EvLoop::defaultLoop — Returns or creates the default event loop
### Description
```
public static EvLoop::defaultLoop(
int $flags = Ev::FLAG_AUTO ,
mixed $data = NULL ,
float $io_interval = 0. ,
float $timeout_interval = 0.
): EvLoop
```
If the default event loop is not created, **EvLoop::defaultLoop()** creates it with the specified parameters. Otherwise, it just returns the object representing previously created instance ignoring all the parameters.
### Parameters
`flags` One of the [event loop flags](class.ev#ev.constants.loop-flags)
`data` Custom data to associate with the loop.
`io_collect_interval` See [io\_interval](class.evloop#evloop.props.io-interval)
`timeout_collect_interval` See [timeout\_interval](class.evloop#evloop.props.timeout-interval)
### Return Values
Returns EvLoop object on success.
### See Also
* [EvLoop::\_\_construct()](evloop.construct) - Constructs the event loop object
php None declare
-------
(PHP 4, PHP 5, PHP 7, PHP 8)
The `declare` construct is used to set execution directives for a block of code. The syntax of `declare` is similar to the syntax of other flow control constructs:
```
declare (directive)
statement
```
The `directive` section allows the behavior of the `declare` block to be set. Currently only three directives are recognized: the `ticks` directive (See below for more information on the [ticks](control-structures.declare#control-structures.declare.ticks) directive), the `encoding` directive (See below for more information on the [encoding](control-structures.declare#control-structures.declare.encoding) directive) and the `strict_types` directive (See for more information the [strict typing](language.types.declarations#language.types.declarations.strict) section on the type declarations page)
As directives are handled as the file is being compiled, only literals may be given as directive values. Variables and constants cannot be used. To illustrate:
```
<?php
// This is valid:
declare(ticks=1);
// This is invalid:
const TICK_VALUE = 1;
declare(ticks=TICK_VALUE);
?>
```
The `statement` part of the `declare` block will be executed - how it is executed and what side effects occur during execution may depend on the directive set in the `directive` block.
The `declare` construct can also be used in the global scope, affecting all code following it (however if the file with `declare` was included then it does not affect the parent file).
```
<?php
// these are the same:
// you can use this:
declare(ticks=1) {
// entire script here
}
// or you can use this:
declare(ticks=1);
// entire script here
?>
```
### Ticks
A tick is an event that occurs for every N low-level tickable statements executed by the parser within the `declare` block. The value for N is specified using `ticks=N` within the `declare` block's `directive` section.
Not all statements are tickable. Typically, condition expressions and argument expressions are not tickable.
The event(s) that occur on each tick are specified using the [register\_tick\_function()](function.register-tick-function). See the example below for more details. Note that more than one event can occur for each tick.
**Example #1 Tick usage example**
```
<?php
declare(ticks=1);
// A function called on each tick event
function tick_handler()
{
echo "tick_handler() called\n";
}
register_tick_function('tick_handler'); // causes a tick event
$a = 1; // causes a tick event
if ($a > 0) {
$a += 2; // causes a tick event
print($a); // causes a tick event
}
?>
```
See also [register\_tick\_function()](function.register-tick-function) and [unregister\_tick\_function()](function.unregister-tick-function).
### Encoding
A script's encoding can be specified per-script using the `encoding` directive.
**Example #2 Declaring an encoding for the script.**
```
<?php
declare(encoding='ISO-8859-1');
// code here
?>
```
**Caution** When combined with namespaces, the only legal syntax for declare is `declare(encoding='...');` where `...` is the encoding value. `declare(encoding='...') {}` will result in a parse error when combined with namespaces.
See also [zend.script\_encoding](https://www.php.net/manual/en/ini.core.php#ini.zend.script-encoding).
php gmp_gcdext gmp\_gcdext
===========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_gcdext — Calculate GCD and multipliers
### Description
```
gmp_gcdext(GMP|int|string $num1, GMP|int|string $num2): array
```
Calculates g, s, and t, such that `a*s + b*t = g =
gcd(a,b)`, where gcd is the greatest common divisor. Returns an array with respective elements g, s and t.
This function can be used to solve linear Diophantine equations in two variables. These are equations that allow only integer solutions and have the form: `a*x + b*y = c`. For more information, go to the [» "Diophantine Equation" page at MathWorld](http://mathworld.wolfram.com/DiophantineEquation.html)
### Parameters
`num1`
A [GMP](class.gmp) object, an int or a numeric string.
`num2`
A [GMP](class.gmp) object, an int or a numeric string.
### Return Values
An array of GMP numbers.
### Examples
**Example #1 Solving a linear Diophantine equation**
```
<?php
// Solve the equation a*s + b*t = g
// where a = 12, b = 21, g = gcd(12, 21) = 3
$a = gmp_init(12);
$b = gmp_init(21);
$g = gmp_gcd($a, $b);
$r = gmp_gcdext($a, $b);
$check_gcd = (gmp_strval($g) == gmp_strval($r['g']));
$eq_res = gmp_add(gmp_mul($a, $r['s']), gmp_mul($b, $r['t']));
$check_res = (gmp_strval($g) == gmp_strval($eq_res));
if ($check_gcd && $check_res) {
$fmt = "Solution: %d*%d + %d*%d = %d\n";
printf($fmt, gmp_strval($a), gmp_strval($r['s']), gmp_strval($b),
gmp_strval($r['t']), gmp_strval($r['g']));
} else {
echo "Error while solving the equation\n";
}
// output: Solution: 12*2 + 21*-1 = 3
?>
```
php Imagick::setLastIterator Imagick::setLastIterator
========================
(PECL imagick 2 >= 2.0.1, PECL imagick 3)
Imagick::setLastIterator — Sets the Imagick iterator to the last image
### Description
```
public Imagick::setLastIterator(): bool
```
Sets the Imagick iterator to the last image.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success.
php getprotobyname getprotobyname
==============
(PHP 4, PHP 5, PHP 7, PHP 8)
getprotobyname — Get protocol number associated with protocol name
### Description
```
getprotobyname(string $protocol): int|false
```
**getprotobyname()** returns the protocol number associated with the protocol `protocol` as per /etc/protocols.
### Parameters
`protocol`
The protocol name.
### Return Values
Returns the protocol number, or **`false`** on failure.
### Examples
**Example #1 **getprotobyname()** example**
```
<?php
$protocol = 'tcp';
$get_prot = getprotobyname($protocol);
if ($get_prot === FALSE) {
echo 'Invalid Protocol';
} else {
echo 'Protocol #' . $get_prot;
}
?>
```
### See Also
* [getprotobynumber()](function.getprotobynumber) - Get protocol name associated with protocol number
php SNMP::get SNMP::get
=========
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
SNMP::get — Fetch an SNMP object
### Description
```
public SNMP::get(array|string $objectId, bool $preserveKeys = false): mixed
```
Fetch an SNMP object specified in `objectId` using GET query.
### Parameters
If `objectId` is a string, then **SNMP::get()** will return SNMP object as string. If `objectId` is a array, all requested SNMP objects will be returned as associative array of the SNMP object ids and their values.
`objectId`
The SNMP object (OID) or objects
`preserveKeys`
When `objectId` is a array and `preserveKeys` set to **`true`** keys in results will be taken exactly as in `objectId`, otherwise SNMP::oid\_output\_format property is used to determinate the form of keys.
### Return Values
Returns SNMP objects requested as string or array depending on `objectId` type or **`false`** on error.
### Errors/Exceptions
This method does not throw any exceptions by default. To enable throwing an SNMPException exception when some of library errors occur the SNMP class parameter `exceptions_enabled` should be set to a corresponding value. See [`SNMP::$exceptions_enabled` explanation](class.snmp#snmp.props.exceptions-enabled) for more details.
### Examples
**Example #1 Single SNMP object**
Single SNMP object may be requested in two ways: as string resulting string return value or as single-element array with associative array as output.
```
<?php
$session = new SNMP(SNMP::VERSION_1, "127.0.0.1", "public");
$sysdescr = $session->get("sysDescr.0");
echo "$sysdescr\n";
$sysdescr = $session->get(array("sysDescr.0"));
print_r($sysdescr);
?>
```
The above example will output something similar to:
```
STRING: Test server
Array
(
[SNMPv2-MIB::sysDescr.0] => STRING: Test server
)
```
**Example #2 Multiple SNMP objects**
```
$session = new SNMP(SNMP::VERSION_1, "127.0.0.1", "public");
$results = $session->get(array("sysDescr.0", "sysName.0"));
print_r($results);
$session->close();
```
The above example will output something similar to:
```
Array
(
[SNMPv2-MIB::sysDescr.0] => STRING: Test server
[SNMPv2-MIB::sysName.0] => STRING: myhost.nodomain
)
```
### See Also
* [SNMP::getErrno()](snmp.geterrno) - Get last error code
* [SNMP::getError()](snmp.geterror) - Get last error message
php Componere\Method::setPrivate Componere\Method::setPrivate
============================
(Componere 2 >= 2.1.0)
Componere\Method::setPrivate — Accessibility Modification
### Description
```
public Componere\Method::setPrivate(): Method
```
### Return Values
The current Method
### Exceptions
**Warning** Shall throw [RuntimeException](class.runtimeexception) if access level was previously set
| programming_docs |
php SolrQuery::getTimeAllowed SolrQuery::getTimeAllowed
=========================
(PECL solr >= 0.9.2)
SolrQuery::getTimeAllowed — Returns the time in milliseconds allowed for the query to finish
### Description
```
public SolrQuery::getTimeAllowed(): int
```
Returns the time in milliseconds allowed for the query to finish.
### Parameters
This function has no parameters.
### Return Values
Returns and integer on success and **`null`** if it is not set.
php dio_read dio\_read
=========
(PHP 4 >= 4.2.0, PHP 5 < 5.1.0)
dio\_read — Reads bytes from a file descriptor
### Description
```
dio_read(resource $fd, int $len = 1024): string
```
The function **dio\_read()** reads and returns `len` bytes from file with descriptor `fd`.
### Parameters
`fd`
The file descriptor returned by [dio\_open()](function.dio-open).
`len`
The number of bytes to read. If not specified, **dio\_read()** reads 1K sized block.
### Return Values
The bytes read from `fd`.
### See Also
* [dio\_write()](function.dio-write) - Writes data to fd with optional truncation at length
php mysqli_stmt::$param_count mysqli\_stmt::$param\_count
===========================
mysqli\_stmt\_param\_count
==========================
(PHP 5, PHP 7, PHP 8)
mysqli\_stmt::$param\_count -- mysqli\_stmt\_param\_count — Returns the number of parameters for the given statement
### Description
Object-oriented style
int [$mysqli\_stmt->param\_count](mysqli-stmt.param-count); Procedural style
```
mysqli_stmt_param_count(mysqli_stmt $statement): int
```
Returns the number of parameter markers present in the prepared statement.
### Parameters
`statement`
Procedural style only: A [mysqli\_stmt](class.mysqli-stmt) object returned by [mysqli\_stmt\_init()](mysqli.stmt-init).
### Return Values
Returns an integer representing the number of parameters.
### Examples
**Example #1 Object-oriented style**
```
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($stmt = $mysqli->prepare("SELECT Name FROM Country WHERE Name=? OR Code=?")) {
$marker = $stmt->param_count;
printf("Statement has %d markers.\n", $marker);
/* close statement */
$stmt->close();
}
/* close connection */
$mysqli->close();
?>
```
**Example #2 Procedural style**
```
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($stmt = mysqli_prepare($link, "SELECT Name FROM Country WHERE Name=? OR Code=?")) {
$marker = mysqli_stmt_param_count($stmt);
printf("Statement has %d markers.\n", $marker);
/* close statement */
mysqli_stmt_close($stmt);
}
/* close connection */
mysqli_close($link);
?>
```
The above examples will output:
```
Statement has 2 markers.
```
### See Also
* [mysqli\_prepare()](mysqli.prepare) - Prepares an SQL statement for execution
php mysqli::$field_count mysqli::$field\_count
=====================
mysqli\_field\_count
====================
(PHP 5, PHP 7, PHP 8)
mysqli::$field\_count -- mysqli\_field\_count — Returns the number of columns for the most recent query
### Description
Object-oriented style
int [$mysqli->field\_count](mysqli.field-count); Procedural style
```
mysqli_field_count(mysqli $mysql): int
```
Returns the number of columns for the most recent query on the connection represented by the `mysql` parameter. This function can be useful when using the [mysqli\_store\_result()](mysqli.store-result) function to determine if the query should have produced a non-empty result set or not without knowing the nature of the query.
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
### Return Values
An integer representing the number of fields in a result set.
### Examples
**Example #1 $mysqli->field\_count example**
Object-oriented style
```
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "test");
$mysqli->query( "DROP TABLE IF EXISTS friends");
$mysqli->query( "CREATE TABLE friends (id int, name varchar(20))");
$mysqli->query( "INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')");
$mysqli->real_query("SELECT * FROM friends");
if ($mysqli->field_count) {
/* this was a select/show or describe query */
$result = $mysqli->store_result();
/* process resultset */
$row = $result->fetch_row();
/* free resultset */
$result->close();
}
/* close connection */
$mysqli->close();
?>
```
Procedural style
```
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "test");
mysqli_query($link, "DROP TABLE IF EXISTS friends");
mysqli_query($link, "CREATE TABLE friends (id int, name varchar(20))");
mysqli_query($link, "INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')");
mysqli_real_query($link, "SELECT * FROM friends");
if (mysqli_field_count($link)) {
/* this was a select/show or describe query */
$result = mysqli_store_result($link);
/* process resultset */
$row = mysqli_fetch_row($result);
/* free resultset */
mysqli_free_result($result);
}
/* close connection */
mysqli_close($link);
?>
```
php mysqli_result::$num_rows mysqli\_result::$num\_rows
==========================
mysqli\_num\_rows
=================
(PHP 5, PHP 7, PHP 8)
mysqli\_result::$num\_rows -- mysqli\_num\_rows — Gets the number of rows in the result set
### Description
Object-oriented style
int|string [$mysqli\_result->num\_rows](mysqli-result.num-rows); Procedural style
```
mysqli_num_rows(mysqli_result $result): int|string
```
Returns the number of rows in the result set.
The behaviour of **mysqli\_num\_rows()** depends on whether buffered or unbuffered result sets are being used. This function returns `0` for unbuffered result sets unless all rows have been fetched from the server.
### Parameters
`result`
Procedural style only: A [mysqli\_result](class.mysqli-result) object returned by [mysqli\_query()](mysqli.query), [mysqli\_store\_result()](mysqli.store-result), [mysqli\_use\_result()](mysqli.use-result) or [mysqli\_stmt\_get\_result()](mysqli-stmt.get-result).
### Return Values
An int representing the number of fetched rows. Returns `0` in unbuffered mode unless all rows have been fetched from the server.
>
> **Note**:
>
>
> If the number of rows is greater than **`PHP_INT_MAX`**, the number will be returned as a string.
>
>
>
### Examples
**Example #1 Object-oriented style**
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
$result = $mysqli->query("SELECT Code, Name FROM Country ORDER BY Name");
/* Get the number of rows in the result set */
$row_cnt = $result->num_rows;
printf("Result set has %d rows.\n", $row_cnt);
```
**Example #2 Procedural style**
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
$result = mysqli_query($link, "SELECT Code, Name FROM Country ORDER BY Name");
/* Get the number of rows in the result set */
$row_cnt = mysqli_num_rows($result);
printf("Result set has %d rows.\n", $row_cnt);
```
The above examples will output:
```
Result set has 239 rows.
```
### Notes
>
> **Note**:
>
>
> In contrast to the [mysqli\_stmt\_num\_rows()](mysqli-stmt.num-rows) function, this function doesn't have object-oriented method variant. In the object-oriented style, use the getter property.
>
>
### See Also
* [mysqli\_affected\_rows()](mysqli.affected-rows) - Gets the number of affected rows in a previous MySQL operation
* [mysqli\_store\_result()](mysqli.store-result) - Transfers a result set from the last query
* [mysqli\_use\_result()](mysqli.use-result) - Initiate a result set retrieval
* [mysqli\_query()](mysqli.query) - Performs a query on the database
* [mysqli\_stmt\_num\_rows()](mysqli-stmt.num-rows) - Returns the number of rows fetched from the server
php ldap_control_paged_result_response ldap\_control\_paged\_result\_response
======================================
(PHP 5 >= 5.4.0, PHP 7)
ldap\_control\_paged\_result\_response — Retrieve the LDAP pagination cookie
**Warning** This function has been *DEPRECATED* as of PHP 7.4.0, and *REMOVED* as of PHP 8.0.0. Instead the `controls` parameter of [ldap\_search()](function.ldap-search) should be used. See also [LDAP Controls](https://www.php.net/manual/en/ldap.controls.php) for details.
### Description
```
ldap_control_paged_result_response(
resource $link,
resource $result,
string &$cookie = ?,
int &$estimated = ?
): bool
```
Retrieve the pagination information send by the server.
### Parameters
`link`
An LDAP resource, returned by [ldap\_connect()](function.ldap-connect).
`result`
`cookie`
An opaque structure sent by the server.
`estimated`
The estimated number of entries to retrieve.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function has been removed. |
| 7.4.0 | This function has been deprecated. |
### See Also
* [ldap\_control\_paged\_result()](function.ldap-control-paged-result) - Send LDAP pagination control
* [» RFC2696 : LDAP Control Extension for Simple Paged Results Manipulation](http://www.faqs.org/rfcs/rfc2696)
php Phar::mount Phar::mount
===========
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
Phar::mount — Mount an external path or file to a virtual location within the phar archive
### Description
```
final public static Phar::mount(string $pharPath, string $externalPath): void
```
Much like the unix file system concept of mounting external devices to paths within the directory tree, **Phar::mount()** allows referring to external files and directories as if they were inside of an archive. This allows powerful abstraction such as referring to external configuration files as if they were inside the archive.
### Parameters
`pharPath`
The internal path within the phar archive to use as the mounted path location. This must be a relative path within the phar archive, and must not already exist.
`externalPath`
A path or URL to an external file or directory to mount within the phar archive
### Return Values
No return. [PharException](class.pharexception) is thrown on failure.
### Errors/Exceptions
Throws [PharException](class.pharexception) if any problems occur mounting the path.
### Examples
**Example #1 A **Phar::mount()** example**
The following example shows accessing an external configuration file as if it were a path within a phar archive.
First, the code inside of a phar archive:
```
<?php
$configuration = simplexml_load_string(file_get_contents(
Phar::running(false) . '/config.xml'));
?>
```
Next the external code used to mount the configuration file:
```
<?php
// first set up the association between the abstract config.xml
// and the actual one on disk
Phar::mount('phar://config.xml', '/home/example/config.xml');
// now run the application
include '/path/to/archive.phar';
?>
```
Another method is to put the mounting code inside the stub of the phar archive. Here is an example of setting up a default configuration file if no user configuration is specified:
```
<?php
// first set up the association between the abstract config.xml
// and the actual one on disk
if (defined('EXTERNAL_CONFIG')) {
Phar::mount('config.xml', EXTERNAL_CONFIG);
if (file_exists(__DIR__ . '/extra_config.xml')) {
Phar::mount('extra.xml', __DIR__ . '/extra_config.xml');
}
} else {
Phar::mount('config.xml', 'phar://' . __FILE__ . '/default_config.xml');
Phar::mount('extra.xml', 'phar://' . __FILE__ . '/default_extra.xml');
}
// now run the application
include 'phar://' . __FILE__ . '/index.php';
__HALT_COMPILER();
?>
```
...and the code externally to load this phar archive:
```
<?php
define('EXTERNAL_CONFIG', '/home/example/config.xml');
// now run the application
include '/path/to/archive.phar';
?>
```
php ftp_nb_fput ftp\_nb\_fput
=============
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
ftp\_nb\_fput — Stores a file from an open file to the FTP server (non-blocking)
### Description
```
ftp_nb_fput(
FTP\Connection $ftp,
string $remote_filename,
resource $stream,
int $mode = FTP_BINARY,
int $offset = 0
): int
```
**ftp\_nb\_fput()** uploads the data from a file pointer to a remote file on the FTP server.
The difference between this function and the [ftp\_fput()](function.ftp-fput) is that this function uploads the file asynchronously, so your program can perform other operations while the file is being uploaded.
### Parameters
`ftp`
An [FTP\Connection](class.ftp-connection) instance.
`remote_filename`
The remote file path.
`stream`
An open file pointer on the local file. Reading stops at end of file.
`mode`
The transfer mode. Must be either **`FTP_ASCII`** or **`FTP_BINARY`**.
`offset`
The position in the remote file to start uploading to.
### Return Values
Returns **`FTP_FAILED`** or **`FTP_FINISHED`** or **`FTP_MOREDATA`**.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `ftp` parameter expects an [FTP\Connection](class.ftp-connection) instance now; previously, a [resource](language.types.resource) was expected. |
| 7.3.0 | The `mode` parameter is now optional. Formerly it has been mandatory. |
### Examples
**Example #1 **ftp\_nb\_fput()** example**
```
<?php
$file = 'index.php';
$fp = fopen($file, 'r');
$ftp = ftp_connect($ftp_server);
$login_result = ftp_login($ftp, $ftp_user_name, $ftp_user_pass);
// Initiate the upload
$ret = ftp_nb_fput($ftp, $file, $fp, FTP_BINARY);
while ($ret == FTP_MOREDATA) {
// Do whatever you want
echo ".";
// Continue upload...
$ret = ftp_nb_continue($ftp);
}
if ($ret != FTP_FINISHED) {
echo "There was an error uploading the file...";
exit(1);
}
fclose($fp);
?>
```
### See Also
* [ftp\_nb\_put()](function.ftp-nb-put) - Stores a file on the FTP server (non-blocking)
* [ftp\_nb\_continue()](function.ftp-nb-continue) - Continues retrieving/sending a file (non-blocking)
* [ftp\_put()](function.ftp-put) - Uploads a file to the FTP server
* [ftp\_fput()](function.ftp-fput) - Uploads from an open file to the FTP server
php mb_parse_str mb\_parse\_str
==============
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
mb\_parse\_str — Parse GET/POST/COOKIE data and set global variable
### Description
```
mb_parse_str(string $string, array &$result): bool
```
Parses GET/POST/COOKIE data and sets global variables. Since PHP does not provide raw POST/COOKIE data, it can only be used for GET data for now. It parses URL encoded data, detects encoding, converts coding to internal encoding and set values to the `result` array or global variables.
### Parameters
`string`
The URL encoded data.
`result`
An array containing decoded and character encoded converted values.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | The second parameter was no longer optional. |
| 7.2.0 | Calling **mb\_parse\_str()** without the second parameter was deprecated. |
### See Also
* [mb\_detect\_order()](function.mb-detect-order) - Set/Get character encoding detection order
* [mb\_internal\_encoding()](function.mb-internal-encoding) - Set/Get internal character encoding
php array_pad array\_pad
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
array\_pad — Pad array to the specified length with a value
### Description
```
array_pad(array $array, int $length, mixed $value): array
```
**array\_pad()** returns a copy of the `array` padded to size specified by `length` with value `value`. If `length` is positive then the array is padded on the right, if it's negative then on the left. If the absolute value of `length` is less than or equal to the length of the `array` then no padding takes place. It is possible to add at most 1048576 elements at a time.
### Parameters
`array`
Initial array of values to pad.
`length`
New size of the array.
`value`
Value to pad if `array` is less than `length`.
### Return Values
Returns a copy of the `array` padded to size specified by `length` with value `value`. If `length` is positive then the array is padded on the right, if it's negative then on the left. If the absolute value of `length` is less than or equal to the length of the `array` then no padding takes place.
### Examples
**Example #1 **array\_pad()** example**
```
<?php
$input = array(12, 10, 9);
$result = array_pad($input, 5, 0);
// result is array(12, 10, 9, 0, 0)
$result = array_pad($input, -7, -1);
// result is array(-1, -1, -1, -1, 12, 10, 9)
$result = array_pad($input, 2, "noop");
// not padded
?>
```
### See Also
* [array\_fill()](function.array-fill) - Fill an array with values
* [range()](function.range) - Create an array containing a range of elements
php SolrQuery::__destruct SolrQuery::\_\_destruct
=======================
(PECL solr >= 0.9.2)
SolrQuery::\_\_destruct — Destructor
### Description
public **SolrQuery::\_\_destruct**() Destructor
### Parameters
This function has no parameters.
### Return Values
None.
php Gmagick::compositeimage Gmagick::compositeimage
=======================
(PECL gmagick >= Unknown)
Gmagick::compositeimage — Composite one image onto another
### Description
```
public Gmagick::compositeimage(
Gmagick $source,
int $COMPOSE,
int $x,
int $y
): Gmagick
```
Composite one image onto another at the specified offset.
### Parameters
`source`
[Gmagick](class.gmagick) object which holds the composite image.
`compose`
Composite operator.
`x`
The column offset of the composited image.
`y`
The row offset of the composited image.
### Return Values
The [Gmagick](class.gmagick) object with compositions.
### Errors/Exceptions
Throws an **GmagickException** on error.
php sqlsrv_prepare sqlsrv\_prepare
===============
(No version information available, might only be in Git)
sqlsrv\_prepare — Prepares a query for execution
### Description
```
sqlsrv_prepare(
resource $conn,
string $sql,
array $params = ?,
array $options = ?
): mixed
```
Prepares a query for execution. This function is ideal for preparing a query that will be executed multiple times with different parameter values.
### Parameters
`conn`
A connection resource returned by [sqlsrv\_connect()](function.sqlsrv-connect).
`sql`
The string that defines the query to be prepared and executed.
`params`
An array specifying parameter information when executing a parameterized query. Array elements can be any of the following:
* A literal value
* A PHP variable
* An array with this structure: array($value [, $direction [, $phpType [, $sqlType]]])
The following table describes the elements in the array structure above:
**Array structure**| Element | Description |
| --- | --- |
| $value | A literal value, a PHP variable, or a PHP by-reference variable. |
| $direction (optional) | One of the following SQLSRV constants used to indicate the parameter direction: SQLSRV\_PARAM\_IN, SQLSRV\_PARAM\_OUT, SQLSRV\_PARAM\_INOUT. The default value is SQLSRV\_PARAM\_IN. |
| $phpType (optional) | A SQLSRV\_PHPTYPE\_\* constant that specifies PHP data type of the returned value. |
| $sqlType (optional) | A SQLSRV\_SQLTYPE\_\* constant that specifies the SQL Server data type of the input value. |
`options`
An array specifying query property options. The supported keys are described in the following table:
**Query Options**| Key | Values | Description |
| --- | --- | --- |
| QueryTimeout | A positive integer value. | Sets the query timeout in seconds. By default, the driver will wait indefinitely for results. |
| SendStreamParamsAtExec | **`true`** or **`false`** (the default is **`true`**) | Configures the driver to send all stream data at execution (**`true`**), or to send stream data in chunks (**`false`**). By default, the value is set to **`true`**. For more information, see [sqlsrv\_send\_stream\_data()](function.sqlsrv-send-stream-data). |
| Scrollable | SQLSRV\_CURSOR\_FORWARD, SQLSRV\_CURSOR\_STATIC, SQLSRV\_CURSOR\_DYNAMIC, or SQLSRV\_CURSOR\_KEYSET | See [» Specifying a Cursor Type and Selecting Rows](http://msdn.microsoft.com/en-us/library/ee376927.aspx) in the Microsoft SQLSRV documentation. |
### Return Values
Returns a statement resource on success and **`false`** if an error occurred.
### Examples
**Example #1 **sqlsrv\_prepare()** example**
This example demonstrates how to prepare a statement with **sqlsrv\_prepare()** and re-execute it multiple times (with different parameter values) using [sqlsrv\_execute()](function.sqlsrv-execute).
```
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "UPDATE Table_1
SET OrderQty = ?
WHERE SalesOrderID = ?";
// Initialize parameters and prepare the statement.
// Variables $qty and $id are bound to the statement, $stmt.
$qty = 0; $id = 0;
$stmt = sqlsrv_prepare( $conn, $sql, array( &$qty, &$id));
if( !$stmt ) {
die( print_r( sqlsrv_errors(), true));
}
// Set up the SalesOrderDetailID and OrderQty information.
// This array maps the order ID to order quantity in key=>value pairs.
$orders = array( 1=>10, 2=>20, 3=>30);
// Execute the statement for each order.
foreach( $orders as $id => $qty) {
// Because $id and $qty are bound to $stmt1, their updated
// values are used with each execution of the statement.
if( sqlsrv_execute( $stmt ) === false ) {
die( print_r( sqlsrv_errors(), true));
}
}
?>
```
### Notes
When you prepare a statement that uses variables as parameters, the variables are bound to the statement. This means that if you update the values of the variables, the next time you execute the statement it will run with updated parameter values. For statements that you plan to execute only once, use [sqlsrv\_query()](function.sqlsrv-query).
### See Also
* [sqlsrv\_execute()](function.sqlsrv-execute) - Executes a statement prepared with sqlsrv\_prepare
* [sqlsrv\_query()](function.sqlsrv-query) - Prepares and executes a query
| programming_docs |
php ReflectionMethod::hasPrototype ReflectionMethod::hasPrototype
==============================
(PHP 8 >= 8.2.0)
ReflectionMethod::hasPrototype — Returns whether a method has a prototype
### Description
```
public ReflectionMethod::hasPrototype(): bool
```
Returns whether a method has a prototype.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the method has a prototype, otherwise **`false`**.
### Examples
**Example #1 **ReflectionMethod::hasPrototype()** example**
```
<?php
class Hello
{
public function sayHelloTo($name)
{
return 'Hello '.$name;
}
}
class HelloWorld extends Hello
{
public function sayHelloTo($name)
{
return 'Hello world: '.$name;
}
}
$reflectionMethod = new ReflectionMethod('HelloWorld', 'sayHelloTo');
var_dump($reflectionMethod->hasPrototype());
?>
```
The above example will output:
```
bool(true)
```
### See Also
* [ReflectionMethod::getPrototype()](reflectionmethod.getprototype) - Gets the method prototype (if there is one)
php GearmanTask::create GearmanTask::create
===================
(PECL gearman <= 0.5.0)
GearmanTask::create — Create a task (deprecated)
### Description
```
public GearmanTask::create(): GearmanTask|false
```
Returns a new [GearmanTask](class.gearmantask) object.
>
> **Note**:
>
>
> This method was removed in the 0.6.0 version of the Gearman extension.
>
>
### Parameters
This function has no parameters.
### Return Values
A [GearmanTask](class.gearmantask) oject or **`false`** on failure.
php session_set_cookie_params session\_set\_cookie\_params
============================
(PHP 4, PHP 5, PHP 7, PHP 8)
session\_set\_cookie\_params — Set the session cookie parameters
### Description
```
session_set_cookie_params(
int $lifetime_or_options,
?string $path = null,
?string $domain = null,
?bool $secure = null,
?bool $httponly = null
): bool
```
Alternative signature available as of PHP 7.3.0:
```
session_set_cookie_params(array $lifetime_or_options): bool
```
Set cookie parameters defined in the php.ini file. The effect of this function only lasts for the duration of the script. Thus, you need to call **session\_set\_cookie\_params()** for every request and before [session\_start()](function.session-start) is called.
This function updates the runtime ini values of the corresponding PHP ini configuration keys which can be retrieved with the [ini\_get()](function.ini-get).
### Parameters
`lifetime_or_options`
When using the first signature, [lifetime](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime) of the session cookie, defined in seconds.
When using the second signature, an associative array which may have any of the keys `lifetime`, `path`, `domain`, `secure`, `httponly` and `samesite`. The values have the same meaning as described for the parameters with the same name. The value of the `samesite` element should be either `Lax` or `Strict`. If any of the allowed options are not given, their default values are the same as the default values of the explicit parameters. If the `samesite` element is omitted, no SameSite cookie attribute is set.
`path`
[Path](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-path) on the domain where the cookie will work. Use a single slash ('/') for all paths on the domain.
`domain`
Cookie [domain](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-domain), for example 'www.php.net'. To make cookies visible on all subdomains then the domain must be prefixed with a dot like '.php.net'.
`secure`
If **`true`** cookie will only be sent over [secure](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-secure) connections.
`httponly`
If set to **`true`** then PHP will attempt to send the [httponly](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-httponly) flag when setting the session cookie.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `path`, `domain`, `secure` and `httponly` are nullable now. |
| 7.3.0 | An alternative signature supporting an `lifetime_or_options` array has been added. This signature supports also setting of the SameSite cookie attribute. |
| 7.2.0 | Returns **`true`** on success or **`false`** on failure. Formerly the function returned void. |
### See Also
* [session.cookie\_lifetime](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime)
* [session.cookie\_path](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-path)
* [session.cookie\_domain](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-domain)
* [session.cookie\_secure](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-secure)
* [session.cookie\_httponly](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-httponly)
* [session.cookie\_samesite](https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-samesite)
* [session\_get\_cookie\_params()](function.session-get-cookie-params) - Get the session cookie parameters
php DOMAttr::__construct DOMAttr::\_\_construct
======================
(PHP 5, PHP 7, PHP 8)
DOMAttr::\_\_construct — Creates a new [DOMAttr](class.domattr) object
### Description
public **DOMAttr::\_\_construct**(string `$name`, string `$value` = "") Creates a new DOMAttr object. This object is read only. It may be appended to a document, but additional nodes may not be appended to this node until the node is associated with a document. To create a writable node, use [DOMDocument::createAttribute](domdocument.createattribute).
### Parameters
`name`
The tag name of the attribute.
`value`
The value of the attribute.
### Examples
**Example #1 Creating a new [DOMAttr](class.domattr) object**
```
<?php
$dom = new DOMDocument('1.0', 'iso-8859-1');
$element = $dom->appendChild(new DOMElement('root'));
$attr = $element->setAttributeNode(new DOMAttr('attr', 'attrvalue'));
echo $dom->saveXML();
?>
```
The above example will output:
```
<?xml version="1.0" encoding="utf-8"?>
<root attr="attrvalue" />
```
### See Also
* [DOMDocument::createAttribute()](domdocument.createattribute) - Create new attribute
php is_tainted is\_tainted
===========
(PECL taint >=0.1.0)
is\_tainted — Checks whether a string is tainted
### Description
```
is_tainted(string $string): bool
```
Checks whether a string is tainted
### Parameters
`string`
### Return Values
Return TRUE if the string is tainted, FALSE otherwise.
php None Assignment Operators
--------------------
The basic assignment operator is "=". Your first inclination might be to think of this as "equal to". Don't. It really means that the left operand gets set to the value of the expression on the right (that is, "gets set to").
The value of an assignment expression is the value assigned. That is, the value of "`$a = 3`" is 3. This allows you to do some tricky things:
```
<?php
$a = ($b = 4) + 5; // $a is equal to 9 now, and $b has been set to 4.
?>
```
In addition to the basic assignment operator, there are "combined operators" for all of the [binary arithmetic](language.operators), array union and string operators that allow you to use a value in an expression and then set its value to the result of that expression. For example:
```
<?php
$a = 3;
$a += 5; // sets $a to 8, as if we had said: $a = $a + 5;
$b = "Hello ";
$b .= "There!"; // sets $b to "Hello There!", just like $b = $b . "There!";
?>
```
Note that the assignment copies the original variable to the new one (assignment by value), so changes to one will not affect the other. This may also have relevance if you need to copy something like a large array inside a tight loop.
An exception to the usual assignment by value behaviour within PHP occurs with objects, which are assigned by reference. Objects may be explicitly copied via the [clone](language.oop5.cloning) keyword.
### Assignment by Reference
Assignment by reference is also supported, using the "$var = &$othervar;" syntax. Assignment by reference means that both variables end up pointing at the same data, and nothing is copied anywhere.
**Example #1 Assigning by reference**
```
<?php
$a = 3;
$b = &$a; // $b is a reference to $a
print "$a\n"; // prints 3
print "$b\n"; // prints 3
$a = 4; // change $a
print "$a\n"; // prints 4
print "$b\n"; // prints 4 as well, since $b is a reference to $a, which has
// been changed
?>
```
The [new](language.oop5.basic#language.oop5.basic.new) operator returns a reference automatically, as such assigning the result of [new](language.oop5.basic#language.oop5.basic.new) by reference is an error.
```
<?php
class C {}
$o = &new C;
?>
```
The above example will output:
```
Parse error: syntax error, unexpected 'new' (T_NEW) in …
```
More information on references and their potential uses can be found in the [References Explained](https://www.php.net/manual/en/language.references.php) section of the manual.
### Arithmetic Assignment Operators
| Example | Equivalent | Operation |
| --- | --- | --- |
| $a += $b | $a = $a + $b | Addition |
| $a -= $b | $a = $a - $b | Subtraction |
| $a \*= $b | $a = $a \* $b | Multiplication |
| $a /= $b | $a = $a / $b | Division |
| $a %= $b | $a = $a % $b | Modulus |
| $a \*\*= $b | $a = $a \*\* $b | Exponentiation |
### Bitwise Assignment Operators
| Example | Equivalent | Operation |
| --- | --- | --- |
| $a &= $b | $a = $a & $b | Bitwise And |
| $a |= $b | $a = $a | $b | Bitwise Or |
| $a ^= $b | $a = $a ^ $b | Bitwise Xor |
| $a <<= $b | $a = $a << $b | Left Shift |
| $a >>= $b | $a = $a >> $b | Right Shift |
### Other Assignment Operators
| Example | Equivalent | Operation |
| --- | --- | --- |
| $a .= $b | $a = $a . $b | String Concatenation |
| $a ??= $b | $a = $a ?? $b | Null Coalesce |
### See Also
* [arithmetic operators](language.operators.arithmetic)
* [bitwise operators](language.operators.bitwise)
* [null coalescing operator](language.operators.comparison#language.operators.comparison.coalesce)
php snmp2_real_walk snmp2\_real\_walk
=================
(PHP >= 5.2.0, PHP 7, PHP 8)
snmp2\_real\_walk — Return all objects including their respective object ID within the specified one
### Description
```
snmp2_real_walk(
string $hostname,
string $community,
array|string $object_id,
int $timeout = -1,
int $retries = -1
): array|false
```
The **snmp2\_real\_walk()** function is used to traverse over a number of SNMP objects starting from `object_id` and return not only their values but also their object ids.
### Parameters
`hostname`
The hostname of the SNMP agent (server).
`community`
The read community.
`object_id`
The SNMP object id which precedes the wanted one.
`timeout`
The number of microseconds until the first timeout.
`retries`
The number of times to retry if timeouts occur.
### Return Values
Returns an associative array of the SNMP object ids and their values on success or **`false`** on error. In case of an error, an E\_WARNING message is shown.
### Examples
**Example #1 Using **snmp2\_real\_walk()****
```
<?php
print_r(snmp2_real_walk("localhost", "public", "IF-MIB::ifName"));
?>
```
The above will output something like:
```
Array
(
[IF-MIB::ifName.1] => STRING: lo
[IF-MIB::ifName.2] => STRING: eth0
[IF-MIB::ifName.3] => STRING: eth2
[IF-MIB::ifName.4] => STRING: sit0
[IF-MIB::ifName.5] => STRING: sixxs
)
```
### See Also
* [snmp2\_walk()](function.snmp2-walk) - Fetch all the SNMP objects from an agent
php None Assertions
----------
An assertion is a test on the characters following or preceding the current matching point that does not actually consume any characters. The simple assertions coded as \b, \B, \A, \Z, \z, ^ and $ are described in [escape sequences](regexp.reference.escape). More complicated assertions are coded as subpatterns. There are two kinds: those that *look ahead* of the current position in the subject string, and those that *look behind* it.
An assertion subpattern is matched in the normal way, except that it does not cause the current matching position to be changed. *Lookahead* assertions start with (?= for positive assertions and (?! for negative assertions. For example, `\w+(?=;)` matches a word followed by a semicolon, but does not include the semicolon in the match, and `foo(?!bar)` matches any occurrence of "foo" that is not followed by "bar". Note that the apparently similar pattern `(?!foo)bar` does not find an occurrence of "bar" that is preceded by something other than "foo"; it finds any occurrence of "bar" whatsoever, because the assertion (?!foo) is always **`true`** when the next three characters are "bar". A lookbehind assertion is needed to achieve this effect.
*Lookbehind* assertions start with (?<= for positive assertions and (?<! for negative assertions. For example, `(?<!foo)bar` does find an occurrence of "bar" that is not preceded by "foo". The contents of a lookbehind assertion are restricted such that all the strings it matches must have a fixed length. However, if there are several alternatives, they do not all have to have the same fixed length. Thus `(?<=bullock|donkey)` is permitted, but `(?<!dogs?|cats?)` causes an error at compile time. Branches that match different length strings are permitted only at the top level of a lookbehind assertion. This is an extension compared with Perl 5.005, which requires all branches to match the same length of string. An assertion such as `(?<=ab(c|de))` is not permitted, because its single top-level branch can match two different lengths, but it is acceptable if rewritten to use two top-level branches: `(?<=abc|abde)` The implementation of lookbehind assertions is, for each alternative, to temporarily move the current position back by the fixed width and then try to match. If there are insufficient characters before the current position, the match is deemed to fail. Lookbehinds in conjunction with once-only subpatterns can be particularly useful for matching at the ends of strings; an example is given at the end of the section on once-only subpatterns.
Several assertions (of any sort) may occur in succession. For example, `(?<=\d{3})(?<!999)foo` matches "foo" preceded by three digits that are not "999". Notice that each of the assertions is applied independently at the same point in the subject string. First there is a check that the previous three characters are all digits, then there is a check that the same three characters are not "999". This pattern does not match "foo" preceded by six characters, the first of which are digits and the last three of which are not "999". For example, it doesn't match "123abcfoo". A pattern to do that is `(?<=\d{3}...)(?<!999)foo`
This time the first assertion looks at the preceding six characters, checking that the first three are digits, and then the second assertion checks that the preceding three characters are not "999".
Assertions can be nested in any combination. For example, `(?<=(?<!foo)bar)baz` matches an occurrence of "baz" that is preceded by "bar" which in turn is not preceded by "foo", while `(?<=\d{3}...(?<!999))foo` is another pattern which matches "foo" preceded by three digits and any three characters that are not "999".
Assertion subpatterns are not capturing subpatterns, and may not be repeated, because it makes no sense to assert the same thing several times. If any kind of assertion contains capturing subpatterns within it, these are counted for the purposes of numbering the capturing subpatterns in the whole pattern. However, substring capturing is carried out only for positive assertions, because it does not make sense for negative assertions.
Assertions count towards the maximum of 200 parenthesized subpatterns.
php dba_nextkey dba\_nextkey
============
(PHP 4, PHP 5, PHP 7, PHP 8)
dba\_nextkey — Fetch next key
### Description
```
dba_nextkey(resource $dba): string|false
```
**dba\_nextkey()** returns the next key of the database and advances the internal key pointer.
### Parameters
`dba`
The database handler, returned by [dba\_open()](function.dba-open) or [dba\_popen()](function.dba-popen).
### Return Values
Returns the key on success or **`false`** on failure.
### See Also
* [dba\_firstkey()](function.dba-firstkey) - Fetch first key
* [dba\_key\_split()](function.dba-key-split) - Splits a key in string representation into array representation
* Example 2 in the [DBA examples](https://www.php.net/manual/en/dba.examples.php)
php SolrQuery::setMltBoost SolrQuery::setMltBoost
======================
(PECL solr >= 0.9.2)
SolrQuery::setMltBoost — Set if the query will be boosted by the interesting term relevance
### Description
```
public SolrQuery::setMltBoost(bool $flag): SolrQuery
```
Set if the query will be boosted by the interesting term relevance
### Parameters
`value`
Sets to **`true`** or **`false`**
### Return Values
Returns the current SolrQuery object, if the return value is used.
php Imagick::combineImages Imagick::combineImages
======================
(PECL imagick 2, PECL imagick 3)
Imagick::combineImages — Combines one or more images into a single image
### Description
```
public Imagick::combineImages(int $channelType): Imagick
```
Combines one or more images into a single image. The grayscale value of the pixels of each image in the sequence is assigned in order to the specified channels of the combined image. The typical ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
### Parameters
`channelType`
Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channeltype constants using bitwise operators. Refer to this list of [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel).
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
php sodium_crypto_sign_secretkey sodium\_crypto\_sign\_secretkey
===============================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_sign\_secretkey — Extract the Ed25519 secret key from a keypair
### Description
```
sodium_crypto_sign_secretkey(string $key_pair): string
```
Extract the Ed25519 secret key from a keypair
### Parameters
`key_pair`
Ed25519 keypair (see: [sodium\_crypto\_sign\_keypair()](function.sodium-crypto-sign-keypair))
### Return Values
Ed25519 secret key
php ctype_print ctype\_print
============
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
ctype\_print — Check for printable character(s)
### Description
```
ctype_print(mixed $text): bool
```
Checks if all of the characters in the provided string, `text`, are printable.
### Parameters
`text`
The tested string.
>
> **Note**:
>
>
> If an int between -128 and 255 inclusive is provided, it is interpreted as the ASCII value of a single character (negative values have 256 added in order to allow characters in the Extended ASCII range). Any other integer is interpreted as a string containing the decimal digits of the integer.
>
>
>
**Warning** As of PHP 8.1.0, passing a non-string argument is deprecated. In the future, the argument will be interpreted as a string instead of an ASCII codepoint. Depending on the intended behavior, the argument should either be cast to string or an explicit call to [chr()](function.chr) should be made.
### Return Values
Returns **`true`** if every character in `text` will actually create output (including blanks). Returns **`false`** if `text` contains control characters or characters that do not have any output or control function at all. When called with an empty string the result will always be **`false`**.
### Examples
**Example #1 A **ctype\_print()** example**
```
<?php
$strings = array('string1' => "asdf\n\r\t", 'string2' => 'arf12', 'string3' => 'LKA#@%.54');
foreach ($strings as $name => $testcase) {
if (ctype_print($testcase)) {
echo "The string '$name' consists of all printable characters.\n";
} else {
echo "The string '$name' does not consist of all printable characters.\n";
}
}
?>
```
The above example will output:
```
The string 'string1' does not consist of all printable characters.
The string 'string2' consists of all printable characters.
The string 'string3' consists of all printable characters.
```
### See Also
* [ctype\_cntrl()](function.ctype-cntrl) - Check for control character(s)
* [ctype\_graph()](function.ctype-graph) - Check for any printable character(s) except space
* [ctype\_punct()](function.ctype-punct) - Check for any printable character which is not whitespace or an alphanumeric character
| programming_docs |
php Imagick::getImageExtrema Imagick::getImageExtrema
========================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageExtrema — Gets the extrema for the image
**Warning**This function has been *DEPRECATED* as of Imagick 3.4.4. Relying on this function is highly discouraged.
### Description
```
public Imagick::getImageExtrema(): array
```
Gets the extrema for the image. Returns an associative array with the keys "min" and "max".
### Parameters
This function has no parameters.
### Return Values
Returns an associative array with the keys "min" and "max".
### Errors/Exceptions
Throws ImagickException on error.
php Memcached::setByKey Memcached::setByKey
===================
(PECL memcached >= 0.1.0)
Memcached::setByKey — Store an item on a specific server
### Description
```
public Memcached::setByKey(
string $server_key,
string $key,
mixed $value,
int $expiration = ?
): bool
```
**Memcached::setByKey()** is functionally equivalent to [Memcached::set()](memcached.set), except that the free-form `server_key` can be used to map the `key` to a specific server. This is useful if you need to keep a bunch of related keys on a certain server.
### Parameters
`server_key`
The key identifying the server to store the value on or retrieve it from. Instead of hashing on the actual key for the item, we hash on the server key when deciding which memcached server to talk to. This allows related items to be grouped together on a single server for efficiency with multi operations.
`key`
The key under which to store the value.
`value`
The value to store.
`expiration`
The expiration time, defaults to 0. See [Expiration Times](https://www.php.net/manual/en/memcached.expiration.php) for more info.
### Return Values
Returns **`true`** on success or **`false`** on failure. Use [Memcached::getResultCode()](memcached.getresultcode) if necessary.
### Examples
**Example #1 **Memcached::setByKey()** example**
```
<?php
$m = new Memcached();
$m->addServer('localhost', 11211);
/* keep IP blocks on a certain server */
$m->setByKey('api-cache', 'block-ip:169.254.253.252', 1);
$m->setByKey('api-cache', 'block-ip:169.127.127.202', 1);
?>
```
### See Also
* [Memcached::set()](memcached.set) - Store an item
php SplFixedArray::offsetExists SplFixedArray::offsetExists
===========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplFixedArray::offsetExists — Returns whether the requested index exists
### Description
```
public SplFixedArray::offsetExists(int $index): bool
```
Checks whether the requested index `index` exists.
### Parameters
`index`
The index being checked.
### Return Values
**`true`** if the requested `index` exists, otherwise **`false`**
php sys_get_temp_dir sys\_get\_temp\_dir
===================
(PHP 5 >= 5.2.1, PHP 7, PHP 8)
sys\_get\_temp\_dir — Returns directory path used for temporary files
### Description
```
sys_get_temp_dir(): string
```
Returns the path of the directory PHP stores temporary files in by default.
### Parameters
This function has no parameters.
### Return Values
Returns the path of the temporary directory.
### Examples
**Example #1 **sys\_get\_temp\_dir()** example**
```
<?php
// Create a temporary file in the temporary
// files directory using sys_get_temp_dir()
$temp_file = tempnam(sys_get_temp_dir(), 'Tux');
echo $temp_file;
?>
```
The above example will output something similar to:
```
C:\Windows\Temp\TuxA318.tmp
```
### See Also
* [tmpfile()](function.tmpfile) - Creates a temporary file
* [tempnam()](function.tempnam) - Create file with unique file name
php Componere\Definition::__construct Componere\Definition::\_\_construct
===================================
(Componere 2 >= 2.1.0)
Componere\Definition::\_\_construct — Definition Construction
### Description
public **Componere\Definition::\_\_construct**(string `$name`)
public **Componere\Definition::\_\_construct**(string `$name`, string `$parent`)
public **Componere\Definition::\_\_construct**(string `$name`, array `$interfaces`)
public **Componere\Definition::\_\_construct**(string `$name`, string `$parent`, array `$interfaces`) ### Parameters
`name`
A case insensitive class name
`parent`
A case insensitive class name
`interfaces`
An array of case insensitive class names
### Exceptions
**Warning** Shall throw [InvalidArgumentException](class.invalidargumentexception) if an attempt is made to replace an internal class
**Warning** Shall throw [InvalidArgumentException](class.invalidargumentexception) if an attempt is made to replace an interface
**Warning** Shall throw [InvalidArgumentException](class.invalidargumentexception) if an attempt is made to replace a trait
**Warning** Shall throw [RuntimeException](class.runtimeexception) if a class in `interfaces` cannot be found
**Warning** Shall throw [RuntimeException](class.runtimeexception) if an class in `interfaces` is not an interface
php SolrQuery::getStatsFacets SolrQuery::getStatsFacets
=========================
(PECL solr >= 0.9.2)
SolrQuery::getStatsFacets — Returns all the stats facets that were set
### Description
```
public SolrQuery::getStatsFacets(): array
```
Returns all the stats facets that were set
### Parameters
This function has no parameters.
### Return Values
Returns an array on success and **`null`** if not set.
php mb_get_info mb\_get\_info
=============
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
mb\_get\_info — Get internal settings of mbstring
### Description
```
mb_get_info(string $type = "all"): array|string|int|false
```
**mb\_get\_info()** returns the internal setting parameters of mbstring.
### Parameters
`type`
If `type` is not specified or is specified as `"all"`, `"internal_encoding"`, `"http_input"`, `"http_output"`, `"http_output_conv_mimetypes"`, `"mail_charset"`, `"mail_header_encoding"`, `"mail_body_encoding"`, `"illegal_chars"`, `"encoding_translation"`, `"language"`, `"detect_order"`, `"substitute_character"` and `"strict_detection"` will be returned.
If `type` is specified as `"internal_encoding"`, `"http_input"`, `"http_output"`, `"http_output_conv_mimetypes"`, `"mail_charset"`, `"mail_header_encoding"`, `"mail_body_encoding"`, `"illegal_chars"`, `"encoding_translation"`, `"language"`, `"detect_order"`, `"substitute_character"` or `"strict_detection"` the specified setting parameter will be returned.
### Return Values
An array of type information if `type` is not specified, otherwise a specific `type`, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | The `type`s `"func_overload"` and `"func_overload_list"` are no longer supported. |
### See Also
* [mb\_regex\_encoding()](function.mb-regex-encoding) - Set/Get character encoding for multibyte regex
* [mb\_http\_output()](function.mb-http-output) - Set/Get HTTP output character encoding
php The libXMLError class
The libXMLError class
=====================
Introduction
------------
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
Contains various information about errors thrown by libxml. The error codes are described within the official [» xmlError API documentation](http://www.xmlsoft.org/html/libxml-xmlerror.html).
Class synopsis
--------------
class **libXMLError** { /\* Properties \*/ public int [$level](class.libxmlerror#libxmlerror.props.level);
public int [$code](class.libxmlerror#libxmlerror.props.code);
public int [$column](class.libxmlerror#libxmlerror.props.column);
public string [$message](class.libxmlerror#libxmlerror.props.message);
public string [$file](class.libxmlerror#libxmlerror.props.file);
public int [$line](class.libxmlerror#libxmlerror.props.line); } Properties
----------
level the severity of the error (one of the following constants: **`LIBXML_ERR_WARNING`**, **`LIBXML_ERR_ERROR`** or **`LIBXML_ERR_FATAL`**)
code The error's code.
column The column where the error occurred.
>
> **Note**:
>
>
> This property isn't entirely implemented in libxml and therefore `0` is often returned.
>
>
message The error message, if any.
file The filename, or empty if the XML was loaded from a string.
line The line where the error occurred.
php SoapServer::handle SoapServer::handle
==================
(PHP 5, PHP 7, PHP 8)
SoapServer::handle — Handles a SOAP request
### Description
```
public SoapServer::handle(?string $request = null): void
```
Processes a SOAP request, calls necessary functions, and sends a response back.
### Parameters
`request`
The SOAP request. If this argument is omitted, the request is assumed to be in the raw POST data of the HTTP request.
### Return Values
No value is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `request` is now nullable. |
### Examples
**Example #1 **SoapServer::handle()** example**
```
<?php
function test($x)
{
return $x;
}
$server = new SoapServer(null, array('uri' => "http://test-uri/"));
$server->addFunction("test");
$server->handle();
?>
```
### See Also
* [SoapServer::\_\_construct()](soapserver.construct) - SoapServer constructor
php IntlChar::isIDStart IntlChar::isIDStart
===================
(PHP 7, PHP 8)
IntlChar::isIDStart — Check if code point is permissible as the first character in an identifier
### Description
```
public static IntlChar::isIDStart(int|string $codepoint): ?bool
```
Determines if the specified character is permissible as the first character in an identifier according to Unicode (The Unicode Standard, Version 3.0, chapter 5.16 Identifiers).
**`true`** for characters with general categories "L" (letters) and "Nl" (letter numbers).
### Parameters
`codepoint`
The int codepoint value (e.g. `0x2603` for *U+2603 SNOWMAN*), or the character encoded as a UTF-8 string (e.g. `"\u{2603}"`)
### Return Values
Returns **`true`** if `codepoint` may start an identifier, **`false`** if not. Returns **`null`** on failure.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::isIDStart("A"));
var_dump(IntlChar::isIDStart("$"));
var_dump(IntlChar::isIDStart("\n"));
var_dump(IntlChar::isIDStart("\u{2603}"));
?>
```
The above example will output:
```
bool(true)
bool(false)
bool(false)
bool(false)
```
### See Also
* [IntlChar::isalpha()](intlchar.isalpha) - Check if code point is a letter character
* [IntlChar::isIDPart()](intlchar.isidpart) - Check if code point is permissible in an identifier
* **`IntlChar::PROPERTY_ID_START`**
php is_uploaded_file is\_uploaded\_file
==================
(PHP 4 >= 4.0.3, PHP 5, PHP 7, PHP 8)
is\_uploaded\_file — Tells whether the file was uploaded via HTTP POST
### Description
```
is_uploaded_file(string $filename): bool
```
Returns **`true`** if the file named by `filename` was uploaded via HTTP POST. This is useful to help ensure that a malicious user hasn't tried to trick the script into working on files upon which it should not be working--for instance, /etc/passwd.
This sort of check is especially important if there is any chance that anything done with uploaded files could reveal their contents to the user, or even to other users on the same system.
For proper working, the function **is\_uploaded\_file()** needs an argument like [$\_FILES['userfile']['tmp\_name']](reserved.variables.files), - the name of the uploaded file on the client's machine [$\_FILES['userfile']['name']](reserved.variables.files) does not work.
### Parameters
`filename`
The filename being checked.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **is\_uploaded\_file()** example**
```
<?php
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
echo "File ". $_FILES['userfile']['name'] ." uploaded successfully.\n";
echo "Displaying contents\n";
readfile($_FILES['userfile']['tmp_name']);
} else {
echo "Possible file upload attack: ";
echo "filename '". $_FILES['userfile']['tmp_name'] . "'.";
}
?>
```
### See Also
* [move\_uploaded\_file()](function.move-uploaded-file) - Moves an uploaded file to a new location
* [$\_FILES](reserved.variables.files)
* See [Handling file uploads](https://www.php.net/manual/en/features.file-upload.php) for a simple usage example.
php openssl_x509_parse openssl\_x509\_parse
====================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
openssl\_x509\_parse — Parse an X509 certificate and return the information as an array
### Description
```
openssl_x509_parse(OpenSSLCertificate|string $certificate, bool $short_names = true): array|false
```
**openssl\_x509\_parse()** returns information about the supplied `certificate`, including fields such as subject name, issuer name, purposes, valid from and valid to dates etc.
### Parameters
`certificate`
X509 certificate. See [Key/Certificate parameters](https://www.php.net/manual/en/openssl.certparams.php) for a list of valid values.
`short_names`
`short_names` controls how the data is indexed in the array - if `short_names` is **`true`** (the default) then fields will be indexed with the short name form, otherwise, the long name form will be used - e.g.: CN is the shortname form of commonName.
### Return Values
*The structure of the returned data is (deliberately) not yet documented, as it is still subject to change.*
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `certificate` accepts an [OpenSSLCertificate](class.opensslcertificate) instance now; previously, a [resource](language.types.resource) of type `OpenSSL X.509` was accepted. |
php uniqid uniqid
======
(PHP 4, PHP 5, PHP 7, PHP 8)
uniqid — Generate a unique ID
### Description
```
uniqid(string $prefix = "", bool $more_entropy = false): string
```
Gets a prefixed unique identifier based on the current time in microseconds.
**Caution** This function does not generate cryptographically secure values, and *must not* be used for cryptographic purposes, or purposes that require returned values to be unguessable.
If cryptographically secure randomness is required, the [Random\Randomizer](https://www.php.net/manual/en/class.random-randomizer.php) may be used with the [Random\Engine\Secure](https://www.php.net/manual/en/class.random-engine-secure.php) engine. For simple use cases, the [random\_int()](https://www.php.net/manual/en/function.random-int.php) and [random\_bytes()](https://www.php.net/manual/en/function.random-bytes.php) functions provide a convenient and secure API that is backed by the operating system’s CSPRNG.
**Warning** This function does not guarantee uniqueness of return value. Since most systems adjust system clock by NTP or like, system time is changed constantly. Therefore, it is possible that this function does not return unique ID for the process/thread. Use `more_entropy` to increase likelihood of uniqueness.
### Parameters
`prefix`
Can be useful, for instance, if you generate identifiers simultaneously on several hosts that might happen to generate the identifier at the same microsecond.
With an empty `prefix`, the returned string will be 13 characters long. If `more_entropy` is **`true`**, it will be 23 characters.
`more_entropy`
If set to **`true`**, **uniqid()** will add additional entropy (using the combined linear congruential generator) at the end of the return value, which increases the likelihood that the result will be unique.
### Return Values
Returns timestamp based unique identifier as a string.
**Warning** This function tries to create unique identifier, but it does not guarantee 100% uniqueness of return value.
### Examples
**Example #1 **uniqid()** Example**
```
<?php
/* A uniqid, like: 4b3403665fea6 */
printf("uniqid(): %s\r\n", uniqid());
/* We can also prefix the uniqid, this the same as
* doing:
*
* $uniqid = $prefix . uniqid();
* $uniqid = uniqid($prefix);
*/
printf("uniqid('php_'): %s\r\n", uniqid('php_'));
/* We can also activate the more_entropy parameter, which is
* required on some systems, like Cygwin. This makes uniqid()
* produce a value like: 4b340550242239.64159797
*/
printf("uniqid('', true): %s\r\n", uniqid('', true));
?>
```
### Notes
>
> **Note**:
>
>
> Under Cygwin, the `more_entropy` must be set to **`true`** for this function to work.
>
>
### See Also
* [random\_bytes()](https://www.php.net/manual/en/function.random-bytes.php) - Get cryptographically secure random bytes
php Imagick::getImageChannelRange Imagick::getImageChannelRange
=============================
(PECL imagick 2 >= 2.2.1, PECL imagick 3)
Imagick::getImageChannelRange — Gets channel range
### Description
```
public Imagick::getImageChannelRange(int $channel): array
```
Gets the range for one or more image channels. This method is available if Imagick has been compiled against ImageMagick version 6.4.0 or newer.
### Parameters
`channel`
Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel) using bitwise operators. Defaults to **`Imagick::CHANNEL_DEFAULT`**. Refer to this list of [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel)
### Return Values
Returns an array containing minima and maxima values of the channel(s).
### Errors/Exceptions
Throws ImagickException on error.
php class_exists class\_exists
=============
(PHP 4, PHP 5, PHP 7, PHP 8)
class\_exists — Checks if the class has been defined
### Description
```
class_exists(string $class, bool $autoload = true): bool
```
This function checks whether or not the given class has been defined.
### Parameters
`class`
The class name. The name is matched in a case-insensitive manner.
`autoload`
Whether to call [\_\_autoload](language.oop5.autoload) by default.
### Return Values
Returns **`true`** if `class` is a defined class, **`false`** otherwise.
### Examples
**Example #1 **class\_exists()** example**
```
<?php
// Check that the class exists before trying to use it
if (class_exists('MyClass')) {
$myclass = new MyClass();
}
?>
```
**Example #2 `autoload` parameter example**
```
<?php
spl_autoload_register(function ($class_name) {
include $class_name . '.php';
// Check to see whether the include declared the class
if (!class_exists($class_name, false)) {
throw new LogicException("Unable to load class: $class_name");
}
});
if (class_exists(MyClass::class)) {
$myclass = new MyClass();
}
?>
```
### See Also
* [function\_exists()](function.function-exists) - Return true if the given function has been defined
* [enum\_exists()](function.enum-exists) - Checks if the enum has been defined
* [interface\_exists()](function.interface-exists) - Checks if the interface has been defined
* [get\_declared\_classes()](function.get-declared-classes) - Returns an array with the name of the defined classes
php RarArchive::close RarArchive::close
=================
rar\_close
==========
(PECL rar >= 2.0.0)
RarArchive::close -- rar\_close — Close RAR archive and free all resources
### Description
Object-oriented style (method):
```
public RarArchive::close(): bool
```
Procedural style:
```
rar_close(RarArchive $rarfile): bool
```
Close RAR archive and free all allocated resources.
### Parameters
`rarfile`
A [RarArchive](class.rararchive) object, opened with [rar\_open()](rararchive.open).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| PECL rar 2.0.0 | The RAR entries returned by [RarArchive::getEntry()](rararchive.getentry) and [RarArchive::getEntries()](rararchive.getentries) are now invalidated when calling this method. This means that all instance methods called for such entries and not guaranteed to succeed. |
### Examples
**Example #1 Object-oriented style**
```
<?php
$rar_arch = RarArchive::open('latest_winrar.rar');
echo $rar_arch."\n";
$rar_arch->close();
echo $rar_arch."\n";
?>
```
The above example will output something similar to:
```
RAR Archive "D:\php_rar\trunk\tests\latest_winrar.rar"
RAR Archive "D:\php_rar\trunk\tests\latest_winrar.rar" (closed)
```
**Example #2 Procedural style**
```
<?php
$rar_arch = rar_open('latest_winrar.rar');
echo $rar_arch."\n";
rar_close($rar_arch);
echo $rar_arch."\n";
?>
```
| programming_docs |
php grapheme_strripos grapheme\_strripos
==================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
grapheme\_strripos — Find position (in grapheme units) of last occurrence of a case-insensitive string
### Description
Procedural style
```
grapheme_strripos(string $haystack, string $needle, int $offset = 0): int|false
```
Find position (in grapheme units) of last occurrence of a case-insensitive string
### Parameters
`haystack`
The string to look in. Must be valid UTF-8.
`needle`
The string to look for. Must be valid UTF-8.
`offset`
The optional `offset` parameter allows you to specify where in `haystack` to start searching as an offset in grapheme units (not bytes or characters). The position returned is still relative to the beginning of `haystack` regardless of the value of `offset`.
### Return Values
Returns the position as an integer. If `needle` is not found, **grapheme\_strripos()** will return **`false`**.
### Examples
**Example #1 **grapheme\_strripos()** example**
```
<?php
$char_a_ring_nfd = "a\xCC\x8A"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) normalization form "D"
$char_o_diaeresis_nfd = "o\xCC\x88"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) normalization form "D"
$char_O_diaeresis_nfd = "O\xCC\x88"; // 'LATIN CAPITAL LETTER O WITH DIAERESIS' (U+00D6) normalization form "D"
print grapheme_strripos( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd);
?>
```
The above example will output:
```
2
```
### See Also
* [grapheme\_stripos()](function.grapheme-stripos) - Find position (in grapheme units) of first occurrence of a case-insensitive string
* [grapheme\_stristr()](function.grapheme-stristr) - Returns part of haystack string from the first occurrence of case-insensitive needle to the end of haystack
* [grapheme\_strpos()](function.grapheme-strpos) - Find position (in grapheme units) of first occurrence of a string
* [grapheme\_strrpos()](function.grapheme-strrpos) - Find position (in grapheme units) of last occurrence of a string
* [grapheme\_strstr()](function.grapheme-strstr) - Returns part of haystack string from the first occurrence of needle to the end of haystack
* [» Unicode Text Segmentation: Grapheme Cluster Boundaries](http://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries)
php radius_put_vendor_string radius\_put\_vendor\_string
===========================
(PECL radius >= 1.1.0)
radius\_put\_vendor\_string — Attaches a vendor specific string attribute
### Description
```
radius_put_vendor_string(
resource $radius_handle,
int $vendor,
int $type,
string $value,
int $options = 0,
int $tag = ?
): bool
```
Attaches a vendor specific string attribute to the current RADIUS request. In general, [radius\_put\_vendor\_attr()](function.radius-put-vendor-attr) is a more useful function for attaching string attributes, as it is binary safe.
>
> **Note**:
>
>
> A request must be created via [radius\_create\_request()](function.radius-create-request) before this function can be called.
>
>
>
### Parameters
`radius_handle`
The RADIUS resource.
`vendor`
The vendor ID.
`type`
The attribute type.
`value`
The attribute value. This value is expected by the underlying library to be null terminated, therefore this parameter is not binary safe.
`options`
A bitmask of the attribute options. The available options include [**`RADIUS_OPTION_TAGGED`**](https://www.php.net/manual/en/radius.constants.options.php#constant.radius-option-tagged) and [**`RADIUS_OPTION_SALT`**](https://www.php.net/manual/en/radius.constants.options.php#constant.radius-option-salt).
`tag`
The attribute tag. This parameter is ignored unless the [**`RADIUS_OPTION_TAGGED`**](https://www.php.net/manual/en/radius.constants.options.php#constant.radius-option-tagged) option is set.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| PECL radius 1.3.0 | The `options` and `tag` parameters were added. |
### See Also
* [radius\_put\_vendor\_int()](function.radius-put-vendor-int) - Attaches a vendor specific integer attribute
php pcntl_getpriority pcntl\_getpriority
==================
(PHP 5, PHP 7, PHP 8)
pcntl\_getpriority — Get the priority of any process
### Description
```
pcntl_getpriority(?int $process_id = null, int $mode = PRIO_PROCESS): int|false
```
**pcntl\_getpriority()** gets the priority of `process_id`. Because priority levels can differ between system types and kernel versions, please see your system's getpriority(2) man page for specific details.
### Parameters
`process_id`
If **`null`**, the process id of the current process is used.
`mode`
One of **`PRIO_PGRP`**, **`PRIO_USER`**, **`PRIO_PROCESS`**, **`PRIO_DARWIN_BG`** or **`PRIO_DARWIN_THREAD`**.
### Return Values
**pcntl\_getpriority()** returns the priority of the process or **`false`** on error. A lower numerical value causes more favorable scheduling.
**Warning**This function may return Boolean **`false`**, but may also return a non-Boolean value which evaluates to **`false`**. Please read the section on [Booleans](language.types.boolean) for more information. Use [the === operator](language.operators.comparison) for testing the return value of this function.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `process_id` is nullable now. |
### See Also
* [pcntl\_setpriority()](function.pcntl-setpriority) - Change the priority of any process
php dba_close dba\_close
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
dba\_close — Close a DBA database
### Description
```
dba_close(resource $dba): void
```
**dba\_close()** closes the established database and frees all resources of the specified database handle.
### Parameters
`dba`
The database handler, returned by [dba\_open()](function.dba-open) or [dba\_popen()](function.dba-popen).
### Return Values
No value is returned.
### See Also
* [dba\_open()](function.dba-open) - Open database
* [dba\_popen()](function.dba-popen) - Open database persistently
php svn_mkdir svn\_mkdir
==========
(PECL svn >= 0.4.0)
svn\_mkdir — Creates a directory in a working copy or repository
### Description
```
svn_mkdir(string $path, string $log_message = ?): bool
```
Creates a directory in a working copy or repository.
### Parameters
`path`
The path to the working copy or repository.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [svn\_add()](function.svn-add) - Schedules the addition of an item in a working directory
* **svn\_copy()**
php mcrypt_get_key_size mcrypt\_get\_key\_size
======================
(PHP 4, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mcrypt\_get\_key\_size — Gets the key size of the specified cipher
**Warning**This function has been *DEPRECATED* as of PHP 7.1.0 and *REMOVED* as of PHP 7.2.0. Relying on this function is highly discouraged.
### Description
```
mcrypt_get_key_size(int $cipher): int|false
```
```
mcrypt_get_key_size(string $cipher, string $mode): int|false
```
The first prototype is when linked against libmcrypt 2.2.x, the second when linked against libmcrypt 2.4.x or 2.5.x.
**mcrypt\_get\_key\_size()** is used to get the size of a key of the specified `cipher` (in combination with an encryption mode).
It is more useful to use the [mcrypt\_enc\_get\_key\_size()](function.mcrypt-enc-get-key-size) function as this uses the resource returned by [mcrypt\_module\_open()](function.mcrypt-module-open).
### Parameters
`cipher`
One of the **`MCRYPT_ciphername`** constants, or the name of the algorithm as string.
`mode`
One of the **`MCRYPT_MODE_modename`** constants, or one of the following strings: "ecb", "cbc", "cfb", "ofb", "nofb" or "stream".
### Return Values
Returns the maximum supported key size of the algorithm in bytes or **`false`** on failure.
### Examples
**Example #1 **mcrypt\_get\_key\_size()** Example**
```
<?php
echo mcrypt_get_key_size('tripledes', 'ecb');
?>
```
The example above shows how to use this function when linked against libmcrypt 2.4.x or 2.5.x.
The above example will output:
```
24
```
### See Also
* [mcrypt\_get\_block\_size()](function.mcrypt-get-block-size) - Gets the block size of the specified cipher
* [mcrypt\_enc\_get\_key\_size()](function.mcrypt-enc-get-key-size) - Returns the maximum supported keysize of the opened mode
* [mcrypt\_encrypt()](function.mcrypt-encrypt) - Encrypts plaintext with given parameters
php SplDoublyLinkedList::prev SplDoublyLinkedList::prev
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplDoublyLinkedList::prev — Move to previous entry
### Description
```
public SplDoublyLinkedList::prev(): void
```
Move the iterator to the previous node.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php filter_list filter\_list
============
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
filter\_list — Returns a list of all supported filters
### Description
```
filter_list(): array
```
### Parameters
This function has no parameters.
### Return Values
Returns an array of names of all supported filters, empty array if there are no such filters. Indexes of this array are not filter IDs, they can be obtained with [filter\_id()](function.filter-id) from a name instead.
### Examples
**Example #1 A **filter\_list()** example**
```
<?php
print_r(filter_list());
?>
```
The above example will output something similar to:
```
Array
(
[0] => int
[1] => boolean
[2] => float
[3] => validate_regexp
[4] => validate_url
[5] => validate_email
[6] => validate_ip
[7] => string
[8] => stripped
[9] => encoded
[10] => special_chars
[11] => unsafe_raw
[12] => email
[13] => url
[14] => number_int
[15] => number_float
[16] => magic_quotes
[17] => callback
)
```
php ZipArchive::clearError ZipArchive::clearError
======================
(PHP 8 >= 8.2.0, PECL zip >= 1.20.0)
ZipArchive::clearError — Clear the status error message, system and/or zip messages
### Description
```
public ZipArchive::clearError(): void
```
Clear the status error message, system and/or zip messages.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### See Also
* [ZipArchive::getStatusString()](ziparchive.getstatusstring) - Returns the status error message, system and/or zip messages
php SolrQuery::getFacetOffset SolrQuery::getFacetOffset
=========================
(PECL solr >= 0.9.2)
SolrQuery::getFacetOffset — Returns an offset into the list of constraints to be used for pagination
### Description
```
public SolrQuery::getFacetOffset(string $field_override = ?): int
```
Returns an offset into the list of constraints to be used for pagination. Accepts an optional field override
### Parameters
`field_override`
The name of the field to override for.
### Return Values
Returns an integer on success and **`null`** if not set
php array_intersect_ukey array\_intersect\_ukey
======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
array\_intersect\_ukey — Computes the intersection of arrays using a callback function on the keys for comparison
### Description
```
array_intersect_ukey(array $array, array ...$arrays, callable $key_compare_func): array
```
**array\_intersect\_ukey()** returns an array containing all the values of `array` which have matching keys that are present in all the arguments.
### Parameters
`array`
Initial array for comparison of the arrays.
`arrays`
Arrays to compare keys against.
`key_compare_func`
The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
```
callback(mixed $a, mixed $b): int
```
### Return Values
Returns the values of `array` whose keys exist in all the arguments.
### Examples
**Example #1 **array\_intersect\_ukey()** example**
```
<?php
function key_compare_func($key1, $key2)
{
if ($key1 == $key2)
return 0;
else if ($key1 > $key2)
return 1;
else
return -1;
}
$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
var_dump(array_intersect_ukey($array1, $array2, 'key_compare_func'));
?>
```
The above example will output:
```
array(2) {
["blue"]=>
int(1)
["green"]=>
int(3)
}
```
In our example you see that only the keys `'blue'` and `'green'` are present in both arrays and thus returned. Also notice that the values for the keys `'blue'` and `'green'` differ between the two arrays. A match still occurs because only the keys are checked. The values returned are those of `array`.
### See Also
* [array\_diff()](function.array-diff) - Computes the difference of arrays
* [array\_udiff()](function.array-udiff) - Computes the difference of arrays by using a callback function for data comparison
* [array\_diff\_assoc()](function.array-diff-assoc) - Computes the difference of arrays with additional index check
* [array\_diff\_uassoc()](function.array-diff-uassoc) - Computes the difference of arrays with additional index check which is performed by a user supplied callback function
* [array\_udiff\_assoc()](function.array-udiff-assoc) - Computes the difference of arrays with additional index check, compares data by a callback function
* [array\_udiff\_uassoc()](function.array-udiff-uassoc) - Computes the difference of arrays with additional index check, compares data and indexes by a callback function
* [array\_diff\_key()](function.array-diff-key) - Computes the difference of arrays using keys for comparison
* [array\_diff\_ukey()](function.array-diff-ukey) - Computes the difference of arrays using a callback function on the keys for comparison
* [array\_intersect()](function.array-intersect) - Computes the intersection of arrays
* [array\_intersect\_assoc()](function.array-intersect-assoc) - Computes the intersection of arrays with additional index check
* [array\_intersect\_uassoc()](function.array-intersect-uassoc) - Computes the intersection of arrays with additional index check, compares indexes by a callback function
* [array\_intersect\_key()](function.array-intersect-key) - Computes the intersection of arrays using keys for comparison
php SoapServer::getFunctions SoapServer::getFunctions
========================
(PHP 5, PHP 7, PHP 8)
SoapServer::getFunctions — Returns list of defined functions
### Description
```
public SoapServer::getFunctions(): array
```
Returns a list of the defined functions in the SoapServer object. This method returns the list of all functions added by [SoapServer::addFunction()](soapserver.addfunction) or [SoapServer::setClass()](soapserver.setclass).
### Parameters
This function has no parameters.
### Return Values
An `array` of the defined functions.
### Examples
**Example #1 **SoapServer::getFunctions()** example**
```
<?php
$server = new SoapServer(NULL, array("uri" => "http://test-uri"));
$server->addFunction(SOAP_FUNCTIONS_ALL);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$server->handle();
} else {
echo "This SOAP server can handle following functions: ";
$functions = $server->getFunctions();
foreach($functions as $func) {
echo $func . "\n";
}
}
?>
```
### See Also
* [SoapServer::\_\_construct()](soapserver.construct) - SoapServer constructor
* [SoapServer::addFunction()](soapserver.addfunction) - Adds one or more functions to handle SOAP requests
* [SoapServer::setClass()](soapserver.setclass) - Sets the class which handles SOAP requests
php pg_connection_reset pg\_connection\_reset
=====================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg\_connection\_reset — Reset connection (reconnect)
### Description
```
pg_connection_reset(PgSql\Connection $connection): bool
```
**pg\_connection\_reset()** resets the connection. It is useful for error recovery.
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `connection` parameter expects an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
**Example #1 **pg\_connection\_reset()** example**
```
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$dbconn2 = pg_connection_reset($dbconn);
if ($dbconn2) {
echo "reset successful\n";
} else {
echo "reset failed\n";
}
?>
```
### See Also
* [pg\_connect()](function.pg-connect) - Open a PostgreSQL connection
* [pg\_pconnect()](function.pg-pconnect) - Open a persistent PostgreSQL connection
* [pg\_connection\_status()](function.pg-connection-status) - Get connection status
php Imagick::getImageInterpolateMethod Imagick::getImageInterpolateMethod
==================================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageInterpolateMethod — Returns the interpolation method
### Description
```
public Imagick::getImageInterpolateMethod(): int
```
Returns the interpolation method for the specified image. The method is one of the **`Imagick::INTERPOLATE_*`** constants.
### Parameters
This function has no parameters.
### Return Values
Returns the interpolate method on success.
### Errors/Exceptions
Throws ImagickException on error.
php SimpleXMLElement::__construct SimpleXMLElement::\_\_construct
===============================
(PHP 5, PHP 7, PHP 8)
SimpleXMLElement::\_\_construct — Creates a new SimpleXMLElement object
### Description
public **SimpleXMLElement::\_\_construct**(
string `$data`,
int `$options` = 0,
bool `$dataIsURL` = **`false`**,
string `$namespaceOrPrefix` = "",
bool `$isPrefix` = **`false`**
) Creates a new [SimpleXMLElement](class.simplexmlelement) object.
### Parameters
`data`
A well-formed XML string or the path or URL to an XML document if `dataIsURL` is **`true`**.
`options`
Optionally used to specify [additional Libxml parameters](https://www.php.net/manual/en/libxml.constants.php), which affect reading of XML documents. Options which affect the output of XML documents (e.g. **`LIBXML_NOEMPTYTAG`**) are silently ignored.
>
> **Note**:
>
>
> It may be necessary to pass **`[LIBXML\_PARSEHUGE](https://www.php.net/manual/en/libxml.constants.php#constant.libxml-parsehuge)`** to be able to process deeply nested XML or very large text nodes.
>
>
`dataIsURL`
By default, `dataIsURL` is **`false`**. Use **`true`** to specify that `data` is a path or URL to an XML document instead of string data.
`namespaceOrPrefix`
Namespace prefix or URI.
`isPrefix`
**`true`** if `namespaceOrPrefix` is a prefix, **`false`** if it's a URI; defaults to **`false`**.
### Errors/Exceptions
Produces an **`E_WARNING`** error message for each error found in the XML data and additionally throws an [Exception](class.exception) if the XML data could not be parsed.
**Tip** Use [libxml\_use\_internal\_errors()](function.libxml-use-internal-errors) to suppress all XML errors, and [libxml\_get\_errors()](function.libxml-get-errors) to iterate over them afterwards.
### Examples
>
> **Note**:
>
>
> Listed examples may include `example.php`, which refers to the XML string found in the first example of the [basic usage](https://www.php.net/manual/en/simplexml.examples-basic.php) guide.
>
>
**Example #1 Create a SimpleXMLElement object**
```
<?php
include 'example.php';
$sxe = new SimpleXMLElement($xmlstr);
echo $sxe->movie[0]->title;
?>
```
The above example will output:
```
PHP: Behind the Parser
```
**Example #2 Create a SimpleXMLElement object from a URL**
```
<?php
$sxe = new SimpleXMLElement('http://example.org/document.xml', NULL, TRUE);
echo $sxe->asXML();
?>
```
### See Also
* [Basic SimpleXML usage](https://www.php.net/manual/en/simplexml.examples-basic.php)
* [simplexml\_load\_string()](function.simplexml-load-string) - Interprets a string of XML into an object
* [simplexml\_load\_file()](function.simplexml-load-file) - Interprets an XML file into an object
* [Dealing with XML errors](https://www.php.net/manual/en/simplexml.examples-errors.php)
* [libxml\_use\_internal\_errors()](function.libxml-use-internal-errors) - Disable libxml errors and allow user to fetch error information as needed
* [libxml\_set\_streams\_context()](function.libxml-set-streams-context) - Set the streams context for the next libxml document load or write
| programming_docs |
php imagesx imagesx
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
imagesx — Get image width
### Description
```
imagesx(GdImage $image): int
```
Returns the width of the given `image` object.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
### Return Values
Return the width of the `image` or **`false`** on errors.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 Using **imagesx()****
```
<?php
// create a 300*200 image
$img = imagecreatetruecolor(300, 200);
echo imagesx($img); // 300
?>
```
### See Also
* [imagecreatetruecolor()](function.imagecreatetruecolor) - Create a new true color image
* [getimagesize()](function.getimagesize) - Get the size of an image
* [imagesy()](function.imagesy) - Get image height
php Ds\Sequence::capacity Ds\Sequence::capacity
=====================
(PECL ds >= 1.0.0)
Ds\Sequence::capacity — Returns the current capacity
### Description
```
abstract public Ds\Sequence::capacity(): int
```
Returns the current capacity.
### Parameters
This function has no parameters.
### Return Values
The current capacity.
### Examples
**Example #1 **Ds\Sequence::capacity()** example**
```
<?php
$sequence = new \Ds\Vector();
var_dump($sequence->capacity());
$sequence->push(...range(1, 50));
var_dump($sequence->capacity());
$sequence[] = "a";
var_dump($sequence->capacity());
?>
```
The above example will output something similar to:
```
int(10)
int(50)
int(75)
```
php DOMDocument::createTextNode DOMDocument::createTextNode
===========================
(PHP 5, PHP 7, PHP 8)
DOMDocument::createTextNode — Create new text node
### Description
```
public DOMDocument::createTextNode(string $data): DOMText
```
This function creates a new instance of class [DOMText](class.domtext). This node will not show up in the document unless it is inserted with (e.g.) [DOMNode::appendChild()](domnode.appendchild).
### Parameters
`data`
The content of the text.
### Return Values
The new [DOMText](class.domtext).
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | In case of an error, a [DomException](class.domexception) is thrown now. Previously, **`false`** was returned. |
### See Also
* [DOMNode::appendChild()](domnode.appendchild) - Adds new child at the end of the children
* [DOMDocument::createAttribute()](domdocument.createattribute) - Create new attribute
* [DOMDocument::createAttributeNS()](domdocument.createattributens) - Create new attribute node with an associated namespace
* [DOMDocument::createCDATASection()](domdocument.createcdatasection) - Create new cdata node
* [DOMDocument::createComment()](domdocument.createcomment) - Create new comment node
* [DOMDocument::createDocumentFragment()](domdocument.createdocumentfragment) - Create new document fragment
* [DOMDocument::createElement()](domdocument.createelement) - Create new element node
* [DOMDocument::createElementNS()](domdocument.createelementns) - Create new element node with an associated namespace
* [DOMDocument::createEntityReference()](domdocument.createentityreference) - Create new entity reference node
* [DOMDocument::createProcessingInstruction()](domdocument.createprocessinginstruction) - Creates new PI node
php Phar::createDefaultStub Phar::createDefaultStub
=======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
Phar::createDefaultStub — Create a phar-file format specific stub
### Description
```
final public static Phar::createDefaultStub(?string $index = null, ?string $webIndex = null): string
```
This method is intended for creation of phar-file format-specific stubs, and is not intended for use with tar- or zip-based phar archives.
Phar archives contain a bootstrap loader, or `stub` written in PHP that is executed when the archive is executed in PHP either via include:
```
<?php
include 'myphar.phar';
?>
```
or by simple execution:
```
php myphar.phar
```
This method provides a simple and easy method to create a stub that will run a startup file from the phar archive. In addition, different files can be specified for running the phar archive from the command line versus through a web server. The loader stub also calls [Phar::interceptFileFuncs()](phar.interceptfilefuncs) to allow easy bundling of a PHP application that accesses the file system. If the phar extension is not present, the loader stub will extract the phar archive to a temporary directory and then operate on the files. A shutdown function erases the temporary files on exit.
### Parameters
`index`
Relative path within the phar archive to run if accessed on the command-line
`webIndex`
Relative path within the phar archive to run if accessed through a web browser
### Return Values
Returns a string containing the contents of a customized bootstrap loader (stub) that allows the created Phar archive to work with or without the Phar extension enabled.
### Errors/Exceptions
Throws [UnexpectedValueException](class.unexpectedvalueexception) if either parameter is longer than 400 bytes.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `index` and `webIndex` are now nullable. |
### Examples
**Example #1 A **Phar::createDefaultStub()** example**
```
<?php
try {
$phar = new Phar('myphar.phar');
$phar->setStub($phar->createDefaultStub('cli.php', 'web/index.php'));
} catch (Exception $e) {
// handle errors
}
?>
```
### See Also
* [Phar::setStub()](phar.setstub) - Used to set the PHP loader or bootstrap stub of a Phar archive
* [Phar::getStub()](phar.getstub) - Return the PHP loader or bootstrap stub of a Phar archive
php Fiber::isRunning Fiber::isRunning
================
(PHP 8 >= 8.1.0)
Fiber::isRunning — Determines if the fiber is running
### Description
```
public Fiber::isRunning(): bool
```
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** only if the fiber is running. A fiber is considered running after a call to [Fiber::start()](fiber.start), [Fiber::resume()](fiber.resume), or [Fiber::throw()](fiber.throw) that has not yet returned. Return **`false`** if the fiber is not running.
php ArrayObject::uasort ArrayObject::uasort
===================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
ArrayObject::uasort — Sort the entries with a user-defined comparison function and maintain key association
### Description
```
public ArrayObject::uasort(callable $callback): bool
```
This function sorts the entries such that keys maintain their correlation with the entry that they are associated with, using a user-defined comparison function.
This is used mainly when sorting associative arrays where the actual element order is significant.
>
> **Note**:
>
>
> If two members compare as equal, they retain their original order. Prior to PHP 8.0.0, their relative order in the sorted array was undefined.
>
>
### Parameters
`callback`
The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
```
callback(mixed $a, mixed $b): int
```
### Return Values
Always returns **`true`**.
### Examples
**Example #1 **ArrayObject::uasort()** example**
```
<?php
// Comparison function
function cmp($a, $b) {
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
}
// Array to be sorted
$array = array('a' => 4, 'b' => 8, 'c' => -1, 'd' => -9, 'e' => 2, 'f' => 5, 'g' => 3, 'h' => -4);
$arrayObject = new ArrayObject($array);
print_r($arrayObject);
// Sort and print the resulting array
$arrayObject->uasort('cmp');
print_r($arrayObject);
?>
```
The above example will output:
```
Array
(
[a] => 4
[b] => 8
[c] => -1
[d] => -9
[e] => 2
[f] => 5
[g] => 3
[h] => -4
)
Array
(
[d] => -9
[h] => -4
[c] => -1
[e] => 2
[g] => 3
[a] => 4
[f] => 5
[b] => 8
)
```
### See Also
* [ArrayObject::asort()](arrayobject.asort) - Sort the entries by value
* [ArrayObject::ksort()](arrayobject.ksort) - Sort the entries by key
* [ArrayObject::natsort()](arrayobject.natsort) - Sort entries using a "natural order" algorithm
* [ArrayObject::natcasesort()](arrayobject.natcasesort) - Sort an array using a case insensitive "natural order" algorithm
* [ArrayObject::uksort()](arrayobject.uksort) - Sort the entries by keys using a user-defined comparison function
* [uasort()](function.uasort) - Sort an array with a user-defined comparison function and maintain index association
php DOMNode::hasAttributes DOMNode::hasAttributes
======================
(PHP 5, PHP 7, PHP 8)
DOMNode::hasAttributes — Checks if node has attributes
### Description
```
public DOMNode::hasAttributes(): bool
```
This method checks if the node has attributes. The tested node has to be an **`XML_ELEMENT_NODE`**.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [DOMNode::hasChildNodes()](domnode.haschildnodes) - Checks if node has children
php sizeof sizeof
======
(PHP 4, PHP 5, PHP 7, PHP 8)
sizeof — Alias of [count()](function.count)
### Description
This function is an alias of: [count()](function.count).
php gzpassthru gzpassthru
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
gzpassthru — Output all remaining data on a gz-file pointer
### Description
```
gzpassthru(resource $stream): int
```
Reads to EOF on the given gz-file pointer from the current position and writes the (uncompressed) results to standard output.
>
> **Note**:
>
>
> You may need to call [gzrewind()](function.gzrewind) to reset the file pointer to the beginning of the file if you have already written data to it.
>
>
**Tip** If you just want to dump the contents of a file to the output buffer, without first modifying it or seeking to a particular offset, you may want to use the [readgzfile()](function.readgzfile) function, which saves you the [gzopen()](function.gzopen) call.
### Parameters
`stream`
The gz-file pointer. It must be valid, and must point to a file successfully opened by [gzopen()](function.gzopen).
### Return Values
The number of uncompressed characters read from `gz` and passed through to the input, or **`false`** on error.
### Examples
**Example #1 **gzpassthru()** example**
```
<?php
$fp = gzopen('file.gz', 'r');
gzpassthru($fp);
gzclose($fp);
?>
```
php The ReflectionUnionType class
The ReflectionUnionType class
=============================
Introduction
------------
(PHP 8)
Class synopsis
--------------
class **ReflectionUnionType** extends [ReflectionType](class.reflectiontype) { /\* Methods \*/
```
public getTypes(): array
```
/\* Inherited methods \*/
```
public ReflectionType::allowsNull(): bool
```
```
public ReflectionType::__toString(): string
```
} Table of Contents
-----------------
* [ReflectionUnionType::getTypes](reflectionuniontype.gettypes) — Returns the types included in the union type
php SolrInputDocument::getField SolrInputDocument::getField
===========================
(PECL solr >= 0.9.2)
SolrInputDocument::getField — Retrieves a field by name
### Description
```
public SolrInputDocument::getField(string $fieldName): SolrDocumentField
```
Retrieves a field in the document.
### Parameters
`fieldName`
The name of the field.
### Return Values
Returns a SolrDocumentField object on success and **`false`** on failure.
php fdf_set_status fdf\_set\_status
================
(PHP 4, PHP 5 < 5.3.0, PECL fdf SVN)
fdf\_set\_status — Set the value of the /STATUS key
### Description
```
fdf_set_status(resource $fdf_document, string $status): bool
```
Sets the value of the `/STATUS` key. When a client receives a FDF with a status set it will present the value in an alert box.
### Parameters
`fdf_document`
The FDF document handle, returned by [fdf\_create()](function.fdf-create), [fdf\_open()](function.fdf-open) or [fdf\_open\_string()](function.fdf-open-string).
`status`
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [fdf\_get\_status()](function.fdf-get-status) - Get the value of the /STATUS key
php mhash_count mhash\_count
============
(PHP 4, PHP 5, PHP 7, PHP 8)
mhash\_count — Gets the highest available hash ID
**Warning**This function has been *DEPRECATED* as of PHP 8.1.0. Relying on this function is highly discouraged.
### Description
```
mhash_count(): int
```
Gets the highest available hash ID.
### Parameters
This function has no parameters.
### Return Values
Returns the highest available hash ID. Hashes are numbered from 0 to this hash ID.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | This function has been deprecated. Use the [`hash_*()` functions](https://www.php.net/manual/en/ref.hash.php) instead. |
### Examples
**Example #1 Traversing all hashes**
```
<?php
$nr = mhash_count();
for ($i = 0; $i <= $nr; $i++) {
echo sprintf("The blocksize of %s is %d\n",
mhash_get_hash_name($i),
mhash_get_block_size($i));
}
?>
```
php ZipArchive::getFromName ZipArchive::getFromName
=======================
(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.1.0)
ZipArchive::getFromName — Returns the entry contents using its name
### Description
```
public ZipArchive::getFromName(string $name, int $len = 0, int $flags = 0): string|false
```
Returns the entry contents using its name.
### Parameters
`name`
Name of the entry
`len`
The length to be read from the entry. If `0`, then the entire entry is read.
`flags`
The flags to use to find the entry. The following values may be ORed.
* **`ZipArchive::FL_UNCHANGED`**
* **`ZipArchive::FL_COMPRESSED`**
* **`ZipArchive::FL_NOCASE`**
### Return Values
Returns the contents of the entry on success or **`false`** on failure.
### Examples
**Example #1 Get the file contents**
```
<?php
$zip = new ZipArchive;
if ($zip->open('test1.zip') === TRUE) {
echo $zip->getFromName('testfromfile.php');
$zip->close();
} else {
echo 'failed';
}
?>
```
**Example #2 Convert an image from a zip entry**
```
<?php
$z = new ZipArchive();
if ($z->open(dirname(__FILE__) . '/test_im.zip')) {
$im_string = $z->getFromName("pear_item.gif");
$im = imagecreatefromstring($im_string);
imagepng($im, 'b.png');
}
?>
```
### See Also
* [ZipArchive::getFromIndex()](ziparchive.getfromindex) - Returns the entry contents using its index
php sqlsrv_client_info sqlsrv\_client\_info
====================
(No version information available, might only be in Git)
sqlsrv\_client\_info — Returns information about the client and specified connection
### Description
```
sqlsrv_client_info(resource $conn): array
```
Returns information about the client and specified connection
### Parameters
`conn`
The connection about which information is returned.
### Return Values
Returns an associative array with keys described in the table below. Returns **`false`** otherwise.
**Array returned by sqlsrv\_client\_info**| Key | Description |
| --- | --- |
| DriverDllName | SQLNCLI10.DLL |
| DriverODBCVer | ODBC version (xx.yy) |
| DriverVer | SQL Server Native Client DLL version (10.5.xxx) |
| ExtensionVer | php\_sqlsrv.dll version (2.0.xxx.x) |
### Examples
**Example #1 **sqlsrv\_client\_info()** example**
```
<?php
$serverName = "serverName\sqlexpress";
$connOptions = array("UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connOptions );
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
if( $client_info = sqlsrv_client_info( $conn)) {
foreach( $client_info as $key => $value) {
echo $key.": ".$value."<br />";
}
} else {
echo "Error in retrieving client info.<br />";
}
?>
```
### See Also
* [sqlsrv\_server\_info()](function.sqlsrv-server-info) - Returns information about the server
php EventUtil::getLastSocketError EventUtil::getLastSocketError
=============================
(PECL event >= 1.2.6-beta)
EventUtil::getLastSocketError — Returns the most recent socket error
### Description
```
public static EventUtil::getLastSocketError( mixed $socket = ?): string
```
Returns the most recent socket error.
### Parameters
`socket` Socket resource, stream or a file descriptor of a socket.
### Return Values
Returns the most recent socket error.
### See Also
* [EventUtil::getLastSocketErrno()](eventutil.getlastsocketerrno) - Returns the most recent socket error number
php Ds\Deque::isEmpty Ds\Deque::isEmpty
=================
(PECL ds >= 1.0.0)
Ds\Deque::isEmpty — Returns whether the deque is empty
### Description
```
public Ds\Deque::isEmpty(): bool
```
Returns whether the deque is empty.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the deque is empty, **`false`** otherwise.
### Examples
**Example #1 **Ds\Deque::isEmpty()** example**
```
<?php
$a = new \Ds\Deque([1, 2, 3]);
$b = new \Ds\Deque();
var_dump($a->isEmpty());
var_dump($b->isEmpty());
?>
```
The above example will output something similar to:
```
bool(false)
bool(true)
```
php PDOStatement::setFetchMode PDOStatement::setFetchMode
==========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.2.0)
PDOStatement::setFetchMode — Set the default fetch mode for this statement
### Description
```
public PDOStatement::setFetchMode(int $mode): bool
```
```
public PDOStatement::setFetchMode(int $mode = PDO::FETCH_COLUMN, int $colno): bool
```
```
public PDOStatement::setFetchMode(int $mode = PDO::FETCH_CLASS, string $class, ?array $constructorArgs = null): bool
```
```
public PDOStatement::setFetchMode(int $mode = PDO::FETCH_INTO, object $object): bool
```
### Parameters
`mode`
The fetch mode must be one of the `PDO::FETCH_*` constants.
`colno`
Column number.
`class`
Class name.
`constructorArgs`
Constructor arguments.
`object`
Object.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Setting the fetch mode**
The following example demonstrates how **PDOStatement::setFetchMode()** changes the default fetch mode for a PDOStatement object.
```
<?php
$stmt = $dbh->query('SELECT name, colour, calories FROM fruit');
$stmt->setFetchMode(PDO::FETCH_NUM);
foreach ($stmt as $row) {
print $row[0] . "\t" . $row[1] . "\t" . $row[2] . "\n";
}
```
The above example will output something similar to:
```
apple red 150
banana yellow 250
orange orange 300
kiwi brown 75
lemon yellow 25
pear green 150
```
php vsprintf vsprintf
========
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
vsprintf — Return a formatted string
### Description
```
vsprintf(string $format, array $values): string
```
Operates as [sprintf()](function.sprintf) but accepts an array of arguments, rather than a variable number of arguments.
### Parameters
`format`
The format string is composed of zero or more directives: ordinary characters (excluding `%`) that are copied directly to the result and *conversion specifications*, each of which results in fetching its own parameter.
A conversion specification follows this prototype: `%[argnum$][flags][width][.precision]specifier`.
##### Argnum
An integer followed by a dollar sign `$`, to specify which number argument to treat in the conversion.
**Flags**| Flag | Description |
| --- | --- |
| `-` | Left-justify within the given field width; Right justification is the default |
| `+` | Prefix positive numbers with a plus sign `+`; Default only negative are prefixed with a negative sign. |
|
(space) | Pads the result with spaces. This is the default. |
| `0` | Only left-pads numbers with zeros. With `s` specifiers this can also right-pad with zeros. |
| `'`(char) | Pads the result with the character (char). |
##### Width
An integer that says how many characters (minimum) this conversion should result in.
##### Precision
A period `.` followed by an integer who's meaning depends on the specifier:
* For `e`, `E`, `f` and `F` specifiers: this is the number of digits to be printed after the decimal point (by default, this is 6).
* For `g`, `G`, `h` and `H` specifiers: this is the maximum number of significant digits to be printed.
* For `s` specifier: it acts as a cutoff point, setting a maximum character limit to the string.
> **Note**: If the period is specified without an explicit value for precision, 0 is assumed.
>
>
> **Note**: Attempting to use a position specifier greater than **`PHP_INT_MAX`** will generate warnings.
>
>
**Specifiers**| Specifier | Description |
| --- | --- |
| `%` | A literal percent character. No argument is required. |
| `b` | The argument is treated as an integer and presented as a binary number. |
| `c` | The argument is treated as an integer and presented as the character with that ASCII. |
| `d` | The argument is treated as an integer and presented as a (signed) decimal number. |
| `e` | The argument is treated as scientific notation (e.g. 1.2e+2). |
| `E` | Like the `e` specifier but uses uppercase letter (e.g. 1.2E+2). |
| `f` | The argument is treated as a float and presented as a floating-point number (locale aware). |
| `F` | The argument is treated as a float and presented as a floating-point number (non-locale aware). |
| `g` | General format. Let P equal the precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero. Then, if a conversion with style E would have an exponent of X: If P > X ≥ −4, the conversion is with style f and precision P − (X + 1). Otherwise, the conversion is with style e and precision P − 1. |
| `G` | Like the `g` specifier but uses `E` and `f`. |
| `h` | Like the `g` specifier but uses `F`. Available as of PHP 8.0.0. |
| `H` | Like the `g` specifier but uses `E` and `F`. Available as of PHP 8.0.0. |
| `o` | The argument is treated as an integer and presented as an octal number. |
| `s` | The argument is treated and presented as a string. |
| `u` | The argument is treated as an integer and presented as an unsigned decimal number. |
| `x` | The argument is treated as an integer and presented as a hexadecimal number (with lowercase letters). |
| `X` | The argument is treated as an integer and presented as a hexadecimal number (with uppercase letters). |
**Warning** The `c` type specifier ignores padding and width
**Warning** Attempting to use a combination of the string and width specifiers with character sets that require more than one byte per character may result in unexpected results
Variables will be co-erced to a suitable type for the specifier:
**Type Handling**| Type | Specifiers |
| --- | --- |
| string | `s` |
| int | `d`, `u`, `c`, `o`, `x`, `X`, `b` |
| float | `e`, `E`, `f`, `F`, `g`, `G`, `h`, `H` |
`values`
### Return Values
Return array values as a formatted string according to `format`.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function no longer returns **`false`** on failure. |
### Examples
**Example #1 **vsprintf()**: zero-padded integers**
```
<?php
print vsprintf("%04d-%02d-%02d", explode('-', '1988-8-1'));
?>
```
The above example will output:
```
1988-08-01
```
### See Also
* [printf()](function.printf) - Output a formatted string
* [sprintf()](function.sprintf) - Return a formatted string
* [fprintf()](function.fprintf) - Write a formatted string to a stream
* [vprintf()](function.vprintf) - Output a formatted string
* [vfprintf()](function.vfprintf) - Write a formatted string to a stream
* [sscanf()](function.sscanf) - Parses input from a string according to a format
* [fscanf()](function.fscanf) - Parses input from a file according to a format
* [number\_format()](function.number-format) - Format a number with grouped thousands
* [date()](function.date) - Format a Unix timestamp
| programming_docs |
php ZipArchive::renameName ZipArchive::renameName
======================
(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.5.0)
ZipArchive::renameName — Renames an entry defined by its name
### Description
```
public ZipArchive::renameName(string $name, string $new_name): bool
```
Renames an entry defined by its name.
### Parameters
`name`
Name of the entry to rename.
`new_name`
New name.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Rename one entry**
```
<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip');
if ($res === TRUE) {
$zip->renameName('currentname.txt','newname.txt');
$zip->close();
} else {
echo 'failed, code:' . $res;
}
?>
```
php Yaf_Application::clearLastError Yaf\_Application::clearLastError
================================
(Yaf >=2.1.2)
Yaf\_Application::clearLastError — Clear the last error info
### Description
```
public Yaf_Application::clearLastError(): Yaf_Application
```
### Parameters
This function has no parameters.
### Return Values
### Examples
**Example #1 **Yaf\_Application::clearLastError()**example**
```
<?php
function error_handler($errno, $errstr, $errfile, $errline) {
Yaf_Application::app()->clearLastError();
var_dump(Yaf_Application::app()->getLastErrorNo());
}
$config = array(
"application" => array(
"directory" => "/tmp/notexists",
"dispatcher" => array(
"throwException" => 0, //trigger error instead of throw exception when error occure
),
),
);
$app = new Yaf_Application($config);
$app->getDispatcher()->setErrorHandler("error_handler", E_RECOVERABLE_ERROR);
$app->run();
?>
```
The above example will output something similar to:
```
int(0)
```
php apache_get_modules apache\_get\_modules
====================
(PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8)
apache\_get\_modules — Get a list of loaded Apache modules
### Description
```
apache_get_modules(): array
```
Get a list of loaded Apache modules.
### Parameters
This function has no parameters.
### Return Values
An array of loaded Apache modules.
### Examples
**Example #1 **apache\_get\_modules()** example**
```
<?php
print_r(apache_get_modules());
?>
```
The above example will output something similar to:
```
Array
(
[0] => core
[1] => http_core
[2] => mod_so
[3] => sapi_apache2
[4] => mod_mime
[5] => mod_rewrite
)
```
php SolrDisMaxQuery::removeQueryField SolrDisMaxQuery::removeQueryField
=================================
(No version information available, might only be in Git)
SolrDisMaxQuery::removeQueryField — Removes a Query Field (qf parameter)
### Description
```
public SolrDisMaxQuery::removeQueryField(string $field): SolrDisMaxQuery
```
Removes a Query Field (qf parameter) from the field list added by [SolrDisMaxQuery::addQueryField()](solrdismaxquery.addqueryfield)
qf: When building DisjunctionMaxQueries from the user's query it specifies the fields to search in, and boosts for those fields.
### Parameters
`field`
Field Name
### Return Values
[SolrDisMaxQuery](class.solrdismaxquery)
### Examples
**Example #1 **SolrDisMaxQuery::removeQueryField()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery('lucene');
$dismaxQuery
->addQueryField('first', 3)
->addQueryField('second', 0.2)
->addQueryField('cat');
echo $dismaxQuery . PHP_EOL;
// remove field 'second'
echo $dismaxQuery->removeQueryField('second');
?>
```
The above example will output something similar to:
```
q=lucene&defType=edismax&qf=first^3 second^0.2 cat
q=lucene&defType=edismax&qf=first^3 cat
```
### See Also
* [SolrDisMaxQuery::addQueryField()](solrdismaxquery.addqueryfield) - Add a query field with optional boost (qf parameter)
php DirectoryIterator::next DirectoryIterator::next
=======================
(PHP 5, PHP 7, PHP 8)
DirectoryIterator::next — Move forward to next DirectoryIterator item
### Description
```
public DirectoryIterator::next(): void
```
Move forward to the next [DirectoryIterator](class.directoryiterator) item.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Examples
**Example #1 **DirectoryIterator::next()** example**
List the contents of a directory using a while loop.
```
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
while($iterator->valid()) {
echo $iterator->getFilename() . "\n";
$iterator->next();
}
?>
```
The above example will output something similar to:
```
.
..
apple.jpg
banana.jpg
index.php
pear.jpg
```
### See Also
* [DirectoryIterator::current()](directoryiterator.current) - Return the current DirectoryIterator item
* [DirectoryIterator::key()](directoryiterator.key) - Return the key for the current DirectoryIterator item
* [DirectoryIterator::rewind()](directoryiterator.rewind) - Rewind the DirectoryIterator back to the start
* [DirectoryIterator::valid()](directoryiterator.valid) - Check whether current DirectoryIterator position is a valid file
* [Iterator::next()](iterator.next) - Move forward to next element
php $php_errormsg $php\_errormsg
==============
(PHP 4, PHP 5, PHP 7)
$php\_errormsg — The previous error message
**Warning**This feature has been *DEPRECATED* as of PHP 7.2.0. Relying on this feature is highly discouraged.
Use [error\_get\_last()](function.error-get-last) instead.
### Description
$php\_errormsg is a variable containing the text of the last error message generated by PHP. This variable will only be available within the scope in which the error occurred, and only if the [track\_errors](https://www.php.net/manual/en/errorfunc.configuration.php#ini.track-errors) configuration option is turned on (it defaults to off).
**Warning** If a user defined error handler ([set\_error\_handler()](function.set-error-handler)) is set $php\_errormsg is only set if the error handler returns **`false`**.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Directive [track\_errors](https://www.php.net/manual/en/errorfunc.configuration.php#ini.track-errors) which caused $php\_errormsg to be available has been removed. |
| 7.2.0 | Directive [track\_errors](https://www.php.net/manual/en/errorfunc.configuration.php#ini.track-errors) which caused $php\_errormsg to be available has been deprecated. |
### Examples
**Example #1 $php\_errormsg example**
```
<?php
@strpos();
echo $php_errormsg;
?>
```
The above example will output something similar to:
```
Wrong parameter count for strpos()
```
### See Also
* [error\_get\_last()](function.error-get-last) - Get the last occurred error
php dba_popen dba\_popen
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
dba\_popen — Open database persistently
### Description
```
dba_popen(
string $path,
string $mode,
?string $handler = null,
int $permission = 0644,
int $map_size = 0,
?int $flags = null
): resource|false
```
**dba\_popen()** establishes a persistent database instance for `path` with `mode` using `handler`.
### Parameters
`path`
Commonly a regular path in your filesystem.
`mode`
It is `r` for read access, `w` for read/write access to an already existing database, `c` for read/write access and database creation if it doesn't currently exist, and `n` for create, truncate and read/write access.
`handler`
The name of the [handler](https://www.php.net/manual/en/dba.requirements.php) which shall be used for accessing `path`. It is passed all optional parameters given to **dba\_popen()** and can act on behalf of them. If `handler` is **`null`**, then the default handler is invoked.
`permission`
Optional int parameter which is passed to the driver. It has the same meaning as the `permissions` parameter of [chmod()](function.chmod), and defaults to `0644`.
The `db1`, `db2`, `db3`, `db4`, `dbm`, `gdbm`, `ndbm`, and `lmdb` drivers support the `permission` parameter.
`map_size`
Optional int parameter which is passed to the driver. Its value should be a multiple of the page size of the OS, or zero, to use the default mapsize.
The `lmdb` driver accepts the `map_size` parameter.
`flags`
Allows to pass flags to the DB drivers. Currently, only LMDB with **`DBA_LMDB_USE_SUB_DIR`** and **`DBA_LMDB_NO_SUB_DIR`** are supported.
### Return Values
Returns a positive handle on success or **`false`** on failure.
### Errors/Exceptions
**`false`** is returned and an **`E_WARNING`** level error is issued when `handler` is **`null`**, but there is no default handler.
### Changelog
| Version | Description |
| --- | --- |
| 8.2.0 | `flags` is added. |
| 8.1.0 | `handler` is now nullable. |
| 7.3.14, 7.4.2 | The `lmdb` driver now supports an additional `map_size` parameter. |
### See Also
* [dba\_open()](function.dba-open) - Open database
* [dba\_close()](function.dba-close) - Close a DBA database
php eio_sync_file_range eio\_sync\_file\_range
======================
(PECL eio >= 0.0.1dev)
eio\_sync\_file\_range — Sync a file segment with disk
### Description
```
eio_sync_file_range(
mixed $fd,
int $offset,
int $nbytes,
int $flags,
int $pri = EIO_PRI_DEFAULT,
callable $callback = NULL,
mixed $data = NULL
): resource
```
**eio\_sync\_file\_range()** permits fine control when synchronizing the open file referred to by the file descriptor `fd` with disk.
### Parameters
`fd`
File descriptor
`offset`
The starting byte of the file range to be synchronized
`nbytes`
Specifies the length of the range to be synchronized, in bytes. If `nbytes` is zero, then all bytes from `offset` through to the end of file are synchronized.
`flags`
A bit-mask. Can include any of the following values: **`EIO_SYNC_FILE_RANGE_WAIT_BEFORE`**, **`EIO_SYNC_FILE_RANGE_WRITE`**, **`EIO_SYNC_FILE_RANGE_WAIT_AFTER`**. These flags have the same meaning as their *SYNC\_FILE\_RANGE\_\** counterparts(see `SYNC_FILE_RANGE(2)` man page).
`pri`
The request priority: **`EIO_PRI_DEFAULT`**, **`EIO_PRI_MIN`**, **`EIO_PRI_MAX`**, or **`null`**. If **`null`** passed, `pri` internally is set to **`EIO_PRI_DEFAULT`**.
`callback`
`callback` function is called when the request is done. It should match the following prototype:
```
void callback(mixed $data, int $result[, resource $req]);
```
`data`
is custom data passed to the request.
`result`
request-specific result value; basically, the value returned by corresponding system call.
`req`
is optional request resource which can be used with functions like [eio\_get\_last\_error()](function.eio-get-last-error)
`data`
Arbitrary variable passed to `callback`.
### Return Values
**eio\_sync\_file\_range()** returns request resource on success, or **`false`** on failure.
php array_reduce array\_reduce
=============
(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)
array\_reduce — Iteratively reduce the array to a single value using a callback function
### Description
```
array_reduce(array $array, callable $callback, mixed $initial = null): mixed
```
**array\_reduce()** applies iteratively the `callback` function to the elements of the `array`, so as to reduce the array to a single value.
### Parameters
`array`
The input array.
`callback`
```
callback(mixed $carry, mixed $item): mixed
```
`carry`
Holds the return value of the previous iteration; in the case of the first iteration it instead holds the value of `initial`.
`item`
Holds the value of the current iteration.
`initial`
If the optional `initial` is available, it will be used at the beginning of the process, or as a final result in case the array is empty.
### Return Values
Returns the resulting value.
If the array is empty and `initial` is not passed, **array\_reduce()** returns **`null`**.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | If `callback` expects a parameter to be passed by reference, this function will now emit an **`E_WARNING`**. |
### Examples
**Example #1 **array\_reduce()** example**
```
<?php
function sum($carry, $item)
{
$carry += $item;
return $carry;
}
function product($carry, $item)
{
$carry *= $item;
return $carry;
}
$a = array(1, 2, 3, 4, 5);
$x = array();
var_dump(array_reduce($a, "sum")); // int(15)
var_dump(array_reduce($a, "product", 10)); // int(1200), because: 10*1*2*3*4*5
var_dump(array_reduce($x, "sum", "No data to reduce")); // string(17) "No data to reduce"
?>
```
### See Also
* [array\_filter()](function.array-filter) - Filters elements of an array using a callback function
* [array\_map()](function.array-map) - Applies the callback to the elements of the given arrays
* [array\_unique()](function.array-unique) - Removes duplicate values from an array
* [array\_count\_values()](function.array-count-values) - Counts all the values of an array
php mcrypt_create_iv mcrypt\_create\_iv
==================
(PHP 4, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mcrypt\_create\_iv — Creates an initialization vector (IV) from a random source
**Warning** This function was *DEPRECATED* in PHP 7.1.0, and *REMOVED* in PHP 7.2.0.
Alternatives to this function include:
* [random\_bytes()](https://www.php.net/manual/en/function.random-bytes.php)
### Description
```
mcrypt_create_iv(int $size, int $source = MCRYPT_DEV_URANDOM): string
```
Creates an initialization vector (IV) from a random source.
The IV is only meant to give an alternative seed to the encryption routines. This IV does not need to be secret at all, though it can be desirable. You even can send it along with your ciphertext without losing security.
### Parameters
`size`
The size of the IV.
`source`
The source of the IV. The source can be **`MCRYPT_RAND`** (system random number generator), **`MCRYPT_DEV_RANDOM`** (read data from /dev/random) and **`MCRYPT_DEV_URANDOM`** (read data from /dev/urandom). Prior to 5.3.0, **`MCRYPT_RAND`** was the only one supported on Windows.
Note that the default value of this parameter was **`MCRYPT_DEV_RANDOM`** prior to PHP 5.6.0.
> **Note**: Note that **`MCRYPT_DEV_RANDOM`** may block until more entropy is available.
>
>
### Return Values
Returns the initialization vector, or **`false`** on error.
### Examples
**Example #1 **mcrypt\_create\_iv()** Example**
```
<?php
$size = mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_CFB);
$iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);
?>
```
### See Also
* [» http://www.ciphersbyritter.com/GLOSSARY.HTM#IV](http://www.ciphersbyritter.com/GLOSSARY.HTM#IV)
* [» http://www.quadibloc.com/crypto/co0409.htm](http://www.quadibloc.com/crypto/co0409.htm)
* Chapter 9.3 of Applied Cryptography by Schneier (ISBN 0-471-11709-9)
* [random\_bytes()](https://www.php.net/manual/en/function.random-bytes.php) - Get cryptographically secure random bytes
php trim trim
====
(PHP 4, PHP 5, PHP 7, PHP 8)
trim — Strip whitespace (or other characters) from the beginning and end of a string
### Description
```
trim(string $string, string $characters = " \n\r\t\v\x00"): string
```
This function returns a string with whitespace stripped from the beginning and end of `string`. Without the second parameter, **trim()** will strip these characters:
* " " (ASCII `32` (`0x20`)), an ordinary space.
* "\t" (ASCII `9` (`0x09`)), a tab.
* "\n" (ASCII `10` (`0x0A`)), a new line (line feed).
* "\r" (ASCII `13` (`0x0D`)), a carriage return.
* "\0" (ASCII `0` (`0x00`)), the `NUL`-byte.
* "\v" (ASCII `11` (`0x0B`)), a vertical tab.
### Parameters
`string`
The string that will be trimmed.
`characters`
Optionally, the stripped characters can also be specified using the `characters` parameter. Simply list all characters that you want to be stripped. With `..` you can specify a range of characters.
### Return Values
The trimmed string.
### Examples
**Example #1 Usage example of **trim()****
```
<?php
$text = "\t\tThese are a few words :) ... ";
$binary = "\x09Example string\x0A";
$hello = "Hello World";
var_dump($text, $binary, $hello);
print "\n";
$trimmed = trim($text);
var_dump($trimmed);
$trimmed = trim($text, " \t.");
var_dump($trimmed);
$trimmed = trim($hello, "Hdle");
var_dump($trimmed);
$trimmed = trim($hello, 'HdWr');
var_dump($trimmed);
// trim the ASCII control characters at the beginning and end of $binary
// (from 0 to 31 inclusive)
$clean = trim($binary, "\x00..\x1F");
var_dump($clean);
?>
```
The above example will output:
```
string(32) " These are a few words :) ... "
string(16) " Example string
"
string(11) "Hello World"
string(28) "These are a few words :) ..."
string(24) "These are a few words :)"
string(5) "o Wor"
string(9) "ello Worl"
string(14) "Example string"
```
**Example #2 Trimming array values with **trim()****
```
<?php
function trim_value(&$value)
{
$value = trim($value);
}
$fruit = array('apple','banana ', ' cranberry ');
var_dump($fruit);
array_walk($fruit, 'trim_value');
var_dump($fruit);
?>
```
The above example will output:
```
array(3) {
[0]=>
string(5) "apple"
[1]=>
string(7) "banana "
[2]=>
string(11) " cranberry "
}
array(3) {
[0]=>
string(5) "apple"
[1]=>
string(6) "banana"
[2]=>
string(9) "cranberry"
}
```
### Notes
>
> **Note**: **Possible gotcha: removing middle characters**
>
>
>
> Because **trim()** trims characters from the beginning and end of a string, it may be confusing when characters are (or are not) removed from the middle. `trim('abc', 'bad')` removes both 'a' and 'b' because it trims 'a' thus moving 'b' to the beginning to also be trimmed. So, this is why it "works" whereas `trim('abc', 'b')` seemingly does not.
>
>
### See Also
* [ltrim()](function.ltrim) - Strip whitespace (or other characters) from the beginning of a string
* [rtrim()](function.rtrim) - Strip whitespace (or other characters) from the end of a string
* [str\_replace()](function.str-replace) - Replace all occurrences of the search string with the replacement string
php ldap_errno ldap\_errno
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
ldap\_errno — Return the LDAP error number of the last LDAP command
### Description
```
ldap_errno(LDAP\Connection $ldap): int
```
Returns the standardized error number returned by the last LDAP command. This number can be converted into a textual error message using [ldap\_err2str()](function.ldap-err2str).
### Parameters
`ldap`
An [LDAP\Connection](class.ldap-connection) instance, returned by [ldap\_connect()](function.ldap-connect).
### Return Values
Return the LDAP error number of the last LDAP command for this link.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `ldap` parameter expects an [LDAP\Connection](class.ldap-connection) instance now; previously, a [resource](language.types.resource) was expected. |
### Examples
Unless you lower your warning level in your php.ini sufficiently or prefix your LDAP commands with @ (at) characters to suppress warning output, the errors generated will also show up in your HTML output.
**Example #1 Generating and catching an error**
```
<?php
// This example contains an error, which we will catch.
$ld = ldap_connect("localhost");
$bind = ldap_bind($ld);
// syntax error in filter expression (errno 87),
// must be "objectclass=*" to work.
$res = @ldap_search($ld, "o=Myorg, c=DE", "objectclass");
if (!$res) {
echo "LDAP-Errno: " . ldap_errno($ld) . "<br />\n";
echo "LDAP-Error: " . ldap_error($ld) . "<br />\n";
die("Argh!<br />\n");
}
$info = ldap_get_entries($ld, $res);
echo $info["count"] . " matching entries.<br />\n";
?>
```
### See Also
* [ldap\_err2str()](function.ldap-err2str) - Convert LDAP error number into string error message
* [ldap\_error()](function.ldap-error) - Return the LDAP error message of the last LDAP command
| programming_docs |
php apcu_inc apcu\_inc
=========
(PECL apcu >= 4.0.0)
apcu\_inc — Increase a stored number
### Description
```
apcu_inc(
string $key,
int $step = 1,
bool &$success = ?,
int $ttl = 0
): int|false
```
Increases a stored number.
### Parameters
`key`
The key of the value being increased.
`step`
The step, or value to increase.
`success`
Optionally pass the success or fail boolean value to this referenced variable.
`ttl`
TTL to use if the operation inserts a new value (rather than incrementing an existing one).
### Return Values
Returns the current value of `key`'s value on success, or **`false`** on failure
### Examples
**Example #1 **apcu\_inc()** example**
```
<?php
echo "Let's do something with success", PHP_EOL;
apcu_store('anumber', 42);
echo apcu_fetch('anumber'), PHP_EOL;
echo apcu_inc('anumber'), PHP_EOL;
echo apcu_inc('anumber', 10), PHP_EOL;
echo apcu_inc('anumber', 10, $success), PHP_EOL;
var_dump($success);
echo "Now, let's fail", PHP_EOL, PHP_EOL;
apcu_store('astring', 'foo');
$ret = apcu_inc('astring', 1, $fail);
var_dump($ret);
var_dump($fail);
?>
```
The above example will output something similar to:
```
Let's do something with success
42
43
53
63
bool(true)
Now, let's fail
bool(false)
bool(false)
```
### See Also
* [apcu\_dec()](function.apcu-dec) - Decrease a stored number
php Yaf_Controller_Abstract::getInvokeArg Yaf\_Controller\_Abstract::getInvokeArg
=======================================
(Yaf >=1.0.0)
Yaf\_Controller\_Abstract::getInvokeArg — The getInvokeArg purpose
### Description
```
public Yaf_Controller_Abstract::getInvokeArg(string $name): void
```
### Parameters
`name`
### Return Values
php VarnishAdmin::setPort VarnishAdmin::setPort
=====================
(PECL varnish >= 0.8)
VarnishAdmin::setPort — Set the class port configuration param
### Description
```
public VarnishAdmin::setPort(int $port): void
```
### Parameters
`port`
Connection port configuration parameter.
### Return Values
php mysqli_result::fetch_object mysqli\_result::fetch\_object
=============================
mysqli\_fetch\_object
=====================
(PHP 5, PHP 7, PHP 8)
mysqli\_result::fetch\_object -- mysqli\_fetch\_object — Fetch the next row of a result set as an object
### Description
Object-oriented style
```
public mysqli_result::fetch_object(string $class = "stdClass", array $constructor_args = []): object|null|false
```
Procedural style
```
mysqli_fetch_object(mysqli_result $result, string $class = "stdClass", array $constructor_args = []): object|null|false
```
Fetches one row of data from the result set and returns it as an object, where each property represents the name of the result set's column. Each subsequent call to this function will return the next row within the result set, or **`null`** if there are no more rows.
If two or more columns of the result have the same name, the last column will take precedence and overwrite any previous data. To access multiple columns with the same name, [mysqli\_fetch\_row()](mysqli-result.fetch-row) may be used to fetch the numerically indexed array, or aliases may be used in the SQL query select list to give columns different names.
> **Note**: This function sets the properties of the object before calling the object constructor.
>
>
> **Note**: Field names returned by this function are *case-sensitive*.
>
>
> **Note**: This function sets NULL fields to the PHP **`null`** value.
>
>
### Parameters
`result`
Procedural style only: A [mysqli\_result](class.mysqli-result) object returned by [mysqli\_query()](mysqli.query), [mysqli\_store\_result()](mysqli.store-result), [mysqli\_use\_result()](mysqli.use-result) or [mysqli\_stmt\_get\_result()](mysqli-stmt.get-result).
`class`
The name of the class to instantiate, set the properties of and return. If not specified, a [stdClass](class.stdclass) object is returned.
`constructor_args`
An optional array of parameters to pass to the constructor for `class` objects.
### Return Values
Returns an object representing the fetched row, where each property represents the name of the result set's column, **`null`** if there are no more rows in the result set, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `constructor_args` now accepts `[]` for constructors with 0 parameters; previously an exception was thrown. |
### Examples
**Example #1 **mysqli\_result::fetch\_object()** example**
Object-oriented style
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
$query = "SELECT Name, CountryCode FROM City ORDER BY ID DESC";
$result = $mysqli->query($query);
/* fetch object array */
while ($obj = $result->fetch_object()) {
printf("%s (%s)\n", $obj->Name, $obj->CountryCode);
}
```
Procedural style
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
$query = "SELECT Name, CountryCode FROM City ORDER BY ID DESC";
$result = mysqli_query($link, $query);
/* fetch associative array */
while ($obj = mysqli_fetch_object($result)) {
printf("%s (%s)\n", $obj->Name, $obj->CountryCode);
}
```
The above examples will output something similar to:
```
Pueblo (USA)
Arvada (USA)
Cape Coral (USA)
Green Bay (USA)
Santa Clara (USA)
```
### See Also
* [mysqli\_fetch\_array()](mysqli-result.fetch-array) - Fetch the next row of a result set as an associative, a numeric array, or both
* [mysqli\_fetch\_assoc()](mysqli-result.fetch-assoc) - Fetch the next row of a result set as an associative array
* [mysqli\_fetch\_column()](mysqli-result.fetch-column) - Fetch a single column from the next row of a result set
* [mysqli\_fetch\_row()](mysqli-result.fetch-row) - Fetch the next row of a result set as an enumerated array
* [mysqli\_query()](mysqli.query) - Performs a query on the database
* [mysqli\_data\_seek()](mysqli-result.data-seek) - Adjusts the result pointer to an arbitrary row in the result
php mb_ord mb\_ord
=======
(PHP 7 >= 7.2.0, PHP 8)
mb\_ord — Get Unicode code point of character
### Description
```
mb_ord(string $string, ?string $encoding = null): int|false
```
Returns the Unicode code point value of the given character.
This function complements [mb\_chr()](function.mb-chr).
### Parameters
`string`
A string
`encoding`
The `encoding` parameter is the character encoding. If it is omitted or **`null`**, the internal character encoding value will be used.
### Return Values
The Unicode code point for the first character of `string` or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `encoding` is nullable now. |
### Examples
```
<?php
var_dump(mb_ord("A", "UTF-8"));
var_dump(mb_ord("🐘", "UTF-8"));
var_dump(mb_ord("\x80", "ISO-8859-1"));
var_dump(mb_ord("\x80", "Windows-1252"));
?>
```
The above example will output:
int(65)
int(128024)
int(128)
int(8364)
### See Also
* [mb\_internal\_encoding()](function.mb-internal-encoding) - Set/Get internal character encoding
* [mb\_chr()](function.mb-chr) - Return character by Unicode code point value
* [IntlChar::ord()](intlchar.ord) - Return Unicode code point value of character
* [ord()](function.ord) - Convert the first byte of a string to a value between 0 and 255
php EventHttpRequest::free EventHttpRequest::free
======================
(PECL event >= 1.4.0-beta)
EventHttpRequest::free — Frees the object and removes associated events
### Description
```
public EventHttpRequest::free(): void
```
Frees the object and removes associated events.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php SolrQuery::getMltMinTermFrequency SolrQuery::getMltMinTermFrequency
=================================
(PECL solr >= 0.9.2)
SolrQuery::getMltMinTermFrequency — Returns the frequency below which terms will be ignored in the source document
### Description
```
public SolrQuery::getMltMinTermFrequency(): int
```
Returns the frequency below which terms will be ignored in the source document
### Parameters
This function has no parameters.
### Return Values
Returns an integer on success and **`null`** if not set.
php Yaf_Application::getDispatcher Yaf\_Application::getDispatcher
===============================
(Yaf >=1.0.0)
Yaf\_Application::getDispatcher — Get Yaf\_Dispatcher instance
### Description
```
public Yaf_Application::getDispatcher(): Yaf_Dispatcher
```
### Parameters
This function has no parameters.
### Return Values
### Examples
**Example #1 **Yaf\_Application::getDispatcher()**example**
```
<?php
$config = array(
"application" => array(
"directory" => realpath(dirname(__FILE__)) . "/application",
),
);
/** Yaf_Application */
$application = new Yaf_Application($config);
print_r($application->getDispatcher());
?>
```
The above example will output something similar to:
```
Yaf_Dispatcher Object
(
[_router:protected] => Yaf_Router Object
(
[_routes:protected] => Array
(
[_default] => Yaf_Route_Static Object
(
)
)
[_current:protected] =>
)
[_view:protected] =>
[_request:protected] => Yaf_Request_Http Object
(
[module] =>
[controller] =>
[action] =>
[method] => Cli
[params:protected] => Array
(
)
[language:protected] =>
[_exception:protected] =>
[_base_uri:protected] =>
[uri:protected] =>
[dispatched:protected] =>
[routed:protected] =>
)
[_plugins:protected] => Array
(
)
[_auto_render:protected] => 1
[_return_response:protected] =>
[_instantly_flush:protected] =>
[_default_module:protected] => Index
[_default_controller:protected] => Index
[_default_action:protected] => index
[_response] => Yaf_Response_Cli Object
(
[_header:protected] => Array
(
)
[_body:protected] =>
[_sendheader:protected] =>
)
)
```
php GearmanClient::addServers GearmanClient::addServers
=========================
(PECL gearman >= 0.5.0)
GearmanClient::addServers — Add a list of job servers to the client
### Description
```
public GearmanClient::addServers(string $servers = 127.0.0.1:4730): bool
```
Adds a list of job servers that can be used to run a task. No socket I/O happens here; the servers are simply added to the full list of servers.
### Parameters
`servers`
A comma-separated list of servers, each server specified in the format '`host:port`'.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Add two job servers**
```
<?php
# Create our client object.
$gmclient= new GearmanClient();
# Add multiple job servers, the first on the default 4730 port
$gmclient->addServers("10.0.0.1,10.0.0.2:7003");
?>
```
### See Also
* [GearmanClient::addServer()](gearmanclient.addserver) - Add a job server to the client
php stats_stat_binomial_coef stats\_stat\_binomial\_coef
===========================
(PECL stats >= 1.0.0)
stats\_stat\_binomial\_coef — Returns a binomial coefficient
### Description
```
stats_stat_binomial_coef(int $x, int $n): float
```
Returns the binomial coefficient of `n` choose `x`.
### Parameters
`x`
The number of chooses from the set
`n`
The number of elements in the set
### Return Values
Returns the binomial coefficient
php ReflectionClass::getProperty ReflectionClass::getProperty
============================
(PHP 5, PHP 7, PHP 8)
ReflectionClass::getProperty — Gets a [ReflectionProperty](class.reflectionproperty) for a class's property
### Description
```
public ReflectionClass::getProperty(string $name): ReflectionProperty
```
Gets a [ReflectionProperty](class.reflectionproperty) for a class's property.
### Parameters
`name`
The property name.
### Return Values
A [ReflectionProperty](class.reflectionproperty).
### Examples
**Example #1 Basic usage of **ReflectionClass::getProperty()****
```
<?php
$class = new ReflectionClass('ReflectionClass');
$property = $class->getProperty('name');
var_dump($property);
?>
```
The above example will output:
```
object(ReflectionProperty)#2 (2) {
["name"]=>
string(4) "name"
["class"]=>
string(15) "ReflectionClass"
}
```
### See Also
* [ReflectionClass::getProperties()](reflectionclass.getproperties) - Gets properties
php max max
===
(PHP 4, PHP 5, PHP 7, PHP 8)
max — Find highest value
### Description
```
max(mixed $value, mixed ...$values): mixed
```
Alternative signature (not supported with named arguments):
```
max(array $value_array): mixed
```
If the first and only parameter is an array, **max()** returns the highest value in that array. If at least two parameters are provided, **max()** returns the biggest of these values.
>
> **Note**:
>
>
> Values of different types will be compared using the [standard comparison rules](language.operators.comparison). For instance, a non-numeric string will be compared to an int as though it were `0`, but multiple non-numeric string values will be compared alphanumerically. The actual value returned will be of the original type with no conversion applied.
>
>
**Caution** Be careful when passing arguments of different types because **max()** can produce unpredictable results.
### Parameters
`value`
Any [comparable](language.operators.comparison) value.
`values`
Any [comparable](language.operators.comparison) values.
`value_array`
An array containing the values.
### Return Values
**max()** returns the parameter value considered "highest" according to standard comparisons. If multiple values of different types evaluate as equal (e.g. `0` and `'abc'`) the first provided to the function will be returned.
### Errors/Exceptions
If an empty array is passed, **max()** throws a [ValueError](class.valueerror).
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | **max()** throws a [ValueError](class.valueerror) on failure now; previously, **`false`** was returned and an **`E_WARNING`** error was emitted. |
### Examples
**Example #1 Example uses of **max()****
```
<?php
echo max(2, 3, 1, 6, 7); // 7
echo max(array(2, 4, 5)); // 5
// The string 'hello' when compared to an int is treated as 0
// Since the two values are equal, the order they are provided determines the result
echo max(0, 'hello'); // 0
echo max('hello', 0); // hello
// Here we are comparing -1 < 0, so 'hello' is the highest value
echo max('hello', -1); // hello
// With multiple arrays of different lengths, max returns the longest
$val = max(array(2, 2, 2), array(1, 1, 1, 1)); // array(1, 1, 1, 1)
// Multiple arrays of the same length are compared from left to right
// so in our example: 2 == 2, but 5 > 4
$val = max(array(2, 4, 8), array(2, 5, 1)); // array(2, 5, 1)
// If both an array and non-array are given, the array will be returned
// as comparisons treat arrays as greater than any other value
$val = max('string', array(2, 5, 7), 42); // array(2, 5, 7)
// If one argument is NULL or a boolean, it will be compared against
// other values using the rule FALSE < TRUE regardless of the other types involved
// In the below example, -10 is treated as TRUE in the comparison
$val = max(-10, FALSE); // -10
// 0, on the other hand, is treated as FALSE, so is "lower than" TRUE
$val = max(0, TRUE); // TRUE
?>
```
### See Also
* [min()](function.min) - Find lowest value
* [count()](function.count) - Counts all elements in an array or in a Countable object
php natcasesort natcasesort
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
natcasesort — Sort an array using a case insensitive "natural order" algorithm
### Description
```
natcasesort(array &$array): bool
```
**natcasesort()** is a case insensitive version of [natsort()](function.natsort).
This function implements a sort algorithm that orders alphanumeric strings in the way a human being would while maintaining key/value associations. This is described as a "natural ordering".
>
> **Note**:
>
>
> If two members compare as equal, they retain their original order. Prior to PHP 8.0.0, their relative order in the sorted array was undefined.
>
>
>
> **Note**:
>
>
> Resets array's internal pointer to the first element.
>
>
### Parameters
`array`
The input array.
### Return Values
Always returns **`true`**.
### Examples
**Example #1 **natcasesort()** example**
```
<?php
$array1 = $array2 = array('IMG0.png', 'img12.png', 'img10.png', 'img2.png', 'img1.png', 'IMG3.png');
sort($array1);
echo "Standard sorting\n";
print_r($array1);
natcasesort($array2);
echo "\nNatural order sorting (case-insensitive)\n";
print_r($array2);
?>
```
The above example will output:
```
Standard sorting
Array
(
[0] => IMG0.png
[1] => IMG3.png
[2] => img1.png
[3] => img10.png
[4] => img12.png
[5] => img2.png
)
Natural order sorting (case-insensitive)
Array
(
[0] => IMG0.png
[4] => img1.png
[3] => img2.png
[5] => IMG3.png
[2] => img10.png
[1] => img12.png
)
```
For more information see: Martin Pool's [» Natural Order String Comparison](https://github.com/sourcefrog/natsort) page.
### See Also
* [natsort()](function.natsort) - Sort an array using a "natural order" algorithm
* The [comparison of array sorting functions](https://www.php.net/manual/en/array.sorting.php)
* [strnatcmp()](function.strnatcmp) - String comparisons using a "natural order" algorithm
* [strnatcasecmp()](function.strnatcasecmp) - Case insensitive string comparisons using a "natural order" algorithm
php SolrInputDocument::addField SolrInputDocument::addField
===========================
(PECL solr >= 0.9.2)
SolrInputDocument::addField — Adds a field to the document
### Description
```
public SolrInputDocument::addField(string $fieldName, string $fieldValue, float $fieldBoostValue = 0.0): bool
```
For multi-value fields, if a valid boost value is specified, the specified value will be multiplied by the current boost value for this field.
### Parameters
`fieldName`
The name of the field
`fieldValue`
The value for the field.
`fieldBoostValue`
The index time boost for the field. Though this cannot be negative, you can still pass values less than 1.0 but they must be greater than zero.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php sodium_crypto_aead_chacha20poly1305_ietf_decrypt sodium\_crypto\_aead\_chacha20poly1305\_ietf\_decrypt
=====================================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_aead\_chacha20poly1305\_ietf\_decrypt — Verify that the ciphertext includes a valid tag
### Description
```
sodium_crypto_aead_chacha20poly1305_ietf_decrypt(
string $ciphertext,
string $additional_data,
string $nonce,
string $key
): string|false
```
Verify then decrypt with ChaCha20-Poly1305 (IETF variant).
The IETF variant uses 96-bit nonces and 32-bit internal counters, instead of 64-bit for both.
### Parameters
`ciphertext`
Must be in the format provided by [sodium\_crypto\_aead\_chacha20poly1305\_ietf\_encrypt()](function.sodium-crypto-aead-chacha20poly1305-ietf-encrypt) (ciphertext and tag, concatenated).
`additional_data`
Additional, authenticated data. This is used in the verification of the authentication tag appended to the ciphertext, but it is not encrypted or stored in the ciphertext.
`nonce`
A number that must be only used once, per message. 12 bytes long.
`key`
Encryption key (256-bit).
### Return Values
Returns the plaintext on success, or **`false`** on failure.
| programming_docs |
php Imagick::setImageType Imagick::setImageType
=====================
(PECL imagick 2, PECL imagick 3)
Imagick::setImageType — Sets the image type
### Description
```
public Imagick::setImageType(int $image_type): bool
```
Sets the image type.
### Parameters
`image_type`
### Return Values
Returns **`true`** on success.
php stream_get_line stream\_get\_line
=================
(PHP 5, PHP 7, PHP 8)
stream\_get\_line — Gets line from stream resource up to a given delimiter
### Description
```
stream_get_line(resource $stream, int $length, string $ending = ""): string|false
```
Gets a line from the given handle.
Reading ends when `length` bytes have been read, when the non-empty string specified by `ending` is found (which is *not* included in the return value), or on EOF (whichever comes first).
This function is nearly identical to [fgets()](function.fgets) except in that it allows end of line delimiters other than the standard \n, \r, and \r\n, and does *not* return the delimiter itself.
### Parameters
`stream`
A valid file handle.
`length`
The maximum number of bytes to read from the handle. Negative values are not supported. Zero (`0`) means the default socket chunk size, i.e. `8192` bytes.
`ending`
An optional string delimiter.
### Return Values
Returns a string of up to `length` bytes read from the file pointed to by `stream`, or **`false`** on failure.
### See Also
* [fread()](function.fread) - Binary-safe file read
* [fgets()](function.fgets) - Gets line from file pointer
* [fgetc()](function.fgetc) - Gets character from file pointer
php ReflectionProperty::__toString ReflectionProperty::\_\_toString
================================
(PHP 5, PHP 7, PHP 8)
ReflectionProperty::\_\_toString — To string
### Description
```
public ReflectionProperty::__toString(): string
```
To string.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
### See Also
* [\_\_toString()](language.oop5.magic#object.tostring)
php IntlBreakIterator::preceding IntlBreakIterator::preceding
============================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlBreakIterator::preceding — Set the iterator position to the first boundary before an offset
### Description
```
public IntlBreakIterator::preceding(int $offset): int
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`offset`
### Return Values
php xml_set_start_namespace_decl_handler xml\_set\_start\_namespace\_decl\_handler
=========================================
(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)
xml\_set\_start\_namespace\_decl\_handler — Set up start namespace declaration handler
### Description
```
xml_set_start_namespace_decl_handler(XMLParser $parser, callable $handler): bool
```
Set a handler to be called when a namespace is declared. Namespace declarations occur inside start tags. But the namespace declaration start handler is called before the start tag handler for each namespace declared in that start tag.
### Parameters
`parser`
A reference to the XML parser.
`handler`
`handler` is a string containing the name of a function that must exist when [xml\_parse()](function.xml-parse) is called for `parser`.
The function named by `handler` must accept three parameters, and should return an integer value. If the value returned from the handler is **`false`** (which it will be if no value is returned), the XML parser will stop parsing and [xml\_get\_error\_code()](function.xml-get-error-code) will return **`XML_ERROR_EXTERNAL_ENTITY_HANDLING`**.
```
handler(XMLParser $parser, string $prefix, string $uri)
```
`parser`
The first parameter, parser, is a reference to the XML parser calling the handler. `prefix`
The prefix is a string used to reference the namespace within an XML object. `uri`
Uniform Resource Identifier (URI) of namespace. If a handler function is set to an empty string, or **`false`**, the handler in question is disabled.
> **Note**: Instead of a function name, an array containing an object reference and a method name can also be supplied.
>
>
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `parser` expects an [XMLParser](class.xmlparser) instance now; previously, a resource was expected. |
### See Also
* [xml\_set\_end\_namespace\_decl\_handler()](function.xml-set-end-namespace-decl-handler) - Set up end namespace declaration handler
php libxml_disable_entity_loader libxml\_disable\_entity\_loader
===============================
(PHP 5 >= 5.2.11, PHP 7, PHP 8)
libxml\_disable\_entity\_loader — Disable the ability to load external entities
**Warning**This function has been *DEPRECATED* as of PHP 8.0.0. Relying on this function is highly discouraged.
### Description
```
libxml_disable_entity_loader(bool $disable = true): bool
```
Disable/enable the ability to load external entities. Note that disabling the loading of external entities may cause general issues with loading XML documents. However, as of libxml 2.9.0 entity substitution is disabled by default, so there is no need to disable the loading of external entities, unless there is the need to resolve internal entity references with **`LIBXML_NOENT`**. Generally, it is preferable to use [libxml\_set\_external\_entity\_loader()](function.libxml-set-external-entity-loader) to suppress loading of external entities.
### Parameters
`disable`
Disable (**`true`**) or enable (**`false`**) libxml extensions (such as [DOM](https://www.php.net/manual/en/book.dom.php), [XMLWriter](https://www.php.net/manual/en/book.xmlwriter.php) and [XMLReader](https://www.php.net/manual/en/book.xmlreader.php)) to load external entities.
### Return Values
Returns the previous value.
### See Also
* [libxml\_use\_internal\_errors()](function.libxml-use-internal-errors) - Disable libxml errors and allow user to fetch error information as needed
* [libxml\_set\_external\_entity\_loader()](function.libxml-set-external-entity-loader) - Changes the default external entity loader
* [The **`LIBXML_NOENT`** constant](https://www.php.net/manual/en/libxml.constants.php)
php fbird_pconnect fbird\_pconnect
===============
(PHP 5, PHP 7 < 7.4.0)
fbird\_pconnect — Alias of [ibase\_pconnect()](function.ibase-pconnect)
### Description
This function is an alias of: [ibase\_pconnect()](function.ibase-pconnect).
### See Also
* [fbird\_close()](function.fbird-close) - Alias of ibase\_close
* [fbird\_connect()](function.fbird-connect) - Alias of ibase\_connect
php OAuth::disableDebug OAuth::disableDebug
===================
(PECL OAuth >= 0.99.3)
OAuth::disableDebug — Turn off verbose debugging
### Description
```
public OAuth::disableDebug(): bool
```
Turns off verbose request information (off by default). Alternatively, the [debug](class.oauth#oauth.props.debug) property can be set to a **`false`** value to turn debug off.
### Parameters
This function has no parameters.
### Return Values
**`true`**
### Changelog
| Version | Description |
| --- | --- |
| PECL oauth 0.99.8 | The related [debug](class.oauth#oauth.props.debug) property was added. |
### See Also
* [OAuth::enableDebug()](oauth.enabledebug) - Turn on verbose debugging
php SplFixedArray::fromArray SplFixedArray::fromArray
========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplFixedArray::fromArray — Import a PHP array in a [SplFixedArray](class.splfixedarray) instance
### Description
```
public static SplFixedArray::fromArray(array $array, bool $preserveKeys = true): SplFixedArray
```
Import the PHP array `array` in a new [SplFixedArray](class.splfixedarray) instance
### Parameters
`array`
The array to import.
`preserveKeys`
Try to save the numeric indexes used in the original array.
### Return Values
Returns an instance of [SplFixedArray](class.splfixedarray) containing the array content.
### Examples
**Example #1 **SplFixedArray::fromArray()** example**
```
<?php
$fa = SplFixedArray::fromArray(array(1 => 1, 0 => 2, 3 => 3));
var_dump($fa);
$fa = SplFixedArray::fromArray(array(1 => 1, 0 => 2, 3 => 3), false);
var_dump($fa);
?>
```
The above example will output:
```
object(SplFixedArray)#1 (4) {
[0]=>
int(2)
[1]=>
int(1)
[2]=>
NULL
[3]=>
int(3)
}
object(SplFixedArray)#2 (3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
```
php Ds\Sequence::filter Ds\Sequence::filter
===================
(PECL ds >= 1.0.0)
Ds\Sequence::filter — Creates a new sequence using a [callable](language.types.callable) to determine which values to include
### Description
```
abstract public Ds\Sequence::filter(callable $callback = ?): Ds\Sequence
```
Creates a new sequence using a [callable](language.types.callable) to determine which values to include.
### Parameters
`callback`
```
callback(mixed $value): bool
```
Optional [callable](language.types.callable) which returns **`true`** if the value should be included, **`false`** otherwise.
If a callback is not provided, only values which are **`true`** (see [converting to boolean](language.types.boolean#language.types.boolean.casting)) will be included.
### Return Values
A new sequence containing all the values for which either the `callback` returned **`true`**, or all values that convert to **`true`** if a `callback` was not provided.
### Examples
**Example #1 **Ds\Sequence::filter()** example using callback function**
```
<?php
$sequence = new \Ds\Vector([1, 2, 3, 4, 5]);
var_dump($sequence->filter(function($value) {
return $value % 2 == 0;
}));
?>
```
The above example will output something similar to:
```
object(Ds\Vector)#3 (2) {
[0]=>
int(2)
[1]=>
int(4)
}
```
**Example #2 **Ds\Sequence::filter()** example without a callback function**
```
<?php
$sequence = new \Ds\Vector([0, 1, 'a', true, false]);
var_dump($sequence->filter());
?>
```
The above example will output something similar to:
```
object(Ds\Vector)#2 (3) {
[0]=>
int(1)
[1]=>
string(1) "a"
[2]=>
bool(true)
}
```
php geoip_isp_by_name geoip\_isp\_by\_name
====================
(PECL geoip >= 1.0.2)
geoip\_isp\_by\_name — Get the Internet Service Provider (ISP) name
### Description
```
geoip_isp_by_name(string $hostname): string
```
The **geoip\_isp\_by\_name()** function will return the name of the Internet Service Provider (ISP) that an IP is assigned to.
This function is currently only available to users who have bought a commercial GeoIP ISP Edition. A warning will be issued if the proper database cannot be located.
### Parameters
`hostname`
The hostname or IP address.
### Return Values
Returns the ISP name on success, or **`false`** if the address cannot be found in the database.
### Examples
**Example #1 A **geoip\_isp\_by\_name()** example**
This will print the ISP name of host example.com.
```
<?php
$isp = geoip_isp_by_name('www.example.com');
if ($isp) {
echo 'This host IP is from ISP: ' . $isp;
}
?>
```
The above example will output:
```
This host IP is from ISP: ICANN c/o Internet Assigned Numbers Authority
```
php Componere\Abstract\Definition::getReflector Componere\Abstract\Definition::getReflector
===========================================
(Componere 2 >= 2.1.0)
Componere\Abstract\Definition::getReflector — Reflection
### Description
```
public Componere\Abstract\Definition::getReflector(): ReflectionClass
```
Shall create or return a ReflectionClass
### Return Values
A ReflectionClass for the current definition (cached)
php DOMElement::setAttribute DOMElement::setAttribute
========================
(PHP 5, PHP 7, PHP 8)
DOMElement::setAttribute — Adds new or modifies existing attribute
### Description
```
public DOMElement::setAttribute(string $qualifiedName, string $value): DOMAttr|bool
```
Sets an attribute with name `qualifiedName` to the given value. If the attribute does not exist, it will be created.
### Parameters
`qualifiedName`
The name of the attribute.
`value`
The value of the attribute.
### Return Values
The created or modified [DOMAttr](class.domattr) or **`false`** if an error occurred.
### Errors/Exceptions
**`DOM_NO_MODIFICATION_ALLOWED_ERR`**
Raised if the node is readonly.
### Examples
**Example #1 Setting an attribute**
```
<?php
$doc = new DOMDocument("1.0");
$node = $doc->createElement("para");
$newnode = $doc->appendChild($node);
$newnode->setAttribute("align", "left");
?>
```
### See Also
* [DOMElement::hasAttribute()](domelement.hasattribute) - Checks to see if attribute exists
* [DOMElement::getAttribute()](domelement.getattribute) - Returns value of attribute
* [DOMElement::removeAttribute()](domelement.removeattribute) - Removes attribute
php XMLWriter::startCdata XMLWriter::startCdata
=====================
xmlwriter\_start\_cdata
=======================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::startCdata -- xmlwriter\_start\_cdata — Create start CDATA tag
### Description
Object-oriented style
```
public XMLWriter::startCdata(): bool
```
Procedural style
```
xmlwriter_start_cdata(XMLWriter $writer): bool
```
Starts a CDATA.
### Parameters
`writer`
Only for procedural calls. The [XMLWriter](class.xmlwriter) instance that is being modified. This object is returned from a call to [xmlwriter\_open\_uri()](xmlwriter.openuri) or [xmlwriter\_open\_memory()](xmlwriter.openmemory).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `writer` expects an [XMLWriter](class.xmlwriter) instance now; previously, a resource was expected. |
### See Also
* [XMLWriter::endCdata()](xmlwriter.endcdata) - End current CDATA
* [XMLWriter::writeCdata()](xmlwriter.writecdata) - Write full CDATA tag
php None Comparing generators with [Iterator](class.iterator) objects
------------------------------------------------------------
The primary advantage of generators is their simplicity. Much less boilerplate code has to be written compared to implementing an [Iterator](class.iterator) class, and the code is generally much more readable. For example, the following function and class are equivalent:
```
<?php
function getLinesFromFile($fileName) {
if (!$fileHandle = fopen($fileName, 'r')) {
return;
}
while (false !== $line = fgets($fileHandle)) {
yield $line;
}
fclose($fileHandle);
}
// versus...
class LineIterator implements Iterator {
protected $fileHandle;
protected $line;
protected $i;
public function __construct($fileName) {
if (!$this->fileHandle = fopen($fileName, 'r')) {
throw new RuntimeException('Couldn\'t open file "' . $fileName . '"');
}
}
public function rewind() {
fseek($this->fileHandle, 0);
$this->line = fgets($this->fileHandle);
$this->i = 0;
}
public function valid() {
return false !== $this->line;
}
public function current() {
return $this->line;
}
public function key() {
return $this->i;
}
public function next() {
if (false !== $this->line) {
$this->line = fgets($this->fileHandle);
$this->i++;
}
}
public function __destruct() {
fclose($this->fileHandle);
}
}
?>
```
This flexibility does come at a cost, however: generators are forward-only iterators, and cannot be rewound once iteration has started. This also means that the same generator can't be iterated over multiple times: the generator will need to be rebuilt by calling the generator function again.
### See Also
* [Object Iteration](language.oop5.iterations)
php eio_nthreads eio\_nthreads
=============
(PECL eio >= 0.0.1dev)
eio\_nthreads — Returns number of threads currently in use
### Description
```
eio_nthreads(): int
```
### Parameters
This function has no parameters.
### Return Values
**eio\_nthreads()** returns number of threads currently in use.
### See Also
* [eio\_npending()](function.eio-npending) - Returns number of finished, but unhandled requests
* [eio\_nready()](function.eio-nready) - Returns number of not-yet handled requests
* [eio\_nreqs()](function.eio-nreqs) - Returns number of requests to be processed
* [eio\_set\_max\_idle()](function.eio-set-max-idle) - Set maximum number of idle threads
* [eio\_set\_max\_parallel()](function.eio-set-max-parallel) - Set maximum parallel threads
* [eio\_set\_min\_parallel()](function.eio-set-min-parallel) - Set minimum parallel thread number
php IntlDateFormatter::getTimeZone IntlDateFormatter::getTimeZone
==============================
datefmt\_get\_timezone
======================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL intl >= 3.0.0)
IntlDateFormatter::getTimeZone -- datefmt\_get\_timezone — Get formatterʼs timezone
### Description
Object-oriented style
```
public IntlDateFormatter::getTimeZone(): IntlTimeZone|false
```
Procedural style
```
datefmt_get_timezone(IntlDateFormatter $formatter): IntlTimeZone|false
```
Returns an [IntlTimeZone](class.intltimezone) object representing the timezone that will be used by this object to format dates and times. When formatting [IntlCalendar](class.intlcalendar) and [DateTime](class.datetime) objects with this [IntlDateFormatter](class.intldateformatter), the timezone used will be the one returned by this method, not the one associated with the objects being formatted.
### Parameters
This function has no parameters.
### Return Values
The associated [IntlTimeZone](class.intltimezone) object or **`false`** on failure.
### Examples
**Example #1 **IntlDateFormatter::getTimeZone()** examples**
```
<?php
$madrid = IntlDateFormatter::create(NULL, NULL, NULL, 'Europe/Madrid');
$lisbon = IntlDateFormatter::create(NULL, NULL, NULL, 'Europe/Lisbon');
var_dump($madrid->getTimezone());
echo $madrid->getTimezone()->getDisplayName(
false, IntlTimeZone::DISPLAY_GENERIC_LOCATION, "en_US"), "\n";
echo $lisbon->getTimeZone()->getId(), "\n";
//The id can also be retrieved with ->getTimezoneId()
echo $lisbon->getTimeZoneId(), "\n";
```
The above example will output:
```
object(IntlTimeZone)#4 (4) {
["valid"]=>
bool(true)
["id"]=>
string(13) "Europe/Madrid"
["rawOffset"]=>
int(3600000)
["currentOffset"]=>
int(7200000)
}
Spain Time
Europe/Lisbon
Europe/Lisbon
```
### See Also
* [IntlDateFormatter::getTimeZoneId()](intldateformatter.gettimezoneid) - Get the timezone-id used for the IntlDateFormatter
* [IntlDateFormatter::setTimeZone()](intldateformatter.settimezone) - Sets formatterʼs timezone
* [IntlTimeZone](class.intltimezone)
php Threaded::pop Threaded::pop
=============
(PECL pthreads >= 2.0.0)
Threaded::pop — Manipulation
### Description
```
public Threaded::pop(): bool
```
Pops an item from the objects property table
### Parameters
This function has no parameters.
### Return Values
The last item from the objects property table
### Examples
**Example #1 Popping the last item from the property table of a threaded object**
```
<?php
$safe = new Threaded();
while (count($safe) < 10)
$safe[] = count($safe);
var_dump($safe->pop());
?>
```
The above example will output:
```
int(9)
```
| programming_docs |
php hash_file hash\_file
==========
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL hash >= 1.1)
hash\_file — Generate a hash value using the contents of a given file
### Description
```
hash_file(
string $algo,
string $filename,
bool $binary = false,
array $options = []
): string|false
```
### Parameters
`algo`
Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..). For a list of supported algorithms see [hash\_algos()](function.hash-algos).
`filename`
URL describing location of file to be hashed; Supports fopen wrappers.
`binary`
When set to **`true`**, outputs raw binary data. **`false`** outputs lowercase hexits.
`options`
An array of options for the various hashing algorithms. Currently, only the "seed" parameter is supported by the MurmurHash variants.
### Return Values
Returns a string containing the calculated message digest as lowercase hexits unless `binary` is set to true in which case the raw binary representation of the message digest is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `options` parameter has been added. |
### Examples
**Example #1 Using **hash\_file()****
```
<?php
/* Create a file to calculate hash of */
file_put_contents('example.txt', 'The quick brown fox jumped over the lazy dog.');
echo hash_file('md5', 'example.txt');
?>
```
The above example will output:
```
5c6ffbdd40d9556b73a21e63c3e0e904
```
### See Also
* [hash()](function.hash) - Generate a hash value (message digest)
* [hash\_hmac\_file()](function.hash-hmac-file) - Generate a keyed hash value using the HMAC method and the contents of a given file
* [hash\_update\_file()](function.hash-update-file) - Pump data into an active hashing context from a file
* [md5\_file()](function.md5-file) - Calculates the md5 hash of a given file
* [sha1\_file()](function.sha1-file) - Calculate the sha1 hash of a file
php ReflectionClass::isUserDefined ReflectionClass::isUserDefined
==============================
(PHP 5, PHP 7, PHP 8)
ReflectionClass::isUserDefined — Checks if user defined
### Description
```
public ReflectionClass::isUserDefined(): bool
```
Checks whether the class is user-defined, as opposed to internal.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [ReflectionClass::isInternal()](reflectionclass.isinternal) - Checks if class is defined internally by an extension, or the core
php The BadFunctionCallException class
The BadFunctionCallException class
==================================
Introduction
------------
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
Exception thrown if a callback refers to an undefined function or if some arguments are missing.
Class synopsis
--------------
class **BadFunctionCallException** extends [LogicException](class.logicexception) { /\* Inherited properties \*/ protected string [$message](class.exception#exception.props.message) = "";
private string [$string](class.exception#exception.props.string) = "";
protected int [$code](class.exception#exception.props.code);
protected string [$file](class.exception#exception.props.file) = "";
protected int [$line](class.exception#exception.props.line);
private array [$trace](class.exception#exception.props.trace) = [];
private ?[Throwable](class.throwable) [$previous](class.exception#exception.props.previous) = null; /\* Inherited methods \*/
```
final public Exception::getMessage(): string
```
```
final public Exception::getPrevious(): ?Throwable
```
```
final public Exception::getCode(): int
```
```
final public Exception::getFile(): string
```
```
final public Exception::getLine(): int
```
```
final public Exception::getTrace(): array
```
```
final public Exception::getTraceAsString(): string
```
```
public Exception::__toString(): string
```
```
private Exception::__clone(): void
```
}
php Imagick::separateImageChannel Imagick::separateImageChannel
=============================
(PECL imagick 2, PECL imagick 3)
Imagick::separateImageChannel — Separates a channel from the image
### Description
```
public Imagick::separateImageChannel(int $channel): bool
```
Separates a channel from the image and returns a grayscale image. A channel is a particular color component of each pixel in the image.
### Parameters
`channel`
Which 'channel' to return. For colorspaces other than RGB, you can still use the CHANNEL\_RED, CHANNEL\_GREEN, CHANNEL\_BLUE constants to indicate the 1st, 2nd and 3rd channels.
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::separateImageChannel()****
```
<?php
function separateImageChannel($imagePath, $channel) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->separateimagechannel($channel);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
separateImageChannel($imagePath, \Imagick::CHANNEL_GREEN);
?>
```
php OAuthProvider::callTimestampNonceHandler OAuthProvider::callTimestampNonceHandler
========================================
(PECL OAuth >= 1.0.0)
OAuthProvider::callTimestampNonceHandler — Calls the timestampNonceHandler callback
### Description
```
public OAuthProvider::callTimestampNonceHandler(): void
```
Calls the registered timestamp handler callback function, which is set with [OAuthProvider::timestampNonceHandler()](oauthprovider.timestampnoncehandler).
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Errors/Exceptions
Emits an **`E_ERROR`** level error if the callback function cannot be called, or was not specified.
### See Also
* [OAuthProvider::timestampNonceHandler()](oauthprovider.timestampnoncehandler) - Set the timestampNonceHandler handler callback
php get_mangled_object_vars get\_mangled\_object\_vars
==========================
(PHP 7 >= 7.4.0, PHP 8)
get\_mangled\_object\_vars — Returns an array of mangled object properties
### Description
```
get_mangled_object_vars(object $object): array
```
Returns an array whose elements are the `object`'s properties. The keys are the member variable names, with a few notable exceptions: private variables have the class name prepended to the variable name, and protected variables have a `*` prepended to the variable name. These prepended values have `NUL` bytes on either side. Uninitialized [typed properties](language.oop5.properties#language.oop5.properties.typed-properties) are silently discarded.
### Parameters
`object`
An object instance.
### Return Values
Returns an array containing all properties, regardless of visibility, of `object`.
### Examples
**Example #1 **get\_mangled\_object\_vars()** example**
```
<?php
class A
{
public $public = 1;
protected $protected = 2;
private $private = 3;
}
class B extends A
{
private $private = 4;
}
$object = new B;
$object->dynamic = 5;
$object->{'6'} = 6;
var_dump(get_mangled_object_vars($object));
class AO extends ArrayObject
{
private $private = 1;
}
$arrayObject = new AO(['x' => 'y']);
$arrayObject->dynamic = 2;
var_dump(get_mangled_object_vars($arrayObject));
```
The above example will output:
```
array(6) {
["Bprivate"]=>
int(4)
["public"]=>
int(1)
["*protected"]=>
int(2)
["Aprivate"]=>
int(3)
["dynamic"]=>
int(5)
[6]=>
int(6)
}
array(2) {
["AOprivate"]=>
int(1)
["dynamic"]=>
int(2)
}
```
### See Also
* [get\_class\_vars()](function.get-class-vars) - Get the default properties of the class
* [get\_object\_vars()](function.get-object-vars) - Gets the properties of the given object
php round round
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
round — Rounds a float
### Description
```
round(int|float $num, int $precision = 0, int $mode = PHP_ROUND_HALF_UP): float
```
Returns the rounded value of `num` to specified `precision` (number of digits after the decimal point). `precision` can also be negative or zero (default).
### Parameters
`num`
The value to round.
`precision`
The optional number of decimal digits to round to.
If the `precision` is positive, `num` is rounded to `precision` significant digits after the decimal point.
If the `precision` is negative, `num` is rounded to `precision` significant digits before the decimal point, i.e. to the nearest multiple of `pow(10, -precision)`, e.g. for a `precision` of -1 `num` is rounded to tens, for a `precision` of -2 to hundreds, etc.
`mode`
Use one of the following constants to specify the mode in which rounding occurs.
| Constants | Description |
| --- | --- |
| **`PHP_ROUND_HALF_UP`** | Rounds `num` away from zero when it is half way there, making 1.5 into 2 and -1.5 into -2. |
| **`PHP_ROUND_HALF_DOWN`** | Rounds `num` towards zero when it is half way there, making 1.5 into 1 and -1.5 into -1. |
| **`PHP_ROUND_HALF_EVEN`** | Rounds `num` towards the nearest even value when it is half way there, making both 1.5 and 2.5 into 2. |
| **`PHP_ROUND_HALF_ODD`** | Rounds `num` towards the nearest odd value when it is half way there, making 1.5 into 1 and 2.5 into 3. |
### Return Values
The value rounded to the given `precision` as a float.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `num` no longer accepts internal objects which support numeric conversion. |
### Examples
**Example #1 **round()** examples**
```
<?php
var_dump(round(3.4));
var_dump(round(3.5));
var_dump(round(3.6));
var_dump(round(3.6, 0));
var_dump(round(5.045, 2));
var_dump(round(5.055, 2));
var_dump(round(345, -2));
var_dump(round(345, -3));
var_dump(round(678, -2));
var_dump(round(678, -3));
?>
```
The above example will output:
```
float(3)
float(4)
float(4)
float(4)
float(5.05)
float(5.06)
float(300)
float(0)
float(700)
float(1000)
```
**Example #2 How `precision` affects a float**
```
<?php
$number = 135.79;
var_dump(round($number, 3));
var_dump(round($number, 2));
var_dump(round($number, 1));
var_dump(round($number, 0));
var_dump(round($number, -1));
var_dump(round($number, -2));
var_dump(round($number, -3));
?>
```
The above example will output:
```
float(135.79)
float(135.79)
float(135.8)
float(136)
float(140)
float(100)
float(0)
```
**Example #3 `mode` examples**
```
<?php
echo 'Rounding modes with 9.5' . PHP_EOL;
var_dump(round(9.5, 0, PHP_ROUND_HALF_UP));
var_dump(round(9.5, 0, PHP_ROUND_HALF_DOWN));
var_dump(round(9.5, 0, PHP_ROUND_HALF_EVEN));
var_dump(round(9.5, 0, PHP_ROUND_HALF_ODD));
echo PHP_EOL;
echo 'Rounding modes with 8.5' . PHP_EOL;
var_dump(round(8.5, 0, PHP_ROUND_HALF_UP));
var_dump(round(8.5, 0, PHP_ROUND_HALF_DOWN));
var_dump(round(8.5, 0, PHP_ROUND_HALF_EVEN));
var_dump(round(8.5, 0, PHP_ROUND_HALF_ODD));
?>
```
The above example will output:
```
Rounding modes with 9.5
float(10)
float(9)
float(10)
float(9)
Rounding modes with 8.5
float(9)
float(8)
float(8)
float(9)
```
**Example #4 `mode` with `precision` examples**
```
<?php
echo 'Using PHP_ROUND_HALF_UP with 1 decimal digit precision' . PHP_EOL;
var_dump(round( 1.55, 1, PHP_ROUND_HALF_UP));
var_dump(round(-1.55, 1, PHP_ROUND_HALF_UP));
echo PHP_EOL;
echo 'Using PHP_ROUND_HALF_DOWN with 1 decimal digit precision' . PHP_EOL;
var_dump(round( 1.55, 1, PHP_ROUND_HALF_DOWN));
var_dump(round(-1.55, 1, PHP_ROUND_HALF_DOWN));
echo PHP_EOL;
echo 'Using PHP_ROUND_HALF_EVEN with 1 decimal digit precision' . PHP_EOL;
var_dump(round( 1.55, 1, PHP_ROUND_HALF_EVEN));
var_dump(round(-1.55, 1, PHP_ROUND_HALF_EVEN));
echo PHP_EOL;
echo 'Using PHP_ROUND_HALF_ODD with 1 decimal digit precision' . PHP_EOL;
var_dump(round( 1.55, 1, PHP_ROUND_HALF_ODD));
var_dump(round(-1.55, 1, PHP_ROUND_HALF_ODD));
?>
```
The above example will output:
```
Using PHP_ROUND_HALF_UP with 1 decimal digit precision
float(1.6)
float(-1.6)
Using PHP_ROUND_HALF_DOWN with 1 decimal digit precision
float(1.5)
float(-1.5)
Using PHP_ROUND_HALF_EVEN with 1 decimal digit precision
float(1.6)
float(-1.6)
Using PHP_ROUND_HALF_ODD with 1 decimal digit precision
float(1.5)
float(-1.5)
```
### See Also
* [ceil()](function.ceil) - Round fractions up
* [floor()](function.floor) - Round fractions down
* [number\_format()](function.number-format) - Format a number with grouped thousands
php FilesystemIterator::__construct FilesystemIterator::\_\_construct
=================================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
FilesystemIterator::\_\_construct — Constructs a new filesystem iterator
### Description
public **FilesystemIterator::\_\_construct**(string `$directory`, int `$flags` = FilesystemIterator::KEY\_AS\_PATHNAME | FilesystemIterator::CURRENT\_AS\_FILEINFO | FilesystemIterator::SKIP\_DOTS) Constructs a new filesystem iterator from the `directory`.
### Parameters
`directory`
The path of the filesystem item to be iterated over.
`flags`
Flags may be provided which will affect the behavior of some methods. A list of the flags can found under [FilesystemIterator predefined constants](class.filesystemiterator#filesystemiterator.constants). They can also be set later with [FilesystemIterator::setFlags()](filesystemiterator.setflags)
### Errors/Exceptions
Throws an [UnexpectedValueException](class.unexpectedvalueexception) if the `directory` does not exist.
Throws a [ValueError](class.valueerror) if the `directory` is an empty string.
### Changelog
| Version | Description |
| --- | --- |
| 8.2.0 | Prior to PHP 8.2.0, **`FilesystemIterator::SKIP_DOTS`** was always set and could not be removed. |
| 8.0.0 | Now throws a [ValueError](class.valueerror) if `directory` is an empty string; previously it threw a [RuntimeException](class.runtimeexception). |
### Examples
**Example #1 **FilesystemIterator::\_\_construct()** example**
```
<?php
$it = new FilesystemIterator(dirname(__FILE__), FilesystemIterator::CURRENT_AS_FILEINFO);
foreach ($it as $fileinfo) {
echo $fileinfo->getFilename() . "\n";
}
?>
```
Output of the above example in PHP 8.2 is similar to:
```
.
..
apples.jpg
banana.jpg
example.php
```
Output of the above example prior to PHP 8.2.0 is similar to:
```
apples.jpg
banana.jpg
example.php
```
### See Also
* [FilesystemIterator::setFlags()](filesystemiterator.setflags) - Sets handling flags
* [DirectoryIterator::\_\_construct()](directoryiterator.construct) - Constructs a new directory iterator from a path
php HashContext::__unserialize HashContext::\_\_unserialize
============================
(PHP 8)
HashContext::\_\_unserialize — Deserializes the `data` parameter into a HashContext object
### Description
```
public HashContext::__unserialize(array $data): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`data`
The value being deserialized.
### Return Values
No value is returned.
php ImagickDraw::setTextDecoration ImagickDraw::setTextDecoration
==============================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setTextDecoration — Specifies a decoration
### Description
```
public ImagickDraw::setTextDecoration(int $decoration): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Specifies a decoration to be applied when annotating with text.
### Parameters
`decoration`
One of the [DECORATION](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.decoration) constant (`imagick::DECORATION_*`).
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::setTextDecoration()** example**
```
<?php
function setTextDecoration($strokeColor, $fillColor, $backgroundColor, $textDecoration) {
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFontSize(72);
$draw->setTextDecoration($textDecoration);
$draw->annotation(50, 75, "Lorem Ipsum!");
$imagick = new \Imagick();
$imagick->newImage(500, 200, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
php xmlrpc_server_register_method xmlrpc\_server\_register\_method
================================
(PHP 4 >= 4.1.0, PHP 5, PHP 7)
xmlrpc\_server\_register\_method — Register a PHP function to resource method matching method\_name
### Description
```
xmlrpc_server_register_method(resource $server, string $method_name, string $function): bool
```
**Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
**Warning**This function is currently not documented; only its argument list is available.
php EvSignal::__construct EvSignal::\_\_construct
=======================
(PECL ev >= 0.2.0)
EvSignal::\_\_construct — Constructs EvSignal watcher object
### Description
public **EvSignal::\_\_construct**(
int `$signum` ,
[callable](language.types.callable) `$callback` ,
[mixed](language.types.declarations#language.types.declarations.mixed) `$data` = **`null`** ,
int `$priority` = 0
) Constructs EvSignal watcher object and starts it automatically. For a stopped periodic watcher consider using [EvSignal::createStopped()](evsignal.createstopped) method.
### Parameters
`signum` Signal number. See constants exported by *pcntl* extension. See also `signal(7)` man page.
`callback` See [Watcher callbacks](https://www.php.net/manual/en/ev.watcher-callbacks.php) .
`data` Custom data associated with the watcher.
`priority` [Watcher priority](class.ev#ev.constants.watcher-pri)
### Examples
**Example #1 Handle SIGTERM signal**
```
<?php
$w = new EvSignal(SIGTERM, function ($watcher) {
echo "SIGTERM received\n";
$watcher->stop();
});
Ev::run();
?>
```
### See Also
* [EvSignal::createStopped()](evsignal.createstopped) - Create stopped EvSignal watcher object
php Gmagick::shearimage Gmagick::shearimage
===================
(PECL gmagick >= Unknown)
Gmagick::shearimage — Creating a parallelogram
### Description
```
public Gmagick::shearimage(mixed $color, float $xShear, float $yShear): Gmagick
```
Slides one edge of an image along the X or Y axis, creating a parallelogram. An X direction shear slides an edge along the X axis, while a Y direction shear slides an edge along the Y axis. The amount of the shear is controlled by a shear angle. For X direction shears, x\_shear is measured relative to the Y axis, and similarly, for Y direction shears y\_shear is measured relative to the X axis. Empty triangles left over from shearing the image are filled with the background color.
### Parameters
`color`
The background pixel wand.
`xShear`
The number of degrees to shear the image.
`yShear`
The number of degrees to shear the image.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php finfo_file finfo\_file
===========
finfo::file
===========
(PHP >= 5.3.0, PHP 7, PHP 8, PECL fileinfo >= 0.1.0)
finfo\_file -- finfo::file — Return information about a file
### Description
Procedural style
```
finfo_file(
finfo $finfo,
string $filename,
int $flags = FILEINFO_NONE,
?resource $context = null
): string|false
```
Object-oriented style
```
public finfo::file(string $filename, int $flags = FILEINFO_NONE, ?resource $context = null): string|false
```
This function is used to get information about a file.
### Parameters
`finfo`
An [finfo](class.finfo) instance, returned by [finfo\_open()](function.finfo-open).
`filename`
Name of a file to be checked.
`flags`
One or disjunction of more [Fileinfo constants](https://www.php.net/manual/en/fileinfo.constants.php).
`context`
For a description of `contexts`, refer to [Stream Functions](https://www.php.net/manual/en/ref.stream.php).
### Return Values
Returns a textual description of the contents of the `filename` argument, or **`false`** if an error occurred.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `finfo` parameter expects an [finfo](class.finfo) instance now; previously, a [resource](language.types.resource) was expected. |
| 8.0.0 | `context` is nullable now. |
### Examples
**Example #1 A [finfo\_file()](finfo.file) example**
```
<?php
$finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
foreach (glob("*") as $filename) {
echo finfo_file($finfo, $filename) . "\n";
}
finfo_close($finfo);
?>
```
The above example will output something similar to:
```
text/html
image/gif
application/vnd.ms-excel
```
### See Also
* [finfo\_buffer()](finfo.buffer) - Alias of finfo\_buffer()
| programming_docs |
php msg_set_queue msg\_set\_queue
===============
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
msg\_set\_queue — Set information in the message queue data structure
### Description
```
msg_set_queue(SysvMessageQueue $queue, array $data): bool
```
**msg\_set\_queue()** allows you to change the values of the msg\_perm.uid, msg\_perm.gid, msg\_perm.mode and msg\_qbytes fields of the underlying message queue data structure.
Changing the data structure will require that PHP be running as the same user that created the queue, owns the queue (as determined by the existing msg\_perm.xxx fields), or be running with root privileges. root privileges are required to raise the msg\_qbytes values above the system defined limit.
### Parameters
`queue`
The message queue.
`data`
You specify the values you require by setting the value of the keys that you require in the `data` array.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `queue` expects a [SysvMessageQueue](class.sysvmessagequeue) instance now; previously, a resource was expected. |
### See Also
* [msg\_remove\_queue()](function.msg-remove-queue) - Destroy a message queue
* [msg\_receive()](function.msg-receive) - Receive a message from a message queue
* [msg\_stat\_queue()](function.msg-stat-queue) - Returns information from the message queue data structure
* [msg\_get\_queue()](function.msg-get-queue) - Create or attach to a message queue
php is_soap_fault is\_soap\_fault
===============
(PHP 5, PHP 7, PHP 8)
is\_soap\_fault — Checks if a SOAP call has failed
### Description
```
is_soap_fault(mixed $object): bool
```
This function is useful to check if the SOAP call failed, but without using exceptions. To use it, create a [SoapClient](class.soapclient) object with the `exceptions` option set to zero or **`false`**. In this case, the SOAP method will return a special [SoapFault](class.soapfault) object which encapsulates the fault details (faultcode, faultstring, faultactor and faultdetails).
If `exceptions` is not set then SOAP call will throw an exception on error. **is\_soap\_fault()** checks if the given parameter is a [SoapFault](class.soapfault) object.
### Parameters
`object`
The object to test.
### Return Values
This will return **`true`** on error, and **`false`** otherwise.
### Examples
**Example #1 **is\_soap\_fault()** example**
```
<?php
$client = new SoapClient("some.wsdl", array('exceptions' => 0));
$result = $client->SomeFunction();
if (is_soap_fault($result)) {
trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})", E_USER_ERROR);
}
?>
```
**Example #2 SOAP's standard method for error reporting is exceptions**
```
<?php
try {
$client = new SoapClient("some.wsdl");
$result = $client->SomeFunction(/* ... */);
} catch (SoapFault $fault) {
trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}
?>
```
### See Also
* [SoapClient::\_\_construct()](soapclient.construct) - SoapClient constructor
* [SoapFault::\_\_construct()](soapfault.construct) - SoapFault constructor
php None What References Are
-------------------
References in PHP are a means to access the same variable content by different names. They are not like C pointers; for instance, you cannot perform pointer arithmetic using them, they are not actual memory addresses, and so on. See [What References Are Not](language.references.arent) for more information. Instead, they are symbol table aliases. Note that in PHP, variable name and variable content are different, so the same content can have different names. The closest analogy is with Unix filenames and files - variable names are directory entries, while variable content is the file itself. References can be likened to hardlinking in Unix filesystem.
php Yaf_Config_Ini::rewind Yaf\_Config\_Ini::rewind
========================
(Yaf >=1.0.0)
Yaf\_Config\_Ini::rewind — The rewind purpose
### Description
```
public Yaf_Config_Ini::rewind(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php finfo::set_flags finfo::set\_flags
=================
(PHP >= 5.3.0, PHP 7, PHP 8, PECL fileinfo >= 0.1.0)
finfo::set\_flags — Alias of [finfo\_set\_flags()](function.finfo-set-flags)
### Description
```
public finfo::set_flags(int $flags): bool
```
This function is an alias of: [finfo\_set\_flags()](function.finfo-set-flags)
php ImagickDraw::getFillRule ImagickDraw::getFillRule
========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::getFillRule — Returns the fill rule
### Description
```
public ImagickDraw::getFillRule(): int
```
**Warning**This function is currently not documented; only its argument list is available.
Returns the fill rule used while drawing polygons.
### Return Values
Returns a [FILLRULE](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.fillrule) constant (`imagick::FILLRULE_*`).
php SolrDisMaxQuery::addUserField SolrDisMaxQuery::addUserField
=============================
(No version information available, might only be in Git)
SolrDisMaxQuery::addUserField — Adds a field to User Fields Parameter (uf)
### Description
```
public SolrDisMaxQuery::addUserField(string $field): SolrDisMaxQuery
```
Adds a field to The User Fields Parameter (uf)
### Parameters
`field`
Field Name
### Return Values
[SolrDisMaxQuery](class.solrdismaxquery)
### Examples
**Example #1 **SolrDisMaxQuery::addUserField()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery('lucene');
$dismaxQuery
->addUserField('cat')
->addUserField('text')
->addUserField('*_dt');
echo $dismaxQuery.PHP_EOL;
?>
```
The above example will output something similar to:
```
q=lucene&defType=edismax&uf=cat text *_dt
```
### See Also
* [SolrDisMaxQuery::removeUserField()](solrdismaxquery.removeuserfield) - Removes a field from The User Fields Parameter (uf)
* [SolrDisMaxQuery::setUserFields()](solrdismaxquery.setuserfields) - Sets User Fields parameter (uf)
php None Errors in PHP 7
---------------
PHP 7 changes how most errors are reported by PHP. Instead of reporting errors through the traditional error reporting mechanism used by PHP 5, most errors are now reported by throwing [Error](class.error) exceptions.
As with normal exceptions, these [Error](class.error) exceptions will bubble up until they reach the first matching [`catch`](language.errors.php7) block. If there are no matching blocks, then any default exception handler installed with [set\_exception\_handler()](function.set-exception-handler) will be called, and if there is no default exception handler, then the exception will be converted to a fatal error and will be handled like a traditional error.
As the [Error](class.error) hierarchy does not inherit from [Exception](class.exception), code that uses `catch (Exception $e) { ... }` blocks to handle uncaught exceptions in PHP 5 will find that these [Error](class.error)s are not caught by these blocks. Either a `catch (Error $e) { ... }` block or a [set\_exception\_handler()](function.set-exception-handler) handler is required.
###
[Error](class.error) hierarchy
* [Throwable](class.throwable)
+ [Error](class.error)
- [ArithmeticError](class.arithmeticerror)
* [DivisionByZeroError](class.divisionbyzeroerror)
- [AssertionError](class.assertionerror)
- [CompileError](class.compileerror)
* [ParseError](class.parseerror)
- [TypeError](class.typeerror)
* [ArgumentCountError](class.argumentcounterror)
- [ValueError](class.valueerror)
- [UnhandledMatchError](class.unhandledmatcherror)
- [FiberError](class.fibererror)
+ [Exception](class.exception)
- ...
php pg_pconnect pg\_pconnect
============
(PHP 4, PHP 5, PHP 7, PHP 8)
pg\_pconnect — Open a persistent PostgreSQL connection
### Description
```
pg_pconnect(string $connection_string, int $flags = 0): PgSql\Connection|false
```
**pg\_pconnect()** opens a connection to a PostgreSQL database. It returns an [PgSql\Connection](class.pgsql-connection) instance that is needed by other PostgreSQL functions.
If a second call is made to **pg\_pconnect()** with the same `connection_string` as an existing connection, the existing connection will be returned unless you pass **`PGSQL_CONNECT_FORCE_NEW`** as `flags`.
To enable persistent connection, the [pgsql.allow\_persistent](https://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.allow-persistent) php.ini directive must be set to "On" (which is the default). The maximum number of persistent connection can be defined with the [pgsql.max\_persistent](https://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.max-persistent) php.ini directive (defaults to -1 for no limit). The total number of connections can be set with the [pgsql.max\_links](https://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.max-links) php.ini directive.
[pg\_close()](function.pg-close) will not close persistent links generated by **pg\_pconnect()**.
### Parameters
`connection_string`
The `connection_string` can be empty to use all default parameters, or it can contain one or more parameter settings separated by whitespace. Each parameter setting is in the form `keyword = value`. Spaces around the equal sign are optional. To write an empty value or a value containing spaces, surround it with single quotes, e.g., `keyword =
'a value'`. Single quotes and backslashes within the value must be escaped with a backslash, i.e., \' and \\.
The currently recognized parameter keywords are: `host`, `hostaddr`, `port`, `dbname`, `user`, `password`, `connect_timeout`, `options`, `tty` (ignored), `sslmode`, `requiressl` (deprecated in favor of `sslmode`), and `service`. Which of these arguments exist depends on your PostgreSQL version.
`flags`
If **`PGSQL_CONNECT_FORCE_NEW`** is passed, then a new connection is created, even if the `connection_string` is identical to an existing connection.
### Return Values
Returns an [PgSql\Connection](class.pgsql-connection) instance on success, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | Returns an [PgSql\Connection](class.pgsql-connection) instance now; previously, a [resource](language.types.resource) was returned. |
### Examples
**Example #1 Using **pg\_pconnect()****
```
<?php
$dbconn = pg_pconnect("dbname=mary");
//connect to a database named "mary"
$dbconn2 = pg_pconnect("host=localhost port=5432 dbname=mary");
// connect to a database named "mary" on "localhost" at port "5432"
$dbconn3 = pg_pconnect("host=sheep port=5432 dbname=mary user=lamb password=foo");
//connect to a database named "mary" on the host "sheep" with a username and password
$conn_string = "host=sheep port=5432 dbname=test user=lamb password=bar";
$dbconn4 = pg_pconnect($conn_string);
//connect to a database named "test" on the host "sheep" with a username and password
?>
```
### See Also
* [pg\_connect()](function.pg-connect) - Open a PostgreSQL connection
* [Persistent Database Connections](https://www.php.net/manual/en/features.persistent-connections.php)
php SVMModel::getSvrProbability SVMModel::getSvrProbability
===========================
(PECL svm >= 0.1.5)
SVMModel::getSvrProbability — Get the sigma value for regression types
### Description
```
public SVMModel::getSvrProbability(): float
```
For regression models, returns a sigma value. If there is no probability information or the model is not SVR, 0 is returned.
### Parameters
This function has no parameters.
### Return Values
Returns a sigma value
php Phar::addFromString Phar::addFromString
===================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
Phar::addFromString — Add a file from a string to the phar archive
### Description
```
public Phar::addFromString(string $localName, string $contents): void
```
>
> **Note**:
>
>
> This method requires the php.ini setting `phar.readonly` to be set to `0` in order to work for [Phar](class.phar) objects. Otherwise, a [PharException](class.pharexception) will be thrown.
>
>
>
With this method, any string can be added to the phar archive. The file will be stored in the archive with `localname` as its path. This method is similar to [ZipArchive::addFromString()](ziparchive.addfromstring).
### Parameters
`localName`
Path that the file will be stored in the archive.
`contents`
The file contents to store
### Return Values
no return value, exception is thrown on failure.
### Examples
**Example #1 A **Phar::addFromString()** example**
```
<?php
try {
$a = new Phar('/path/to/phar.phar');
$a->addFromString('path/to/file.txt', 'my simple file');
$b = $a['path/to/file.txt']->getContent();
// to add contents from a stream handle for large files, use offsetSet()
$c = fopen('/path/to/hugefile.bin');
$a['largefile.bin'] = $c;
fclose($c);
} catch (Exception $e) {
// handle errors here
}
?>
```
### Notes
> **Note**: [Phar::addFile()](phar.addfile), **Phar::addFromString()** and [Phar::offsetSet()](phar.offsetset) save a new phar archive each time they are called. If performance is a concern, [Phar::buildFromDirectory()](phar.buildfromdirectory) or [Phar::buildFromIterator()](phar.buildfromiterator) should be used instead.
>
>
### See Also
* [Phar::offsetSet()](phar.offsetset) - Set the contents of an internal file to those of an external file
* [PharData::addFromString()](phardata.addfromstring) - Add a file from the filesystem to the tar/zip archive
* [Phar::addFile()](phar.addfile) - Add a file from the filesystem to the phar archive
* [Phar::addEmptyDir()](phar.addemptydir) - Add an empty directory to the phar archive
php VarnishAdmin::banUrl VarnishAdmin::banUrl
====================
(PECL varnish >= 0.3)
VarnishAdmin::banUrl — Ban an URL using a VCL expression
### Description
```
public VarnishAdmin::banUrl(string $vcl_regex): int
```
### Parameters
`vcl_regex`
URL regular expression in PCRE compatible syntax. It's based on the ban.url varnish command.
### Return Values
Returns the varnish command status.
php DateTime::setTimezone DateTime::setTimezone
=====================
date\_timezone\_set
===================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
DateTime::setTimezone -- date\_timezone\_set — Sets the time zone for the DateTime object
### Description
Object-oriented style
```
public DateTime::setTimezone(DateTimeZone $timezone): DateTime
```
Procedural style
```
date_timezone_set(DateTime $object, DateTimeZone $timezone): DateTime
```
Sets a new timezone for a [DateTime](class.datetime) object.
Like [DateTimeImmutable::setTimezone()](datetimeimmutable.settimezone) but works with [DateTime](class.datetime).
The procedural version takes the [DateTime](class.datetime) object as its first argument.
### Parameters
`object`
Procedural style only: A [DateTime](class.datetime) object returned by [date\_create()](function.date-create). The function modifies this object.
`timezone`
A [DateTimeZone](class.datetimezone) object representing the desired time zone.
### Return Values
Returns the [DateTime](class.datetime) object for method chaining. The underlaying point-in-time is not changed when calling this method.
### Examples
**Example #1 **DateTime::setTimeZone()** example**
Object-oriented style
```
<?php
$date = new DateTime('2000-01-01', new DateTimeZone('Pacific/Nauru'));
echo $date->format('Y-m-d H:i:sP') . "\n";
$date->setTimezone(new DateTimeZone('Pacific/Chatham'));
echo $date->format('Y-m-d H:i:sP') . "\n";
?>
```
Procedural style
```
<?php
$date = date_create('2000-01-01', timezone_open('Pacific/Nauru'));
echo date_format($date, 'Y-m-d H:i:sP') . "\n";
date_timezone_set($date, timezone_open('Pacific/Chatham'));
echo date_format($date, 'Y-m-d H:i:sP') . "\n";
?>
```
The above examples will output:
```
2000-01-01 00:00:00+12:00
2000-01-01 01:45:00+13:45
```
### See Also
* [DateTimeImmutable::setTimezone()](datetimeimmutable.settimezone) - Sets the time zone
* [DateTime::getTimezone()](datetime.gettimezone) - Return time zone relative to given DateTime
* [DateTimeZone::\_\_construct()](datetimezone.construct) - Creates new DateTimeZone object
php tidy_config_count tidy\_config\_count
===================
(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.5.2)
tidy\_config\_count — Returns the Number of Tidy configuration errors encountered for specified document
### Description
```
tidy_config_count(tidy $tidy): int
```
Returns the number of errors encountered in the configuration of the specified tidy `tidy`.
### Parameters
`tidy`
The [Tidy](class.tidy) object.
### Return Values
Returns the number of errors.
### Examples
**Example #1 **tidy\_config\_count()** example**
```
<?php
$html = '<p>test</I>';
$config = array('doctype' => 'bogus');
$tidy = tidy_parse_string($html, $config);
/* This outputs 1, because 'bogus' isn't a valid doctype */
echo tidy_config_count($tidy);
?>
```
php Gmagick::drawimage Gmagick::drawimage
==================
(PECL gmagick >= Unknown)
Gmagick::drawimage — Renders the GmagickDraw object on the current image
### Description
```
public Gmagick::drawimage(GmagickDraw $GmagickDraw): Gmagick
```
Renders the [GmagickDraw](class.gmagickdraw) object on the current image.
### Parameters
`GmagickDraw`
The drawing operations to render on the image.
### Return Values
The drawn [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php deg2rad deg2rad
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
deg2rad — Converts the number in degrees to the radian equivalent
### Description
```
deg2rad(float $num): float
```
This function converts `num` from degrees to the radian equivalent.
### Parameters
`num`
Angular value in degrees
### Return Values
The radian equivalent of `num`
### Examples
**Example #1 **deg2rad()** example**
```
<?php
echo deg2rad(45); // 0.785398163397
var_dump(deg2rad(45) === M_PI_4); // bool(true)
?>
```
### See Also
* [rad2deg()](function.rad2deg) - Converts the radian number to the equivalent number in degrees
php SyncSemaphore::__construct SyncSemaphore::\_\_construct
============================
(PECL sync >= 1.0.0)
SyncSemaphore::\_\_construct — Constructs a new SyncSemaphore object
### Description
```
public SyncSemaphore::__construct(string $name = ?, int $initialval = 1, bool $autounlock = true)
```
Constructs a named or unnamed semaphore.
### Parameters
`name`
The name of the semaphore if this is a named semaphore object.
>
> **Note**:
>
>
> If the name already exists, it must be able to be opened by the current user that the process is running as or an exception will be thrown with a meaningless error message.
>
>
`initialval`
The initial value of the semaphore. This is the number of locks that may be obtained.
`autounlock`
Specifies whether or not to automatically unlock the semaphore at the conclusion of the PHP script.
**Warning** If an object is: A named semaphore with an autounlock of **`false`**, the object is locked, and the PHP script concludes before the object is unlocked, then the underlying semaphore will end up in an inconsistent state.
### Return Values
The new [SyncSemaphore](class.syncsemaphore) object.
### Errors/Exceptions
An exception is thrown if the semaphore cannot be created or opened.
### Examples
**Example #1 **SyncSemaphore::\_\_construct()** example**
```
<?php
$semaphore = new SyncSemaphore("LimitedResource_2clients", 2);
if (!$semaphore->lock(3000))
{
echo "Unable to lock semaphore.";
exit();
}
/* ... */
$semaphore->unlock();
?>
```
### See Also
* [SyncSemaphore::lock()](syncsemaphore.lock) - Decreases the count of the semaphore or waits
* [SyncSemaphore::unlock()](syncsemaphore.unlock) - Increases the count of the semaphore
| programming_docs |
php GmagickPixel::setcolor GmagickPixel::setcolor
======================
(PECL gmagick >= Unknown)
GmagickPixel::setcolor — Sets the color
### Description
```
public GmagickPixel::setcolor(string $color): GmagickPixel
```
Sets the color described by the [GmagickPixel](class.gmagickpixel) object, with a string (e.g. "blue", "#0000ff", "rgb(0,0,255)", "cmyk(100,100,100,10)", etc.).
### Parameters
`color`
The color definition to use in order to initialise the [GmagickPixel](class.gmagickpixel) object.
### Return Values
The [GmagickPixel](class.gmagickpixel) object.
php fbird_blob_echo fbird\_blob\_echo
=================
(PHP 5, PHP 7 < 7.4.0)
fbird\_blob\_echo — Alias of [ibase\_blob\_echo()](function.ibase-blob-echo)
### Description
This function is an alias of: [ibase\_blob\_echo()](function.ibase-blob-echo).
### See Also
* [fbird\_blob\_open()](function.fbird-blob-open) - Alias of ibase\_blob\_open
* [fbird\_blob\_close()](function.fbird-blob-close) - Alias of ibase\_blob\_close
* [fbird\_blob\_get()](function.fbird-blob-get) - Alias of ibase\_blob\_get
php Ds\Set::reverse Ds\Set::reverse
===============
(PECL ds >= 1.0.0)
Ds\Set::reverse — Reverses the set in-place
### Description
```
public Ds\Set::reverse(): void
```
Reverses the set in-place.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Set::reverse()** example**
```
<?php
$set = new \Ds\Set(["a", "b", "c"]);
$set->reverse();
print_r($set);
?>
```
The above example will output something similar to:
```
Ds\Set Object
(
[0] => c
[1] => b
[2] => a
)
```
php Imagick::enhanceImage Imagick::enhanceImage
=====================
(PECL imagick 2, PECL imagick 3)
Imagick::enhanceImage — Improves the quality of a noisy image
### Description
```
public Imagick::enhanceImage(): bool
```
Applies a digital filter that improves the quality of a noisy image.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::enhanceImage()****
```
<?php
function enhanceImage($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->enhanceImage();
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php pcntl_errno pcntl\_errno
============
(PHP 5 >= 5.3.4, PHP 7, PHP 8)
pcntl\_errno — Alias of [pcntl\_get\_last\_error()](function.pcntl-get-last-error)
### Description
This function is an alias of: [pcntl\_get\_last\_error()](function.pcntl-get-last-error)
php gmp_binomial gmp\_binomial
=============
(PHP 7 >= 7.3.0, PHP 8)
gmp\_binomial — Calculates binomial coefficient
### Description
```
gmp_binomial(GMP|int|string $n, int $k): GMP
```
Calculates the binomial coefficient C(n, k).
### Parameters
`n`
A [GMP](class.gmp) object, an int or a numeric string.
`k`
### Return Values
Returns the binomial coefficient C(n, k).
### Errors/Exceptions
Throws [ValueError](class.valueerror) if `k` is negative. Prior to PHP 8.0.0, **`E_WARNING`** was issued instead.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function no longer returns **`false`** on failure. |
php fbird_set_event_handler fbird\_set\_event\_handler
==========================
(PHP 5, PHP 7 < 7.4.0)
fbird\_set\_event\_handler — Alias of [ibase\_set\_event\_handler()](function.ibase-set-event-handler)
### Description
This function is an alias of: [ibase\_set\_event\_handler()](function.ibase-set-event-handler).
### See Also
* [fbird\_free\_event\_handler()](function.fbird-free-event-handler) - Alias of ibase\_free\_event\_handler
* [fbird\_wait\_event()](function.fbird-wait-event) - Alias of ibase\_wait\_event
php ldap_sort ldap\_sort
==========
(PHP 4 >= 4.2.0, PHP 5, PHP 7)
ldap\_sort — Sort LDAP result entries on the client side
**Warning**This function has been *DEPRECATED* as of PHP 7.0.0 and *REMOVED* as of PHP 8.0.0. Relying on this function is highly discouraged.
### Description
```
ldap_sort(resource $link, resource $result, string $sortfilter): bool
```
Sort the result of a LDAP search, returned by [ldap\_search()](function.ldap-search).
As this function sorts the returned values on the client side it is possible that you might not get the expected results in case you reach the `sizelimit` either of the server or defined within [ldap\_search()](function.ldap-search).
### Parameters
`link`
An LDAP resource, returned by [ldap\_connect()](function.ldap-connect).
`result`
An search result identifier, returned by [ldap\_search()](function.ldap-search).
`sortfilter`
The attribute to use as a key in the sort.
### Return Values
No value is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function has been removed. |
### Examples
Sorting the result of a search.
**Example #1 LDAP sort**
```
<?php
// $ds is a valid link identifier (see ldap_connect)
$dn = 'ou=example,dc=org';
$filter = '(|(sn=Doe*)(givenname=John*))';
$justthese = array('ou', 'sn', 'givenname', 'mail');
$sr = ldap_search($ds, $dn, $filter, $justthese);
// Sort
ldap_sort($ds, $sr, 'sn');
// Retrieving the data
$info = ldap_get_entries($ds, $sr);
```
php SolrQuery::getHighlight SolrQuery::getHighlight
=======================
(PECL solr >= 0.9.2)
SolrQuery::getHighlight — Returns the state of the hl parameter
### Description
```
public SolrQuery::getHighlight(): bool
```
Returns a boolean indicating whether or not to enable highlighted snippets to be generated in the query response.
### Parameters
This function has no parameters.
### Return Values
Returns a boolean on success and **`null`** if not set.
php sodium_crypto_kx_server_session_keys sodium\_crypto\_kx\_server\_session\_keys
=========================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_kx\_server\_session\_keys — Calculate the server-side session keys.
### Description
```
sodium_crypto_kx_server_session_keys(string $server_key_pair, string $client_key): array
```
Calculate the server-side session keys, using the X25519 + BLAKE2b key-exchange method.
### Parameters
`server_key_pair`
A crypto\_kx keypair, such as one generated by [sodium\_crypto\_kx\_keypair()](function.sodium-crypto-kx-keypair).
`client_key`
A crypto\_kx public key.
### Return Values
An array consisting of two strings. The first should be used for receiving data from the client. The second should be used for sending data to the client.
php xml_parse xml\_parse
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
xml\_parse — Start parsing an XML document
### Description
```
xml_parse(XMLParser $parser, string $data, bool $is_final = false): int
```
**xml\_parse()** parses an XML document. The handlers for the configured events are called as many times as necessary.
### Parameters
`parser`
A reference to the XML parser to use.
`data`
Chunk of data to parse. A document may be parsed piece-wise by calling **xml\_parse()** several times with new data, as long as the `is_final` parameter is set and **`true`** when the last data is parsed.
`is_final`
If set and **`true`**, `data` is the last piece of data sent in this parse.
### Return Values
Returns 1 on success or 0 on failure.
For unsuccessful parses, error information can be retrieved with [xml\_get\_error\_code()](function.xml-get-error-code), [xml\_error\_string()](function.xml-error-string), [xml\_get\_current\_line\_number()](function.xml-get-current-line-number), [xml\_get\_current\_column\_number()](function.xml-get-current-column-number) and [xml\_get\_current\_byte\_index()](function.xml-get-current-byte-index).
>
> **Note**:
>
>
> Some errors (such as entity errors) are reported at the end of the data, thus only if `is_final` is set and **`true`**.
>
>
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `parser` expects an [XMLParser](class.xmlparser) instance now; previously, a resource was expected. |
### Examples
**Example #1 Chunked parsing of large XML documents**
This example shows how large XML documents can be read and parsed in chunks, so that it not necessary to keep the whole document in memory. Error handling is omitted for brevity.
```
<?php
$stream = fopen('large.xml', 'r');
$parser = xml_parser_create();
// set up the handlers here
while (($data = fread($stream, 16384))) {
xml_parse($parser, $data); // parse the current chunk
}
xml_parse($parser, '', true); // finalize parsing
xml_parser_free($parser);
fclose($stream);
```
php curl_unescape curl\_unescape
==============
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
curl\_unescape — Decodes the given URL encoded string
### Description
```
curl_unescape(CurlHandle $handle, string $string): string|false
```
This function decodes the given URL encoded string.
### Parameters
`handle` A cURL handle returned by [curl\_init()](function.curl-init).
`string`
The URL encoded string to be decoded.
### Return Values
Returns decoded string or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `handle` expects a [CurlHandle](class.curlhandle) instance now; previously, a resource was expected. |
### Examples
**Example #1 [curl\_escape()](function.curl-escape) example**
```
<?php
// Create a curl handle
$ch = curl_init('http://example.com/redirect.php');
// Send HTTP request and follow redirections
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_exec($ch);
// Get the last effective URL
$effective_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
// ie. "http://example.com/show_location.php?loc=M%C3%BCnchen"
// Decode the URL
$effective_url_decoded = curl_unescape($ch, $effective_url);
// "http://example.com/show_location.php?loc=München"
// Close the handle
curl_close($ch);
?>
```
### Notes
>
> **Note**:
>
>
> **curl\_unescape()** does not decode plus symbols (+) into spaces. [urldecode()](function.urldecode) does.
>
>
### See Also
* [curl\_escape()](function.curl-escape) - URL encodes the given string
* [urlencode()](function.urlencode) - URL-encodes string
* [urldecode()](function.urldecode) - Decodes URL-encoded string
* [rawurlencode()](function.rawurlencode) - URL-encode according to RFC 3986
* [rawurldecode()](function.rawurldecode) - Decode URL-encoded strings
php GearmanJob::__construct GearmanJob::\_\_construct
=========================
(PECL gearman >= 0.5.0)
GearmanJob::\_\_construct — Create a GearmanJob instance
### Description
```
public GearmanJob::__construct()
```
Creates a [GearmanJob](class.gearmanjob) instance representing a job the worker is to complete.
### Parameters
This function has no parameters.
### Return Values
A [GearmanJob](class.gearmanjob) object.
php gzgetss gzgetss
=======
(PHP 4, PHP 5, PHP 7)
gzgetss — Get line from gz-file pointer and strip HTML tags
**Warning**This function has been *DEPRECATED* as of PHP 7.3.0, and *REMOVED* as of PHP 8.0.0. Relying on this function is highly discouraged.
### Description
```
gzgetss(resource $zp, int $length, string $allowable_tags = ?): string
```
Identical to [gzgets()](function.gzgets), except that **gzgetss()** attempts to strip any HTML and PHP tags from the text it reads.
### Parameters
`zp`
The gz-file pointer. It must be valid, and must point to a file successfully opened by [gzopen()](function.gzopen).
`length`
The length of data to get.
`allowable_tags`
You can use this optional parameter to specify tags which should not be stripped.
### Return Values
The uncompressed and stripped string, or **`false`** on error.
### Examples
**Example #1 **gzgetss()** example**
```
<?php
$handle = gzopen('somefile.gz', 'r');
while (!gzeof($handle)) {
$buffer = gzgetss($handle, 4096);
echo $buffer;
}
gzclose($handle);
?>
```
### See Also
* [gzopen()](function.gzopen) - Open gz-file
* [gzgets()](function.gzgets) - Get line from file pointer
* [strip\_tags()](function.strip-tags) - Strip HTML and PHP tags from a string
php Imagick::getImageBlob Imagick::getImageBlob
=====================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageBlob — Returns the image sequence as a blob
### Description
```
public Imagick::getImageBlob(): string
```
Implements direct to memory image formats. It returns the image sequence as a string. The format of the image determines the format of the returned blob (GIF, JPEG, PNG, etc.). To return a different image format, use Imagick::setImageFormat().
### Parameters
This function has no parameters.
### Return Values
Returns a string containing the image.
### Errors/Exceptions
Throws ImagickException on error.
php Yaf_Action_Abstract::execute Yaf\_Action\_Abstract::execute
==============================
(Yaf >=1.0.0)
Yaf\_Action\_Abstract::execute — Action entry point
### Description
```
abstract publicYaf_Action_Abstract::execute(mixed ...$args): mixed
```
user should always define this method for a action, this is the entry point of an action. **Yaf\_Action\_Abstract::execute()** may have agruments.
>
> **Note**:
>
>
> The value retrived from the request is not safe. you should do some filtering work before you use it.
>
>
### Parameters
`args`
### Return Values
### Examples
**Example #1 **Yaf\_Action\_Abstract::execute()**example**
```
<?php
/**
* A controller example
*/
class ProductController extends Yaf_Controller_Abstract {
protected $actions = array(
"index" => "actions/Index.php",
);
}
?>
```
**Example #2 **Yaf\_Action\_Abstract::execute()**example**
```
<?php
/**
* ListAction
*/
class ListAction extends Yaf_Action_Abstract {
public function execute ($name, $id) {
assert($name == $this->getRequest()->getParam("name"));
assert($id == $this->getRequest()->getParam("id"));
}
}
?>
```
The above example will output something similar to:
```
/**
* Now assuming we are using the Yaf_Route_Static route
* for request: http://yourdomain/product/list/name/yaf/id/22
* will result:
*/
bool(true)
bool(true)
```
### See Also
*
php is_finite is\_finite
==========
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
is\_finite — Finds whether a value is a legal finite number
### Description
```
is_finite(float $num): bool
```
Checks whether `num` is a legal finite on this platform.
### Parameters
`num`
The value to check
### Return Values
**`true`** if `num` is a legal finite number within the allowed range for a PHP float on this platform, else **`false`**.
### See Also
* [is\_infinite()](function.is-infinite) - Finds whether a value is infinite
* [is\_nan()](function.is-nan) - Finds whether a value is not a number
php Imagick::getImageChannelMean Imagick::getImageChannelMean
============================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageChannelMean — Gets the mean and standard deviation
### Description
```
public Imagick::getImageChannelMean(int $channel): array
```
Gets the mean and standard deviation of one or more image channels.
### Parameters
`channel`
Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channeltype constants using bitwise operators. Refer to this list of [channel constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel).
### Return Values
Returns an array with `"mean"` and `"standardDeviation"` members.
### Errors/Exceptions
Throws ImagickException on error.
php realpath_cache_size realpath\_cache\_size
=====================
(PHP 5 >= 5.3.2, PHP 7, PHP 8)
realpath\_cache\_size — Get realpath cache size
### Description
```
realpath_cache_size(): int
```
Get the amount of memory used by the realpath cache.
### Parameters
This function has no parameters.
### Return Values
Returns how much memory realpath cache is using.
### Examples
**Example #1 **realpath\_cache\_size()** example**
```
<?php
var_dump(realpath_cache_size());
?>
```
The above example will output something similar to:
```
int(412)
```
### See Also
* [realpath\_cache\_get()](function.realpath-cache-get) - Get realpath cache entries
* The [realpath\_cache\_size](https://www.php.net/manual/en/ini.core.php#ini.realpath-cache-size) configuration option
php socket_get_option socket\_get\_option
===================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
socket\_get\_option — Gets socket options for the socket
### Description
```
socket_get_option(Socket $socket, int $level, int $option): array|int|false
```
The **socket\_get\_option()** function retrieves the value for the option specified by the `option` parameter for the specified `socket`.
### Parameters
`socket`
A [Socket](class.socket) instance created with [socket\_create()](function.socket-create) or [socket\_accept()](function.socket-accept).
`level`
The `level` parameter specifies the protocol level at which the option resides. For example, to retrieve options at the socket level, a `level` parameter of **`SOL_SOCKET`** would be used. Other levels, such as **`TCP`**, can be used by specifying the protocol number of that level. Protocol numbers can be found by using the [getprotobyname()](function.getprotobyname) function.
`option`
**Available Socket Options**| Option | Description | Type |
| --- | --- | --- |
| **`SO_DEBUG`** | Reports whether debugging information is being recorded. | int |
| **`SO_BROADCAST`** | Reports whether transmission of broadcast messages is supported. | int |
| **`SO_REUSEADDR`** | Reports whether local addresses can be reused. | int |
| **`SO_REUSEPORT`** | Reports whether local ports can be reused. | int |
| **`SO_KEEPALIVE`** | Reports whether connections are kept active with periodic transmission of messages. If the connected socket fails to respond to these messages, the connection is broken and processes writing to that socket are notified with a SIGPIPE signal. | int |
| **`SO_LINGER`** | Reports whether the `socket` lingers on [socket\_close()](function.socket-close) if data is present. By default, when the socket is closed, it attempts to send all unsent data. In the case of a connection-oriented socket, [socket\_close()](function.socket-close) will wait for its peer to acknowledge the data. If l\_onoff is non-zero and l\_linger is zero, all the unsent data will be discarded and RST (reset) is sent to the peer in the case of a connection-oriented socket. On the other hand, if l\_onoff is non-zero and l\_linger is non-zero, [socket\_close()](function.socket-close) will block until all the data is sent or the time specified in l\_linger elapses. If the socket is non-blocking, [socket\_close()](function.socket-close) will fail and return an error. | array. The array will contain two keys: l\_onoff and l\_linger. |
| **`SO_OOBINLINE`** | Reports whether the `socket` leaves out-of-band data inline. | int |
| **`SO_SNDBUF`** | Reports the size of the send buffer. | int |
| **`SO_RCVBUF`** | Reports the size of the receive buffer. | int |
| **`SO_ERROR`** | Reports information about error status and clears it. | int (cannot be set by [socket\_set\_option()](function.socket-set-option)) |
| **`SO_TYPE`** | Reports the `socket` type (e.g. **`SOCK_STREAM`**). | int (cannot be set by [socket\_set\_option()](function.socket-set-option)) |
| **`SO_DONTROUTE`** | Reports whether outgoing messages bypass the standard routing facilities. | int |
| **`SO_RCVLOWAT`** | Reports the minimum number of bytes to process for `socket` input operations. | int |
| **`SO_RCVTIMEO`** | Reports the timeout value for input operations. | array. The array will contain two keys: sec which is the seconds part on the timeout value and usec which is the microsecond part of the timeout value. |
| **`SO_SNDTIMEO`** | Reports the timeout value specifying the amount of time that an output function blocks because flow control prevents data from being sent. | array. The array will contain two keys: sec which is the seconds part on the timeout value and usec which is the microsecond part of the timeout value. |
| **`SO_SNDLOWAT`** | Reports the minimum number of bytes to process for `socket` output operations. | int |
| **`TCP_NODELAY`** | Reports whether the Nagle TCP algorithm is disabled. | int |
| **`MCAST_JOIN_GROUP`** | Joins a multicast group. | array with keys `"group"`, specifying a string with an IPv4 or IPv6 multicast address and `"interface"`, specifying either an interface number (type int) or a `string` with the interface name, like `"eth0"`. `0` can be specified to indicate the interface should be selected using routing rules. (can only be used in [socket\_set\_option()](function.socket-set-option)) |
| **`MCAST_LEAVE_GROUP`** | Leaves a multicast group. | array. See **`MCAST_JOIN_GROUP`** for more information. (can only be used in [socket\_set\_option()](function.socket-set-option)) |
| **`MCAST_BLOCK_SOURCE`** | Blocks packets arriving from a specific source to a specific multicast group, which must have been previously joined. | array with the same keys as **`MCAST_JOIN_GROUP`**, plus one extra key, `source`, which maps to a string specifying an IPv4 or IPv6 address of the source to be blocked. (can only be used in [socket\_set\_option()](function.socket-set-option)) |
| **`MCAST_UNBLOCK_SOURCE`** | Unblocks (start receiving again) packets arriving from a specific source address to a specific multicast group, which must have been previously joined. | array with the same format as **`MCAST_BLOCK_SOURCE`**. (can only be used in [socket\_set\_option()](function.socket-set-option)) |
| **`MCAST_JOIN_SOURCE_GROUP`** | Receive packets destined to a specific multicast group whose source address matches a specific value. | array with the same format as **`MCAST_BLOCK_SOURCE`**. (can only be used in [socket\_set\_option()](function.socket-set-option)) |
| **`MCAST_LEAVE_SOURCE_GROUP`** | Stop receiving packets destined to a specific multicast group whose source address matches a specific value. | array with the same format as **`MCAST_BLOCK_SOURCE`**. (can only be used in [socket\_set\_option()](function.socket-set-option)) |
| **`IP_MULTICAST_IF`** | The outgoing interface for IPv4 multicast packets. | Either int specifying the interface number or a string with an interface name, like `eth0`. The value 0 can be used to indicate the routing table is to used in the interface selection. The function **socket\_get\_option()** returns an interface index. Note that, unlike the C API, this option does NOT take an IP address. This eliminates the interface difference between **`IP_MULTICAST_IF`** and **`IPV6_MULTICAST_IF`**. |
| **`IPV6_MULTICAST_IF`** | The outgoing interface for IPv6 multicast packets. | The same as **`IP_MULTICAST_IF`**. |
| **`IP_MULTICAST_LOOP`** | The multicast loopback policy for IPv4 packets enables or disables loopback of outgoing multicasts, which must have been previously joined. The effect differs, however, whether it applies on unixes or Windows, the former being on the receive path whereas the latter being on the send path. | int (either `0` or `1`). For [socket\_set\_option()](function.socket-set-option) any value will be accepted and will be converted to a boolean following the usual PHP rules. |
| **`IPV6_MULTICAST_LOOP`** | Analogous to **`IP_MULTICAST_LOOP`**, but for IPv6. | int. See **`IP_MULTICAST_LOOP`**. |
| **`IP_MULTICAST_TTL`** | The time-to-live of outgoing IPv4 multicast packets. This should be a value between 0 (don't leave the interface) and 255. The default value is 1 (only the local network is reached). | int between 0 and 255. |
| **`IPV6_MULTICAST_HOPS`** | Analogous to **`IP_MULTICAST_TTL`**, but for IPv6 packets. The value -1 is also accepted, meaning the route default should be used. | int between -1 and 255. |
| **`SO_MARK`** | Sets an identifier on the socket for packet filtering purpose on Linux. | int |
| **`SO_ACCEPTFILTER`** | Adds an accept filter on the listened socket (FreeBSD/NetBSD). An accept filter kernel module needs to be loaded beforehand on FreeBSD (e.g. accf\_http). | string name of the filter (length 15 max). |
| **`SO_USER_COOKIE`** | Sets an identifier on the socket for packet filtering purpose on FreeBSD. | int |
| **`SO_RTABLE`** | Sets an identifier on the socket for packet filtering purpose on OpenBSD. | int |
| **`SO_DONTTRUNC`** | Retain unread data. | int |
| **`SO_WANTMORE`** | Give a hint when more data is ready. | int |
| **`TCP_DEFER_ACCEPT`** | Don't notify a listening socket until data is ready. | int |
| **`SO_INCOMING_CPU`** | Gets/Sets the cpu affinity of a socket. | int |
| **`SO_MEMINFO`** | Gets all the meminfo of a socket. | int |
| **`SO_BPF_EXTENSIONS`** | Gets the supported BPF extensions by the kernel to attach to a socket. | int |
| **`SO_SETFIB`** | Sets the route table (FIB) of a socket. (FreeBSD only) | int |
| **`SOL_FILTER`** | Filters attributed to a socket. (Solaris/Illumos only) | int |
| **`TCP_KEEPCNT`** | Sets the maximum number of keepalive probes TCP should send before dropping the connection. | int |
| **`TCP_KEEPIDLE`** | Sets the time the connection needs to remain idle. | int |
| **`TCP_KEEPINTVL`** | Sets the time between individual keepalive probes. | int |
| **`TCP_KEEPALIVE`** | Sets the time the connection needs to remain idle. (macOS only) | int |
| **`TCP_NOTSENT_LOWAT`** | Sets the limit number of unsent data in write queue by the socket stream. (Linux only) | int |
### Return Values
Returns the value of the given option, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `socket` is a [Socket](class.socket) instance now; previously, it was a resource. |
### Examples
**Example #1 **socket\_get\_option()** example**
```
<?php
$socket = socket_create_listen(1223);
$linger = array('l_linger' => 1, 'l_onoff' => 1);
socket_set_option($socket, SOL_SOCKET, SO_LINGER, $linger);
var_dump(socket_get_option($socket, SOL_SOCKET, SO_REUSEADDR));
?>
```
### See Also
* [socket\_create\_listen()](function.socket-create-listen) - Opens a socket on port to accept connections
* [socket\_set\_option()](function.socket-set-option) - Sets socket options for the socket
| programming_docs |
php imap_getsubscribed imap\_getsubscribed
===================
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_getsubscribed — List all the subscribed mailboxes
### Description
```
imap_getsubscribed(IMAP\Connection $imap, string $reference, string $pattern): array|false
```
Gets information about the subscribed mailboxes.
Identical to [imap\_getmailboxes()](function.imap-getmailboxes), except that it only returns mailboxes that the user is subscribed to.
### Parameters
`imap`
An [IMAP\Connection](class.imap-connection) instance.
`reference`
`reference` should normally be just the server specification as described in [imap\_open()](function.imap-open)
**Warning** Passing untrusted data to this parameter is *insecure*, unless [imap.enable\_insecure\_rsh](https://www.php.net/manual/en/imap.configuration.php#ini.imap.enable-insecure-rsh) is disabled.
`pattern`
Specifies where in the mailbox hierarchy to start searching.
There are two special characters you can pass as part of the `pattern`: '`*`' and '`%`'. '`*`' means to return all mailboxes. If you pass `pattern` as '`*`', you will get a list of the entire mailbox hierarchy. '`%`' means to return the current level only. '`%`' as the `pattern` parameter will return only the top level mailboxes; '`~/mail/%`' on `UW_IMAPD` will return every mailbox in the ~/mail directory, but none in subfolders of that directory.
### Return Values
Returns an array of objects containing mailbox information. Each object has the attributes `name`, specifying the full name of the mailbox; `delimiter`, which is the hierarchy delimiter for the part of the hierarchy this mailbox is in; and `attributes`. `Attributes` is a bitmask that can be tested against:
* **`LATT_NOINFERIORS`** - This mailbox has no "children" (there are no mailboxes below this one).
* **`LATT_NOSELECT`** - This is only a container, not a mailbox - you cannot open it.
* **`LATT_MARKED`** - This mailbox is marked. Only used by UW-IMAPD.
* **`LATT_UNMARKED`** - This mailbox is not marked. Only used by UW-IMAPD.
* **`LATT_REFERRAL`** - This container has a referral to a remote mailbox.
* **`LATT_HASCHILDREN`** - This mailbox has selectable inferiors.
* **`LATT_HASNOCHILDREN`** - This mailbox has no selectable inferiors.
The function returns **`false`** on failure. ### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `imap` parameter expects an [IMAP\Connection](class.imap-connection) instance now; previously, a [resource](language.types.resource) was expected. |
php opcache_get_status opcache\_get\_status
====================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL ZendOpcache > 7.0.2)
opcache\_get\_status — Get status information about the cache
### Description
```
opcache_get_status(bool $include_scripts = true): array|false
```
This function returns state information about the in-memory cache instance. It will not return any information about the file cache.
### Parameters
`include_scripts`
Include script specific state information
### Return Values
Returns an array of information, optionally containing script specific state information, or **`false`** on failure.
### Errors/Exceptions
If `opcache.restrict_api` is in use and the current path is in violation of the rule, an E\_WARNING will be raised; no status information will be returned.
### See Also
* [opcache\_get\_configuration()](function.opcache-get-configuration) - Get configuration information about the cache
php snmp_set_valueretrieval snmp\_set\_valueretrieval
=========================
(PHP 4 >= 4.3.3, PHP 5, PHP 7, PHP 8)
snmp\_set\_valueretrieval — Specify the method how the SNMP values will be returned
### Description
```
snmp_set_valueretrieval(int $method): bool
```
### Parameters
`method`
**types**| SNMP\_VALUE\_LIBRARY | The return values will be as returned by the Net-SNMP library. |
| SNMP\_VALUE\_PLAIN | The return values will be the plain value without the SNMP type information. |
| SNMP\_VALUE\_OBJECT | The return values will be objects with the properties `value` and `type`, where the latter is one of the **`SNMP_OCTET_STR`**, **`SNMP_COUNTER`** etc. constants. The way `value` is returned is based on which one of constants **`SNMP_VALUE_LIBRARY`**, **`SNMP_VALUE_PLAIN`** is set. |
### Return Values
Always returns **`true`**.
### Examples
**Example #1 Using **snmp\_set\_valueretrieval()****
```
<?php
snmp_set_valueretrieval(SNMP_VALUE_LIBRARY);
$ret = snmpget('localhost', 'public', 'IF-MIB::ifName.1');
// $ret = "STRING: lo"
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
$ret = snmpget('localhost', 'public', 'IF-MIB::ifName.1');
// $ret = "lo";
snmp_set_valueretrieval(SNMP_VALUE_OBJECT);
$ret = snmpget('localhost', 'public', 'IF-MIB::ifName.1');
// stdClass Object
// (
// [type] => 4 <-- SNMP_OCTET_STR, see constants
// [value] => lo
// )
snmp_set_valueretrieval(SNMP_VALUE_OBJECT | SNMP_VALUE_PLAIN);
$ret = snmpget('localhost', 'public', 'IF-MIB::ifName.1');
// stdClass Object
// (
// [type] => 4 <-- SNMP_OCTET_STR, see constants
// [value] => lo
// )
snmp_set_valueretrieval(SNMP_VALUE_OBJECT | SNMP_VALUE_LIBRARY);
$ret = snmpget('localhost', 'public', 'IF-MIB::ifName.1');
// stdClass Object
// (
// [type] => 4 <-- SNMP_OCTET_STR, see constants
// [value] => STRING: lo
// )
?>
```
### See Also
* [snmp\_get\_valueretrieval()](function.snmp-get-valueretrieval) - Return the method how the SNMP values will be returned
* [Predefined Constants](https://www.php.net/manual/en/snmp.constants.php)
php Componere\Value::isStatic Componere\Value::isStatic
=========================
(Componere 2 >= 2.1.0)
Componere\Value::isStatic — Accessibility Detection
### Description
```
public Componere\Value::isStatic(): bool
```
php GearmanJob::workload GearmanJob::workload
====================
(PECL gearman >= 0.5.0)
GearmanJob::workload — Get workload
### Description
```
public GearmanJob::workload(): string
```
Returns the workload for the job. This is serialized data that is to be processed by the worker.
### Parameters
This function has no parameters.
### Return Values
Serialized data.
### See Also
* [GearmanClient::do()](gearmanclient.do) - Run a single task and return a result [deprecated]
* [GearmanJob::workloadSize()](gearmanjob.workloadsize) - Get size of work load
php fputs fputs
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
fputs — Alias of [fwrite()](function.fwrite)
### Description
This function is an alias of: [fwrite()](function.fwrite).
php SplObjectStorage::getInfo SplObjectStorage::getInfo
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplObjectStorage::getInfo — Returns the data associated with the current iterator entry
### Description
```
public SplObjectStorage::getInfo(): mixed
```
Returns the data, or info, associated with the object pointed by the current iterator position.
### Parameters
This function has no parameters.
### Return Values
The data associated with the current iterator position.
### Examples
**Example #1 **SplObjectStorage::getInfo()** example**
```
<?php
$s = new SplObjectStorage();
$o1 = new StdClass;
$o2 = new StdClass;
$s->attach($o1, "d1");
$s->attach($o2, "d2");
$s->rewind();
while($s->valid()) {
$index = $s->key();
$object = $s->current(); // similar to current($s)
$data = $s->getInfo();
var_dump($object);
var_dump($data);
$s->next();
}
?>
```
The above example will output something similar to:
```
object(stdClass)#2 (0) {
}
string(2) "d1"
object(stdClass)#3 (0) {
}
string(2) "d2"
```
### See Also
* [SplObjectStorage::current()](splobjectstorage.current) - Returns the current storage entry
* [SplObjectStorage::rewind()](splobjectstorage.rewind) - Rewind the iterator to the first storage element
* [SplObjectStorage::key()](splobjectstorage.key) - Returns the index at which the iterator currently is
* [SplObjectStorage::next()](splobjectstorage.next) - Move to the next entry
* [SplObjectStorage::valid()](splobjectstorage.valid) - Returns if the current iterator entry is valid
* [SplObjectStorage::setInfo()](splobjectstorage.setinfo) - Sets the data associated with the current iterator entry
php stream_context_create stream\_context\_create
=======================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
stream\_context\_create — Creates a stream context
### Description
```
stream_context_create(?array $options = null, ?array $params = null): resource
```
Creates and returns a stream context with any options supplied in `options` preset.
### Parameters
`options`
Must be an associative array of associative arrays in the format `$arr['wrapper']['option'] = $value`, or **`null`**. Refer to [context options](https://www.php.net/manual/en/context.php) for a list of available wrappers and options.
Defaults to **`null`**.
`params`
Must be an associative array in the format `$arr['parameter'] = $value`, or **`null`**. Refer to [context parameters](https://www.php.net/manual/en/context.params.php) for a listing of standard stream parameters.
### Return Values
A stream context resource.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `options` and `params` are now nullable. |
### Examples
**Example #1 Using **stream\_context\_create()****
```
<?php
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n"
)
);
$context = stream_context_create($opts);
/* Sends an http request to www.example.com
with additional headers shown above */
$fp = fopen('http://www.example.com', 'r', false, $context);
fpassthru($fp);
fclose($fp);
?>
```
### See Also
* [stream\_context\_set\_option()](function.stream-context-set-option) - Sets an option for a stream/wrapper/context
* Listing of supported wrappers ([Supported Protocols and Wrappers](https://www.php.net/manual/en/wrappers.php))
* Context options ([Context options and parameters](https://www.php.net/manual/en/context.php))
php SolrQuery::setHighlightSimplePost SolrQuery::setHighlightSimplePost
=================================
(PECL solr >= 0.9.2)
SolrQuery::setHighlightSimplePost — Sets the text which appears after a highlighted term
### Description
```
public SolrQuery::setHighlightSimplePost(string $simplePost, string $field_override = ?): SolrQuery
```
Sets the text which appears before a highlighted term
### Parameters
`simplePost`
Sets the text which appears after a highlighted term
```
The default is </em>
```
`field_override`
The name of the field.
### Return Values
Returns an instance of [SolrQuery](class.solrquery).
php Imagick::getPixelIterator Imagick::getPixelIterator
=========================
(PECL imagick 2, PECL imagick 3)
Imagick::getPixelIterator — Returns a MagickPixelIterator
### Description
```
public Imagick::getPixelIterator(): ImagickPixelIterator
```
Returns a MagickPixelIterator.
### Parameters
This function has no parameters.
### Return Values
Returns an ImagickPixelIterator on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::getPixelIterator()****
```
<?php
function getPixelIterator($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imageIterator = $imagick->getPixelIterator();
foreach ($imageIterator as $row => $pixels) { /* Loop through pixel rows */
foreach ($pixels as $column => $pixel) { /* Loop through the pixels in the row (columns) */
/** @var $pixel \ImagickPixel */
if ($column % 2) {
$pixel->setColor("rgba(0, 0, 0, 0)"); /* Paint every second pixel black*/
}
}
$imageIterator->syncIterator(); /* Sync the iterator, this is important to do on each iteration */
}
header("Content-Type: image/jpg");
echo $imagick;
}
?>
```
php pspell_new_config pspell\_new\_config
===================
(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)
pspell\_new\_config — Load a new dictionary with settings based on a given config
### Description
```
pspell_new_config(PSpell\Config $config): PSpell\Dictionary|false
```
**pspell\_new\_config()** opens up a new dictionary with settings specified in a `config`, created with [pspell\_config\_create()](function.pspell-config-create) and modified with **pspell\_config\_\*()** functions. This method provides you with the most flexibility and has all the functionality provided by [pspell\_new()](function.pspell-new) and [pspell\_new\_personal()](function.pspell-new-personal).
### Parameters
`config`
The `config` parameter is the one returned by [pspell\_config\_create()](function.pspell-config-create) when the config was created.
### Return Values
Returns an [PSpell\Dictionary](class.pspell-dictionary) instance on success, or **`false`** on failure
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `config` parameter expects an [PSpell\Config](class.pspell-config) instance now; previously, a [resource](language.types.resource) was expected. |
| 8.1.0 | Returns an [PSpell\Dictionary](class.pspell-dictionary) instance now; previously, a [resource](language.types.resource) was returned. |
### Examples
**Example #1 **pspell\_new\_config()****
```
<?php
$pspell_config = pspell_config_create("en");
pspell_config_personal($pspell_config, "/var/dictionaries/custom.pws");
pspell_config_repl($pspell_config, "/var/dictionaries/custom.repl");
$pspell = pspell_new_config($pspell_config);
?>
```
php bcdiv bcdiv
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
bcdiv — Divide two arbitrary precision numbers
### Description
```
bcdiv(string $num1, string $num2, ?int $scale = null): string
```
Divides the `num1` by the `num2`.
### Parameters
`num1`
The dividend, as a string.
`num2`
The divisor, as a string.
`scale`
This optional parameter is used to set the number of digits after the decimal place in the result. If omitted, it will default to the scale set globally with the [bcscale()](function.bcscale) function, or fallback to `0` if this has not been set.
### Return Values
Returns the result of the division as a string, or **`null`** if `num2` is `0`.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `scale` is now nullable. |
### Examples
**Example #1 **bcdiv()** example**
```
<?php
echo bcdiv('105', '6.55957', 3); // 16.007
?>
```
### See Also
* [bcmul()](function.bcmul) - Multiply two arbitrary precision numbers
php cal_to_jd cal\_to\_jd
===========
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
cal\_to\_jd — Converts from a supported calendar to Julian Day Count
### Description
```
cal_to_jd(
int $calendar,
int $month,
int $day,
int $year
): int
```
**cal\_to\_jd()** calculates the Julian day count for a date in the specified `calendar`. Supported `calendar`s are **`CAL_GREGORIAN`**, **`CAL_JULIAN`**, **`CAL_JEWISH`** and **`CAL_FRENCH`**.
### Parameters
`calendar`
Calendar to convert from, one of **`CAL_GREGORIAN`**, **`CAL_JULIAN`**, **`CAL_JEWISH`** or **`CAL_FRENCH`**.
`month`
The month as a number, the valid range depends on the `calendar`
`day`
The day as a number, the valid range depends on the `calendar`
`year`
The year as a number, the valid range depends on the `calendar`
### Return Values
A Julian Day number.
### See Also
* [cal\_from\_jd()](function.cal-from-jd) - Converts from Julian Day Count to a supported calendar
* [frenchtojd()](function.frenchtojd) - Converts a date from the French Republican Calendar to a Julian Day Count
* [gregoriantojd()](function.gregoriantojd) - Converts a Gregorian date to Julian Day Count
* [jewishtojd()](function.jewishtojd) - Converts a date in the Jewish Calendar to Julian Day Count
* [juliantojd()](function.juliantojd) - Converts a Julian Calendar date to Julian Day Count
* [unixtojd()](function.unixtojd) - Convert Unix timestamp to Julian Day
php chop chop
====
(PHP 4, PHP 5, PHP 7, PHP 8)
chop — Alias of [rtrim()](function.rtrim)
### Description
This function is an alias of: [rtrim()](function.rtrim).
### Notes
>
> **Note**:
>
>
> **chop()** is different than the Perl `chop()` function, which removes the last character in the string.
>
>
php GearmanClient::jobStatus GearmanClient::jobStatus
========================
gearman\_job\_status
====================
(PECL gearman >= 0.5.0)
GearmanClient::jobStatus -- gearman\_job\_status — Get the status of a background job
### Description
Object-oriented style (method):
```
public GearmanClient::jobStatus(string $job_handle): array
```
Gets the status for a background job given a job handle. The status information will specify whether the job is known, whether the job is currently running, and the percentage completion.
### Parameters
`job_handle`
The job handle assigned by the Gearman server
### Return Values
An array containing status information for the job corresponding to the supplied job handle. The first array element is a boolean indicating whether the job is even known, the second is a boolean indicating whether the job is still running, and the third and fourth elements correspond to the numerator and denominator of the fractional completion percentage, respectively.
### Examples
**Example #1 Monitor the status of a long running background job**
```
<?php
/* create our object */
$gmclient= new GearmanClient();
/* add the default server */
$gmclient->addServer();
/* run reverse client */
$job_handle = $gmclient->doBackground("reverse", "this is a test");
if ($gmclient->returnCode() != GEARMAN_SUCCESS)
{
echo "bad return code\n";
exit;
}
$done = false;
do
{
sleep(3);
$stat = $gmclient->jobStatus($job_handle);
if (!$stat[0]) // the job is known so it is not done
$done = true;
echo "Running: " . ($stat[1] ? "true" : "false") . ", numerator: " . $stat[2] . ", denomintor: " . $stat[3] . "\n";
}
while(!$done);
echo "done!\n";
?>
```
The above example will output something similar to:
```
Running: true, numerator: 3, denomintor: 14
Running: true, numerator: 6, denomintor: 14
Running: true, numerator: 9, denomintor: 14
Running: true, numerator: 12, denomintor: 14
Running: false, numerator: 0, denomintor: 0
done!
```
### See Also
* [GearmanClient::doStatus()](gearmanclient.dostatus) - Get the status for the running task
php IteratorIterator::valid IteratorIterator::valid
=======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
IteratorIterator::valid — Checks if the iterator is valid
### Description
```
public IteratorIterator::valid(): bool
```
Checks if the iterator is valid.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the iterator is valid, otherwise **`false`**
### See Also
* [iterator\_count()](function.iterator-count) - Count the elements in an iterator
* [IteratorIterator::current()](iteratoriterator.current) - Get the current value
php SplPriorityQueue::isEmpty SplPriorityQueue::isEmpty
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplPriorityQueue::isEmpty — Checks whether the queue is empty
### Description
```
public SplPriorityQueue::isEmpty(): bool
```
### Parameters
This function has no parameters.
### Return Values
Returns whether the queue is empty.
php ImagickDraw::setFontSize ImagickDraw::setFontSize
========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setFontSize — Sets the font pointsize to use when annotating with text
### Description
```
public ImagickDraw::setFontSize(float $pointsize): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Sets the font pointsize to use when annotating with text.
### Parameters
`pointsize`
the point size
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::setFontSize()** example**
```
<?php
function setFontSize($fillColor, $strokeColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeOpacity(1);
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFont("../fonts/Arial.ttf");
$sizes = [24, 36, 48, 60, 72];
foreach ($sizes as $size) {
$draw->setFontSize($size);
$draw->annotation(50, ($size * $size / 16), "Lorem Ipsum!");
}
$imagick = new \Imagick();
$imagick->newImage(500, 500, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
| programming_docs |
php The Yaf_Route_Interface class
The Yaf\_Route\_Interface class
===============================
Introduction
------------
(Yaf >=1.0.0)
**Yaf\_Route\_Interface** used for developer defined their custom route.
Class synopsis
--------------
class **Yaf\_Route\_Interface** { /\* Methods \*/
```
abstract public assemble(array $info, array $query = ?): string
```
```
abstract public route(Yaf_Request_Abstract $request): bool
```
} Table of Contents
-----------------
* [Yaf\_Route\_Interface::assemble](yaf-route-interface.assemble) — Assemble a request
* [Yaf\_Route\_Interface::route](yaf-route-interface.route) — Route a request
php DirectoryIterator::getExtension DirectoryIterator::getExtension
===============================
(PHP 5 >= 5.3.6, PHP 7, PHP 8)
DirectoryIterator::getExtension — Gets the file extension
### Description
```
public DirectoryIterator::getExtension(): string
```
Retrieves the file extension.
### Parameters
This function has no parameters.
### Return Values
Returns a string containing the file extension, or an empty string if the file has no extension.
### Examples
**Example #1 **DirectoryIterator::getExtension()** example**
```
<?php
$directory = new DirectoryIterator(__DIR__);
foreach ($directory as $fileinfo) {
if ($fileinfo->isFile()) {
echo $fileinfo->getExtension() . "\n";
}
}
?>
```
The above example will output something similar to:
```
php
txt
jpg
gz
```
### Notes
>
> **Note**:
>
>
> Another way of getting the extension is to use the [pathinfo()](function.pathinfo) function.
>
>
> ```
> <?php
> $extension = pathinfo($fileinfo->getFilename(), PATHINFO_EXTENSION);
> ?>
> ```
>
### See Also
* [DirectoryIterator::getFilename()](directoryiterator.getfilename) - Return file name of current DirectoryIterator item
* [DirectoryIterator::getBasename()](directoryiterator.getbasename) - Get base name of current DirectoryIterator item
* [pathinfo()](function.pathinfo) - Returns information about a file path
php Imagick::roundCorners Imagick::roundCorners
=====================
(PECL imagick 2, PECL imagick 3)
Imagick::roundCorners — Rounds image corners
**Warning**This function has been *DEPRECATED* as of Imagick 3.4.4. Relying on this function is highly discouraged.
### Description
```
public Imagick::roundCorners(
float $x_rounding,
float $y_rounding,
float $stroke_width = 10,
float $displace = 5,
float $size_correction = -6
): bool
```
Rounds image corners. The first two parameters control the amount of rounding and the three last parameters can be used to fine-tune the rounding process. This method is available if Imagick has been compiled against ImageMagick version 6.2.9 or newer. This method is not available if Imagick has been compiled against ImageMagick version 7.0.0 or newer.
### Parameters
`x_rounding`
x rounding
`y_rounding`
y rounding
`stroke_width`
stroke width
`displace`
image displace
`size_correction`
size correction
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 Using **Imagick::roundCorners()**:**
Rounds the image corners
```
<?php
$image = new Imagick();
$image->newPseudoImage(100, 100, "magick:rose");
$image->setImageFormat("png");
$image->roundCorners(5,3);
$image->writeImage("rounded.png");
?>
```
php ReflectionNamedType::isBuiltin ReflectionNamedType::isBuiltin
==============================
(PHP 7, PHP 8)
ReflectionNamedType::isBuiltin — Checks if it is a built-in type
### Description
```
public ReflectionNamedType::isBuiltin(): bool
```
Checks if the type is a built-in type in PHP. A built-in type is any type that is not a class, interface, or trait.
### Parameters
This function has no parameters.
### Return Values
**`true`** if it's a built-in type, otherwise **`false`**
### Examples
**Example #1 **ReflectionNamedType::isBuiltin()** example**
```
<?php
class SomeClass {}
function someFunction(string $param, SomeClass $param2, StdClass $param3) {}
$reflectionFunc = new ReflectionFunction('someFunction');
$reflectionParams = $reflectionFunc->getParameters();
var_dump($reflectionParams[0]->getType()->isBuiltin());
var_dump($reflectionParams[1]->getType()->isBuiltin());
var_dump($reflectionParams[2]->getType()->isBuiltin());
```
The above example will output:
```
bool(true)
bool(false)
bool(false)
```
Note that the **ReflectionNamedType::isBuiltin()** method does not distinguish between internal and custom classes. To make this distinction, the [ReflectionClass::isInternal()](reflectionclass.isinternal) method should be used on the returned class name.
### See Also
* [ReflectionType::allowsNull()](reflectiontype.allowsnull) - Checks if null is allowed
* [ReflectionType::\_\_toString()](reflectiontype.tostring) - To string
* [ReflectionClass::isInternal()](reflectionclass.isinternal) - Checks if class is defined internally by an extension, or the core
* [ReflectionParameter::getType()](reflectionparameter.gettype) - Gets a parameter's type
php The QuickHashIntHash class
The QuickHashIntHash class
==========================
Introduction
------------
(PECL quickhash >= Unknown)
This class wraps around a hash containing integer numbers, where the values are also integer numbers. Hashes are also available as implementation of the [ArrayAccess](class.arrayaccess) interface.
Hashes can also be iterated over with [`foreach`](control-structures.foreach) as the [Iterator](class.iterator) interface is implemented as well. The order of which elements are returned in is not guaranteed.
Class synopsis
--------------
class **QuickHashIntHash** { /\* Constants \*/ const int [CHECK\_FOR\_DUPES](class.quickhashinthash#quickhashinthash.constants.check-for-dupes) = 1;
const int [DO\_NOT\_USE\_ZEND\_ALLOC](class.quickhashinthash#quickhashinthash.constants.do-not-use-zend-alloc) = 2;
const int [HASHER\_NO\_HASH](class.quickhashinthash#quickhashinthash.constants.hasher-no-hash) = 256;
const int [HASHER\_JENKINS1](class.quickhashinthash#quickhashinthash.constants.hasher-jenkins1) = 512;
const int [HASHER\_JENKINS2](class.quickhashinthash#quickhashinthash.constants.hasher-jenkins2) = 1024; /\* Methods \*/
```
public add(int $key, int $value = ?): bool
```
```
public __construct(int $size, int $options = ?)
```
```
public delete(int $key): bool
```
```
public exists(int $key): bool
```
```
public get(int $key): int
```
```
public getSize(): int
```
```
public static loadFromFile(string $filename, int $options = ?): QuickHashIntHash
```
```
public static loadFromString(string $contents, int $options = ?): QuickHashIntHash
```
```
public saveToFile(string $filename): void
```
```
public saveToString(): string
```
```
public set(int $key, int $value): bool
```
```
public update(int $key, int $value): bool
```
} Predefined Constants
--------------------
**`QuickHashIntHash::CHECK_FOR_DUPES`** If enabled, adding duplicate elements to a set (through either [QuickHashIntHash::add()](quickhashinthash.add) or [QuickHashIntHash::loadFromFile()](quickhashinthash.loadfromfile)) will result in those elements to be dropped from the set. This will take up extra time, so only used when it is required.
**`QuickHashIntHash::DO_NOT_USE_ZEND_ALLOC`** Disables the use of PHP's internal memory manager for internal set structures. With this option enabled, internal allocations will not count towards the [memory\_limit](https://www.php.net/manual/en/ini.core.php#ini.memory-limit) settings.
**`QuickHashIntHash::HASHER_NO_HASH`** Selects to not use a hashing function, but merely use a modulo to find the bucket list index. This is not faster than normal hashing, and gives more collisions.
**`QuickHashIntHash::HASHER_JENKINS1`** This is the default hashing function to turn the integer hashes into bucket list indexes.
**`QuickHashIntHash::HASHER_JENKINS2`** Selects a variant hashing algorithm.
Table of Contents
-----------------
* [QuickHashIntHash::add](quickhashinthash.add) — This method adds a new entry to the hash
* [QuickHashIntHash::\_\_construct](quickhashinthash.construct) — Creates a new QuickHashIntHash object
* [QuickHashIntHash::delete](quickhashinthash.delete) — This method deletes an entry from the hash
* [QuickHashIntHash::exists](quickhashinthash.exists) — This method checks whether a key is part of the hash
* [QuickHashIntHash::get](quickhashinthash.get) — This method retrieves a value from the hash by its key
* [QuickHashIntHash::getSize](quickhashinthash.getsize) — Returns the number of elements in the hash
* [QuickHashIntHash::loadFromFile](quickhashinthash.loadfromfile) — This factory method creates a hash from a file
* [QuickHashIntHash::loadFromString](quickhashinthash.loadfromstring) — This factory method creates a hash from a string
* [QuickHashIntHash::saveToFile](quickhashinthash.savetofile) — This method stores an in-memory hash to disk
* [QuickHashIntHash::saveToString](quickhashinthash.savetostring) — This method returns a serialized version of the hash
* [QuickHashIntHash::set](quickhashinthash.set) — This method updates an entry in the hash with a new value, or adds a new one if the entry doesn't exist
* [QuickHashIntHash::update](quickhashinthash.update) — This method updates an entry in the hash with a new value
php None Object Cloning
--------------
Creating a copy of an object with fully replicated properties is not always the wanted behavior. A good example of the need for copy constructors, is if you have an object which represents a GTK window and the object holds the resource of this GTK window, when you create a duplicate you might want to create a new window with the same properties and have the new object hold the resource of the new window. Another example is if your object holds a reference to another object which it uses and when you replicate the parent object you want to create a new instance of this other object so that the replica has its own separate copy.
An object copy is created by using the `clone` keyword (which calls the object's [\_\_clone()](language.oop5.cloning#object.clone) method if possible).
```
$copy_of_object = clone $object;
```
When an object is cloned, PHP will perform a shallow copy of all of the object's properties. Any properties that are references to other variables will remain references.
```
__clone(): void
```
Once the cloning is complete, if a [\_\_clone()](language.oop5.cloning#object.clone) method is defined, then the newly created object's [\_\_clone()](language.oop5.cloning#object.clone) method will be called, to allow any necessary properties that need to be changed.
**Example #1 Cloning an object**
```
<?php
class SubObject
{
static $instances = 0;
public $instance;
public function __construct() {
$this->instance = ++self::$instances;
}
public function __clone() {
$this->instance = ++self::$instances;
}
}
class MyCloneable
{
public $object1;
public $object2;
function __clone()
{
// Force a copy of this->object, otherwise
// it will point to same object.
$this->object1 = clone $this->object1;
}
}
$obj = new MyCloneable();
$obj->object1 = new SubObject();
$obj->object2 = new SubObject();
$obj2 = clone $obj;
print("Original Object:\n");
print_r($obj);
print("Cloned Object:\n");
print_r($obj2);
?>
```
The above example will output:
```
Original Object:
MyCloneable Object
(
[object1] => SubObject Object
(
[instance] => 1
)
[object2] => SubObject Object
(
[instance] => 2
)
)
Cloned Object:
MyCloneable Object
(
[object1] => SubObject Object
(
[instance] => 3
)
[object2] => SubObject Object
(
[instance] => 2
)
)
```
It is possible to access a member of a freshly cloned object in a single expression:
**Example #2 Access member of freshly cloned object**
```
<?php
$dateTime = new DateTime();
echo (clone $dateTime)->format('Y');
?>
```
The above example will output something similar to:
```
2016
```
php odbc_errormsg odbc\_errormsg
==============
(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)
odbc\_errormsg — Get the last error message
### Description
```
odbc_errormsg(?resource $odbc = null): string
```
Returns a string containing the last ODBC error message, or an empty string if there has been no errors.
### Parameters
`odbc`
The ODBC connection identifier, see [odbc\_connect()](function.odbc-connect) for details.
### Return Values
If `odbc` is specified, the last state of that connection is returned, else the last state of any connection is returned.
This function returns meaningful value only if last odbc query failed (i.e. [odbc\_exec()](function.odbc-exec) returned **`false`**).
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `odbc` is nullable now. |
### See Also
* [odbc\_error()](function.odbc-error) - Get the last error code
* [odbc\_exec()](function.odbc-exec) - Directly execute an SQL statement
php Spoofchecker::isSuspicious Spoofchecker::isSuspicious
==========================
(PHP 5 >= 5.4.0, PHP 7, PHP 8, PECL intl >= 2.0.0)
Spoofchecker::isSuspicious — Checks if a given text contains any suspicious characters
### Description
```
public Spoofchecker::isSuspicious(string $string, int &$errorCode = null): bool
```
Checks if given string contains any suspicious characters like letters which are almost identical visually, but are Unicode characters from different sets.
### Parameters
`string`
String to test.
`errorCode`
This variable is set by-reference to int containing an error, if there was any.
### Return Values
Returns **`true`** if there are suspicious characters, **`false`** otherwise.
### Examples
**Example #1 **Spoofchecker::isSuspicious()** example**
```
<?php
$checker = new Spoofchecker();
$checker->isSuspicious('google.com'); // FALSE: only ASCII characters
$checker->isSuspicious('Рaypal.com'); // TRUE
// The first letter is from Cyrylic, not a regular latin "P"
```
php ReflectionMethod::getDeclaringClass ReflectionMethod::getDeclaringClass
===================================
(PHP 5, PHP 7, PHP 8)
ReflectionMethod::getDeclaringClass — Gets declaring class for the reflected method
### Description
```
public ReflectionMethod::getDeclaringClass(): ReflectionClass
```
Gets the declaring class for the reflected method.
### Parameters
This function has no parameters.
### Return Values
A [ReflectionClass](class.reflectionclass) object of the class that the reflected method is part of.
### Examples
**Example #1 **ReflectionMethod::getDeclaringClass()** example**
```
<?php
class HelloWorld {
protected function sayHelloTo($name) {
return 'Hello ' . $name;
}
}
$reflectionMethod = new ReflectionMethod(new HelloWorld(), 'sayHelloTo');
var_dump($reflectionMethod->getDeclaringClass());
?>
```
The above example will output:
```
object(ReflectionClass)#2 (1) {
["name"]=>
string(10) "HelloWorld"
}
```
### See Also
* [ReflectionMethod::isAbstract()](reflectionmethod.isabstract) - Checks if method is abstract
php fbird_free_event_handler fbird\_free\_event\_handler
===========================
(PHP 5, PHP 7 < 7.4.0)
fbird\_free\_event\_handler — Alias of [ibase\_free\_event\_handler()](function.ibase-free-event-handler)
### Description
This function is an alias of: [ibase\_free\_event\_handler()](function.ibase-free-event-handler).
### See Also
* [fbird\_set\_event\_handler()](function.fbird-set-event-handler) - Alias of ibase\_set\_event\_handler
php ldap_next_reference ldap\_next\_reference
=====================
(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)
ldap\_next\_reference — Get next reference
### Description
```
ldap_next_reference(LDAP\Connection $ldap, LDAP\ResultEntry $entry): LDAP\ResultEntry|false
```
**Warning**This function is currently not documented; only its argument list is available.
php gzinflate gzinflate
=========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gzinflate — Inflate a deflated string
### Description
```
gzinflate(string $data, int $max_length = 0): string|false
```
This function inflates a deflated string.
### Parameters
`data`
The data compressed by [gzdeflate()](function.gzdeflate).
`max_length`
The maximum length of decoded data.
### Return Values
The original uncompressed data or **`false`** on error.
The function will return an error if the uncompressed data is more than 32768 times the length of the compressed input `data` or, unless `max_length` is `0`, more than the optional parameter `max_length`.
### Examples
**Example #1 **gzinflate()** example**
```
<?php
$compressed = gzdeflate('Compress me', 9);
$uncompressed = gzinflate($compressed);
echo $uncompressed;
?>
```
### See Also
* [gzdeflate()](function.gzdeflate) - Deflate a string
* [gzcompress()](function.gzcompress) - Compress a string
* [gzuncompress()](function.gzuncompress) - Uncompress a compressed string
* [gzencode()](function.gzencode) - Create a gzip compressed string
php wincache_ucache_get wincache\_ucache\_get
=====================
(PECL wincache >= 1.1.0)
wincache\_ucache\_get — Gets a variable stored in the user cache
### Description
```
wincache_ucache_get(mixed $key, bool &$success = ?): mixed
```
Gets a variable stored in the user cache.
### Parameters
`key`
The `key` that was used to store the variable in the cache. `key` is case sensitive. `key` can be an array of keys. In this case the return value will be an array of values of each element in the `key` array. If an object, or an array containing objects, is returned, then the objects will be unserialized. See [\_\_wakeup()](language.oop5.magic#object.wakeup) for details on unserializing objects.
`success`
Will be set to **`true`** on success and **`false`** on failure.
### Return Values
If `key` is a string, the function returns the value of the variable stored with that key. The `success` is set to **`true`** on success and to **`false`** on failure.
The `key` is an array, the parameter `success` is always set to **`true`**. The returned array (name => value pairs) will contain only those name => value pairs for which the get operation in user cache was successful. If none of the keys in the key array finds a match in the user cache an empty array will be returned.
### Examples
**Example #1 **wincache\_ucache\_get()** with `key` as a string**
```
<?php
wincache_ucache_add('color', 'blue');
var_dump(wincache_ucache_get('color', $success));
var_dump($success);
?>
```
The above example will output:
```
string(4) "blue"
bool(true)
```
**Example #2 **wincache\_ucache\_get()** with `key` as an array**
```
<?php
$array1 = array('green' => '5', 'Blue' => '6', 'yellow' => '7', 'cyan' => '8');
wincache_ucache_set($array1);
$array2 = array('green', 'Blue', 'yellow', 'cyan');
var_dump(wincache_ucache_get($array2, $success));
var_dump($success);
?>
```
The above example will output:
```
array(4) { ["green"]=> string(1) "5"
["Blue"]=> string(1) "6"
["yellow"]=> string(1) "7"
["cyan"]=> string(1) "8" }
bool(true)
```
### See Also
* [wincache\_ucache\_add()](function.wincache-ucache-add) - Adds a variable in user cache only if variable does not already exist in the cache
* [wincache\_ucache\_set()](function.wincache-ucache-set) - Adds a variable in user cache and overwrites a variable if it already exists in the cache
* [wincache\_ucache\_delete()](function.wincache-ucache-delete) - Deletes variables from the user cache
* [wincache\_ucache\_clear()](function.wincache-ucache-clear) - Deletes entire content of the user cache
* [wincache\_ucache\_exists()](function.wincache-ucache-exists) - Checks if a variable exists in the user cache
* [wincache\_ucache\_meminfo()](function.wincache-ucache-meminfo) - Retrieves information about user cache memory usage
* [wincache\_ucache\_info()](function.wincache-ucache-info) - Retrieves information about data stored in the user cache
* [\_\_wakeup()](language.oop5.magic#object.wakeup)
| programming_docs |
php fbird_execute fbird\_execute
==============
(PHP 5, PHP 7 < 7.4.0)
fbird\_execute — Alias of [ibase\_execute()](function.ibase-execute)
### Description
This function is an alias of: [ibase\_execute()](function.ibase-execute).
### See Also
* [fbird\_query()](function.fbird-query) - Alias of ibase\_query
php Parle\Parser::right Parle\Parser::right
===================
(PECL parle >= 0.5.1)
Parle\Parser::right — Declare a token with right-associativity
### Description
```
public Parle\Parser::right(string $tok): void
```
Declare a terminal with right associativity.
### Parameters
`tok`
Token name.
### Return Values
No value is returned.
php ReflectionFunctionAbstract::getShortName ReflectionFunctionAbstract::getShortName
========================================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
ReflectionFunctionAbstract::getShortName — Gets function short name
### Description
```
public ReflectionFunctionAbstract::getShortName(): string
```
Get the short name of the function (without the namespace part).
### Parameters
This function has no parameters.
### Return Values
The short name of the function.
### See Also
* [ReflectionFunctionAbstract::getNamespaceName()](reflectionfunctionabstract.getnamespacename) - Gets namespace name
* [namespaces](https://www.php.net/manual/en/language.namespaces.php)
php xmlrpc_encode xmlrpc\_encode
==============
(PHP 4 >= 4.1.0, PHP 5, PHP 7)
xmlrpc\_encode — Generates XML for a PHP value
### Description
```
xmlrpc_encode(mixed $value): string
```
**Warning**This function is *EXPERIMENTAL*. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
**Warning**This function is currently not documented; only its argument list is available.
php SolrCollapseFunction::setNullPolicy SolrCollapseFunction::setNullPolicy
===================================
(PECL solr >= 2.2.0)
SolrCollapseFunction::setNullPolicy — Sets the NULL Policy
### Description
```
public SolrCollapseFunction::setNullPolicy(string $nullPolicy): SolrCollapseFunction
```
Sets the NULL Policy. One of the 3 policies defined as class constants shall be passed. Accepts ignore, expand, or collapse policies.
### Parameters
`nullPolicy`
### Return Values
[SolrCollapseFunction](class.solrcollapsefunction)
php mysqli::savepoint mysqli::savepoint
=================
mysqli\_savepoint
=================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
mysqli::savepoint -- mysqli\_savepoint — Set a named transaction savepoint
### Description
Object-oriented style
```
public mysqli::savepoint(string $name): bool
```
Procedural style:
```
mysqli_savepoint(mysqli $mysql, string $name): bool
```
This function is identical to executing `$mysqli->query("SAVEPOINT `$name`");`
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
`name`
The identifier of the savepoint.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [mysqli\_release\_savepoint()](mysqli.release-savepoint) - Removes the named savepoint from the set of savepoints of the current transaction
php SolrDisMaxQuery::addQueryField SolrDisMaxQuery::addQueryField
==============================
(No version information available, might only be in Git)
SolrDisMaxQuery::addQueryField — Add a query field with optional boost (qf parameter)
### Description
```
public SolrDisMaxQuery::addQueryField(string $field, string $boost = ?): SolrDisMaxQuery
```
Add a query field with optional boost (qf parameter)
### Parameters
`field`
field name
`boost`
Boost value. Boosts documents with matching terms.
### Return Values
[SolrDisMaxQuery](class.solrdismaxquery)
### Examples
**Example #1 **SolrDisMaxQuery::addQueryField()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery("lucene");
$dismaxQuery
->addQueryField("location", 4)
->addQueryField("price")
->addQueryField("sku")
->addQueryField("title",3.4)
;
echo $dismaxQuery;
?>
```
The above example will output something similar to:
```
q=lucene&defType=edismax&qf=location^4 price sku title^3.4
```
### See Also
* [SolrDisMaxQuery::removeQueryField()](solrdismaxquery.removequeryfield) - Removes a Query Field (qf parameter)
php fbird_add_user fbird\_add\_user
================
(PHP 5, PHP 7 < 7.4.0)
fbird\_add\_user — Alias of [ibase\_add\_user()](function.ibase-add-user)
### Description
This function is an alias of: [ibase\_add\_user()](function.ibase-add-user).
### See Also
* [fbird\_modify\_user()](function.fbird-modify-user) - Alias of ibase\_modify\_user
* [fbird\_delete\_user()](function.fbird-delete-user) - Alias of ibase\_delete\_user
php The QuickHashIntStringHash class
The QuickHashIntStringHash class
================================
Introduction
------------
(PECL quickhash >= Unknown)
This class wraps around a hash containing integer numbers, where the values are strings. Hashes are also available as implementation of the [ArrayAccess](class.arrayaccess) interface.
Hashes can also be iterated over with [`foreach`](control-structures.foreach) as the [Iterator](class.iterator) interface is implemented as well. The order of which elements are returned in is not guaranteed.
Class synopsis
--------------
class **QuickHashIntStringHash** { /\* Constants \*/ const int [CHECK\_FOR\_DUPES](class.quickhashintstringhash#quickhashintstringhash.constants.check-for-dupes) = 1;
const int [DO\_NOT\_USE\_ZEND\_ALLOC](class.quickhashintstringhash#quickhashintstringhash.constants.do-not-use-zend-alloc) = 2;
const int [HASHER\_NO\_HASH](class.quickhashintstringhash#quickhashintstringhash.constants.hasher-no-hash) = 256;
const int [HASHER\_JENKINS1](class.quickhashintstringhash#quickhashintstringhash.constants.hasher-jenkins1) = 512;
const int [HASHER\_JENKINS2](class.quickhashintstringhash#quickhashintstringhash.constants.hasher-jenkins2) = 1024; /\* Methods \*/
```
public add(int $key, string $value): bool
```
```
public __construct(int $size, int $options = 0)
```
```
public delete(int $key): bool
```
```
public exists(int $key): bool
```
```
public get(int $key): mixed
```
```
public getSize(): int
```
```
public static loadFromFile(string $filename, int $size = 0, int $options = 0): QuickHashIntStringHash
```
```
public static loadFromString(string $contents, int $size = 0, int $options = 0): QuickHashIntStringHash
```
```
public saveToFile(string $filename): void
```
```
public saveToString(): string
```
```
public set(int $key, string $value): int
```
```
public update(int $key, string $value): bool
```
} Predefined Constants
--------------------
**`QuickHashIntStringHash::CHECK_FOR_DUPES`** If enabled, adding duplicate elements to a set (through either [QuickHashIntStringHash::add()](quickhashintstringhash.add) or [QuickHashIntStringHash::loadFromFile()](quickhashintstringhash.loadfromfile)) will result in those elements to be dropped from the set. This will take up extra time, so only used when it is required.
**`QuickHashIntStringHash::DO_NOT_USE_ZEND_ALLOC`** Disables the use of PHP's internal memory manager for internal set structures. With this option enabled, internal allocations will not count towards the [memory\_limit](https://www.php.net/manual/en/ini.core.php#ini.memory-limit) settings.
**`QuickHashIntStringHash::HASHER_NO_HASH`** Selects to not use a hashing function, but merely use a modulo to find the bucket list index. This is not faster than normal hashing, and gives more collisions.
**`QuickHashIntStringHash::HASHER_JENKINS1`** This is the default hashing function to turn the integer hashes into bucket list indexes.
**`QuickHashIntStringHash::HASHER_JENKINS2`** Selects a variant hashing algorithm.
Table of Contents
-----------------
* [QuickHashIntStringHash::add](quickhashintstringhash.add) — This method adds a new entry to the hash
* [QuickHashIntStringHash::\_\_construct](quickhashintstringhash.construct) — Creates a new QuickHashIntStringHash object
* [QuickHashIntStringHash::delete](quickhashintstringhash.delete) — This method deletes an entry from the hash
* [QuickHashIntStringHash::exists](quickhashintstringhash.exists) — This method checks whether a key is part of the hash
* [QuickHashIntStringHash::get](quickhashintstringhash.get) — This method retrieves a value from the hash by its key
* [QuickHashIntStringHash::getSize](quickhashintstringhash.getsize) — Returns the number of elements in the hash
* [QuickHashIntStringHash::loadFromFile](quickhashintstringhash.loadfromfile) — This factory method creates a hash from a file
* [QuickHashIntStringHash::loadFromString](quickhashintstringhash.loadfromstring) — This factory method creates a hash from a string
* [QuickHashIntStringHash::saveToFile](quickhashintstringhash.savetofile) — This method stores an in-memory hash to disk
* [QuickHashIntStringHash::saveToString](quickhashintstringhash.savetostring) — This method returns a serialized version of the hash
* [QuickHashIntStringHash::set](quickhashintstringhash.set) — This method updates an entry in the hash with a new value, or adds a new one if the entry doesn't exist
* [QuickHashIntStringHash::update](quickhashintstringhash.update) — This method updates an entry in the hash with a new value
php mb_ereg_match mb\_ereg\_match
===============
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
mb\_ereg\_match — Regular expression match for multibyte string
### Description
```
mb_ereg_match(string $pattern, string $string, ?string $options = null): bool
```
A regular expression match for a multibyte string
> **Note**: `pattern` is only matched at the beginning of `string`.
>
>
### Parameters
`pattern`
The regular expression pattern.
`string`
The string being evaluated.
`options`
The search option. See [mb\_regex\_set\_options()](function.mb-regex-set-options) for explanation.
### Return Values
Returns **`true`** if `string` matches the regular expression `pattern`, **`false`** if not.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `options` is nullable now. |
### Notes
>
> **Note**:
>
>
> The internal encoding or the character encoding specified by [mb\_regex\_encoding()](function.mb-regex-encoding) will be used as the character encoding for this function.
>
>
>
### See Also
* [mb\_regex\_encoding()](function.mb-regex-encoding) - Set/Get character encoding for multibyte regex
* [mb\_ereg()](function.mb-ereg) - Regular expression match with multibyte support
php Error::getCode Error::getCode
==============
(PHP 7, PHP 8)
Error::getCode — Gets the error code
### Description
```
final public Error::getCode(): int
```
Returns the error code.
### Parameters
This function has no parameters.
### Return Values
Returns the error code as int
### Examples
**Example #1 **Error::getCode()** example**
```
<?php
try {
throw new Error("Some error message", 30);
} catch(Error $e) {
echo "The Error code is: " . $e->getCode();
}
?>
```
The above example will output something similar to:
```
The Error code is: 30
```
### See Also
* [Throwable::getCode()](throwable.getcode) - Gets the exception code
php Ev::time Ev::time
========
(PECL ev >= 0.2.0)
Ev::time — Returns the current time in fractional seconds since the epoch
### Description
```
final public static Ev::time(): float
```
Returns the current time in fractional seconds since the epoch. Consider using [Ev::now()](ev.now)
### Parameters
This function has no parameters.
### Return Values
Returns the current time in fractional seconds since the epoch.
### See Also
* [Ev::now()](ev.now) - Returns the time when the last iteration of the default event loop has started
php SolrQuery::setGroupOffset SolrQuery::setGroupOffset
=========================
(PECL solr >= 2.2.0)
SolrQuery::setGroupOffset — Sets the group.offset parameter
### Description
```
public SolrQuery::setGroupOffset(int $value): SolrQuery
```
Sets the group.offset parameter.
### Parameters
`value`
### Return Values
### See Also
* [SolrQuery::setGroup()](solrquery.setgroup) - Enable/Disable result grouping (group parameter)
* [SolrQuery::addGroupField()](solrquery.addgroupfield) - Add a field to be used to group results
* [SolrQuery::addGroupFunction()](solrquery.addgroupfunction) - Allows grouping results based on the unique values of a function query (group.func parameter)
* [SolrQuery::addGroupQuery()](solrquery.addgroupquery) - Allows grouping of documents that match the given query
* [SolrQuery::addGroupSortField()](solrquery.addgroupsortfield) - Add a group sort field (group.sort parameter)
* [SolrQuery::setGroupFacet()](solrquery.setgroupfacet) - Sets group.facet parameter
* [SolrQuery::setGroupLimit()](solrquery.setgrouplimit) - Specifies the number of results to return for each group. The server default value is 1
* [SolrQuery::setGroupMain()](solrquery.setgroupmain) - If true, the result of the first field grouping command is used as the main result list in the response, using group.format=simple
* [SolrQuery::setGroupNGroups()](solrquery.setgroupngroups) - If true, Solr includes the number of groups that have matched the query in the results
* [SolrQuery::setGroupTruncate()](solrquery.setgrouptruncate) - If true, facet counts are based on the most relevant document of each group matching the query
* [SolrQuery::setGroupFormat()](solrquery.setgroupformat) - Sets the group format, result structure (group.format parameter)
* [SolrQuery::setGroupCachePercent()](solrquery.setgroupcachepercent) - Enables caching for result grouping
php SplFileObject::fgets SplFileObject::fgets
====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::fgets — Gets line from file
### Description
```
public SplFileObject::fgets(): string
```
Gets a line from the file.
### Parameters
This function has no parameters.
### Return Values
Returns a string containing the next line from the file, or **`false`** on error.
### Errors/Exceptions
Throws a [RuntimeException](class.runtimeexception) if the file cannot be read.
### Examples
**Example #1 **SplFileObject::fgets()** example**
This example simply outputs the contents of `file.txt` line-by-line.
```
<?php
$file = new SplFileObject("file.txt");
while (!$file->eof()) {
echo $file->fgets();
}
?>
```
### See Also
* [fgets()](function.fgets) - Gets line from file pointer
* [SplFileObject::fgetss()](splfileobject.fgetss) - Gets line from file and strip HTML tags
* [SplFileObject::fgetc()](splfileobject.fgetc) - Gets character from file
* [SplFileObject::current()](splfileobject.current) - Retrieve current line of file
php strnatcmp strnatcmp
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
strnatcmp — String comparisons using a "natural order" algorithm
### Description
```
strnatcmp(string $string1, string $string2): int
```
This function implements a comparison algorithm that orders alphanumeric strings in the way a human being would, this is described as a "natural ordering". Note that this comparison is case sensitive.
### Parameters
`string1`
The first string.
`string2`
The second string.
### Return Values
Similar to other string comparison functions, this one returns `-1` if `string1` is less than `string2`; `1` if `string1` is greater than `string2`, and `0` if they are equal.
### Changelog
| Version | Description |
| --- | --- |
| 8.2.0 | This function now returns `-1` or `1`, where it previously returned a negative or positive number. |
### Examples
An example of the difference between this algorithm and the regular computer string sorting algorithms (used in [strcmp()](function.strcmp)) can be seen below:
```
<?php
$arr1 = $arr2 = array("img12.png", "img10.png", "img2.png", "img1.png");
echo "Standard string comparison\n";
usort($arr1, "strcmp");
print_r($arr1);
echo "\nNatural order string comparison\n";
usort($arr2, "strnatcmp");
print_r($arr2);
?>
```
The above example will output:
```
Standard string comparison
Array
(
[0] => img1.png
[1] => img10.png
[2] => img12.png
[3] => img2.png
)
Natural order string comparison
Array
(
[0] => img1.png
[1] => img2.png
[2] => img10.png
[3] => img12.png
)
```
For more information see: Martin Pool's [» Natural Order String Comparison](https://github.com/sourcefrog/natsort) page. ### See Also
* [preg\_match()](function.preg-match) - Perform a regular expression match
* [strcasecmp()](function.strcasecmp) - Binary safe case-insensitive string comparison
* [substr()](function.substr) - Return part of a string
* [stristr()](function.stristr) - Case-insensitive strstr
* [strcmp()](function.strcmp) - Binary safe string comparison
* [strncmp()](function.strncmp) - Binary safe string comparison of the first n characters
* [strncasecmp()](function.strncasecmp) - Binary safe case-insensitive string comparison of the first n characters
* [strnatcasecmp()](function.strnatcasecmp) - Case insensitive string comparisons using a "natural order" algorithm
* [strstr()](function.strstr) - Find the first occurrence of a string
* [natsort()](function.natsort) - Sort an array using a "natural order" algorithm
* [natcasesort()](function.natcasesort) - Sort an array using a case insensitive "natural order" algorithm
php IntlCalendar::getNow IntlCalendar::getNow
====================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::getNow — Get number representing the current time
### Description
Object-oriented style
```
public static IntlCalendar::getNow(): float
```
Procedural style
```
intlcal_get_now(): float
```
The number of milliseconds that have passed since the reference date. This number is derived from the system time.
### Parameters
This function has no parameters.
### Return Values
A float representing a number of milliseconds since the epoch, not counting leap seconds.
### Examples
**Example #1 **IntlCalendar::getNow()****
```
<?php
$formatter = IntlDateFormatter::create('es_ES',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'Europe/Madrid');
$val = IntlCalendar::getNow();
var_dump($val);
echo $formatter->format(IntlCalendar::getNow() / 1000.), "\n";
```
The above example will output:
```
float(1371425814666)
lunes, 17 de junio de 2013 01:36:54 Hora de verano de Europa central
```
php DirectoryIterator::isDir DirectoryIterator::isDir
========================
(PHP 5, PHP 7, PHP 8)
DirectoryIterator::isDir — Determine if current DirectoryIterator item is a directory
### Description
```
public DirectoryIterator::isDir(): bool
```
Determines if the current [DirectoryIterator](class.directoryiterator) item is a directory.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if it is a directory, otherwise **`false`**
### Examples
**Example #1 **DirectoryIterator::isDir()** example**
This example lists the directories within the directory of the current script.
```
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
foreach ($iterator as $fileinfo) {
if ($fileinfo->isDir()) {
echo $fileinfo->getFilename() . "\n";
}
}
?>
```
The above example will output something similar to:
```
.
..
apples
bananas
pears
```
### See Also
* [DirectoryIterator::getType()](directoryiterator.gettype) - Determine the type of the current DirectoryIterator item
* [DirectoryIterator::isDot()](directoryiterator.isdot) - Determine if current DirectoryIterator item is '.' or '..'
* [DirectoryIterator::isFile()](directoryiterator.isfile) - Determine if current DirectoryIterator item is a regular file
* [DirectoryIterator::isLink()](directoryiterator.islink) - Determine if current DirectoryIterator item is a symbolic link
| programming_docs |
php Ds\Set::count Ds\Set::count
=============
(PECL ds >= 1.0.0)
Ds\Set::count — Returns the number of values in the set
See [Countable::count()](countable.count)
php The InfiniteIterator class
The InfiniteIterator class
==========================
Introduction
------------
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
The **InfiniteIterator** allows one to infinitely iterate over an iterator without having to manually rewind the iterator upon reaching its end.
Class synopsis
--------------
class **InfiniteIterator** extends [IteratorIterator](class.iteratoriterator) { /\* Methods \*/ public [\_\_construct](infiniteiterator.construct)([Iterator](class.iterator) `$iterator`)
```
public next(): void
```
/\* Inherited methods \*/
```
public IteratorIterator::current(): mixed
```
```
public IteratorIterator::getInnerIterator(): ?Iterator
```
```
public IteratorIterator::key(): mixed
```
```
public IteratorIterator::next(): void
```
```
public IteratorIterator::rewind(): void
```
```
public IteratorIterator::valid(): bool
```
} Table of Contents
-----------------
* [InfiniteIterator::\_\_construct](infiniteiterator.construct) — Constructs an InfiniteIterator
* [InfiniteIterator::next](infiniteiterator.next) — Moves the inner Iterator forward or rewinds it
php Yaf_Route_Interface::route Yaf\_Route\_Interface::route
============================
(Yaf >=1.0.0)
Yaf\_Route\_Interface::route — Route a request
### Description
```
abstract public Yaf_Route_Interface::route(Yaf_Request_Abstract $request): bool
```
**Yaf\_Route\_Interface::route()** is the only method that a custom route should implement.
>
> **Note**:
>
>
> since of 2.3.0, there is another method should also be implemented, see [Yaf\_Route\_Interface::assemble()](yaf-route-interface.assemble).
>
>
if this method return **`true`**, then the route process will be end. otherwise, [Yaf\_Router](class.yaf-router) will call next route in the route stack to route request.
This method would set the route result to the parameter request, by calling [Yaf\_Request\_Abstract::setControllerName()](yaf-request-abstract.setcontrollername), [Yaf\_Request\_Abstract::setActionName()](yaf-request-abstract.setactionname) and [Yaf\_Request\_Abstract::setModuleName()](yaf-request-abstract.setmodulename).
This method should also call [Yaf\_Request\_Abstract::setRouted()](yaf-request-abstract.setrouted) to make the request routed at last.
### Parameters
`request`
A [Yaf\_Request\_Abstract](class.yaf-request-abstract) instance.
### Return Values
php IntlBreakIterator::last IntlBreakIterator::last
=======================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlBreakIterator::last — Set the iterator position to index beyond the last character
### Description
```
public IntlBreakIterator::last(): int
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php zookeeper_dispatch zookeeper\_dispatch
===================
(PECL zookeeper >= 0.4.0)
zookeeper\_dispatch — Calls callbacks for pending operations
### Description
```
zookeeper_dispatch(): void
```
The **zookeeper\_dispatch()** function calls the callbacks passed by operations like [Zookeeper::get()](zookeeper.get) or [Zookeeper::exists()](zookeeper.exists).
**Caution** Since version 0.4.0, this function must be called manually to achieve asynchronous operations. If you want that to be done automatically, you also can declare ticks at the beginning of your program.
After PHP 7.1, you can ignore this function. This extension uses EG(vm\_interrupt) to implement async dispatch.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Errors/Exceptions
This method emits PHP warning when callback could not be invoked.
### Examples
**Example #1 **zookeeper\_dispatch()** example #1**
Dispatch callbacks manually.
```
<?php
$client = new Zookeeper();
$client->connect('localhost:2181');
$client->get('/zookeeper', function() {
echo "Callback was called".PHP_EOL;
});
while(true) {
sleep(1);
zookeeper_dispatch();
}
?>
```
**Example #2 **zookeeper\_dispatch()** example #2**
Declare ticks.
```
<?php
declare(ticks=1);
$client = new Zookeeper();
$client->connect('localhost:2181');
$client->get('/zookeeper', function() {
echo "Callback was called".PHP_EOL;
});
while(true) {
sleep(1);
}
?>
```
### See Also
* [Zookeeper::addAuth()](zookeeper.addauth) - Specify application credentials
* [Zookeeper::connect()](zookeeper.connect) - Create a handle to used communicate with zookeeper
* [Zookeeper::\_\_construct()](zookeeper.construct) - Create a handle to used communicate with zookeeper
* [Zookeeper::exists()](zookeeper.exists) - Checks the existence of a node in zookeeper synchronously
* [Zookeeper::get()](zookeeper.get) - Gets the data associated with a node synchronously
* [Zookeeper::getChildren()](zookeeper.getchildren) - Lists the children of a node synchronously
* [Zookeeper::setWatcher()](zookeeper.setwatcher) - Set a watcher function
php The EventHttpConnection class
The EventHttpConnection class
=============================
Introduction
------------
(PECL event >= 1.4.0-beta)
Represents an HTTP connection.
Class synopsis
--------------
class **EventHttpConnection** { /\* Methods \*/
```
public __construct(
EventBase $base ,
EventDnsBase $dns_base ,
string $address ,
int $port ,
EventSslContext $ctx = null
)
```
```
public getBase(): EventBase
```
```
public getPeer( string &$address , int &$port ): void
```
```
public makeRequest( EventHttpRequest $req , int $type , string $uri ): bool
```
```
public setCloseCallback( callable $callback , mixed $data = ?): void
```
```
public setLocalAddress( string $address ): void
```
```
public setLocalPort( int $port ): void
```
```
public setMaxBodySize( string $max_size ): void
```
```
public setMaxHeadersSize( string $max_size ): void
```
```
public setRetries( int $retries ): void
```
```
public setTimeout( int $timeout ): void
```
} Table of Contents
-----------------
* [EventHttpConnection::\_\_construct](eventhttpconnection.construct) — Constructs EventHttpConnection object
* [EventHttpConnection::getBase](eventhttpconnection.getbase) — Returns event base associated with the connection
* [EventHttpConnection::getPeer](eventhttpconnection.getpeer) — Gets the remote address and port associated with the connection
* [EventHttpConnection::makeRequest](eventhttpconnection.makerequest) — Makes an HTTP request over the specified connection
* [EventHttpConnection::setCloseCallback](eventhttpconnection.setclosecallback) — Set callback for connection close
* [EventHttpConnection::setLocalAddress](eventhttpconnection.setlocaladdress) — Sets the IP address from which HTTP connections are made
* [EventHttpConnection::setLocalPort](eventhttpconnection.setlocalport) — Sets the local port from which connections are made
* [EventHttpConnection::setMaxBodySize](eventhttpconnection.setmaxbodysize) — Sets maximum body size for the connection
* [EventHttpConnection::setMaxHeadersSize](eventhttpconnection.setmaxheaderssize) — Sets maximum header size
* [EventHttpConnection::setRetries](eventhttpconnection.setretries) — Sets the retry limit for the connection
* [EventHttpConnection::setTimeout](eventhttpconnection.settimeout) — Sets the timeout for the connection
php radius_put_int radius\_put\_int
================
(PECL radius >= 1.1.0)
radius\_put\_int — Attaches an integer attribute
### Description
```
radius_put_int(
resource $radius_handle,
int $type,
int $value,
int $options = 0,
int $tag = ?
): bool
```
Attaches an integer attribute to the current RADIUS request.
>
> **Note**:
>
>
> A request must be created via [radius\_create\_request()](function.radius-create-request) before this function can be called.
>
>
>
### Parameters
`radius_handle`
The RADIUS resource.
`type`
The attribute type.
`value`
The attribute value.
`options`
A bitmask of the attribute options. The available options include [**`RADIUS_OPTION_TAGGED`**](https://www.php.net/manual/en/radius.constants.options.php#constant.radius-option-tagged) and [**`RADIUS_OPTION_SALT`**](https://www.php.net/manual/en/radius.constants.options.php#constant.radius-option-salt).
`tag`
The attribute tag. This parameter is ignored unless the [**`RADIUS_OPTION_TAGGED`**](https://www.php.net/manual/en/radius.constants.options.php#constant.radius-option-tagged) option is set.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| PECL radius 1.3.0 | The `options` and `tag` parameters were added. |
### Examples
**Example #1 **radius\_put\_int()** example**
```
<?php
if (!radius_put_int($res, RAD_FRAMED_PROTOCOL, RAD_PPP)) {
echo 'RadiusError:' . radius_strerror($res). "\n<br />";
exit;
}
?>
```
### See Also
* [radius\_put\_string()](function.radius-put-string) - Attaches a string attribute
* [radius\_put\_vendor\_int()](function.radius-put-vendor-int) - Attaches a vendor specific integer attribute
* [radius\_put\_vendor\_string()](function.radius-put-vendor-string) - Attaches a vendor specific string attribute
php hash_update_stream hash\_update\_stream
====================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL hash >= 1.1)
hash\_update\_stream — Pump data into an active hashing context from an open stream
### Description
```
hash_update_stream(HashContext $context, resource $stream, int $length = -1): int
```
### Parameters
`context`
Hashing context returned by [hash\_init()](function.hash-init).
`stream`
Open file handle as returned by any stream creation function.
`length`
Maximum number of characters to copy from `stream` into the hashing context.
### Return Values
Actual number of bytes added to the hashing context from `stream`.
### Changelog
| Version | Description |
| --- | --- |
| 7.2.0 | Accept [HashContext](class.hashcontext) instead of resource. |
### Examples
**Example #1 **hash\_update\_stream()** example**
```
<?php
$fp = tmpfile();
fwrite($fp, 'The quick brown fox jumped over the lazy dog.');
rewind($fp);
$ctx = hash_init('md5');
hash_update_stream($ctx, $fp);
echo hash_final($ctx);
?>
```
The above example will output:
```
5c6ffbdd40d9556b73a21e63c3e0e904
```
### See Also
* [hash\_init()](function.hash-init) - Initialize an incremental hashing context
* [hash\_update()](function.hash-update) - Pump data into an active hashing context
* [hash\_final()](function.hash-final) - Finalize an incremental hash and return resulting digest
* [hash()](function.hash) - Generate a hash value (message digest)
* [hash\_file()](function.hash-file) - Generate a hash value using the contents of a given file
php apcu_exists apcu\_exists
============
(PECL apcu >= 4.0.0)
apcu\_exists — Checks if entry exists
### Description
```
apcu_exists(mixed $keys): mixed
```
Checks if one or more APCu entries exist.
### Parameters
`keys`
A string, or an array of strings, that contain keys.
### Return Values
Returns **`true`** if the key exists, otherwise **`false`** Or if an array was passed to `keys`, then an array is returned that contains all existing keys, or an empty array if none exist.
### Examples
**Example #1 **apcu\_exists()** example**
```
<?php
$fruit = 'apple';
$veggie = 'carrot';
apcu_store('foo', $fruit);
apcu_store('bar', $veggie);
if (apcu_exists('foo')) {
echo "Foo exists: ";
echo apcu_fetch('foo');
} else {
echo "Foo does not exist";
}
echo PHP_EOL;
if (apcu_exists('baz')) {
echo "Baz exists.";
} else {
echo "Baz does not exist";
}
echo PHP_EOL;
$ret = apcu_exists(array('foo', 'donotexist', 'bar'));
var_dump($ret);
?>
```
The above example will output something similar to:
```
Foo exists: apple
Baz does not exist
array(2) {
["foo"]=>
bool(true)
["bar"]=>
bool(true)
}
```
### See Also
* [apcu\_cache\_info()](function.apcu-cache-info) - Retrieves cached information from APCu's data store
* [apcu\_fetch()](function.apcu-fetch) - Fetch a stored variable from the cache
php DOMNode::cloneNode DOMNode::cloneNode
==================
(PHP 5, PHP 7, PHP 8)
DOMNode::cloneNode — Clones a node
### Description
```
public DOMNode::cloneNode(bool $deep = false): DOMNode|false
```
Creates a copy of the node.
### Parameters
`deep`
Indicates whether to copy all descendant nodes. This parameter is defaulted to **`false`**.
### Return Values
The cloned node.
php The ZookeeperNoNodeException class
The ZookeeperNoNodeException class
==================================
Introduction
------------
(PECL zookeeper >= 0.3.0)
The ZooKeeper exception (when node does not exist) handling class.
Class synopsis
--------------
class **ZookeeperNoNodeException** extends [ZookeeperException](class.zookeeperexception) { /\* Inherited properties \*/ protected string [$message](class.exception#exception.props.message) = "";
private string [$string](class.exception#exception.props.string) = "";
protected int [$code](class.exception#exception.props.code);
protected string [$file](class.exception#exception.props.file) = "";
protected int [$line](class.exception#exception.props.line);
private array [$trace](class.exception#exception.props.trace) = [];
private ?[Throwable](class.throwable) [$previous](class.exception#exception.props.previous) = null; /\* Inherited methods \*/
```
final public Exception::getMessage(): string
```
```
final public Exception::getPrevious(): ?Throwable
```
```
final public Exception::getCode(): int
```
```
final public Exception::getFile(): string
```
```
final public Exception::getLine(): int
```
```
final public Exception::getTrace(): array
```
```
final public Exception::getTraceAsString(): string
```
```
public Exception::__toString(): string
```
```
private Exception::__clone(): void
```
}
php ldap_free_result ldap\_free\_result
==================
(PHP 4, PHP 5, PHP 7, PHP 8)
ldap\_free\_result — Free result memory
### Description
```
ldap_free_result(LDAP\Result $result): bool
```
Frees up the memory allocated internally to store the result. All result memory will be automatically freed when the script terminates.
Typically all the memory allocated for the LDAP result gets freed at the end of the script. In case the script is making successive searches which return large result sets, **ldap\_free\_result()** could be called to keep the runtime memory usage by the script low.
### Parameters
`result`
An [LDAP\Result](class.ldap-result) instance, returned by [ldap\_list()](function.ldap-list) or [ldap\_search()](function.ldap-search).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `result` parameter expects an [LDAP\Result](class.ldap-result) instance now; previously, a [resource](language.types.resource) was expected. |
php Directory::read Directory::read
===============
(PHP 4, PHP 5, PHP 7, PHP 8)
Directory::read — Read entry from directory handle
### Description
```
public Directory::read(): string|false
```
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | No parameter is accepted. Previously, a directory handle could be passed as argument. |
php eio_statvfs eio\_statvfs
============
(PECL eio >= 0.0.1dev)
eio\_statvfs — Get file system statistics
### Description
```
eio_statvfs(
string $path,
int $pri,
callable $callback,
mixed $data = ?
): resource
```
**eio\_statvfs()** returns file system statistics information in `result` argument of `callback`
### Parameters
`path`
Pathname of any file within the mounted file system
`pri`
The request priority: **`EIO_PRI_DEFAULT`**, **`EIO_PRI_MIN`**, **`EIO_PRI_MAX`**, or **`null`**. If **`null`** passed, `pri` internally is set to **`EIO_PRI_DEFAULT`**.
`callback`
`callback` function is called when the request is done. It should match the following prototype:
```
void callback(mixed $data, int $result[, resource $req]);
```
`data`
is custom data passed to the request.
`result`
request-specific result value; basically, the value returned by corresponding system call.
`req`
is optional request resource which can be used with functions like [eio\_get\_last\_error()](function.eio-get-last-error)
`data`
Arbitrary variable passed to `callback`.
### Return Values
**eio\_statvfs()** returns request resource on success, or **`false`** on failure. On success assigns `result` argument of `callback` to an array.
### Examples
**Example #1 **eio\_statvfs()** example**
```
<?php
$tmp_filename = '/tmp/eio-file.tmp';
touch($tmp_filename);
function my_statvfs_callback($data, $result) {
var_dump($data);
var_dump($result);
@unlink($data);
}
eio_statvfs($tmp_filename, EIO_PRI_DEFAULT, "my_statvfs_callback", $tmp_filename);
eio_event_loop();
?>
```
The above example will output something similar to:
```
string(17) "/tmp/eio-file.tmp"
array(11) {
["f_bsize"]=>
int(4096)
["f_frsize"]=>
int(4096)
["f_blocks"]=>
int(262144)
["f_bfree"]=>
int(262111)
["f_bavail"]=>
int(262111)
["f_files"]=>
int(1540815)
["f_ffree"]=>
int(1540743)
["f_favail"]=>
int(1540743)
["f_fsid"]=>
int(0)
["f_flag"]=>
int(4102)
["f_namemax"]=>
int(255)
}
```
php GearmanClient::addTaskHigh GearmanClient::addTaskHigh
==========================
(PECL gearman >= 0.5.0)
GearmanClient::addTaskHigh — Add a high priority task to run in parallel
### Description
```
public GearmanClient::addTaskHigh(
string $function_name,
string $workload,
mixed &$context = ?,
string $unique = ?
): GearmanTask
```
Adds a high priority task to be run in parallel with other tasks. Call this method for all the high priority tasks to be run in parallel, then call [GearmanClient::runTasks()](gearmanclient.runtasks) to perform the work. Tasks with a high priority will be selected from the queue before those of normal or low priority.
### Parameters
`function_name`
A registered function the worker is to execute
`workload`
Serialized data to be processed
`context`
Application context to associate with a task
`unique`
A unique ID used to identify a particular task
### Return Values
A [GearmanTask](class.gearmantask) object or **`false`** if the task could not be added.
### Examples
**Example #1 A high priority task along with two normal tasks**
A high priority task is included among two other tasks. A single worker is available, so that tasks are run one at a time, with the high priority task run first.
```
<?php
# create the gearman client
$gmc= new GearmanClient();
# add the default job server
$gmc->addServer();
# set the callback for when the job is complete
$gmc->setCompleteCallback("reverse_complete");
# add tasks, one of which is high priority
$task= $gmc->addTask("reverse", "Hello World!", null, "1");
$task= $gmc->addTaskHigh("reverse", "!dlroW olleH", null, "2");
$task= $gmc->addTask("reverse", "Hello World!", null, "3");
if (! $gmc->runTasks())
{
echo "ERROR " . $gmc->error() . "\n";
exit;
}
echo "DONE\n";
function reverse_complete($task)
{
echo "COMPLETE: " . $task->unique() . ", " . $task->data() . "\n";
}
?>
```
The above example will output something similar to:
```
COMPLETE: 2, Hello World!
COMPLETE: 3, !dlroW olleH
COMPLETE: 1, !dlroW olleH
DONE
```
### See Also
* [GearmanClient::addTask()](gearmanclient.addtask) - Add a task to be run in parallel
* [GearmanClient::addTaskLow()](gearmanclient.addtasklow) - Add a low priority task to run in parallel
* [GearmanClient::addTaskBackground()](gearmanclient.addtaskbackground) - Add a background task to be run in parallel
* [GearmanClient::addTaskHighBackground()](gearmanclient.addtaskhighbackground) - Add a high priority background task to be run in parallel
* [GearmanClient::addTaskLowBackground()](gearmanclient.addtasklowbackground) - Add a low priority background task to be run in parallel
* [GearmanClient::runTasks()](gearmanclient.runtasks) - Run a list of tasks in parallel
| programming_docs |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.