code
stringlengths 2.5k
150k
| kind
stringclasses 1
value |
---|---|
php DirectoryIterator::valid DirectoryIterator::valid
========================
(PHP 5, PHP 7, PHP 8)
DirectoryIterator::valid — Check whether current DirectoryIterator position is a valid file
### Description
```
public DirectoryIterator::valid(): bool
```
Check whether current [DirectoryIterator](class.directoryiterator) position is a valid file.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the position is valid, otherwise **`false`**
### Examples
**Example #1 A **DirectoryIterator::valid()** example**
```
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
// Loop to end of iterator
while($iterator->valid()) {
$iterator->next();
}
$iterator->valid(); // FALSE
$iterator->rewind();
$iterator->valid(); // TRUE
?>
```
### See Also
* [DirectoryIterator::current()](directoryiterator.current) - Return the current DirectoryIterator item
* [DirectoryIterator::key()](directoryiterator.key) - Return the key for the current DirectoryIterator item
* [DirectoryIterator::next()](directoryiterator.next) - Move forward to next DirectoryIterator item
* [DirectoryIterator::rewind()](directoryiterator.rewind) - Rewind the DirectoryIterator back to the start
* [Iterator::valid()](iterator.valid) - Checks if current position is valid
php gmp_mul gmp\_mul
========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_mul — Multiply numbers
### Description
```
gmp_mul(GMP|int|string $num1, GMP|int|string $num2): GMP
```
Multiplies `num1` by `num2` and returns the result.
### Parameters
`num1`
A number that will be multiplied by `num2`.
A [GMP](class.gmp) object, an int or a numeric string.
`num2`
A number that will be multiplied by `num1`.
A [GMP](class.gmp) object, an int or a numeric string.
### Return Values
A [GMP](class.gmp) object.
### Examples
**Example #1 **gmp\_mul()** example**
```
<?php
$mul = gmp_mul("12345678", "2000");
echo gmp_strval($mul) . "\n";
?>
```
The above example will output:
```
24691356000
```
php SolrParams::setParam SolrParams::setParam
====================
(PECL solr >= 0.9.2)
SolrParams::setParam — Sets the parameter to the specified value
### Description
```
public SolrParams::setParam(string $name, string $value): SolrParams
```
Sets the query parameter to the specified value. This is used for parameters that can only be specified once. Subsequent calls with the same parameter name will override the existing value
### Parameters
`name`
Name of the parameter
`value`
Value of the parameter
### Return Values
Returns a SolrParam object on success and **`false`** on value.
### Examples
**Example #1 **SolrParams::setParam()** example**
```
<?php
$param = new SolrParams();
$param->setParam('q', 'solr')->setParam('rows', 2);
?>
```
The above example will output something similar to:
php Imagick::setImageColorspace Imagick::setImageColorspace
===========================
(PECL imagick 2, PECL imagick 3)
Imagick::setImageColorspace — Sets the image colorspace
### Description
```
public Imagick::setImageColorspace(int $colorspace): bool
```
Sets the image colorspace. This method should be used when creating new images. To change the colorspace of an existing image, you should use [Imagick::transformImageColorspace()](imagick.transformimagecolorspace).
### Parameters
`colorspace`
One of the [COLORSPACE constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.colorspace)
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
php pg_connection_status pg\_connection\_status
======================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg\_connection\_status — Get connection status
### Description
```
pg_connection_status(PgSql\Connection $connection): int
```
**pg\_connection\_status()** returns the status of the specified `connection`.
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance.
### Return Values
**`PGSQL_CONNECTION_OK`** or **`PGSQL_CONNECTION_BAD`**.
### 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\_status()** example**
```
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$stat = pg_connection_status($dbconn);
if ($stat === PGSQL_CONNECTION_OK) {
echo 'Connection status ok';
} else {
echo 'Connection status bad';
}
?>
```
### See Also
* [pg\_connection\_busy()](function.pg-connection-busy) - Get connection is busy or not
php SolrClient::getDebug SolrClient::getDebug
====================
(PECL solr >= 0.9.7)
SolrClient::getDebug — Returns the debug data for the last connection attempt
### Description
```
public SolrClient::getDebug(): string
```
Returns the debug data for the last connection attempt
### Parameters
This function has no parameters.
### Return Values
Returns a string on success and null if there is nothing to return.
php oauth_urlencode oauth\_urlencode
================
(PECL OAuth >=0.99.2)
oauth\_urlencode — Encode a URI to RFC 3986
### Description
```
oauth_urlencode(string $uri): string
```
Encodes a URI to [» RFC 3986](http://www.faqs.org/rfcs/rfc3986).
### Parameters
`uri`
URI to encode.
### Return Values
Returns an [» RFC 3986](http://www.faqs.org/rfcs/rfc3986) encoded string.
php SolrQuery::getMltMaxNumTokens SolrQuery::getMltMaxNumTokens
=============================
(PECL solr >= 0.9.2)
SolrQuery::getMltMaxNumTokens — Returns the maximum number of tokens to parse in each document field that is not stored with TermVector support
### Description
```
public SolrQuery::getMltMaxNumTokens(): int
```
Returns the maximum number of tokens to parse in each document field that is not stored with TermVector support
### Parameters
This function has no parameters.
### Return Values
Returns an integer on success and **`null`** if not set.
php Componere\Value::__construct Componere\Value::\_\_construct
==============================
(Componere 2 >= 2.1.0)
Componere\Value::\_\_construct — Value Construction
### Description
public **Componere\Value::\_\_construct**( `$default` = ?) ### Parameters
`default`
### Exceptions
**Warning** Shall throw [InvalidArgumentException](class.invalidargumentexception) if `default` does not have a suitable value
php libxml_set_external_entity_loader libxml\_set\_external\_entity\_loader
=====================================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
libxml\_set\_external\_entity\_loader — Changes the default external entity loader
### Description
```
libxml_set_external_entity_loader(?callable $resolver_function): bool
```
Changes the default external entity loader. This can be used to suppress the expansion of arbitrary external entities to avoid XXE attacks, even when **`LIBXML_NOENT`** has been set for the respective operation, and is usually preferable over calling [libxml\_disable\_entity\_loader()](function.libxml-disable-entity-loader).
### Parameters
`resolver_function`
A [callable](language.types.callable) with the following signature:
```
resolver(string $public_id, string $system_id, array $context): resource|string|null
```
`public_id`
The public ID. `system_id`
The system ID. `context`
An array with the four elements `"directory"`, `"intSubName"`, `"extSubURI"` and `"extSubSystem"`. This callable should return a [resource](language.types.resource), a string from which a resource can be opened. If **`null`** is returned, the entity reference resolution will fail. ### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **libxml\_set\_external\_entity\_loader()** example**
```
<?php
$xml = <<<XML
<!DOCTYPE foo PUBLIC "-//FOO/BAR" "http://example.com/foobar">
<foo>bar</foo>
XML;
$dtd = <<<DTD
<!ELEMENT foo (#PCDATA)>
DTD;
libxml_set_external_entity_loader(
function ($public, $system, $context) use($dtd) {
var_dump($public);
var_dump($system);
var_dump($context);
$f = fopen("php://temp", "r+");
fwrite($f, $dtd);
rewind($f);
return $f;
}
);
$dd = new DOMDocument;
$r = $dd->loadXML($xml);
var_dump($dd->validate());
?>
```
The above example will output:
```
string(10) "-//FOO/BAR"
string(25) "http://example.com/foobar"
array(4) {
["directory"] => NULL
["intSubName"] => NULL
["extSubURI"] => NULL
["extSubSystem"] => NULL
}
bool(true)
```
### See Also
* [libxml\_disable\_entity\_loader()](function.libxml-disable-entity-loader) - Disable the ability to load external entities
* [libxml\_get\_external\_entity\_loader()](function.libxml-get-external-entity-loader) - Get the current external entity loader
php stream_get_filters stream\_get\_filters
====================
(PHP 5, PHP 7, PHP 8)
stream\_get\_filters — Retrieve list of registered filters
### Description
```
stream_get_filters(): array
```
Retrieve the list of registered filters on the running system.
### Parameters
This function has no parameters.
### Return Values
Returns an indexed array containing the name of all stream filters available.
### Examples
**Example #1 Using **stream\_get\_filters()****
```
<?php
$streamlist = stream_get_filters();
print_r($streamlist);
?>
```
The above example will output something similar to:
```
Array (
[0] => string.rot13
[1] => string.toupper
[2] => string.tolower
[3] => string.base64
[4] => string.quoted-printable
)
```
### See Also
* [stream\_filter\_register()](function.stream-filter-register) - Register a user defined stream filter
* [stream\_get\_wrappers()](function.stream-get-wrappers) - Retrieve list of registered streams
php Gmagick::setimagebackgroundcolor Gmagick::setimagebackgroundcolor
================================
(PECL gmagick >= Unknown)
Gmagick::setimagebackgroundcolor — Sets the image background color
### Description
```
public Gmagick::setimagebackgroundcolor(GmagickPixel $color): Gmagick
```
Sets the image background color.
### Parameters
`color`
The background pixel wand.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php eio_unlink eio\_unlink
===========
(PECL eio >= 0.0.1dev)
eio\_unlink — Delete a name and possibly the file it refers to
### Description
```
eio_unlink(
string $path,
int $pri = EIO_PRI_DEFAULT,
callable $callback = NULL,
mixed $data = NULL
): resource
```
**eio\_unlink()** deletes a name from the file system.
### Parameters
`path`
Path to file
`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\_unlink()** returns request resource on success, or **`false`** on failure.
php runkit7_constant_remove runkit7\_constant\_remove
=========================
(PECL runkit7 >= Unknown)
runkit7\_constant\_remove — Remove/Delete an already defined constant
### Description
```
runkit7_constant_remove(string $constant_name): bool
```
### Parameters
`constant_name`
Name of the constant to remove. Either the name of a global constant, or `classname::constname` indicating a class constant.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [define()](function.define) - Defines a named constant
* [runkit7\_constant\_add()](function.runkit7-constant-add) - Similar to define(), but allows defining in class definitions as well
* [runkit7\_constant\_redefine()](function.runkit7-constant-redefine) - Redefine an already defined constant
php ibase_param_info ibase\_param\_info
==================
(PHP 5, PHP 7 < 7.4.0)
ibase\_param\_info — Return information about a parameter in a prepared query
### Description
```
ibase_param_info(resource $query, int $param_number): array
```
Returns an array with information about a parameter after a query has been prepared.
### Parameters
`query`
An InterBase prepared query handle.
`param_number`
Parameter offset.
### Return Values
Returns an array with the following keys: `name`, `alias`, `relation`, `length` and `type`.
### See Also
* [ibase\_field\_info()](function.ibase-field-info) - Get information about a field
* [ibase\_num\_params()](function.ibase-num-params) - Return the number of parameters in a prepared query
php ResourceBundle::create ResourceBundle::create
======================
resourcebundle\_create
======================
ResourceBundle::\_\_construct
=============================
(PHP 5 >= 5.3.2, PHP 7, PHP 8, PECL intl >= 2.0.0)
ResourceBundle::create -- resourcebundle\_create -- ResourceBundle::\_\_construct — Create a resource bundle
### Description
Object-oriented style (method)
```
public static ResourceBundle::create(?string $locale, ?string $bundle, bool $fallback = true): ?ResourceBundle
```
Procedural style
```
resourcebundle_create(?string $locale, ?string $bundle, bool $fallback = true): ?ResourceBundle
```
Object-oriented style (constructor):
public **ResourceBundle::\_\_construct**(?string `$locale`, ?string `$bundle`, bool `$fallback` = **`true`**) Creates a resource bundle.
### Parameters
`locale`
Locale for which the resources should be loaded (locale name, e.g. en\_CA).
`bundle`
The directory where the data is stored or the name of the .dat file.
`fallback`
Whether locale should match exactly or fallback to parent locale is allowed.
### Return Values
Returns [ResourceBundle](class.resourcebundle) object or **`null`** on error.
### Examples
**Example #1 **resourcebundle\_create()** example**
```
<?php
$r = resourcebundle_create( 'es', "/usr/share/data/myapp");
echo $r['teststring'];
?>
```
**Example #2 **ResourceBundle::create()** example**
```
<?php
$r = ResourceBundle::create( 'es', "/usr/share/data/myapp");
echo $r['teststring'];
?>
```
The above example will output:
```
¡Hola, mundo!
```
### See Also
* [resourcebundle\_get()](resourcebundle.get) - Get data from the bundle
php DOMDocument::saveHTMLFile DOMDocument::saveHTMLFile
=========================
(PHP 5, PHP 7, PHP 8)
DOMDocument::saveHTMLFile — Dumps the internal document into a file using HTML formatting
### Description
```
public DOMDocument::saveHTMLFile(string $filename): int|false
```
Creates an HTML document from the DOM representation. This function is usually called after building a new dom document from scratch as in the example below.
### Parameters
`filename`
The path to the saved HTML document.
### Return Values
Returns the number of bytes written or **`false`** if an error occurred.
### Examples
**Example #1 Saving a HTML tree into a file**
```
<?php
$doc = new DOMDocument('1.0');
// we want a nice output
$doc->formatOutput = true;
$root = $doc->createElement('html');
$root = $doc->appendChild($root);
$head = $doc->createElement('head');
$head = $root->appendChild($head);
$title = $doc->createElement('title');
$title = $head->appendChild($title);
$text = $doc->createTextNode('This is the title');
$text = $title->appendChild($text);
echo 'Wrote: ' . $doc->saveHTMLFile("/tmp/test.html") . ' bytes'; // Wrote: 129 bytes
?>
```
### See Also
* [DOMDocument::saveHTML()](domdocument.savehtml) - Dumps the internal document into a string using HTML formatting
* [DOMDocument::loadHTML()](domdocument.loadhtml) - Load HTML from a string
* [DOMDocument::loadHTMLFile()](domdocument.loadhtmlfile) - Load HTML from a file
php setcookie setcookie
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
setcookie — Send a cookie
### Description
```
setcookie(
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):
```
setcookie(string $name, string $value = "", array $options = []): bool
```
**setcookie()** defines a cookie to be sent along with the rest of the HTTP headers. Like other headers, cookies must be sent *before* any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including `<html>` and `<head>` tags as well as any whitespace.
Once the cookies have been set, they can be accessed on the next page load with the [$\_COOKIE](reserved.variables.cookies) array. Cookie values may also exist in [$\_REQUEST](reserved.variables.request).
### Parameters
[» RFC 6265](http://www.faqs.org/rfcs/rfc6265) provides the normative reference on how each **setcookie()** parameter is interpreted.
`name`
The name of the cookie.
`value`
The value of the cookie. This value is stored on the clients computer; do not store sensitive information. Assuming the `name` is `'cookiename'`, this value is retrieved through [$\_COOKIE['cookiename']](reserved.variables.cookies)
`expires_or_options`
The time the cookie expires. This is a Unix timestamp so is in number of seconds since the epoch. One way to set this is by adding the number of seconds before the cookie should expire to the result of calling [time()](function.time). For instance, `time()+60*60*24*30` will set the cookie to expire in 30 days. Another option is to use the [mktime()](function.mktime) function. If set to `0`, or omitted, the cookie will expire at the end of the session (when the browser closes).
>
> **Note**:
>
>
> You may notice the `expires_or_options` parameter takes on a Unix timestamp, as opposed to the date format `Wdy, DD-Mon-YYYY
> HH:MM:SS GMT`, this is because PHP does this conversion internally.
>
>
`path`
The path on the server in which the cookie will be available on. If set to `'/'`, the cookie will be available within the entire `domain`. If set to `'/foo/'`, the cookie will only be available within the `/foo/` directory and all sub-directories such as `/foo/bar/` of `domain`. The default value is the current directory that the cookie is being set in.
`domain`
The (sub)domain that the cookie is available to. Setting this to a subdomain (such as `'www.example.com'`) will make the cookie available to that subdomain and all other sub-domains of it (i.e. w2.www.example.com). To make the cookie available to the whole domain (including all subdomains of it), simply set the value to the domain name (`'example.com'`, in this case).
Older browsers still implementing the deprecated [» RFC 2109](http://www.faqs.org/rfcs/rfc2109) may require a leading `.` to match all subdomains.
`secure`
Indicates that the cookie should only be transmitted over a secure HTTPS connection from the client. When set to **`true`**, the cookie will only be set if a secure connection exists. On the server-side, it's on the programmer to send this kind of cookie only on secure connection (e.g. with respect to [$\_SERVER["HTTPS"]](reserved.variables.server)).
`httponly`
When **`true`** the cookie will be made accessible only through the HTTP protocol. This means that the cookie won't be accessible by scripting languages, such as JavaScript. It has been suggested that this setting can effectively help to reduce identity theft through XSS attacks (although it is not supported by all browsers), but that claim is often disputed. **`true`** or **`false`**
`options`
An associative array which may have any of the keys `expires`, `path`, `domain`, `secure`, `httponly` and `samesite`. If any other key is present an error of level **`E_WARNING`** is generated. The values have the same meaning as described for the parameters with the same name. The value of the `samesite` element should be either `None`, `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.
### Return Values
If output exists prior to calling this function, **setcookie()** will fail and return **`false`**. If **setcookie()** successfully runs, it will return **`true`**. This does not indicate whether the user accepted the cookie.
### 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. |
### Examples
Some examples follow how to send cookies:
**Example #1 **setcookie()** send example**
```
<?php
$value = 'something from somewhere';
setcookie("TestCookie", $value);
setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */
setcookie("TestCookie", $value, time()+3600, "/~rasmus/", "example.com", 1);
?>
```
Note that the value portion of the cookie will automatically be urlencoded when you send the cookie, and when it is received, it is automatically decoded and assigned to a variable by the same name as the cookie name. If you don't want this, you can use [setrawcookie()](function.setrawcookie) instead. To see the contents of our test cookie in a script, simply use one of the following examples:
```
<?php
// Print an individual cookie
echo $_COOKIE["TestCookie"];
// Another way to debug/test is to view all cookies
print_r($_COOKIE);
?>
```
**Example #2 **setcookie()** delete example**
When deleting a cookie you should assure that the expiration date is in the past, to trigger the removal mechanism in your browser. Examples follow how to delete cookies sent in previous example:
```
<?php
// set the expiration date to one hour ago
setcookie("TestCookie", "", time() - 3600);
setcookie("TestCookie", "", time() - 3600, "/~rasmus/", "example.com", 1);
?>
```
**Example #3 **setcookie()** and arrays**
You may also set array cookies by using array notation in the cookie name. This has the effect of setting as many cookies as you have array elements, but when the cookie is received by your script, the values are all placed in an array with the cookie's name:
```
<?php
// set the cookies
setcookie("cookie[three]", "cookiethree");
setcookie("cookie[two]", "cookietwo");
setcookie("cookie[one]", "cookieone");
// after the page reloads, print them out
if (isset($_COOKIE['cookie'])) {
foreach ($_COOKIE['cookie'] as $name => $value) {
$name = htmlspecialchars($name);
$value = htmlspecialchars($value);
echo "$name : $value <br />\n";
}
}
?>
```
The above example will output:
```
three : cookiethree
two : cookietwo
one : cookieone
```
> **Note**: Using separator characters such as `[` and `]` as part of the cookie name is not compliant to RFC 6265, section 4, but supposed to be supported by user agents according to RFC 6265, section 5.
>
>
### Notes
>
> **Note**:
>
>
> You can use output buffering to send output prior to the call of this function, with the overhead of all of your output to the browser being buffered in the server until you send it. You can do this by calling [ob\_start()](function.ob-start) and [ob\_end\_flush()](function.ob-end-flush) in your script, or setting the `output_buffering` configuration directive on in your php.ini or server configuration files.
>
>
Common Pitfalls:
* Cookies will not become visible until the next loading of a page that the cookie should be visible for. To test if a cookie was successfully set, check for the cookie on a next loading page before the cookie expires. Expire time is set via the `expires_or_options` parameter. A nice way to debug the existence of cookies is by simply calling `print_r($_COOKIE);`.
* Cookies must be deleted with the same parameters as they were set with. If the value argument is an empty string, and all other arguments match a previous call to setcookie, then the cookie with the specified name will be deleted from the remote client. This is internally achieved by setting value to `'deleted'` and expiration time in the past.
* Because setting a cookie with a value of **`false`** will try to delete the cookie, you should not use boolean values. Instead, use *0* for **`false`** and *1* for **`true`**.
* Cookies names can be set as array names and will be available to your PHP scripts as arrays but separate cookies are stored on the user's system. Consider [explode()](function.explode) to set one cookie with multiple names and values. It is not recommended to use [serialize()](function.serialize) for this purpose, because it can result in security holes.
Multiple calls to **setcookie()** are performed in the order called.
### See Also
* [header()](function.header) - Send a raw HTTP header
* [setrawcookie()](function.setrawcookie) - Send a cookie without urlencoding the cookie value
* [cookies section](https://www.php.net/manual/en/features.cookies.php)
* [» RFC 6265](http://www.faqs.org/rfcs/rfc6265)
* [» RFC 2109](http://www.faqs.org/rfcs/rfc2109)
| programming_docs |
php GearmanClient::echo GearmanClient::echo
===================
(PECL gearman >= 0.5.0)
GearmanClient::echo — Send data to all job servers to see if they echo it back [deprecated]
### Description
```
public GearmanClient::echo(string $workload): bool
```
The **GearmanClient::echo()** method is deprecated as of pecl/gearman 1.0.0. Use [GearmanClient::ping()](gearmanclient.ping).
### Parameters
`workload`
Some arbitrary serialized data to be echo back
### Return Values
Returns **`true`** on success or **`false`** on failure.
php ImagickDraw::pathFinish ImagickDraw::pathFinish
=======================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::pathFinish — Terminates the current path
### Description
```
public ImagickDraw::pathFinish(): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Terminates the current path.
### Return Values
No value is returned.
php NumberFormatter::setTextAttribute NumberFormatter::setTextAttribute
=================================
numfmt\_set\_text\_attribute
============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
NumberFormatter::setTextAttribute -- numfmt\_set\_text\_attribute — Set a text attribute
### Description
Object-oriented style
```
public NumberFormatter::setTextAttribute(int $attribute, string $value): bool
```
Procedural style
```
numfmt_set_text_attribute(NumberFormatter $formatter, int $attribute, string $value): bool
```
Set a text attribute associated with the formatter. An example of a text attribute is the suffix for positive numbers. If the formatter does not understand the attribute, **`U_UNSUPPORTED_ERROR`** error is produced. Rule-based formatters only understand **`NumberFormatter::DEFAULT_RULESET`** and **`NumberFormatter::PUBLIC_RULESETS`**.
### Parameters
`formatter`
[NumberFormatter](class.numberformatter) object.
`attribute`
Attribute specifier - one of the [text attribute](class.numberformatter#intl.numberformatter-constants.unumberformattextattribute) constants.
`value`
Text for the attribute value.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **numfmt\_set\_text\_attribute()** example**
```
<?php
$fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL );
echo "Prefix: ".numfmt_get_text_attribute($fmt, NumberFormatter::NEGATIVE_PREFIX)."\n";
echo numfmt_format($fmt, -1234567.891234567890000)."\n";
numfmt_set_text_attribute($fmt, NumberFormatter::NEGATIVE_PREFIX, "MINUS");
echo "Prefix: ".numfmt_get_text_attribute($fmt, NumberFormatter::NEGATIVE_PREFIX)."\n";
echo numfmt_format($fmt, -1234567.891234567890000)."\n";
?>
```
**Example #2 OO example**
```
<?php
$fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL );
echo "Prefix: ".$fmt->getTextAttribute(NumberFormatter::NEGATIVE_PREFIX)."\n";
echo $fmt->format(-1234567.891234567890000)."\n";
$fmt->setTextAttribute(NumberFormatter::NEGATIVE_PREFIX, "MINUS");
echo "Prefix: ".$fmt->getTextAttribute(NumberFormatter::NEGATIVE_PREFIX)."\n";
echo $fmt->format(-1234567.891234567890000)."\n";
?>
```
The above example will output:
```
Prefix: -
-1.234.567,891
Prefix: MINUS
MINUS1.234.567,891
```
### See Also
* [numfmt\_get\_error\_code()](numberformatter.geterrorcode) - Get formatter's last error code
* [numfmt\_get\_text\_attribute()](numberformatter.gettextattribute) - Get a text attribute
* [numfmt\_set\_attribute()](numberformatter.setattribute) - Set an attribute
php SolrQuery::removeMltField SolrQuery::removeMltField
=========================
(PECL solr >= 0.9.2)
SolrQuery::removeMltField — Removes one of the moreLikeThis fields
### Description
```
public SolrQuery::removeMltField(string $field): SolrQuery
```
Removes one of the moreLikeThis fields.
### Parameters
`field`
Name of the field
### Return Values
Returns the current SolrQuery object, if the return value is used.
php Ds\Vector::allocate Ds\Vector::allocate
===================
(PECL ds >= 1.0.0)
Ds\Vector::allocate — Allocates enough memory for a required capacity
### Description
```
public Ds\Vector::allocate(int $capacity): void
```
Ensures that enough memory is allocated for a required capacity. This removes the need to reallocate the internal as values are added.
### Parameters
`capacity`
The number of values for which capacity should be allocated.
>
> **Note**:
>
>
> Capacity will stay the same if this value is less than or equal to the current capacity.
>
>
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Vector::allocate()** example**
```
<?php
$vector = new \Ds\Vector();
var_dump($vector->capacity());
$vector->allocate(100);
var_dump($vector->capacity());
?>
```
The above example will output something similar to:
```
int(10)
int(100)
```
php The SplFixedArray class
The SplFixedArray class
=======================
Introduction
------------
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
The SplFixedArray class provides the main functionalities of array. The main difference between a SplFixedArray and a normal PHP array is that the SplFixedArray must be resized manually and allows only integers within the range as indexes. The advantage is that it uses less memory than a standard array.
Class synopsis
--------------
class **SplFixedArray** implements [IteratorAggregate](class.iteratoraggregate), [ArrayAccess](class.arrayaccess), [Countable](class.countable), [JsonSerializable](class.jsonserializable) { /\* Methods \*/ public [\_\_construct](splfixedarray.construct)(int `$size` = 0)
```
public count(): int
```
```
public current(): mixed
```
```
public static fromArray(array $array, bool $preserveKeys = true): SplFixedArray
```
```
public getSize(): int
```
```
public key(): int
```
```
public next(): void
```
```
public offsetExists(int $index): bool
```
```
public offsetGet(int $index): mixed
```
```
public offsetSet(int $index, mixed $value): void
```
```
public offsetUnset(int $index): void
```
```
public rewind(): void
```
```
public setSize(int $size): bool
```
```
public toArray(): array
```
```
public valid(): bool
```
```
public __wakeup(): void
```
} Changelog
---------
| Version | Description |
| --- | --- |
| 8.1.0 | **SplFixedArray** implements [JsonSerializable](class.jsonserializable) now. |
| 8.0.0 | **SplFixedArray** implements [IteratorAggregate](class.iteratoraggregate) now. Previously, [Iterator](class.iterator) was implemented instead. |
Examples
--------
**Example #1 **SplFixedArray** usage example**
```
<?php
// Initialize the array with a fixed length
$array = new SplFixedArray(5);
$array[1] = 2;
$array[4] = "foo";
var_dump($array[0]); // NULL
var_dump($array[1]); // int(2)
var_dump($array["4"]); // string(3) "foo"
// Increase the size of the array to 10
$array->setSize(10);
$array[9] = "asdf";
// Shrink the array to a size of 2
$array->setSize(2);
// The following lines throw a RuntimeException: Index invalid or out of range
try {
var_dump($array["non-numeric"]);
} catch(RuntimeException $re) {
echo "RuntimeException: ".$re->getMessage()."\n";
}
try {
var_dump($array[-1]);
} catch(RuntimeException $re) {
echo "RuntimeException: ".$re->getMessage()."\n";
}
try {
var_dump($array[5]);
} catch(RuntimeException $re) {
echo "RuntimeException: ".$re->getMessage()."\n";
}
?>
```
The above example will output:
```
NULL
int(2)
string(3) "foo"
RuntimeException: Index invalid or out of range
RuntimeException: Index invalid or out of range
RuntimeException: Index invalid or out of range
```
Table of Contents
-----------------
* [SplFixedArray::\_\_construct](splfixedarray.construct) — Constructs a new fixed array
* [SplFixedArray::count](splfixedarray.count) — Returns the size of the array
* [SplFixedArray::current](splfixedarray.current) — Return current array entry
* [SplFixedArray::fromArray](splfixedarray.fromarray) — Import a PHP array in a SplFixedArray instance
* [SplFixedArray::getSize](splfixedarray.getsize) — Gets the size of the array
* [SplFixedArray::key](splfixedarray.key) — Return current array index
* [SplFixedArray::next](splfixedarray.next) — Move to next entry
* [SplFixedArray::offsetExists](splfixedarray.offsetexists) — Returns whether the requested index exists
* [SplFixedArray::offsetGet](splfixedarray.offsetget) — Returns the value at the specified index
* [SplFixedArray::offsetSet](splfixedarray.offsetset) — Sets a new value at a specified index
* [SplFixedArray::offsetUnset](splfixedarray.offsetunset) — Unsets the value at the specified $index
* [SplFixedArray::rewind](splfixedarray.rewind) — Rewind iterator back to the start
* [SplFixedArray::setSize](splfixedarray.setsize) — Change the size of an array
* [SplFixedArray::toArray](splfixedarray.toarray) — Returns a PHP array from the fixed array
* [SplFixedArray::valid](splfixedarray.valid) — Check whether the array contains more elements
* [SplFixedArray::\_\_wakeup](splfixedarray.wakeup) — Reinitialises the array after being unserialised
php IntlTimeZone::getEquivalentID IntlTimeZone::getEquivalentID
=============================
intltz\_get\_equivalent\_id
===========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlTimeZone::getEquivalentID -- intltz\_get\_equivalent\_id — Get an ID in the equivalency group that includes the given ID
### Description
Object-oriented style (method):
```
public static IntlTimeZone::getEquivalentID(string $timezoneId, int $offset): string|false
```
Procedural style:
```
intltz_get_equivalent_id(string $timezoneId, int $offset): string|false
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`timezoneId`
`offset`
### Return Values
php Gmagick::setimagegreenprimary Gmagick::setimagegreenprimary
=============================
(PECL gmagick >= Unknown)
Gmagick::setimagegreenprimary — Sets the image chromaticity green primary point
### Description
```
public Gmagick::setimagegreenprimary(float $x, float $y): Gmagick
```
Sets the image chromaticity green primary point.
### Parameters
`x`
The chromaticity green primary x-point.
`y`
The chromaticity green primary y-point.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php Imagick::opaquePaintImage Imagick::opaquePaintImage
=========================
(PECL imagick 2 >= 2.3.0, PECL imagick 3)
Imagick::opaquePaintImage — Changes the color value of any pixel that matches target
### Description
```
public Imagick::opaquePaintImage(
mixed $target,
mixed $fill,
float $fuzz,
bool $invert,
int $channel = Imagick::CHANNEL_DEFAULT
): bool
```
Changes any pixel that matches color with the color defined by fill. This method is available if Imagick has been compiled against ImageMagick version 6.3.8 or newer.
### Parameters
`target`
ImagickPixel object or a string containing the color to change
`fill`
The replacement 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.
`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.
php EvLoop::run EvLoop::run
===========
(PECL ev >= 0.2.0)
EvLoop::run — Begin checking for events and calling callbacks for the loop
### Description
```
public EvLoop::run( int $flags = 0 ): void
```
Begin checking for events and calling callbacks for the current event loop. Returns when a callback calls [Ev::stop()](ev.stop) method, or the flags are nonzero(in which case the return value is true) or when there are no active watchers which reference the loop( [EvWatcher::keepalive()](evwatcher.keepalive) is **`true`**), in which case the return value will be **`false`**. The return value can generally be interpreted as *if **`true`**, there is more work left to do* .
### Parameters
`flags` Optional parameter `flags` can be one of the following:
**List for possible values of `flags`** | `flags` | Description |
| --- | --- |
| **`0`** | The default behavior described above |
| **`Ev::RUN_ONCE`** | Block at most one(wait, but don't loop) |
| **`Ev::RUN_NOWAIT`** | Don't block at all(fetch/handle events, but don't wait) |
See [the run flag constants](class.ev#ev.constants.run-flags) .
### Return Values
No value is returned.
### See Also
* [EvLoop::stop()](evloop.stop) - Stops the event loop
* [Ev::run()](ev.run) - Begin checking for events and calling callbacks for the default loop
php Yar_Concurrent_Client::loop Yar\_Concurrent\_Client::loop
=============================
(PECL yar >= 1.0.0)
Yar\_Concurrent\_Client::loop — Send all calls
### Description
```
public static Yar_Concurrent_Client::loop(callable $callback = ?, callable $error_callback = ?): bool
```
Send all registed remote RPC calls.
### Parameters
`callback`
If this callback is set, then Yar will call this callback after all calls are sent and before any response return, with a $callinfo NULL.
Then, if user didn't specify callback when registering concurrent call, this callback will be used to handle response, otherwise, the callback specified while registering will be used.
`error_callback`
If this callback is set, then Yar will call this callback while error occurred.
### Return Values
### Examples
**Example #1 **Yar\_Concurrent\_Client::loop()** example**
```
<?php
function callback($retval, $callinfo) {
if ($callinfo == NULL) {
echo "Now, all requests are sent, and no any response available\n";
} else {
echo "This is a remote call response, the method name is", $callinfo["method"],
". calling sequence is " , $callinfo["sequence"] , "\n";
var_dump($retval);
}
}
function error_callback($type, $error, $callinfo) {
error_log($error);
}
Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters"), "callback");
Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters")); // if the callback is not specificed,
// callback in loop will be used
Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters"), "callback", NULL, array(YAR_OPT_PACKAGER => "json"));
//this server accept json packager
Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters"), "callback", NULL, array(YAR_OPT_TIMEOUT=>1));
//custom timeout
Yar_Concurrent_Client::loop("callback", "error_callback"); //send the requests,
//the error_callback is optional
?>
```
The above example will output something similar to:
```
Now, all requests are sent, and no any response available
This is a remote call response, the method name issome_method. calling sequence is 4
string(11) "some_method"
This is a remote call response, the method name issome_method. calling sequence is 1
string(11) "some_method"
This is a remote call response, the method name issome_method. calling sequence is 2
string(11) "some_method"
This is a remote call response, the method name issome_method. calling sequence is 3
string(11) "some_method"
```
### See Also
* [Yar\_Concurrent\_Client::call()](yar-concurrent-client.call) - Register a concurrent call
* [Yar\_Concurrent\_Client::reset()](yar-concurrent-client.reset) - Clean all registered calls
* [Yar\_Server::\_\_construct()](yar-server.construct) - Register a server
* [Yar\_Server::handle()](yar-server.handle) - Start RPC Server
php ssh2_auth_hostbased_file ssh2\_auth\_hostbased\_file
===========================
(PECL ssh2 >= 0.9.0)
ssh2\_auth\_hostbased\_file — Authenticate using a public hostkey
### Description
```
ssh2_auth_hostbased_file(
resource $session,
string $username,
string $hostname,
string $pubkeyfile,
string $privkeyfile,
string $passphrase = ?,
string $local_username = ?
): bool
```
Authenticate using a public hostkey read from a file.
### Parameters
`session`
An SSH connection link identifier, obtained from a call to [ssh2\_connect()](function.ssh2-connect).
`username`
`hostname`
`pubkeyfile`
`privkeyfile`
`passphrase`
If `privkeyfile` is encrypted (which it should be), the passphrase must be provided.
`local_username`
If `local_username` is omitted, then the value for `username` will be used for it.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Authentication using a public hostkey**
```
<?php
$connection = ssh2_connect('shell.example.com', 22, array('hostkey'=>'ssh-rsa'));
if (ssh2_auth_hostbased_file($connection, 'remoteusername', 'myhost.example.com',
'/usr/local/etc/hostkey_rsa.pub',
'/usr/local/etc/hostkey_rsa', 'secret',
'localusername')) {
echo "Public Key Hostbased Authentication Successful\n";
} else {
die('Public Key Hostbased Authentication Failed');
}
?>
```
### Notes
>
> **Note**:
>
>
> **ssh2\_auth\_hostbased\_file()** requires libssh2 >= 0.7 and PHP/SSH2 >= 0.7
>
>
php mb_ereg_replace_callback mb\_ereg\_replace\_callback
===========================
(PHP 5 >= 5.4.1, PHP 7, PHP 8)
mb\_ereg\_replace\_callback — Perform a regular expression search and replace with multibyte support using a callback
### Description
```
mb_ereg_replace_callback(
string $pattern,
callable $callback,
string $string,
?string $options = null
): string|false|null
```
Scans `string` for matches to `pattern`, then replaces the matched text with the output of `callback` function.
The behavior of this function is almost identical to [mb\_ereg\_replace()](function.mb-ereg-replace), except for the fact that instead of `replacement` parameter, one should specify a `callback`.
### Parameters
`pattern`
The regular expression pattern.
Multibyte characters may be used in `pattern`.
`callback`
A callback that will be called and passed an array of matched elements in the `subject` string. The callback should return the replacement string.
You'll often need the `callback` function for a **mb\_ereg\_replace\_callback()** in just one place. In this case you can use an [anonymous function](functions.anonymous) to declare the callback within the call to **mb\_ereg\_replace\_callback()**. By doing it this way you have all information for the call in one place and do not clutter the function namespace with a callback function's name not used anywhere else.
`string`
The string being checked.
`options`
The search option. See [mb\_regex\_set\_options()](function.mb-regex-set-options) for explanation.
### Return Values
The resultant string on success, or **`false`** on error. If `string` is not valid for the current encoding, **`null`** is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `options` is nullable now. |
| 7.1.0 | The function checks whether `string` is valid for the current encoding. |
### Examples
**Example #1 **mb\_ereg\_replace\_callback()** example**
```
<?php
// this text was used in 2002
// we want to get this up to date for 2003
$text = "April fools day is 04/01/2002\n";
$text.= "Last christmas was 12/24/2001\n";
// the callback function
function next_year($matches)
{
// as usual: $matches[0] is the complete match
// $matches[1] the match for the first subpattern
// enclosed in '(...)' and so on
return $matches[1].($matches[2]+1);
}
echo mb_ereg_replace_callback(
"(\d{2}/\d{2}/)(\d{4})",
"next_year",
$text);
?>
```
The above example will output:
```
April fools day is 04/01/2003
Last christmas was 12/24/2002
```
**Example #2 **mb\_ereg\_replace\_callback()** using anonymous function**
```
<?php
// this text was used in 2002
// we want to get this up to date for 2003
$text = "April fools day is 04/01/2002\n";
$text.= "Last christmas was 12/24/2001\n";
echo mb_ereg_replace_callback(
"(\d{2}/\d{2}/)(\d{4})",
function ($matches) {
return $matches[1].($matches[2]+1);
},
$text);
?>
```
### 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\_replace()](function.mb-ereg-replace) - Replace regular expression with multibyte support
* [Anonymous functions](functions.anonymous)
| programming_docs |
php RarArchive::getEntries RarArchive::getEntries
======================
rar\_list
=========
(PECL rar >= 2.0.0)
RarArchive::getEntries -- rar\_list — Get full list of entries from the RAR archive
### Description
Object-oriented style (method):
```
public RarArchive::getEntries(): array|false
```
Procedural style:
```
rar_list(RarArchive $rarfile): array|false
```
Get entries list (files and directories) from the RAR archive.
>
> **Note**:
>
>
> If the archive has entries with the same name, this method, together with [RarArchive](class.rararchive) `foreach` iteration and array-like access with numeric indexes, are the only ones to access all the entries (i.e., [RarArchive::getEntry()](rararchive.getentry) and the [`rar://` wrapper](https://www.php.net/manual/en/wrappers.rar.php) are insufficient).
>
>
### Parameters
`rarfile`
A [RarArchive](class.rararchive) object, opened with [rar\_open()](rararchive.open).
### Return Values
**rar\_list()** returns array of [RarEntry](class.rarentry) objects 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 Object-oriented style**
```
<?php
$rar_arch = RarArchive::open('solid.rar');
if ($rar_arch === FALSE)
die("Could not open RAR archive.");
$rar_entries = $rar_arch->getEntries();
if ($rar_entries === FALSE)
die("Could not retrieve entries.");
echo "Found " . count($rar_entries) . " entries.\n";
foreach ($rar_entries as $e) {
echo $e;
echo "\n";
}
$rar_arch->close();
?>
```
The above example will output something similar to:
```
Found 2 entries.
RarEntry for file "tese.txt" (23b93a7a)
RarEntry for file "unrardll.txt" (2ed64b6e)
```
**Example #2 Procedural style**
```
<?php
$rar_arch = rar_open('solid.rar');
if ($rar_arch === FALSE)
die("Could not open RAR archive.");
$rar_entries = rar_list($rar_arch);
if ($rar_entries === FALSE)
die("Could retrieve entries.");
echo "Found " . count($rar_entries) . " entries.\n";
foreach ($rar_entries as $e) {
echo $e;
echo "\n";
}
rar_close($rar_arch);
?>
```
### See Also
* [RarArchive::getEntry()](rararchive.getentry) - Get entry object from the RAR archive
* [`rar://` wrapper](https://www.php.net/manual/en/wrappers.rar.php)
php VarnishAdmin::getParams VarnishAdmin::getParams
=======================
(PECL varnish >= 0.4)
VarnishAdmin::getParams — Fetch current varnish instance configuration parameters
### Description
```
public VarnishAdmin::getParams(): array
```
### Parameters
This function has no parameters.
### Return Values
Returns an array with the varnish configuration parameters.
php dns_get_mx dns\_get\_mx
============
(PHP 5, PHP 7, PHP 8)
dns\_get\_mx — Alias of [getmxrr()](function.getmxrr)
### Description
This function is an alias of: [getmxrr()](function.getmxrr).
php Imagick::__toString Imagick::\_\_toString
=====================
(PECL imagick 2, PECL imagick 3)
Imagick::\_\_toString — Returns the image as a string
### Description
```
public Imagick::__toString(): string
```
Returns the current image as string. This will only return a single image; it should not be used for Imagick objects that contain multiple images e.g. an animated GIF or PDF with multiple pages.
### Parameters
This function has no parameters.
### Return Values
Returns the string content on success or an empty string on failure.
### See Also
* [Imagick::getImageBlob()](imagick.getimageblob) - Returns the image sequence as a blob
* [Imagick::getImagesBlob()](imagick.getimagesblob) - Returns all image sequences as a blob
php sodium_crypto_kx_client_session_keys sodium\_crypto\_kx\_client\_session\_keys
=========================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_kx\_client\_session\_keys — Calculate the client-side session keys.
### Description
```
sodium_crypto_kx_client_session_keys(string $client_key_pair, string $server_key): array
```
Calculate the client-side session keys, using the X25519 + BLAKE2b key-exchange method.
### Parameters
`client_key_pair`
A crypto\_kx keypair, such as one generated by [sodium\_crypto\_kx\_keypair()](function.sodium-crypto-kx-keypair).
`server_key`
A crypto\_kx public key.
### Return Values
An array consisting of two strings. The first should be used for receiving data from the server. The second should be used for sending data to the server.
php ArithmeticError
ArithmeticError
===============
Introduction
------------
(PHP 7, PHP 8)
**ArithmeticError** is thrown when an error occurs while performing mathematical operations. These errors include attempting to perform a bitshift by a negative amount, and any call to [intdiv()](function.intdiv) that would result in a value outside the possible bounds of an int.
Class synopsis
--------------
class **ArithmeticError** extends [Error](class.error) { /\* Inherited properties \*/ protected string [$message](class.error#error.props.message) = "";
private string [$string](class.error#error.props.string) = "";
protected int [$code](class.error#error.props.code);
protected string [$file](class.error#error.props.file) = "";
protected int [$line](class.error#error.props.line);
private array [$trace](class.error#error.props.trace) = [];
private ?[Throwable](class.throwable) [$previous](class.error#error.props.previous) = null; /\* Inherited methods \*/
```
final public Error::getMessage(): string
```
```
final public Error::getPrevious(): ?Throwable
```
```
final public Error::getCode(): int
```
```
final public Error::getFile(): string
```
```
final public Error::getLine(): int
```
```
final public Error::getTrace(): array
```
```
final public Error::getTraceAsString(): string
```
```
public Error::__toString(): string
```
```
private Error::__clone(): void
```
}
php ZipArchive::extractTo ZipArchive::extractTo
=====================
(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.1.0)
ZipArchive::extractTo — Extract the archive contents
### Description
```
public ZipArchive::extractTo(string $pathto, array|string|null $files = null): bool
```
Extract the complete archive or the given files to the specified destination.
**Warning** The default permissions for extracted files and directories give the widest possible access. This can be restricted by setting the current umask, which can be changed using [umask()](function.umask).
### Parameters
`pathto`
Location where to extract the files.
`files`
The entries to extract. It accepts either a single entry name or an array of names.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Extract all entries**
```
<?php
$zip = new ZipArchive;
if ($zip->open('test.zip') === TRUE) {
$zip->extractTo('/my/destination/dir/');
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
```
**Example #2 Extract two entries**
```
<?php
$zip = new ZipArchive;
$res = $zip->open('test_im.zip');
if ($res === TRUE) {
$zip->extractTo('/my/destination/dir/', array('pear_item.gif', 'testfromfile.php'));
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
```
### Notes
>
> **Note**:
>
>
> Windows NTFS file systems do not support some characters in filenames, namely `<|>*?":`. Filenames with a trailing dot are not supported either. Contrary to some extraction tools, this method does not replace these characters with an underscore, but instead fails to extract such files.
>
>
>
php iconv_mime_decode_headers iconv\_mime\_decode\_headers
============================
(PHP 5, PHP 7, PHP 8)
iconv\_mime\_decode\_headers — Decodes multiple `MIME` header fields at once
### Description
```
iconv_mime_decode_headers(string $headers, int $mode = 0, ?string $encoding = null): array|false
```
Decodes multiple `MIME` header fields at once.
### Parameters
`headers`
The encoded headers, as a string.
`mode`
`mode` determines the behaviour in the event **iconv\_mime\_decode\_headers()** encounters a malformed `MIME` header field. You can specify any combination of the following bitmasks.
**Bitmasks acceptable to **iconv\_mime\_decode\_headers()****| Value | Constant | Description |
| --- | --- | --- |
| 1 | ICONV\_MIME\_DECODE\_STRICT | If set, the given header is decoded in full conformance with the standards defined in [» RFC2047](http://www.faqs.org/rfcs/rfc2047). This option is disabled by default because there are a lot of broken mail user agents that don't follow the specification and don't produce correct `MIME` headers. |
| 2 | ICONV\_MIME\_DECODE\_CONTINUE\_ON\_ERROR | If set, **iconv\_mime\_decode\_headers()** attempts to ignore any grammatical errors and continue to process a given header. |
`encoding`
The optional `encoding` parameter specifies the character set to represent the result by. If omitted or **`null`**, [iconv.internal\_encoding](https://www.php.net/manual/en/iconv.configuration.php) will be used.
### Return Values
Returns an associative array that holds a whole set of `MIME` header fields specified by `headers` on success, or **`false`** if an error occurs during the decoding.
Each key of the return value represents an individual field name and the corresponding element represents a field value. If more than one field of the same name are present, **iconv\_mime\_decode\_headers()** automatically incorporates them into a numerically indexed array in the order of occurrence. Note that header names are not *case-insensitive*.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `encoding` is nullable now. |
### Examples
**Example #1 **iconv\_mime\_decode\_headers()** example**
```
<?php
$headers_string = <<<EOF
Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=
To: [email protected]
Date: Thu, 1 Jan 1970 00:00:00 +0000
Message-Id: <[email protected]>
Received: from localhost (localhost [127.0.0.1]) by localhost
with SMTP id example for <[email protected]>;
Thu, 1 Jan 1970 00:00:00 +0000 (UTC)
(envelope-from [email protected])
Received: (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000
EOF;
$headers = iconv_mime_decode_headers($headers_string, 0, "ISO-8859-1");
print_r($headers);
?>
```
The above example will output:
```
Array
(
[Subject] => Prüfung Prüfung
[To] => [email protected]
[Date] => Thu, 1 Jan 1970 00:00:00 +0000
[Message-Id] => <[email protected]>
[Received] => Array
(
[0] => from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <[email protected]>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from [email protected])
[1] => (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000
)
)
```
### See Also
* [iconv\_mime\_decode()](function.iconv-mime-decode) - Decodes a MIME header field
* [mb\_decode\_mimeheader()](function.mb-decode-mimeheader) - Decode string in MIME header field
* [imap\_mime\_header\_decode()](function.imap-mime-header-decode) - Decode MIME header elements
* [imap\_base64()](function.imap-base64) - Decode BASE64 encoded text
* [imap\_qprint()](function.imap-qprint) - Convert a quoted-printable string to an 8 bit string
php sodium_crypto_generichash_keygen sodium\_crypto\_generichash\_keygen
===================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_generichash\_keygen — Generate a random generichash key
### Description
```
sodium_crypto_generichash_keygen(): string
```
Generate a random key for use with the generichash API.
### Parameters
This function has no parameters.
### Return Values
A random 256-bit key.
php ReflectionReference::fromArrayElement ReflectionReference::fromArrayElement
=====================================
(PHP 7 >= 7.4.0, PHP 8)
ReflectionReference::fromArrayElement — Create a ReflectionReference from an array element
### Description
```
public static ReflectionReference::fromArrayElement(array $array, int|string $key): ?ReflectionReference
```
Creates a [ReflectionReference](class.reflectionreference) from an array element.
### Parameters
`array`
The array which contains the potential reference.
`key`
The key; either an int or a string.
### Return Values
Returns a **ReflectionReference** instance if `$array[$key]` is a reference, or **`null`** otherwise.
### Errors/Exceptions
If `array` is not an array, or `key` is not an int or string, a [TypeError](class.typeerror) is thrown. If `$array[$key]` does not exist, a [ReflectionException](class.reflectionexception) is thrown.
php enchant_broker_init enchant\_broker\_init
=====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant >= 0.1.0 )
enchant\_broker\_init — Create a new broker object capable of requesting
### Description
```
enchant_broker_init(): EnchantBroker|false
```
### Parameters
### Return Values
Returns a broker resource on success or **`false`**.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | On success, this function returns an [EnchantBroker](class.enchantbroker) instance now; previoulsy, a [resource](language.types.resource) was retured. |
### See Also
* [enchant\_broker\_free()](function.enchant-broker-free) - Free the broker resource and its dictionaries
php ArrayIterator::append ArrayIterator::append
=====================
(PHP 5, PHP 7, PHP 8)
ArrayIterator::append — Append an element
### Description
```
public ArrayIterator::append(mixed $value): void
```
Appends value as the last element.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`value`
The value to append.
### Return Values
No value is returned.
### Notes
>
> **Note**:
>
>
> This method cannot be called when the [ArrayIterator](class.arrayiterator) refers to an object.
>
>
### See Also
* [ArrayIterator::next()](arrayiterator.next) - Move to next entry
php ReflectionClassConstant::getName ReflectionClassConstant::getName
================================
(PHP 7 >= 7.1.0, PHP 8)
ReflectionClassConstant::getName — Get name of the constant
### Description
```
public ReflectionClassConstant::getName(): string
```
### Parameters
This function has no parameters.
### Return Values
Returns the constant's name.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | Throws an [Error](class.error) in case the name property has not been initialized. Previously, the method returned **`false`** on failure. |
php mailparse_msg_free mailparse\_msg\_free
====================
(PECL mailparse >= 0.9.0)
mailparse\_msg\_free — Frees a MIME resource
### Description
```
mailparse_msg_free(resource $mimemail): bool
```
Frees a `MIME` resource.
### Parameters
`mimemail`
A valid `MIME` resource allocated by [mailparse\_msg\_create()](function.mailparse-msg-create) or [mailparse\_msg\_parse\_file()](function.mailparse-msg-parse-file).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [mailparse\_msg\_create()](function.mailparse-msg-create) - Create a mime mail resource
* [mailparse\_msg\_parse\_file()](function.mailparse-msg-parse-file) - Parses a file
php None include\_once
-------------
(PHP 4, PHP 5, PHP 7, PHP 8)
The `include_once` statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the [include](function.include) statement, with the only difference being that if the code from a file has already been included, it will not be included again, and include\_once returns **`true`**. As the name suggests, the file will be included just once.
`include_once` may be used in cases where the same file might be included and evaluated more than once during a particular execution of a script, so in this case it may help avoid problems such as function redefinitions, variable value reassignments, etc.
See the [include](function.include) documentation for information about how this function works.
php Ds\Pair::isEmpty Ds\Pair::isEmpty
================
(No version information available, might only be in Git)
Ds\Pair::isEmpty — Returns whether the pair is empty
### Description
```
public Ds\Pair::isEmpty(): bool
```
Returns whether the pair is empty.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the pair is empty, **`false`** otherwise.
### Examples
**Example #1 **Ds\Pair::isEmpty()** example**
```
<?php
$a = new \Ds\Pair("a", 1);
$b = new \Ds\Pair();
var_dump($a->isEmpty());
var_dump($b->isEmpty());
?>
```
The above example will output something similar to:
```
bool(false)
bool(true)
```
php SolrDisMaxQuery::setPhraseSlop SolrDisMaxQuery::setPhraseSlop
==============================
(No version information available, might only be in Git)
SolrDisMaxQuery::setPhraseSlop — Sets the default slop on phrase queries (ps parameter)
### Description
```
public SolrDisMaxQuery::setPhraseSlop(string $slop): SolrDisMaxQuery
```
Sets the default amount of slop on phrase queries built with "pf", "pf2" and/or "pf3" fields (affects boosting). "ps" parameter
### Parameters
`slop`
### Return Values
[SolrDisMaxQuery](class.solrdismaxquery)
### Examples
**Example #1 **SolrDisMaxQuery::setPhraseSlop()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery('lucene');
$dismaxQuery->setPhraseSlop(4);
echo $dismaxQuery.PHP_EOL;
?>
```
The above example will output:
```
q=lucene&defType=edismax&ps=4
```
php Worker::isShutdown Worker::isShutdown
==================
(PECL pthreads >= 2.0.0)
Worker::isShutdown — State Detection
### Description
```
public Worker::isShutdown(): bool
```
Whether the worker has been shutdown or not.
### Parameters
This function has no parameters.
### Return Values
Returns whether the worker has been shutdown or not.
### Examples
**Example #1 Detect the state of a worker**
```
<?php
$worker = new Worker();
$worker->start();
var_dump($worker->isShutdown());
$worker->shutdown();
var_dump($worker->isShutdown());
```
The above example will output:
```
bool(false)
bool(true)
```
php sodium_crypto_kdf_derive_from_key sodium\_crypto\_kdf\_derive\_from\_key
======================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_kdf\_derive\_from\_key — Derive a subkey
### Description
```
sodium_crypto_kdf_derive_from_key(
int $subkey_length,
int $subkey_id,
string $context,
string $key
): string
```
Derive a subkey from a root key and additional context.
Similar to [hash\_hkdf()](function.hash-hkdf).
### Parameters
`subkey_length`
Length of the key to return (in bytes)
`subkey_id`
Return the Nth subkey from a given root key. Useful for seeking.
`context`
Application-specific context.
`key`
The root key from which the subkey is derived.
### Return Values
A string of pseudorandom (raw binary) bytes.
php enchant_dict_add_to_session enchant\_dict\_add\_to\_session
===============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant >= 0.1.0 )
enchant\_dict\_add\_to\_session — Add 'word' to this spell-checking session
### Description
```
enchant_dict_add_to_session(EnchantDictionary $dictionary, string $word): void
```
Add a word to the given dictionary. It will be added only for the active spell-checking 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 add
### Return Values
No value is returned.
### 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\_broker\_request\_dict()](function.enchant-broker-request-dict) - Create a new dictionary using a tag
| programming_docs |
php SimpleXMLElement::count SimpleXMLElement::count
=======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SimpleXMLElement::count — Counts the children of an element
### Description
```
public SimpleXMLElement::count(): int
```
This method counts the number of children of an element.
### Parameters
This function has no parameters.
### Return Values
Returns the number of elements of an element.
### Examples
**Example #1 Counting the number of children**
```
<?php
$xml = <<<EOF
<people>
<person name="Person 1">
<child/>
<child/>
<child/>
</person>
<person name="Person 2">
<child/>
<child/>
<child/>
<child/>
<child/>
</person>
</people>
EOF;
$elem = new SimpleXMLElement($xml);
foreach ($elem as $person) {
printf("%s has got %d children.\n", $person['name'], $person->count());
}
?>
```
The above example will output:
```
Person 1 has got 3 children.
Person 2 has got 5 children.
```
### See Also
* [SimpleXMLElement::children()](simplexmlelement.children) - Finds children of given node
php SplFileInfo::getPathInfo SplFileInfo::getPathInfo
========================
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
SplFileInfo::getPathInfo — Gets an SplFileInfo object for the path
### Description
```
public SplFileInfo::getPathInfo(?string $class = null): ?SplFileInfo
```
Gets an [SplFileInfo](class.splfileinfo) object for the parent of the current file.
### Parameters
`class`
Name of an [SplFileInfo](class.splfileinfo) derived class to use, or itself if **`null`**.
### Return Values
Returns an [SplFileInfo](class.splfileinfo) object for the parent path of the file on success, or **`null`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `class` is now nullable. |
### Examples
**Example #1 **SplFileInfo::getPathInfo()** example**
```
<?php
$info = new SplFileInfo('/usr/bin/php');
$parent_info = $info->getPathInfo();
var_dump($parent_info->getRealPath());
?>
```
The above example will output something similar to:
```
string(8) "/usr/bin"
```
### See Also
* [SplFileInfo::setInfoClass()](splfileinfo.setinfoclass) - Sets the class used with SplFileInfo::getFileInfo and SplFileInfo::getPathInfo
php Memcached::resetServerList Memcached::resetServerList
==========================
(PECL memcached >= 2.0.0)
Memcached::resetServerList — Clears all servers from the server list
### Description
```
public Memcached::resetServerList(): bool
```
**Memcached::resetserverlist()** removes all memcache servers from the known server list, resetting it back to empty.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [Memcached::addServer()](memcached.addserver) - Add a server to the server pool
* [Memcached::addServers()](memcached.addservers) - Add multiple servers to the server pool
php pcntl_fork pcntl\_fork
===========
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
pcntl\_fork — Forks the currently running process
### Description
```
pcntl_fork(): int
```
The **pcntl\_fork()** function creates a child process that differs from the parent process only in its PID and PPID. Please see your system's fork(2) man page for specific details as to how fork works on your system.
### Parameters
This function has no parameters.
### Return Values
On success, the PID of the child process is returned in the parent's thread of execution, and a 0 is returned in the child's thread of execution. On failure, a -1 will be returned in the parent's context, no child process will be created, and a PHP error is raised.
### Examples
**Example #1 **pcntl\_fork()** example**
```
<?php
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
} else if ($pid) {
// we are the parent
pcntl_wait($status); //Protect against Zombie children
} else {
// we are the child
}
?>
```
### See Also
* [pcntl\_rfork()](function.pcntl-rfork) - Manipulates process resources
* [pcntl\_waitpid()](function.pcntl-waitpid) - Waits on or returns the status of a forked child
* [pcntl\_signal()](function.pcntl-signal) - Installs a signal handler
* [cli\_set\_process\_title()](function.cli-set-process-title) - Sets the process title
php Lua::getVersion Lua::getVersion
===============
(PECL lua >=0.9.0)
Lua::getVersion — The getversion purpose
### Description
```
public Lua::getVersion(): string
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
Returns Lua::LUA\_VERSION.
php enchant_broker_set_ordering enchant\_broker\_set\_ordering
==============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant >= 0.1.0 )
enchant\_broker\_set\_ordering — Declares a preference of dictionaries to use for the language
### Description
```
enchant_broker_set_ordering(EnchantBroker $broker, string $tag, string $ordering): bool
```
Declares a preference of dictionaries to use for the language described/referred to by 'tag'. The ordering is a comma delimited list of provider names. As a special exception, the "\*" tag can be used as a language tag to declare a default ordering for any language that does not explicitly declare an ordering.
### Parameters
`broker`
An Enchant broker returned by [enchant\_broker\_init()](function.enchant-broker-init).
`tag`
Language tag. The special "\*" tag can be used as a language tag to declare a default ordering for any language that does not explicitly declare an ordering.
`ordering`
Comma delimited list of provider names
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `broker` expects an [EnchantBroker](class.enchantbroker) instance now; previoulsy, a [resource](language.types.resource) was expected. |
php Phar::getSupportedCompression Phar::getSupportedCompression
=============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.2.0)
Phar::getSupportedCompression — Return array of supported compression algorithms
### Description
```
final public static Phar::getSupportedCompression(): array
```
### Parameters
No parameters.
### Return Values
Returns an array containing any of `Phar::GZ` or `Phar::BZ2`, depending on the availability of the [zlib](https://www.php.net/manual/en/book.zlib.php) extension or the [bz2](https://www.php.net/manual/en/book.bzip2.php) extension.
### 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::compress()](phar.compress) - Compresses the entire Phar archive using Gzip or Bzip2 compression
* [Phar::decompress()](phar.decompress) - Decompresses the entire Phar archive
* [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
php WeakMap::getIterator WeakMap::getIterator
====================
(PHP 8)
WeakMap::getIterator — Retrieve an external iterator
### Description
```
public WeakMap::getIterator(): Iterator
```
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 XMLWriter::endAttribute XMLWriter::endAttribute
=======================
xmlwriter\_end\_attribute
=========================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::endAttribute -- xmlwriter\_end\_attribute — End attribute
### Description
Object-oriented style
```
public XMLWriter::endAttribute(): bool
```
Procedural style
```
xmlwriter_end_attribute(XMLWriter $writer): bool
```
Ends the current 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).
### 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::startAttribute()](xmlwriter.startattribute) - Create start attribute
* [XMLWriter::startAttributeNs()](xmlwriter.startattributens) - Create start namespaced attribute
* [XMLWriter::writeAttribute()](xmlwriter.writeattribute) - Write full attribute
* [XMLWriter::writeAttributeNs()](xmlwriter.writeattributens) - Write full namespaced attribute
php SQLite3::createFunction SQLite3::createFunction
=======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3::createFunction — Registers a PHP function for use as an SQL scalar function
### Description
```
public SQLite3::createFunction(
string $name,
callable $callback,
int $argCount = -1,
int $flags = 0
): bool
```
Registers a PHP function or user-defined function for use as an SQL scalar function for use within SQL statements.
### Parameters
`name`
Name of the SQL function to be created or redefined.
`callback`
The name of a PHP function or user-defined function to apply as a callback, defining the behavior of the SQL function.
This function need to be defined as:
```
callback(mixed $value, mixed ...$values): mixed
```
`value`
The first argument passed to the SQL function.
`values`
Further arguments passed to the SQL function.
`argCount`
The number of arguments that the SQL function takes. If this parameter is `-1`, then the SQL function may take any number of arguments.
`flags`
A bitwise conjunction of flags. Currently, only **`SQLITE3_DETERMINISTIC`** is supported, which specifies that the function always returns the same result given the same inputs within a single SQL statement.
### Return Values
Returns **`true`** upon successful creation of the function, **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 7.1.4 | The `flags` parameter has been added. |
### Examples
**Example #1 **SQLite3::createFunction()** example**
```
<?php
function my_udf_md5($string) {
return md5($string);
}
$db = new SQLite3('mysqlitedb.db');
$db->createFunction('my_udf_md5', 'my_udf_md5');
var_dump($db->querySingle('SELECT my_udf_md5("test")'));
?>
```
The above example will output something similar to:
```
string(32) "098f6bcd4621d373cade4e832627b4f6"
```
php SolrQuery::getQuery SolrQuery::getQuery
===================
(PECL solr >= 0.9.2)
SolrQuery::getQuery — Returns the main query
### Description
```
public SolrQuery::getQuery(): string
```
Returns the main search query
### Parameters
This function has no parameters.
### Return Values
Returns a string on success and **`null`** if not set.
php RecursiveCachingIterator::__construct RecursiveCachingIterator::\_\_construct
=======================================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
RecursiveCachingIterator::\_\_construct — Construct
### Description
public **RecursiveCachingIterator::\_\_construct**([Iterator](class.iterator) `$iterator`, int `$flags` = RecursiveCachingIterator::CALL\_TOSTRING) Constructs a new [RecursiveCachingIterator](class.recursivecachingiterator), which consists of a passed in `iterator`.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`iterator`
The iterator being used.
`flags`
The flags. Use **`CALL_TOSTRING`** to call **RecursiveCachingIterator::\_\_toString()** for every element (the default), and/or **`CATCH_GET_CHILD`** to catch exceptions when trying to get children.
### See Also
* [CachingIterator::\_\_construct()](cachingiterator.construct) - Construct a new CachingIterator object for the iterator
php strtoupper strtoupper
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
strtoupper — Make a string uppercase
### Description
```
strtoupper(string $string): string
```
Returns `string` with all ASCII alphabetic characters converted to uppercase.
Bytes in the range `"a"` (0x61) to `"z"` (0x7a) will be converted to the corresponding uppercase letter by subtracting 32 from 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\_strtoupper()](function.mb-strtoupper).
### Parameters
`string`
The input string.
### Return Values
Returns the uppercased 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 **strtoupper()** example**
```
<?php
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = strtoupper($str);
echo $str; // Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
?>
```
### Notes
> **Note**: This function is binary-safe.
>
>
### See Also
* [strtolower()](function.strtolower) - Make a string lowercase
* [ucfirst()](function.ucfirst) - Make a string's first character uppercase
* [ucwords()](function.ucwords) - Uppercase the first character of each word in a string
* [mb\_strtoupper()](function.mb-strtoupper) - Make a string uppercase
php mb_output_handler mb\_output\_handler
===================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
mb\_output\_handler — Callback function converts character encoding in output buffer
### Description
```
mb_output_handler(string $string, int $status): string
```
**mb\_output\_handler()** is [ob\_start()](function.ob-start) callback function. **mb\_output\_handler()** converts characters in the output buffer from internal character encoding to HTTP output character encoding.
### Parameters
`string`
The contents of the output buffer.
`status`
The status of the output buffer.
### Return Values
The converted string.
### Examples
**Example #1 **mb\_output\_handler()** example**
```
<?php
mb_http_output("UTF-8");
ob_start("mb_output_handler");
?>
```
### Notes
>
> **Note**:
>
>
> If you want to output binary data, such as an image, a Content-Type: header must be set using [header()](function.header) before any binary data is sent to the client (e.g. header("Content-Type: image/png")). If Content-Type: header is sent, output character encoding conversion will not be performed.
>
> Note that if 'Content-Type: text/\*' is sent, the content body is regarded as text; conversion will take place.
>
>
### See Also
* [ob\_start()](function.ob-start) - Turn on output buffering
php SolrQuery::addMltQueryField SolrQuery::addMltQueryField
===========================
(PECL solr >= 0.9.2)
SolrQuery::addMltQueryField — Maps to mlt.qf
### Description
```
public SolrQuery::addMltQueryField(string $field, float $boost): SolrQuery
```
Maps to mlt.qf. It is used to specify query fields and their boosts
### Parameters
`field`
The name of the field
`boost`
Its boost value
### Return Values
Returns the current SolrQuery object, if the return value is used.
php str_ireplace str\_ireplace
=============
(PHP 5, PHP 7, PHP 8)
str\_ireplace — Case-insensitive version of [str\_replace()](function.str-replace)
### Description
```
str_ireplace(
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` (ignoring case) replaced with the given `replace` value. If you don't need fancy replacing rules, you should generally use this function instead of [preg\_replace()](function.preg-replace) with the `i` modifier.
### Parameters
If `search` and `replace` are arrays, then **str\_ireplace()** 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
Returns a string or an array of replacements.
### 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. |
### Examples
**Example #1 **str\_ireplace()** example**
```
<?php
$bodytag = str_ireplace("%body%", "black", "<body text=%BODY%>");
echo $bodytag; // <body text=black>
?>
```
### Notes
> **Note**: This function is binary-safe.
>
>
**Caution** Replacement order gotcha
========================
Because **str\_ireplace()** replaces left to right, it might replace a previously inserted value when doing multiple replacements. Example #2 in the [str\_replace()](function.str-replace) documentation demonstrates how this may affect you in practice.
### See Also
* [str\_replace()](function.str-replace) - Replace all occurrences of the search string with the replacement string
* [preg\_replace()](function.preg-replace) - Perform a regular expression search and replace
* [strtr()](function.strtr) - Translate characters or replace substrings
php radius_put_vendor_attr radius\_put\_vendor\_attr
=========================
(PECL radius >= 1.1.0)
radius\_put\_vendor\_attr — Attaches a vendor specific binary attribute
### Description
```
radius_put_vendor_attr(
resource $radius_handle,
int $vendor,
int $type,
string $value,
int $options = 0,
int $tag = ?
): bool
```
Attaches a vendor specific binary 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.
`value`
The attribute value, which will be treated as a raw binary string.
`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\_vendor\_attr()** example**
```
<?php
if (!radius_put_vendor_attr($res, RADIUS_VENDOR_MICROSOFT, RAD_MICROSOFT_MS_CHAP_CHALLENGE, $challenge)) {
echo 'RadiusError:' . radius_strerror($res). "\n<br />";
exit;
}
?>
```
### See Also
* [radius\_get\_vendor\_attr()](function.radius-get-vendor-attr) - Extracts a vendor specific attribute
| programming_docs |
php The finfo class
The finfo class
===============
Introduction
------------
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL fileinfo >= 0.1.0)
This class provides an object-oriented interface into the fileinfo functions.
Class synopsis
--------------
class **finfo** { /\* Methods \*/ public [\_\_construct](finfo.construct)(int `$flags` = **`FILEINFO_NONE`**, ?string `$magic_database` = **`null`**)
```
public buffer(string $string, int $flags = FILEINFO_NONE, ?resource $context = null): string|false
```
```
public file(string $filename, int $flags = FILEINFO_NONE, ?resource $context = null): string|false
```
```
public set_flags(int $flags): bool
```
} Table of Contents
-----------------
* [finfo::buffer](finfo.buffer) — Alias of finfo\_buffer()
* [finfo::\_\_construct](finfo.construct) — Alias of finfo\_open
* [finfo::file](finfo.file) — Alias of finfo\_file()
* [finfo::set\_flags](finfo.set-flags) — Alias of finfo\_set\_flags()
php snmpget snmpget
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
snmpget — Fetch an SNMP object
### Description
```
snmpget(
string $hostname,
string $community,
array|string $object_id,
int $timeout = -1,
int $retries = -1
): mixed
```
The **snmpget()** 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 **snmpget()****
```
<?php
$syscontact = snmpget("127.0.0.1", "public", "system.SysContact.0");
?>
```
### See Also
* [snmpset()](function.snmpset) - Set the value of an SNMP object
php Yaf_Config_Simple::next Yaf\_Config\_Simple::next
=========================
(Yaf >=1.0.0)
Yaf\_Config\_Simple::next — The next purpose
### Description
```
public Yaf_Config_Simple::next(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php Imagick::exportImagePixels Imagick::exportImagePixels
==========================
(PECL imagick 2 >=2.3.0, PECL imagick 3)
Imagick::exportImagePixels — Exports raw image pixels
### Description
```
public Imagick::exportImagePixels(
int $x,
int $y,
int $width,
int $height,
string $map,
int $STORAGE
): array
```
Exports image pixels into an array. The map defines the ordering of the exported pixels. The size of the returned array is `width * height * strlen(map)`. This method is available if Imagick has been compiled against ImageMagick version 6.4.7 or newer.
### Parameters
`x`
X-coordinate of the exported area
`y`
Y-coordinate of the exported area
`width`
Width of the exported aread
`height`
Height of the exported area
`map`
Ordering of the exported pixels. For example `"RGB"`. Valid characters for the map are R, G, B, A, O, C, Y, M, K, I and P.
`STORAGE`
Refer to this list of [pixel type constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.pixel)
### Return Values
Returns an array containing the pixels values.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 Using **Imagick::exportImagePixels()****
Export image pixels into an array
```
<?php
/* Create new object */
$im = new Imagick();
/* Create new image */
$im->newPseudoImage(0, 0, "magick:rose");
/* Export the image pixels */
$pixels = $im->exportImagePixels(10, 10, 2, 2, "RGB", Imagick::PIXEL_CHAR);
/* Output */
var_dump($pixels);
?>
```
The above example will output:
```
array(12) {
[0]=>
int(72)
[1]=>
int(64)
[2]=>
int(57)
[3]=>
int(69)
[4]=>
int(59)
[5]=>
int(43)
[6]=>
int(124)
[7]=>
int(120)
[8]=>
int(-96)
[9]=>
int(91)
[10]=>
int(84)
[11]=>
int(111)
}
```
php mcrypt_enc_self_test mcrypt\_enc\_self\_test
=======================
(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mcrypt\_enc\_self\_test — Runs a self test on the opened module
**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_self_test(resource $td): int
```
This function runs the self test on the algorithm specified by the descriptor `td`.
### Parameters
`td`
The encryption descriptor.
### Return Values
Returns `0` on success and a negative int on failure.
php stream_register_wrapper stream\_register\_wrapper
=========================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
stream\_register\_wrapper — Alias of [stream\_wrapper\_register()](function.stream-wrapper-register)
### Description
This function is an alias of: [stream\_wrapper\_register()](function.stream-wrapper-register).
php ImagickDraw::rotate ImagickDraw::rotate
===================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::rotate — Applies the specified rotation to the current coordinate space
### Description
```
public ImagickDraw::rotate(float $degrees): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Applies the specified rotation to the current coordinate space.
### Parameters
`degrees`
degrees to rotate.
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::rotate()** example**
```
<?php
function rotate($strokeColor, $fillColor, $backgroundColor, $fillModifiedColor) {
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setStrokeOpacity(1);
$draw->setFillColor($fillColor);
$draw->rectangle(200, 200, 300, 300);
$draw->setFillColor($fillModifiedColor);
$draw->rotate(15);
$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 Imagick::compositeImage Imagick::compositeImage
=======================
(PECL imagick 2, PECL imagick 3)
Imagick::compositeImage — Composite one image onto another
### Description
```
public Imagick::compositeImage(
Imagick $composite_object,
int $composite,
int $x,
int $y,
int $channel = Imagick::CHANNEL_DEFAULT
): bool
```
Composite one image onto another at the specified offset. Any extra arguments needed for the compose algorithm should passed to setImageArtifact with 'compose:args' as the first parameter and the data as the second parameter.
### Parameters
`composite_object`
Imagick object which holds the composite image
`compose`
Composite operator. See [Composite Operator Constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.compositeop)
`x`
The column offset of the composited image
`y`
The row offset of the composited image
`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 Using **Imagick::compositeImage()**:**
Composite two images with the 'mathematics' compose method
```
<?php
// Equivalent to running the command
// convert src1.png src2.png -compose mathematics -define compose:args="1,0,-0.5,0.5" -composite output.png
$src1 = new \Imagick("./src1.png");
$src2 = new \Imagick("./src2.png");
$src1->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT);
$src1->setImageArtifact('compose:args', "1,0,-0.5,0.5");
$src1->compositeImage($src2, Imagick::COMPOSITE_MATHEMATICS, 0, 0);
$src1->writeImage("./output.png");
?>
```
### See Also
* [Imagick::setImageArtifact()](imagick.setimageartifact) - Set image artifact
php Imagick::getImageCompression Imagick::getImageCompression
============================
(PECL imagick 3 >= 3.3.0)
Imagick::getImageCompression — Gets the current image's compression type
### Description
```
public Imagick::getImageCompression(): int
```
Gets the current image's compression type.
### Parameters
This function has no parameters.
### Return Values
Returns the compression constant
php SplFileInfo::isLink SplFileInfo::isLink
===================
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
SplFileInfo::isLink — Tells if the file is a link
### Description
```
public SplFileInfo::isLink(): bool
```
Use this method to check if the file referenced by the SplFileInfo object is a link.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the file is a link, **`false`** otherwise.
### Examples
**Example #1 **SplFileInfo::isLink()** example**
```
<?php
$info = new SplFileInfo('/path/to/symlink');
if ($info->isLink()) {
echo 'The real path is '.$info->getRealPath();
}
?>
```
### See Also
* [SplFileInfo::getRealPath()](splfileinfo.getrealpath) - Gets absolute path to file
php date_sunset date\_sunset
============
(PHP 5, PHP 7, PHP 8)
date\_sunset — Returns time of sunset for a given day and location
**Warning** This function has been *DEPRECATED* as of PHP 8.1.0. Relying on this function is highly discouraged. Use [date\_sun\_info()](function.date-sun-info) instead.
### Description
```
date_sunset(
int $timestamp,
int $returnFormat = SUNFUNCS_RET_STRING,
?float $latitude = null,
?float $longitude = null,
?float $zenith = null,
?float $utcOffset = null
): string|int|float|false
```
**date\_sunset()** returns the sunset time for a given day (specified as a `timestamp`) and location.
### Parameters
`timestamp`
The `timestamp` of the day from which the sunset time is taken.
`returnFormat`
**`returnFormat` constants**| constant | description | example |
| --- | --- | --- |
| SUNFUNCS\_RET\_STRING | returns the result as string | 16:46 |
| SUNFUNCS\_RET\_DOUBLE | returns the result as float | 16.78243132 |
| SUNFUNCS\_RET\_TIMESTAMP | returns the result as int (timestamp) | 1095034606 |
`latitude`
Defaults to North, pass in a negative value for South. See also: [date.default\_latitude](https://www.php.net/manual/en/datetime.configuration.php#ini.date.default-latitude)
`longitude`
Defaults to East, pass in a negative value for West. See also: [date.default\_longitude](https://www.php.net/manual/en/datetime.configuration.php#ini.date.default-longitude)
`zenith`
`zenith` is the angle between the center of the sun and a line perpendicular to earth's surface. It defaults to [date.sunset\_zenith](https://www.php.net/manual/en/datetime.configuration.php#ini.date.sunset-zenith)
**Common `zenith` angles**| Angle | Description |
| --- | --- |
| 90°50' | Sunset: the point where the sun becomes invisible. |
| 96° | Civil twilight: conventionally used to signify the end of dusk. |
| 102° | Nautical twilight: the point at which the horizon ends being visible at sea. |
| 108° | Astronomical twilight: the point at which the sun ends being the source of any illumination. |
`utcOffset`
Specified in hours. The `utcOffset` is ignored, if `returnFormat` is **`SUNFUNCS_RET_TIMESTAMP`**.
### Return Values
Returns the sunset time in a specified `returnFormat` on success or **`false`** on failure. One potential reason for failure is that the sun does not set at all, which happens inside the polar circles for part of the year.
### Errors/Exceptions
Every call to a date/time function will generate a **`E_WARNING`** if the time zone is not valid. See also [date\_default\_timezone\_set()](function.date-default-timezone-set)
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | This function has been deprecated in favor of [date\_sun\_info()](function.date-sun-info). |
| 8.0.0 | `latitude`, `longitude`, `zenith` and `utcOffset` are nullable now. |
### Examples
**Example #1 **date\_sunset()** example**
```
<?php
/* calculate the sunset time for Lisbon, Portugal
Latitude: 38.4 North
Longitude: 9 West
Zenith ~= 90
offset: +1 GMT
*/
echo date("D M d Y"). ', sunset time : ' .date_sunset(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1);
?>
```
The above example will output something similar to:
```
Mon Dec 20 2004, sunset time : 18:13
```
**Example #2 No sunset**
```
<?php
$solstice = strtotime('2017-12-21');
var_dump(date_sunset($solstice, SUNFUNCS_RET_STRING, 69.245833, -53.537222));
?>
```
The above example will output:
```
bool(false)
```
### See Also
* [date\_sun\_info()](function.date-sun-info) - Returns an array with information about sunset/sunrise and twilight begin/end
php Ds\PriorityQueue::clear Ds\PriorityQueue::clear
=======================
(PECL ds >= 1.0.0)
Ds\PriorityQueue::clear — Removes all values
### Description
```
public Ds\PriorityQueue::clear(): void
```
Removes all values from the queue.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\PriorityQueue::clear()** example**
```
<?php
$queue = new \Ds\PriorityQueue();
$queue->push("a", 5);
$queue->push("b", 15);
$queue->push("c", 10);
$queue->clear();
print_r($queue);
?>
```
The above example will output something similar to:
```
Ds\PriorityQueue Object
(
)
```
php Ds\Queue::peek Ds\Queue::peek
==============
(PECL ds >= 1.0.0)
Ds\Queue::peek — Returns the value at the front of the queue
### Description
```
public Ds\Queue::peek(): mixed
```
Returns the value at the front of the queue, but does not remove it.
### Parameters
This function has no parameters.
### Return Values
The value at the front of the queue.
### Errors/Exceptions
[UnderflowException](class.underflowexception) if empty.
### Examples
**Example #1 **Ds\Queue::peek()** example**
```
<?php
$queue = new \Ds\Queue();
$queue->push("a");
$queue->push("b");
$queue->push("c");
var_dump($queue->peek());
?>
```
The above example will output something similar to:
```
string(1) "a"
```
php SQLite3::backup SQLite3::backup
===============
(PHP 7 >= 7.4.0, PHP 8)
SQLite3::backup — Backup one database to another database
### Description
```
public SQLite3::backup(SQLite3 $destination, string $sourceDatabase = "main", string $destinationDatabase = "main"): bool
```
**SQLite3::backup()** copies the contents of one database into another, overwriting the contents of the destination database. It is useful either for creating backups of databases or for copying in-memory databases to or from persistent files.
**Tip** As of SQLite 3.27.0 (2019-02-07), it is also possible to use the statement `VACUUM INTO 'file.db';` to backup the database to a new file.
### Parameters
`destination`
A database connection opened with [SQLite3::open()](sqlite3.open).
`sourceDatabase`
The database name is `"main"` for the main database, `"temp"` for the temporary database, or the name specified after the `AS` keyword in an `ATTACH` statement for an attached database.
`destinationDatabase`
Analogous to `sourceDatabase` but for the `destination`.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Backup an existing database**
```
<?php
// $conn is a connection to an already opened sqlite3 database
$backup = new SQLite3('backup.sqlite');
$conn->backup($backup);
?>
```
php The BadMethodCallException class
The BadMethodCallException class
================================
Introduction
------------
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
Exception thrown if a callback refers to an undefined method or if some arguments are missing.
Class synopsis
--------------
class **BadMethodCallException** extends [BadFunctionCallException](class.badfunctioncallexception) { /\* 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 quoted_printable_encode quoted\_printable\_encode
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
quoted\_printable\_encode — Convert a 8 bit string to a quoted-printable string
### Description
```
quoted_printable_encode(string $string): string
```
Returns a quoted printable string created according to [» RFC2045](http://www.faqs.org/rfcs/rfc2045), section 6.7.
This function is similar to [imap\_8bit()](function.imap-8bit), except this one does not require the IMAP module to work.
### Parameters
`string`
The input string.
### Return Values
Returns the encoded string.
### Examples
**Example #1 **quoted\_printable\_encode()** example**
```
<?php
$encoded = quoted_printable_encode('Möchten Sie ein paar Äpfel?');
var_dump($encoded);
var_dump(quoted_printable_decode($encoded));
?>
```
The above example will output:
```
string(37) "M=C3=B6chten Sie ein paar =C3=84pfel?"
string(29) "Möchten Sie ein paar Äpfel?"
```
### See Also
* [quoted\_printable\_decode()](function.quoted-printable-decode) - Convert a quoted-printable string to an 8 bit string
* [iconv\_mime\_encode()](function.iconv-mime-encode) - Composes a MIME header field
php SplHeap::current SplHeap::current
================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplHeap::current — Return current node pointed by the iterator
### Description
```
public SplHeap::current(): mixed
```
Get the current datastructure node.
### Parameters
This function has no parameters.
### Return Values
The current node value.
php sodium_crypto_aead_chacha20poly1305_encrypt sodium\_crypto\_aead\_chacha20poly1305\_encrypt
===============================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_aead\_chacha20poly1305\_encrypt — Encrypt then authenticate with ChaCha20-Poly1305
### Description
```
sodium_crypto_aead_chacha20poly1305_encrypt(
string $message,
string $additional_data,
string $nonce,
string $key
): string
```
Encrypt then authenticate with ChaCha20-Poly1305.
### Parameters
`message`
The plaintext message to encrypt.
`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. 8 bytes long.
`key`
Encryption key (256-bit).
### Return Values
Returns the ciphertext and tag on success, or **`false`** on failure.
| programming_docs |
php Imagick::getCompressionQuality Imagick::getCompressionQuality
==============================
(PECL imagick 2, PECL imagick 3)
Imagick::getCompressionQuality — Gets the object compression quality
### Description
```
public Imagick::getCompressionQuality(): int
```
Gets the object compression quality.
### Parameters
This function has no parameters.
### Return Values
Returns integer describing the compression quality
php SoapFault::__toString SoapFault::\_\_toString
=======================
(PHP 5, PHP 7, PHP 8)
SoapFault::\_\_toString — Obtain a string representation of a SoapFault
### Description
```
public SoapFault::__toString(): string
```
Returns a string representation of the SoapFault.
### Parameters
This function has no parameters.
### Return Values
A string describing the SoapFault.
php Reflector::export Reflector::export
=================
(PHP 5, PHP 7)
Reflector::export — Exports
**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 Reflector::export(): string
```
Exports.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
### See Also
* **Reflection::\_\_toString()**
php SimpleXMLElement::__toString SimpleXMLElement::\_\_toString
==============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SimpleXMLElement::\_\_toString — Returns the string content
### Description
```
public SimpleXMLElement::__toString(): string
```
Returns text content that is directly in this element. Does not return text content that is inside this element's children.
### Parameters
This function has no parameters.
### Return Values
Returns the string content on success or an empty string on failure.
### Examples
**Example #1 Get string content**
```
<?php
$xml = new SimpleXMLElement('<a>1 <b>2 </b>3</a>');
echo $xml;
?>
```
The above example will output:
```
1 3
```
### See Also
* [SimpleXMLElement::asXML()](simplexmlelement.asxml) - Return a well-formed XML string based on SimpleXML element
php GearmanWorker::unregisterAll GearmanWorker::unregisterAll
============================
(PECL gearman >= 0.6.0)
GearmanWorker::unregisterAll — Unregister all function names with the job servers
### Description
```
public GearmanWorker::unregisterAll(): bool
```
Unregisters all previously registered functions, ensuring that no more jobs are sent to this worker.
### Parameters
This function has no parameters.
### Return Values
A standard Gearman return value.
### See Also
* [GearmanWorker::register()](gearmanworker.register) - Register a function with the job server
* [GearmanWorker::unregister()](gearmanworker.unregister) - Unregister a function name with the job servers
php APCUIterator::__construct APCUIterator::\_\_construct
===========================
(PECL apcu >= 5.0.0)
APCUIterator::\_\_construct — Constructs an APCUIterator iterator object
### Description
public **APCUIterator::\_\_construct**(
array|string|null `$search` = **`null`**,
int `$format` = APC\_ITER\_ALL,
int `$chunk_size` = 100,
int `$list` = APC\_LIST\_ACTIVE
) Constructs an [APCUIterator](class.apcuiterator) object.
### Parameters
`search`
Either a [PCRE](https://www.php.net/manual/en/book.pcre.php) regular expression that matches against APCu key names, given as a string. Or an array of strings with APCu key names. Or, optionally **`null`** to skip the search.
`format`
The desired format, as configured with one or more of the [APC\_ITER\_\*](https://www.php.net/manual/en/apcu.constants.php) constants.
`chunk_size`
The chunk size. Must be a value greater than 0. The default value is 100.
`list`
The type to list. Either pass in **`APC_LIST_ACTIVE`** or **`APC_LIST_DELETED`**.
### Examples
**Example #1 A **APCUIterator::\_\_construct()** example**
```
<?php
foreach (new APCUIterator('/^counter\./') as $counter) {
echo "$counter[key]: $counter[value]\n";
apc_dec($counter['key'], $counter['value']);
}
?>
```
### See Also
* [apcu\_exists()](function.apcu-exists) - Checks if entry exists
* [apcu\_cache\_info()](function.apcu-cache-info) - Retrieves cached information from APCu's data store
php yaml_emit yaml\_emit
==========
(PECL yaml >= 0.5.0)
yaml\_emit — Returns the YAML representation of a value
### Description
```
yaml_emit(
mixed $data,
int $encoding = YAML_ANY_ENCODING,
int $linebreak = YAML_ANY_BREAK,
array $callbacks = null
): string
```
Generate a YAML representation of the provided `data`.
### Parameters
`data`
The `data` being encoded. Can be any type except a resource.
`encoding`
Output character encoding chosen from **`YAML_ANY_ENCODING`**, **`YAML_UTF8_ENCODING`**, **`YAML_UTF16LE_ENCODING`**, **`YAML_UTF16BE_ENCODING`**.
`linebreak`
Output linebreak style chosen from **`YAML_ANY_BREAK`**, **`YAML_CR_BREAK`**, **`YAML_LN_BREAK`**, **`YAML_CRLN_BREAK`**.
`callbacks`
Content handlers for emitting YAML nodes. Associative array of classname => [callable](language.types.callable) mappings. See [emit callbacks](https://www.php.net/manual/en/yaml.callbacks.emit.php) for more details.
### Return Values
Returns a YAML encoded string on success.
### Changelog
| Version | Description |
| --- | --- |
| PECL yaml 1.1.0 | The `callbacks` parameter was added. |
### Examples
**Example #1 **yaml\_emit()** example**
```
<?php
$addr = array(
"given" => "Chris",
"family"=> "Dumars",
"address"=> array(
"lines"=> "458 Walkman Dr.
Suite #292",
"city"=> "Royal Oak",
"state"=> "MI",
"postal"=> 48046,
),
);
$invoice = array (
"invoice"=> 34843,
"date"=> 980208000,
"bill-to"=> $addr,
"ship-to"=> $addr,
"product"=> array(
array(
"sku"=> "BL394D",
"quantity"=> 4,
"description"=> "Basketball",
"price"=> 450,
),
array(
"sku"=> "BL4438H",
"quantity"=> 1,
"description"=> "Super Hoop",
"price"=> 2392,
),
),
"tax"=> 251.42,
"total"=> 4443.52,
"comments"=> "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.",
);
var_dump(yaml_emit($invoice));
?>
```
The above example will output something similar to:
```
string(628) "---
invoice: 34843
date: 980208000
bill-to:
given: Chris
family: Dumars
address:
lines: |-
458 Walkman Dr.
Suite #292
city: Royal Oak
state: MI
postal: 48046
ship-to:
given: Chris
family: Dumars
address:
lines: |-
458 Walkman Dr.
Suite #292
city: Royal Oak
state: MI
postal: 48046
product:
- sku: BL394D
quantity: 4
description: Basketball
price: 450
- sku: BL4438H
quantity: 1
description: Super Hoop
price: 2392
tax: 251.420000
total: 4443.520000
comments: Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.
...
"
```
### See Also
* [yaml\_emit\_file()](function.yaml-emit-file) - Send the YAML representation of a value to a file
* [yaml\_parse()](function.yaml-parse) - Parse a YAML stream
php WeakMap::count WeakMap::count
==============
(PHP 8)
WeakMap::count — Counts the number of live entries in the map
### Description
```
public WeakMap::count(): int
```
Counts the number of live entries in the map.
### Parameters
This function has no parameters.
### Return Values
Returns the number of live entries in the map.
php ReflectionClass::getTraits ReflectionClass::getTraits
==========================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
ReflectionClass::getTraits — Returns an array of traits used by this class
### Description
```
public ReflectionClass::getTraits(): 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 trait names in keys and instances of trait's [ReflectionClass](class.reflectionclass) in values. Returns **`null`** in case of an error.
php umask umask
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
umask — Changes the current umask
### Description
```
umask(?int $mask = null): int
```
**umask()** sets PHP's umask to `mask` & 0777 and returns the old umask. When PHP is being used as a server module, the umask is restored when each request is finished.
### Parameters
`mask`
The new umask.
### Return Values
If `mask` is **`null`**, **umask()** simply returns the current umask otherwise the old umask is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `mask` is nullable now. |
### Examples
**Example #1 **umask()** example**
```
<?php
$old = umask(0);
chmod("/path/some_dir/some_file.txt", 0755);
umask($old);
// Checking
if ($old != umask()) {
die('An error occurred while changing back the umask');
}
?>
```
### Notes
>
> **Note**:
>
>
> Avoid using this function in multithreaded webservers. It is better to change the file permissions with [chmod()](function.chmod) after creating the file. Using **umask()** can lead to unexpected behavior of concurrently running scripts and the webserver itself because they all use the same umask.
>
>
php sodium_crypto_scalarmult sodium\_crypto\_scalarmult
==========================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_scalarmult — Compute a shared secret given a user's secret key and another user's public key
### Description
```
sodium_crypto_scalarmult(string $n, string $p): string
```
Elliptic Curve Diffie-Hellman. Calculates scalar n times point p, on an elliptic curve.
### Parameters
`n`
scalar, which is typically a secret key
`p`
point (x-coordinate), which is typically a public key
### Return Values
A 32-byte random string.
php odbc_connection_string_is_quoted odbc\_connection\_string\_is\_quoted
====================================
(PHP 8 >= 8.2.0)
odbc\_connection\_string\_is\_quoted — Determines if an ODBC connection string value is quoted
### Description
```
odbc_connection_string_is_quoted(string $str): bool
```
Determines if a string is properly quoted for an ODBC connection string value. ODBC connection string quoting is performed using curly braces, and ending braces within a string must be escaped through repeating them twice, similar to SQL quoting.
### Parameters
`str`
The string to check for quoting.
### Return Values
**`true`** if quoted properly, **`false`** if not.
### See Also
* [odbc\_connection\_string\_quote()](function.odbc-connection-string-quote) - Quotes an ODBC connection string value
* [odbc\_connection\_string\_should\_quote()](function.odbc-connection-string-should-quote) - Determines if an ODBC connection string value should be quoted
php DirectoryIterator::getPath DirectoryIterator::getPath
==========================
(PHP 5, PHP 7, PHP 8)
DirectoryIterator::getPath — Get path of current Iterator item without filename
### Description
```
public DirectoryIterator::getPath(): string
```
Get the path to the current [DirectoryIterator](class.directoryiterator) item.
### Parameters
This function has no parameters.
### Return Values
Returns the path to the file, omitting the file name and any trailing slash.
### Examples
**Example #1 **DirectoryIterator::getPath()** example**
```
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
echo $iterator->getPath();
?>
```
The above example will output something similar to:
```
/home/examples/public_html
```
### 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::getPathname()](directoryiterator.getpathname) - Return path and file name of current DirectoryIterator item
* [pathinfo()](function.pathinfo) - Returns information about a file path
php mysqli::close mysqli::close
=============
mysqli\_close
=============
(PHP 5, PHP 7, PHP 8)
mysqli::close -- mysqli\_close — Closes a previously opened database connection
### Description
Object-oriented style
```
public mysqli::close(): bool
```
Procedural style
```
mysqli_close(mysqli $mysql): bool
```
Closes a previously opened database connection.
Open non-persistent MySQL connections and result sets are automatically closed when their objects are destroyed. Explicitly closing open connections and freeing result sets is optional. However, it's a good idea to close the connection as soon as the script finishes performing all of its database operations, if it still has a lot of processing to do after getting the results.
### 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::close()** 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");
/* Close the connection as soon as it's no longer needed */
$mysqli->close();
foreach ($result as $row) {
/* Processing of the data retrieved from the database */
}
```
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");
/* Close the connection as soon as it's no longer needed */
mysqli_close($mysqli);
foreach ($result as $row) {
/* Processing of the data retrieved from the database */
}
```
### Notes
>
> **Note**:
>
>
> **mysqli\_close()** will not close persistent connections. For additional details, see the manual page on [persistent connections](https://www.php.net/manual/en/features.persistent-connections.php).
>
>
### See Also
* [mysqli::\_\_construct()](mysqli.construct) - Open a new connection to the MySQL server
* [mysqli\_init()](mysqli.init) - Initializes MySQLi and returns an object for use with mysqli\_real\_connect()
* [mysqli\_real\_connect()](mysqli.real-connect) - Opens a connection to a mysql server
* [mysqli\_free\_result()](mysqli-result.free) - Frees the memory associated with a result
php array_diff_assoc array\_diff\_assoc
==================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
array\_diff\_assoc — Computes the difference of arrays with additional index check
### Description
```
array_diff_assoc(array $array, array ...$arrays): array
```
Compares `array` against `arrays` and returns the difference. Unlike [array\_diff()](function.array-diff) the array keys are also used in the comparison.
### Parameters
`array`
The array to compare from
`arrays`
Arrays to compare against
### Return Values
Returns an array containing all the values from `array` that are not present in any of the other arrays.
### 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\_diff\_assoc()** example**
In this example you see 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
$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array2 = array("a" => "green", "yellow", "red");
$result = array_diff_assoc($array1, $array2);
print_r($result);
?>
```
The above example will output:
```
Array
(
[b] => brown
[c] => blue
[0] => red
)
```
**Example #2 **array\_diff\_assoc()** example**
Two values from *key => value* pairs are considered equal only if `(string) $elem1 === (string)
$elem2` . In other words a strict check takes place so the string representations must be the same.
```
<?php
$array1 = array(0, 1, 2);
$array2 = array("00", "01", "2");
$result = array_diff_assoc($array1, $array2);
print_r($result);
?>
```
The above example will output:
```
Array
(
[0] => 0
[1] => 1
)
```
### 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_assoc($array1[0], $array2[0]);`.
>
>
> **Note**: Ensure you pass arguments in the correct order when comparing similar arrays with more keys. The new array should be the first in the list.
>
>
### See Also
* [array\_diff()](function.array-diff) - Computes the difference of arrays
* [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\_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
php xdiff_string_merge3 xdiff\_string\_merge3
=====================
(PECL xdiff >= 0.2.0)
xdiff\_string\_merge3 — Merge 3 strings into one
### Description
```
xdiff_string_merge3(
string $old_data,
string $new_data1,
string $new_data2,
string &$error = ?
): mixed
```
Merges three strings into one and returns the result. The `old_data` is an original version of data while `new_data1` and `new_data2` are modified versions of an original. An optional `error` is used to pass any rejected parts during merging process.
### Parameters
`old_data`
First string with data. It acts as "old" data.
`new_data1`
Second string with data. It acts as modified version of `old_data`.
`new_data2`
Third string with data. It acts as modified version of `old_data`.
`error`
If provided then rejected parts are stored inside this variable.
### Return Values
Returns the merged string, **`false`** if an internal error happened, or **`true`** if merged string is empty.
### See Also
* [xdiff\_file\_merge3()](function.xdiff-file-merge3) - Merge 3 files into one
php fbird_prepare fbird\_prepare
==============
(PHP 5, PHP 7 < 7.4.0)
fbird\_prepare — Alias of [ibase\_prepare()](function.ibase-prepare)
### Description
This function is an alias of: [ibase\_prepare()](function.ibase-prepare).
php strval strval
======
(PHP 4, PHP 5, PHP 7, PHP 8)
strval — Get string value of a variable
### Description
```
strval(mixed $value): string
```
Get the string value of a variable. See the documentation on string for more information on converting to string.
This function performs no formatting on the returned value. If you are looking for a way to format a numeric value as a string, please see [sprintf()](function.sprintf) or [number\_format()](function.number-format).
### Parameters
`value`
The variable that is being converted to a string.
`value` may be any scalar type or an object that implements the [\_\_toString()](language.oop5.magic#object.tostring) method. You cannot use **strval()** on arrays or on objects that do not implement the [\_\_toString()](language.oop5.magic#object.tostring) method.
### Return Values
The string value of `value`.
### Examples
**Example #1 **strval()** example using PHP magic [\_\_toString()](language.oop5.magic#object.tostring) method.**
```
<?php
class StrValTest
{
public function __toString()
{
return __CLASS__;
}
}
// Prints 'StrValTest'
echo strval(new StrValTest);
?>
```
### See Also
* [boolval()](function.boolval) - Get the boolean value of a variable
* [floatval()](function.floatval) - Get float value of a variable
* [intval()](function.intval) - Get the integer value of a variable
* [settype()](function.settype) - Set the type of a variable
* [sprintf()](function.sprintf) - Return a formatted string
* [number\_format()](function.number-format) - Format a number with grouped thousands
* [Type juggling](language.types.type-juggling)
* [\_\_toString()](language.oop5.magic#object.tostring)
| programming_docs |
php sqlsrv_begin_transaction sqlsrv\_begin\_transaction
==========================
(No version information available, might only be in Git)
sqlsrv\_begin\_transaction — Begins a database transaction
### Description
```
sqlsrv_begin_transaction(resource $conn): bool
```
The transaction begun by **sqlsrv\_begin\_transaction()** includes all statements that were executed after the call to **sqlsrv\_begin\_transaction()** and before calls to [sqlsrv\_rollback()](function.sqlsrv-rollback) or [sqlsrv\_commit()](function.sqlsrv-commit). Explicit transactions should be started and committed or rolled back using these functions instead of executing SQL statements that begin and commit/roll back transactions. For more information, see [» SQLSRV Transactions](http://msdn.microsoft.com/en-us/library/cc296206.aspx).
### Parameters
`conn`
The connection resource returned by a call to [sqlsrv\_connect()](function.sqlsrv-connect).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **sqlsrv\_begin\_transaction()** example**
The following example demonstrates how to use **sqlsrv\_begin\_transaction()** together with [sqlsrv\_commit()](function.sqlsrv-commit) and [sqlsrv\_rollback()](function.sqlsrv-rollback).
```
<?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 ));
}
/* Begin the transaction. */
if ( sqlsrv_begin_transaction( $conn ) === false ) {
die( print_r( sqlsrv_errors(), true ));
}
/* Initialize parameter values. */
$orderId = 1; $qty = 10; $productId = 100;
/* Set up and execute the first query. */
$sql1 = "INSERT INTO OrdersTable (ID, Quantity, ProductID)
VALUES (?, ?, ?)";
$params1 = array( $orderId, $qty, $productId );
$stmt1 = sqlsrv_query( $conn, $sql1, $params1 );
/* Set up and execute the second query. */
$sql2 = "UPDATE InventoryTable
SET Quantity = (Quantity - ?)
WHERE ProductID = ?";
$params2 = array($qty, $productId);
$stmt2 = sqlsrv_query( $conn, $sql2, $params2 );
/* If both queries were successful, commit the transaction. */
/* Otherwise, rollback the transaction. */
if( $stmt1 && $stmt2 ) {
sqlsrv_commit( $conn );
echo "Transaction committed.<br />";
} else {
sqlsrv_rollback( $conn );
echo "Transaction rolled back.<br />";
}
?>
```
The above example will output something similar to:
### See Also
* [sqlsrv\_commit()](function.sqlsrv-commit) - Commits a transaction that was begun with sqlsrv\_begin\_transaction
* [sqlsrv\_rollback()](function.sqlsrv-rollback) - Rolls back a transaction that was begun with sqlsrv\_begin\_transaction
php stats_dens_laplace stats\_dens\_laplace
====================
(PECL stats >= 1.0.0)
stats\_dens\_laplace — Probability density function of the Laplace distribution
### Description
```
stats_dens_laplace(float $x, float $ave, float $stdev): float
```
Returns the probability density at `x`, where the random variable follows the Laplace distribution of which the location parameter is `ave` and the scale parameter is `stdev`.
### Parameters
`x`
The value at which the probability density is calculated
`ave`
The location parameter of the distribution
`stdev`
The shape parameter of the distribution
### Return Values
The probability density at `x` or **`false`** for failure.
php sodium_unpad sodium\_unpad
=============
(PHP 7 >= 7.2.0, PHP 8)
sodium\_unpad — Remove padding data
### Description
```
sodium_unpad(string $string, int $block_size): string
```
Unpad a padded string. Timing-safe.
### Parameters
`string`
Padded string.
`block_size`
The block size for padding.
### Return Values
Unpadded string.
php Yaf_Registry::del Yaf\_Registry::del
==================
(Yaf >=1.0.0)
Yaf\_Registry::del — Remove an item from registry
### Description
```
public static Yaf_Registry::del(string $name): void
```
Remove an item from registry
### Parameters
`name`
### Return Values
php Imagick::newImage Imagick::newImage
=================
(PECL imagick 2, PECL imagick 3)
Imagick::newImage — Creates a new image
### Description
```
public Imagick::newImage(
int $cols,
int $rows,
mixed $background,
string $format = ?
): bool
```
Creates a new image and associates ImagickPixel value as background color
### Parameters
`cols`
Columns in the new image
`rows`
Rows in the new image
`background`
The background color used for this image
`format`
Image format. This parameter was added in Imagick version 2.0.1.
### 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 object. |
### Examples
**Example #1 Using **Imagick::newImage()**:**
Create a new image and display it.
```
<?php
$image = new Imagick();
$image->newImage(100, 100, new ImagickPixel('red'));
$image->setImageFormat('png');
header('Content-type: image/png');
echo $image;
?>
```
php ReflectionClassConstant::getDeclaringClass ReflectionClassConstant::getDeclaringClass
==========================================
(PHP 7 >= 7.1.0, PHP 8)
ReflectionClassConstant::getDeclaringClass — Gets declaring class
### Description
```
public ReflectionClassConstant::getDeclaringClass(): ReflectionClass
```
Gets the declaring class.
### Parameters
This function has no parameters.
### Return Values
A [ReflectionClass](class.reflectionclass) object.
php stats_rand_get_seeds stats\_rand\_get\_seeds
=======================
(PECL stats >= 1.0.0)
stats\_rand\_get\_seeds — Get the seed values of the random number generator
### Description
```
stats_rand_get_seeds(): array
```
Returns the current seed values of the random number generator
### Parameters
This function has no parameters.
### Return Values
Returns an array of two integers.
php json_decode json\_decode
============
(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL json >= 1.2.0)
json\_decode — Decodes a JSON string
### Description
```
json_decode(
string $json,
?bool $associative = null,
int $depth = 512,
int $flags = 0
): mixed
```
Takes a JSON encoded string and converts it into a PHP value.
### Parameters
`json`
The `json` string being decoded.
This function only works with UTF-8 encoded strings.
>
> **Note**:
>
>
> PHP implements a superset of JSON as specified in the original [» RFC 7159](http://www.faqs.org/rfcs/rfc7159).
>
>
`associative`
When **`true`**, JSON objects will be returned as associative arrays; when **`false`**, JSON objects will be returned as objects. When **`null`**, JSON objects will be returned as associative arrays or objects depending on whether **`JSON_OBJECT_AS_ARRAY`** is set in the `flags`.
`depth`
Maximum nesting depth of the structure being decoded. The value must be greater than `0`, and less than or equal to `2147483647`.
`flags`
Bitmask of **`JSON_BIGINT_AS_STRING`**, **`JSON_INVALID_UTF8_IGNORE`**, **`JSON_INVALID_UTF8_SUBSTITUTE`**, **`JSON_OBJECT_AS_ARRAY`**, **`JSON_THROW_ON_ERROR`**. The behaviour of these constants is described on the [JSON constants](https://www.php.net/manual/en/json.constants.php) page.
### Return Values
Returns the value encoded in `json` in appropriate PHP type. Values `true`, `false` and `null` are returned as **`true`**, **`false`** and **`null`** respectively. **`null`** is returned if the `json` cannot be decoded or if the encoded data is deeper than the nesting limit.
### Errors/Exceptions
If `depth` is outside the allowed range, a [ValueError](class.valueerror) is thrown as of PHP 8.0.0, while previously, an error of level **`E_WARNING`** was raised.
### Changelog
| Version | Description |
| --- | --- |
| 7.3.0 | **`JSON_THROW_ON_ERROR`** `flags` was added. |
| 7.2.0 | `associative` is nullable now. |
| 7.2.0 | **`JSON_INVALID_UTF8_IGNORE`**, and **`JSON_INVALID_UTF8_SUBSTITUTE`** `flags` were added. |
| 7.1.0 | An empty JSON key ("") can be encoded to the empty object property instead of using a key with value `_empty_`. |
### Examples
**Example #1 **json\_decode()** examples**
```
<?php
$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
var_dump(json_decode($json));
var_dump(json_decode($json, true));
?>
```
The above example will output:
```
object(stdClass)#1 (5) {
["a"] => int(1)
["b"] => int(2)
["c"] => int(3)
["d"] => int(4)
["e"] => int(5)
}
array(5) {
["a"] => int(1)
["b"] => int(2)
["c"] => int(3)
["d"] => int(4)
["e"] => int(5)
}
```
**Example #2 Accessing invalid object properties**
Accessing elements within an object that contain characters not permitted under PHP's naming convention (e.g. the hyphen) can be accomplished by encapsulating the element name within braces and the apostrophe.
```
<?php
$json = '{"foo-bar": 12345}';
$obj = json_decode($json);
print $obj->{'foo-bar'}; // 12345
?>
```
**Example #3 common mistakes using **json\_decode()****
```
<?php
// the following strings are valid JavaScript but not valid JSON
// the name and value must be enclosed in double quotes
// single quotes are not valid
$bad_json = "{ 'bar': 'baz' }";
json_decode($bad_json); // null
// the name must be enclosed in double quotes
$bad_json = '{ bar: "baz" }';
json_decode($bad_json); // null
// trailing commas are not allowed
$bad_json = '{ bar: "baz", }';
json_decode($bad_json); // null
?>
```
**Example #4 `depth` errors**
```
<?php
// Encode some data with a maximum depth of 4 (array -> array -> array -> string)
$json = json_encode(
array(
1 => array(
'English' => array(
'One',
'January'
),
'French' => array(
'Une',
'Janvier'
)
)
)
);
// Show the errors for different depths.
var_dump(json_decode($json, true, 4));
echo 'Last error: ', json_last_error_msg(), PHP_EOL, PHP_EOL;
var_dump(json_decode($json, true, 3));
echo 'Last error: ', json_last_error_msg(), PHP_EOL, PHP_EOL;
?>
```
The above example will output:
```
array(1) {
[1]=>
array(2) {
["English"]=>
array(2) {
[0]=>
string(3) "One"
[1]=>
string(7) "January"
}
["French"]=>
array(2) {
[0]=>
string(3) "Une"
[1]=>
string(7) "Janvier"
}
}
}
Last error: No error
NULL
Last error: Maximum stack depth exceeded
```
**Example #5 **json\_decode()** of large integers**
```
<?php
$json = '{"number": 12345678901234567890}';
var_dump(json_decode($json));
var_dump(json_decode($json, false, 512, JSON_BIGINT_AS_STRING));
?>
```
The above example will output:
```
object(stdClass)#1 (1) {
["number"]=>
float(1.2345678901235E+19)
}
object(stdClass)#1 (1) {
["number"]=>
string(20) "12345678901234567890"
}
```
### Notes
>
> **Note**:
>
>
> The JSON spec is not JavaScript, but a subset of JavaScript.
>
>
>
> **Note**:
>
>
> In the event of a failure to decode, [json\_last\_error()](function.json-last-error) can be used to determine the exact nature of the error.
>
>
### See Also
* [json\_encode()](function.json-encode) - Returns the JSON representation of a value
* [json\_last\_error()](function.json-last-error) - Returns the last error occurred
php Collator::sortWithSortKeys Collator::sortWithSortKeys
==========================
collator\_sort\_with\_sort\_keys
================================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
Collator::sortWithSortKeys -- collator\_sort\_with\_sort\_keys — Sort array using specified collator and sort keys
### Description
Object-oriented style
```
public Collator::sortWithSortKeys(array &$array): bool
```
Procedural style
```
collator_sort_with_sort_keys(Collator $object, array &$array): bool
```
Similar to [collator\_sort()](collator.sort) but uses ICU sorting keys produced by ucol\_getSortKey() to gain more speed on large arrays.
### Parameters
`object`
[Collator](class.collator) object.
`array`
Array of strings to sort
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **collator\_sort\_with\_sort\_keys()** example**
```
<?php
$arr = array( 'Köpfe', 'Kypper', 'Kopfe' );
$coll = collator_create( 'sv' );
collator_sort_with_sort_keys( $coll, $arr );
var_export( $arr );
?>
```
The above example will output:
```
array (
0 => 'Kopfe',
1 => 'Kypper',
2 => 'Köpfe',
)
```
### See Also
* [[Collator](class.collator) constants](class.collator#intl.collator-constants)
* [collator\_sort()](collator.sort) - Sort array using specified collator
* [collator\_asort()](collator.asort) - Sort array maintaining index association
php PDOStatement::rowCount PDOStatement::rowCount
======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0)
PDOStatement::rowCount — Returns the number of rows affected by the last SQL statement
### Description
```
public PDOStatement::rowCount(): int
```
**PDOStatement::rowCount()** returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement executed by the corresponding `PDOStatement` object.
For statements that produce result sets, such as `SELECT`, the behavior is undefined and can be different for each driver. Some databases may return the number of rows produced by that statement (e.g. MySQL in buffered mode), but this behaviour is not guaranteed for all databases and should not be relied on for portable applications.
>
> **Note**:
>
>
> This method returns "0" (zero) with the SQLite driver at all times, and with the PostgreSQL driver only when setting the **`PDO::ATTR_CURSOR`** statement attribute to **`PDO::CURSOR_SCROLL`**.
>
>
### Parameters
This function has no parameters.
### Return Values
Returns the number of rows.
### Examples
**Example #1 Return the number of deleted rows**
**PDOStatement::rowCount()** returns the number of rows affected by a DELETE, INSERT, or UPDATE statement.
```
<?php
/* Delete all rows from the FRUIT table */
$del = $dbh->prepare('DELETE FROM fruit');
$del->execute();
/* Return number of rows that were deleted */
print("Return number of rows that were deleted:\n");
$count = $del->rowCount();
print("Deleted $count rows.\n");
?>
```
The above example will output something similar to:
```
Return number of rows that were deleted:
Deleted 9 rows.
```
**Example #2 Counting rows returned by a SELECT statement**
For most databases, **PDOStatement::rowCount()** does not return the number of rows affected by a SELECT statement. Instead, use [PDO::query()](pdo.query) to issue a SELECT COUNT(\*) statement with the same predicates as your intended SELECT statement, then use [PDOStatement::fetchColumn()](pdostatement.fetchcolumn) to retrieve the number of matching rows.
```
<?php
$sql = "SELECT COUNT(*) FROM fruit WHERE calories > 100";
$res = $conn->query($sql);
$count = $res->fetchColumn();
print "There are " . $count . " matching records.";
```
The above example will output something similar to:
```
There are 2 matching records.
```
### See Also
* [PDOStatement::columnCount()](pdostatement.columncount) - Returns the number of columns in the result set
* [PDOStatement::fetchColumn()](pdostatement.fetchcolumn) - Returns a single column from the next row of a result set
* [PDO::query()](pdo.query) - Prepares and executes an SQL statement without placeholders
php timezone_location_get timezone\_location\_get
=======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
timezone\_location\_get — Alias of [DateTimeZone::getLocation()](datetimezone.getlocation)
### Description
This function is an alias of: [DateTimeZone::getLocation()](datetimezone.getlocation)
php Threaded::wait Threaded::wait
==============
(PECL pthreads >= 2.0.0)
Threaded::wait — Synchronization
### Description
```
public Threaded::wait(int $timeout = ?): bool
```
Will cause the calling context to wait for notification from the referenced object
### Parameters
`timeout`
An optional timeout in microseconds
### 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->notify();
}, $my);
var_dump($my->join());
?>
```
The above example will output:
```
bool(true)
```
php PharData::buildFromDirectory PharData::buildFromDirectory
============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
PharData::buildFromDirectory — Construct a tar/zip archive from the files within a directory
### Description
```
public PharData::buildFromDirectory(string $directory, string $pattern = ""): array
```
Populate a tar/zip archive from directory contents. The optional second parameter is a regular expression (pcre) that is used to exclude files. Any filename that matches the regular expression will be included, all others will be excluded. For more fine-grained control, use [PharData::buildFromIterator()](phardata.buildfromiterator).
### Parameters
`directory`
The full or relative path to the directory that contains all files to add to the archive.
`pattern`
An optional pcre regular expression that is used to filter the list of files. Only file paths matching the regular expression will be included in the archive.
### Return Values
[Phar::buildFromDirectory()](phar.buildfromdirectory) returns an associative array mapping internal path of file to the full path of the file on the filesystem, or **`false`** on failure.
### Errors/Exceptions
This method throws [BadMethodCallException](class.badmethodcallexception) when unable to instantiate the internal directory iterators, or a [PharException](class.pharexception) if there were errors saving the phar archive.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | **PharData::buildFromDirectory()** no longer returns **`false`**. |
### Examples
**Example #1 A **PharData::buildFromDirectory()** example**
```
<?php
$phar = new PharData('project.tar');
// add all files in the project
$phar->buildFromDirectory(dirname(__FILE__) . '/project');
$phar2 = new PharData('project2.zip');
// add all files in the project, only include php files
$phar2->buildFromDirectory(dirname(__FILE__) . '/project', '/\.php$/');
?>
```
### See Also
* [Phar::buildFromDirectory()](phar.buildfromdirectory) - Construct a phar archive from the files within a directory
* [PharData::buildFromIterator()](phardata.buildfromiterator) - Construct a tar or zip archive from an iterator
php ftruncate ftruncate
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
ftruncate — Truncates a file to a given length
### Description
```
ftruncate(resource $stream, int $size): bool
```
Takes the filepointer, `stream`, and truncates the file to length, `size`.
### Parameters
`stream`
The file pointer.
>
> **Note**:
>
>
> The `stream` must be open for writing.
>
>
`size`
The size to truncate to.
>
> **Note**:
>
>
> If `size` is larger than the file then the file is extended with null bytes.
>
> If `size` is smaller than the file then the file is truncated to that size.
>
>
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 File truncation example**
```
<?php
$filename = 'lorem_ipsum.txt';
$handle = fopen($filename, 'r+');
ftruncate($handle, rand(1, filesize($filename)));
rewind($handle);
echo fread($handle, filesize($filename));
fclose($handle);
?>
```
### Notes
>
> **Note**:
>
>
> The file pointer is *not* changed.
>
>
### See Also
* [fopen()](function.fopen) - Opens file or URL
* [fseek()](function.fseek) - Seeks on a file pointer
| programming_docs |
php ImagickPixel::setColorValueQuantum ImagickPixel::setColorValueQuantum
==================================
(PECL imagick 2 >=2.3.0, PECL imagick 3)
ImagickPixel::setColorValueQuantum — Description
### Description
```
public ImagickPixel::setColorValueQuantum(int $color, int|float $value): bool
```
Sets the quantum value of a color element of the ImagickPixel.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`color`
Which color element to set e.g. \Imagick::COLOR\_GREEN.
`value`
The quantum value to set the color element to. This should be a float if ImageMagick was compiled with HDRI otherwise an int in the range 0 to Imagick::getQuantum().
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **ImagickPixel::setColorValueQuantum()****
```
<?php
function setColorValueQuantum() {
$image = new \Imagick();
$quantumRange = $image->getQuantumRange();
$draw = new \ImagickDraw();
$color = new \ImagickPixel('blue');
$color->setcolorValueQuantum(\Imagick::COLOR_RED, 128 * $quantumRange['quantumRangeLong'] / 256);
$draw->setstrokewidth(1.0);
$draw->setStrokeColor($color);
$draw->setFillColor($color);
$draw->rectangle(200, 200, 300, 300);
$image->newImage(500, 500, "SteelBlue2");
$image->setImageFormat("png");
$image->drawImage($draw);
header("Content-Type: image/png");
echo $image->getImageBlob();
}
?>
```
php SolrQuery::setTermsReturnRaw SolrQuery::setTermsReturnRaw
============================
(PECL solr >= 0.9.2)
SolrQuery::setTermsReturnRaw — Return the raw characters of the indexed term
### Description
```
public SolrQuery::setTermsReturnRaw(bool $flag): SolrQuery
```
If true, return the raw characters of the indexed term, regardless of if it is human readable
### Parameters
`value`
**`true`** or **`false`**
### Return Values
Returns the current SolrQuery object, if the return value is used.
php ArrayObject::offsetUnset ArrayObject::offsetUnset
========================
(PHP 5, PHP 7, PHP 8)
ArrayObject::offsetUnset — Unsets the value at the specified index
### Description
```
public ArrayObject::offsetUnset(mixed $key): void
```
Unsets the value at the specified index.
### Parameters
`key`
The index being unset.
### Return Values
No value is returned.
### Examples
**Example #1 **ArrayObject::offsetUnset()** example**
```
<?php
$arrayobj = new ArrayObject(array(0=>'zero',2=>'two'));
$arrayobj->offsetUnset(2);
var_dump($arrayobj);
?>
```
The above example will output:
```
object(ArrayObject)#1 (1) {
[0]=>
string(4) "zero"
}
```
php imap_open imap\_open
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_open — Open an IMAP stream to a mailbox
### Description
```
imap_open(
string $mailbox,
string $user,
string $password,
int $flags = 0,
int $retries = 0,
array $options = []
): IMAP\Connection|false
```
Opens an IMAP stream to a `mailbox`.
This function can also be used to open streams to POP3 and NNTP servers, but some functions and features are only available on IMAP servers.
### Parameters
`mailbox`
A mailbox name consists of a server and a mailbox path on this server. The special name `INBOX` stands for the current users personal mailbox. Mailbox names that contain international characters besides those in the printable ASCII space have to be encoded with [imap\_utf7\_encode()](function.imap-utf7-encode).
**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.
The server part, which is enclosed in '{' and '}', consists of the servers name or ip address, an optional port (prefixed by ':'), and an optional protocol specification (prefixed by '/').
The server part is mandatory in all mailbox parameters.
All names which start with `{` are remote names, and are in the form `"{" remote_system_name [":" port] [flags] "}"
[mailbox_name]` where:
* `remote_system_name` - Internet domain name or bracketed IP address of server.
* `port` - optional TCP port number, default is the default port for that service
* `flags` - optional flags, see following table.
* `mailbox_name` - remote mailbox name, default is INBOX
**Optional flags for names**| Flag | Description |
| --- | --- |
| `/service=`*service* | mailbox access service, default is "imap" |
| `/user=`*user* | remote user name for login on the server |
| `/authuser=`*user* | remote authentication user; if specified this is the user name whose password is used (e.g. administrator) |
| `/anonymous` | remote access as anonymous user |
| `/debug` | record protocol telemetry in application's debug log |
| `/secure` | do not transmit a plaintext password over the network |
| `/imap`, `/imap2`, `/imap2bis`, `/imap4`, `/imap4rev1` | equivalent to `/service=imap` |
| `/pop3` | equivalent to `/service=pop3` |
| `/nntp` | equivalent to `/service=nntp` |
| `/norsh` | do not use rsh or ssh to establish a preauthenticated IMAP session |
| `/ssl` | use the `Secure Socket Layer` to encrypt the session |
| `/validate-cert` | validate certificates from TLS/SSL server (this is the default behavior) |
| `/novalidate-cert` | do not validate certificates from TLS/SSL server, needed if server uses self-signed certificates |
| `/tls` | force use of `start-TLS` to encrypt the session, and reject connection to servers that do not support it |
| `/notls` | do not do `start-TLS` to encrypt the session, even with servers that support it |
| `/readonly` | request read-only mailbox open (IMAP only; ignored on NNTP, and an error with SMTP and POP3) |
`user`
The user name
`password`
The password associated with the `user`
`flags`
The `flags` are a bit mask with one or more of the following:
* **`OP_READONLY`** - Open mailbox read-only
* **`OP_ANONYMOUS`** - Don't use or update a .newsrc for news (NNTP only)
* **`OP_HALFOPEN`** - For IMAP and NNTP names, open a connection but don't open a mailbox.
* **`CL_EXPUNGE`** - Expunge mailbox automatically upon mailbox close (see also [imap\_delete()](function.imap-delete) and [imap\_expunge()](function.imap-expunge))
* **`OP_DEBUG`** - Debug protocol negotiations
* **`OP_SHORTCACHE`** - Short (`elt`-only) caching
* **`OP_SILENT`** - Don't pass up events (internal use)
* **`OP_PROTOTYPE`** - Return driver prototype
* **`OP_SECURE`** - Don't do non-secure authentication
`retries`
Number of maximum connect attempts
`options`
Connection parameters, the following (string) keys maybe used to set one or more connection parameters:
* `DISABLE_AUTHENTICATOR` - Disable authentication properties
### Return Values
Returns an [IMAP\Connection](class.imap-connection) instance on success, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | Returns an [IMAP\Connection](class.imap-connection) instance now; previously, a [resource](language.types.resource) was returned. |
### Examples
**Example #1 Different use of **imap\_open()****
```
<?php
// To connect to an IMAP server running on port 143 on the local machine,
// do the following:
$mbox = imap_open("{localhost:143}INBOX", "user_id", "password");
// To connect to a POP3 server on port 110 on the local server, use:
$mbox = imap_open ("{localhost:110/pop3}INBOX", "user_id", "password");
// To connect to an SSL IMAP or POP3 server, add /ssl after the protocol
// specification:
$mbox = imap_open ("{localhost:993/imap/ssl}INBOX", "user_id", "password");
// To connect to an SSL IMAP or POP3 server with a self-signed certificate,
// add /ssl/novalidate-cert after the protocol specification:
$mbox = imap_open ("{localhost:995/pop3/ssl/novalidate-cert}", "user_id", "password");
// To connect to an NNTP server on port 119 on the local server, use:
$nntp = imap_open ("{localhost:119/nntp}comp.test", "", "");
// To connect to a remote server replace "localhost" with the name or the
// IP address of the server you want to connect to.
?>
```
**Example #2 **imap\_open()** example**
```
<?php
$mbox = imap_open("{imap.example.org:143}", "username", "password");
echo "<h1>Mailboxes</h1>\n";
$folders = imap_listmailbox($mbox, "{imap.example.org:143}", "*");
if ($folders == false) {
echo "Call failed<br />\n";
} else {
foreach ($folders as $val) {
echo $val . "<br />\n";
}
}
echo "<h1>Headers in INBOX</h1>\n";
$headers = imap_headers($mbox);
if ($headers == false) {
echo "Call failed<br />\n";
} else {
foreach ($headers as $val) {
echo $val . "<br />\n";
}
}
imap_close($mbox);
?>
```
### See Also
* [imap\_close()](function.imap-close) - Close an IMAP stream
php V8Js::registerExtension V8Js::registerExtension
=======================
(PECL v8js >= 0.1.0)
V8Js::registerExtension — Register Javascript extensions for V8Js
### Description
```
public static V8Js::registerExtension(
string $extension_name,
string $script,
array $dependencies = array(),
bool $auto_enable = false
): bool
```
Registers passed Javascript `script` as extension to be used in [V8Js](class.v8js) contexts.
### Parameters
`extension_name`
Name of the extension to be registered.
`script`
The Javascript code to be registered.
`dependencies`
Array of extension names the extension to be registered depends on. Any such extension is enabled automatically when this extension is loaded.
>
> **Note**:
>
>
> All extensions, including the dependencies, must be registered before any [V8Js](class.v8js) are created which use them.
>
>
`auto_enable`
If set to **`true`**, the extension will be enabled automatically in all [V8Js](class.v8js) contexts.
### Return Values
Returns **`true`** if extension was registered successfully, **`false`** otherwise.
php readline_redisplay readline\_redisplay
===================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
readline\_redisplay — Redraws the display
### Description
```
readline_redisplay(): void
```
Redraws readline to redraw the display.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php GmagickDraw::setfillopacity GmagickDraw::setfillopacity
===========================
(PECL gmagick >= Unknown)
GmagickDraw::setfillopacity — The setfillopacity purpose
### Description
```
public GmagickDraw::setfillopacity(float $fill_opacity): GmagickDraw
```
Sets the opacity to use when drawing using the fill color or fill texture. Setting it to 1.0 will make fill full opaque.
### Parameters
`fill_opacity`
Fill opacity
### Return Values
The [GmagickDraw](class.gmagickdraw) object.
php sqlsrv_get_config sqlsrv\_get\_config
===================
(No version information available, might only be in Git)
sqlsrv\_get\_config — Returns the value of the specified configuration setting
### Description
```
sqlsrv_get_config(string $setting): mixed
```
Returns the value of the specified configuration setting.
### Parameters
`setting`
The name of the setting for which the value is returned. For a list of configurable settings, see [sqlsrv\_configure()](function.sqlsrv-configure).
### Return Values
Returns the value of the specified setting. If an invalid setting is specified, **`false`** is returned.
### See Also
* [sqlsrv\_configure()](function.sqlsrv-configure) - Changes the driver error handling and logging configurations
php DateTimeZone::getTransitions DateTimeZone::getTransitions
============================
timezone\_transitions\_get
==========================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
DateTimeZone::getTransitions -- timezone\_transitions\_get — Returns all transitions for the timezone
### Description
Object-oriented style
```
public DateTimeZone::getTransitions(int $timestampBegin = PHP_INT_MIN, int $timestampEnd = PHP_INT_MAX): array|false
```
Procedural style
```
timezone_transitions_get(DateTimeZone $object, int $timestampBegin = PHP_INT_MIN, int $timestampEnd = PHP_INT_MAX): array|false
```
### Parameters
`object`
Procedural style only: A [DateTimeZone](class.datetimezone) object returned by [timezone\_open()](function.timezone-open)
`timestampBegin`
Begin timestamp.
`timestampEnd`
End timestamp.
### Return Values
Returns a numerically indexed array of transition arrays on success, or **`false`** on failure. DateTimeZone objects wrapping type 1 (UTC offsets) and type 2 (abbreviations) do not contain any transitions, and calling this method on them will return **`false`**.
If `timestampBegin` is given, the first entry in the returned array will contain a transition element at the time of `timestampBegin`.
**Transition Array Structure**| Key | Type | Description |
| --- | --- | --- |
| `ts` | int | Unix timestamp |
| `time` | string | **`DateTimeInterface::ISO8601_EXPANDED`** (PHP 8.2 and later), or **`DateTimeInterface::ISO8601`** (PHP 8.1 and lower) time string |
| `offset` | int | Offset to UTC in seconds |
| `isdst` | bool | Whether daylight saving time is active |
| `abbr` | string | Timezone abbreviation |
### Examples
**Example #1 A [timezone\_transitions\_get()](function.timezone-transitions-get) example**
```
<?php
$timezone = new DateTimeZone("Europe/London");
$transitions = $timezone->getTransitions();
print_r(array_slice($transitions, 0, 3));
?>
```
The above example will output something similar to:
```
Array
(
[0] => Array
(
[ts] => -9223372036854775808
[time] => -292277022657-01-27T08:29:52+0000
[offset] => 3600
[isdst] => 1
[abbr] => BST
)
[1] => Array
(
[ts] => -1691964000
[time] => 1916-05-21T02:00:00+0000
[offset] => 3600
[isdst] => 1
[abbr] => BST
)
[2] => Array
(
[ts] => -1680472800
[time] => 1916-10-01T02:00:00+0000
[offset] => 0
[isdst] =>
[abbr] => GMT
)
)
```
**Example #2 A [timezone\_transitions\_get()](function.timezone-transitions-get) example with `timestampBegin` set**
```
<?php
$timezone = new DateTimeZone("Europe/London");
$transitions = $timezone->getTransitions(time());
print_r(array_slice($transitions, 0, 3));
?>
```
The above example will output something similar to:
```
Array
(
[0] => Array
(
[ts] => 1654184161
[time] => 2022-06-02T15:36:01+0000
[offset] => 3600
[isdst] => 1
[abbr] => BST
)
[1] => Array
(
[ts] => 1667091600
[time] => 2022-10-30T01:00:00+0000
[offset] => 0
[isdst] =>
[abbr] => GMT
)
[2] => Array
(
[ts] => 1679792400
[time] => 2023-03-26T01:00:00+0000
[offset] => 3600
[isdst] => 1
[abbr] => BST
)
)
```
php ReflectionMethod::invokeArgs ReflectionMethod::invokeArgs
============================
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
ReflectionMethod::invokeArgs — Invoke args
### Description
```
public ReflectionMethod::invokeArgs(?object $object, array $args): mixed
```
Invokes the reflected method and pass its arguments as array.
### Parameters
`object`
The object to invoke the method on. In case of static methods, you can pass null to this parameter.
`args`
The parameters to be passed to the function, as an array.
### Return Values
Returns the method result.
### Errors/Exceptions
A [ReflectionException](class.reflectionexception) if the `object` parameter does not contain an instance of the class that this method was declared in.
A [ReflectionException](class.reflectionexception) if the method invocation failed.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `args` keys will now be interpreted as parameter names, instead of being silently ignored. |
### Examples
**Example #1 **ReflectionMethod::invokeArgs()** example**
```
<?php
class HelloWorld {
public function sayHelloTo($name) {
return 'Hello ' . $name;
}
}
$reflectionMethod = new ReflectionMethod('HelloWorld', 'sayHelloTo');
echo $reflectionMethod->invokeArgs(new HelloWorld(), array('Mike'));
?>
```
The above example will output:
```
Hello Mike
```
### Notes
>
> **Note**:
>
>
> If the function has arguments that need to be references, then they must be references in the passed argument list.
>
>
### See Also
* [ReflectionMethod::invoke()](reflectionmethod.invoke) - Invoke
* [\_\_invoke()](language.oop5.magic#object.invoke)
* [call\_user\_func\_array()](function.call-user-func-array) - Call a callback with an array of parameters
php Error::getLine Error::getLine
==============
(PHP 7, PHP 8)
Error::getLine — Gets the line in which the error occurred
### Description
```
final public Error::getLine(): int
```
Get line number where the error occurred.
### Parameters
This function has no parameters.
### Return Values
Returns the line number where the error occurred.
### Examples
**Example #1 **Error::getLine()** example**
```
<?php
try {
throw new Error("Some error message");
} catch(Error $e) {
echo "The error was created on line: " . $e->getLine();
}
?>
```
The above example will output something similar to:
```
The error was created on line: 3
```
### See Also
* [Throwable::getLine()](throwable.getline) - Gets the line on which the object was instantiated
php shm_get_var shm\_get\_var
=============
(PHP 4, PHP 5, PHP 7, PHP 8)
shm\_get\_var — Returns a variable from shared memory
### Description
```
shm_get_var(SysvSharedMemory $shm, int $key): mixed
```
**shm\_get\_var()** returns the variable with a given `key`, in the given shared memory segment. The variable is still present in the shared memory.
### Parameters
`shm`
A shared memory segment obtained from [shm\_attach()](function.shm-attach).
`key`
The variable key.
### Return Values
Returns the variable with the given key.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `shm` expects a [SysvSharedMemory](class.sysvsharedmemory) instance now; previously, a resource was expected. |
### See Also
* [shm\_has\_var()](function.shm-has-var) - Check whether a specific entry exists
* [shm\_put\_var()](function.shm-put-var) - Inserts or updates a variable in shared memory
php imap_mutf7_to_utf8 imap\_mutf7\_to\_utf8
=====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
imap\_mutf7\_to\_utf8 — Decode a modified UTF-7 string to UTF-8
### Description
```
imap_mutf7_to_utf8(string $string): string|false
```
Decode a modified UTF-7 (as specified in RFC 2060, section 5.1.3) string to UTF-8.
>
> **Note**:
>
>
> This function is only available, if libcclient exports utf8\_to\_mutf7().
>
>
### Parameters
`string`
A string encoded in modified UTF-7.
### Return Values
Returns `string` converted to UTF-8, or **`false`** on failure.
### See Also
* [imap\_utf8\_to\_mutf7()](function.imap-utf8-to-mutf7) - Encode a UTF-8 string to modified UTF-7
php ldap_mod_replace_ext ldap\_mod\_replace\_ext
=======================
(PHP 7 >= 7.3.0, PHP 8)
ldap\_mod\_replace\_ext — Replace attribute values with new ones
### Description
```
ldap_mod_replace_ext(
LDAP\Connection $ldap,
string $dn,
array $entry,
?array $controls = null
): LDAP\Result|false
```
Does the same thing as [ldap\_mod\_replace()](function.ldap-mod-replace) but returns an [LDAP\Result](class.ldap-result) instance to be parsed with [ldap\_parse\_result()](function.ldap-parse-result).
### Parameters
See [ldap\_mod\_replace()](function.ldap-mod-replace)
### Return Values
Returns an [LDAP\Result](class.ldap-result) instance, 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 | Returns an [LDAP\Result](class.ldap-result) instance now; previously, a [resource](language.types.resource) was returned. |
| 8.0.0 | `controls` is nullable now; previously, it defaulted to `[]`. |
| 7.3.0 | Support for `controls` added |
### See Also
* [ldap\_mod\_replace()](function.ldap-mod-replace) - Replace attribute values with new ones
* [ldap\_parse\_result()](function.ldap-parse-result) - Extract information from result
| programming_docs |
php The ReflectionEnumUnitCase class
The ReflectionEnumUnitCase class
================================
Introduction
------------
(PHP 8 >= 8.1.0)
The **ReflectionEnumUnitCase** class reports information about an Enum unit case, which has no scalar equivalent.
Class synopsis
--------------
class **ReflectionEnumUnitCase** extends [ReflectionClassConstant](class.reflectionclassconstant) { /\* 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](reflectionenumunitcase.construct)(object|string `$class`, string `$constant`)
```
public getEnum(): ReflectionEnum
```
```
public getValue(): UnitEnum
```
/\* Inherited methods \*/
```
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)
* [ReflectionEnumBackedCase](class.reflectionenumbackedcase)
Table of Contents
-----------------
* [ReflectionEnumUnitCase::\_\_construct](reflectionenumunitcase.construct) — Instantiates a ReflectionEnumUnitCase object
* [ReflectionEnumUnitCase::getEnum](reflectionenumunitcase.getenum) — Gets the reflection of the enum of this case
* [ReflectionEnumUnitCase::getValue](reflectionenumunitcase.getvalue) — Gets the enum case object described by this reflection object
php SolrQuery::getFacetDateEnd SolrQuery::getFacetDateEnd
==========================
(PECL solr >= 0.9.2)
SolrQuery::getFacetDateEnd — Returns the value for the facet.date.end parameter
### Description
```
public SolrQuery::getFacetDateEnd(string $field_override = ?): string
```
Returns the value for the facet.date.end parameter. This method 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 ucfirst ucfirst
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
ucfirst — Make a string's first character uppercase
### Description
```
ucfirst(string $string): string
```
Returns a string with the first character of `string` capitalized, if that character is an ASCII character in the range from `"a"` (0x61) to `"z"` (0x7a).
### Parameters
`string`
The input string.
### Return Values
Returns the resulting 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 **ucfirst()** example**
```
<?php
$foo = 'hello world!';
$foo = ucfirst($foo); // Hello world!
$bar = 'HELLO WORLD!';
$bar = ucfirst($bar); // HELLO WORLD!
$bar = ucfirst(strtolower($bar)); // Hello world!
?>
```
### See Also
* [lcfirst()](function.lcfirst) - Make a string's first character lowercase
* [strtolower()](function.strtolower) - Make a string lowercase
* [strtoupper()](function.strtoupper) - Make a string uppercase
* [ucwords()](function.ucwords) - Uppercase the first character of each word in a string
* [mb\_convert\_case()](function.mb-convert-case) - Perform case folding on a string
php Gmagick::trimimage Gmagick::trimimage
==================
(PECL gmagick >= Unknown)
Gmagick::trimimage — Remove edges from the image
### Description
```
public Gmagick::trimimage(float $fuzz): Gmagick
```
Remove edges that are the background color from the image.
### Parameters
`fuzz`
By default target must match a particular pixel color exactly. However, in many cases two colors may differ by a small amount. The fuzz member of image defines how much tolerance is acceptable to consider two colors as the same. This parameter represents the variation on the quantum range.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php SolrQuery::getGroupCachePercent SolrQuery::getGroupCachePercent
===============================
(PECL solr >= 2.2.0)
SolrQuery::getGroupCachePercent — Returns group cache percent value
### Description
```
public SolrQuery::getGroupCachePercent(): int
```
Returns group cache percent value
### Parameters
This function has no parameters.
### Return Values
### See Also
* [SolrQuery::setGroupCachePercent()](solrquery.setgroupcachepercent) - Enables caching for result grouping
php Zookeeper::set Zookeeper::set
==============
(PECL zookeeper >= 0.1.0)
Zookeeper::set — Sets the data associated with a node
### Description
```
public Zookeeper::set(
string $path,
string $value,
int $version = -1,
array &$stat = null
): bool
```
### Parameters
`path`
The name of the node. Expressed as a file name with slashes separating ancestors of the node.
`value`
The data to be stored in the node.
`version`
The expected version of the node. The function will fail if the actual version of the node does not match the expected version. If -1 is used the version check will not take place.
`stat`
If not NULL, will hold the value of stat for the path on return.
### 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 save value to node.
**Caution** Since version 0.3.0, this method emits [ZookeeperException](class.zookeeperexception) and it's derivatives.
### Examples
**Example #1 **Zookeeper::set()** example**
Save value to node.
```
<?php
$zookeeper = new Zookeeper('locahost:2181');
$path = '/path/to/node';
$value = 'nodevalue';
$r = $zookeeper->set($path, $value);
if ($r)
echo 'SUCCESS';
else
echo 'ERR';
?>
```
The above example will output:
```
SUCCESS
```
### See Also
* [Zookeeper::create()](zookeeper.create) - Create a node synchronously
* [Zookeeper::get()](zookeeper.get) - Gets the data associated with a node synchronously
* [ZookeeperException](class.zookeeperexception)
php metaphone metaphone
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
metaphone — Calculate the metaphone key of a string
### Description
```
metaphone(string $string, int $max_phonemes = 0): string
```
Calculates the metaphone key of `string`.
Similar to [soundex()](function.soundex) metaphone creates the same key for similar sounding words. It's more accurate than [soundex()](function.soundex) as it knows the basic rules of English pronunciation. The metaphone generated keys are of variable length.
Metaphone was developed by Lawrence Philips <lphilips at verity dot com>. It is described in ["Practical Algorithms for Programmers", Binstock & Rex, Addison Wesley, 1995].
### Parameters
`string`
The input string.
`max_phonemes`
This parameter restricts the returned metaphone key to `max_phonemes` *characters* in length. However, the resulting phonemes are always transcribed completely, so the resulting string length may be slightly longer than `max_phonemes`. The default value of `0` means no restriction.
### Return Values
Returns the metaphone key as a string.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | The function returned **`false`** on failure. |
### Examples
**Example #1 **metaphone()** basic example**
```
<?php
var_dump(metaphone('programming'));
var_dump(metaphone('programmer'));
?>
```
The above example will output:
```
string(7) "PRKRMNK"
string(6) "PRKRMR"
```
**Example #2 Using the `max_phonemes` parameter**
```
<?php
var_dump(metaphone('programming', 5));
var_dump(metaphone('programmer', 5));
?>
```
The above example will output:
```
string(5) "PRKRM"
string(5) "PRKRM"
```
**Example #3 Using the `max_phonemes` parameter**
In this example, **metaphone()** is advised to produce a string of five characters, but that would require to split the final phoneme (`'x'` is supposed to be transcribed to `'KS'`), so the function returns a string with six characters.
```
<?php
var_dump(metaphone('Asterix', 5));
?>
```
The above example will output:
```
string(6) "ASTRKS"
```
php svn_checkout svn\_checkout
=============
(PECL svn >= 0.1.0)
svn\_checkout — Checks out a working copy from the repository
### Description
```
svn_checkout(
string $repos,
string $targetpath,
int $revision = ?,
int $flags = 0
): bool
```
Checks out a working copy from the repository at `repos` to `targetpath` at revision `revision`.
### Parameters
`repos`
String URL path to directory in repository to check out.
`targetpath`
String local path to directory to check out in to
> **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\_\_).
>
>
`revision`
Integer revision number of repository to check out. Default is HEAD, the most recent revision.
`flags`
Any combination of **`SVN_NON_RECURSIVE`** and **`SVN_IGNORE_EXTERNALS`**.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Basic example**
This example demonstrates how to check out a directory from a repository to a directory named calc:
```
<?php
svn_checkout('http://www.example.com/svnroot/calc/trunk', dirname(__FILE__) . '/calc');
?>
```
The `dirname(__FILE__)` call is necessary in order to convert the calc relative path into an absolute one. If calc exists, you can also use [realpath()](function.realpath) to retrieve an absolute 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.
### See Also
* [svn\_add()](function.svn-add) - Schedules the addition of an item in a working directory
* [svn\_commit()](function.svn-commit) - Sends changes from the local working copy to the repository
* [svn\_status()](function.svn-status) - Returns the status of working copy files and directories
* [svn\_update()](function.svn-update) - Update working copy
* [» SVN documentation on svn checkout](http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.checkout.html)
php streamWrapper::stream_open streamWrapper::stream\_open
===========================
(PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8)
streamWrapper::stream\_open — Opens file or URL
### Description
```
public streamWrapper::stream_open(
string $path,
string $mode,
int $options,
?string &$opened_path
): bool
```
This method is called immediately after the wrapper is initialized (f.e. by [fopen()](function.fopen) and [file\_get\_contents()](function.file-get-contents)).
### Parameters
`path`
Specifies the URL that was passed to the original function.
>
> **Note**:
>
>
> The URL can be broken apart with [parse\_url()](function.parse-url). Note that only URLs delimited by :// are supported. : and :/ while technically valid URLs, are not.
>
>
`mode`
The mode used to open the file, as detailed for [fopen()](function.fopen).
>
> **Note**:
>
>
> Remember to check if the `mode` is valid for the `path` requested.
>
>
`options`
Holds additional flags set by the streams API. It can hold one or more of the following values OR'd together.
| Flag | Description |
| --- | --- |
| **`STREAM_USE_PATH`** | If `path` is relative, search for the resource using the include\_path. |
| **`STREAM_REPORT_ERRORS`** | If this flag is set, you are responsible for raising errors using [trigger\_error()](function.trigger-error) during opening of the stream. If this flag is not set, you should not raise any errors. |
`opened_path`
If the `path` is opened successfully, and **`STREAM_USE_PATH`** is set in `options`, `opened_path` should be set to the full path of the file/resource that was actually opened.
### 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
* [fopen()](function.fopen) - Opens file or URL
* [parse\_url()](function.parse-url) - Parse a URL and return its components
php Yar_Server::handle Yar\_Server::handle
===================
(PECL yar >= 1.0.0)
Yar\_Server::handle — Start RPC Server
### Description
```
public Yar_Server::handle(): bool
```
Start a RPC HTTP server, and ready for accpet RPC requests.
>
> **Note**:
>
>
> Usual RPC calls will be issued as HTTP POST requests. If a HTTP GET request is issued to the uri, the service information (commented section above) will be printed on the page
>
>
### Parameters
This function has no parameters.
### Return Values
boolean
### Examples
**Example #1 **Yar\_Server::handle()** example**
```
<?php
class API {
/**
* the doc info will be generated automatically into service info page.
* @params
* @return
*/
public function some_method($parameter, $option = "foo") {
}
protected function client_can_not_see() {
}
}
$service = new Yar_Server(new API());
$service->handle();
?>
```
The above example will output something similar to:
### See Also
* [Yar\_Server::\_\_construct()](yar-server.construct) - Register a server
php gmp_lcm gmp\_lcm
========
(PHP 7 >= 7.3.0, PHP 8)
gmp\_lcm — Calculate LCM
### Description
```
gmp_lcm(GMP|int|string $num1, GMP|int|string $num2): GMP
```
This function computes the least common multiple (lcm) of `num1` and `num2`.
### 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
A [GMP](class.gmp) object.
### See Also
* [gmp\_gcd()](function.gmp-gcd) - Calculate GCD
php XMLWriter::startDtdAttlist XMLWriter::startDtdAttlist
==========================
xmlwriter\_start\_dtd\_attlist
==============================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::startDtdAttlist -- xmlwriter\_start\_dtd\_attlist — Create start DTD AttList
### Description
Object-oriented style
```
public XMLWriter::startDtdAttlist(string $name): bool
```
Procedural style
```
xmlwriter_start_dtd_attlist(XMLWriter $writer, string $name): bool
```
Starts 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 attribute list 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::endDtdAttlist()](xmlwriter.enddtdattlist) - End current DTD AttList
* [XMLWriter::writeDtdAttlist()](xmlwriter.writedtdattlist) - Write full DTD AttList tag
php sodium_crypto_core_ristretto255_add sodium\_crypto\_core\_ristretto255\_add
=======================================
(PHP 8 >= 8.1.0)
sodium\_crypto\_core\_ristretto255\_add — Adds an element
### Description
```
sodium_crypto_core_ristretto255_add(string $p, string $q): string
```
Adds an element `q` to `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\_add()** 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\_sub()](function.sodium-crypto-core-ristretto255-sub) - Subtracts an element
php MessageFormatter::parse MessageFormatter::parse
=======================
msgfmt\_parse
=============
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
MessageFormatter::parse -- msgfmt\_parse — Parse input string according to pattern
### Description
Object-oriented style
```
public MessageFormatter::parse(string $string): array|false
```
Procedural style
```
msgfmt_parse(MessageFormatter $formatter, string $string): array|false
```
Parses input string and return any extracted items as an array.
### Parameters
`formatter`
The message formatter
`string`
The string to parse
### Return Values
An array containing the items extracted, or **`false`** on error
### Examples
**Example #1 **msgfmt\_parse()** example**
```
<?php
$fmt = msgfmt_create('en_US', "{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree");
$res = msgfmt_parse($fmt, "4,560 monkeys on 123 trees make 37.073 monkeys per tree");
var_export($res);
$fmt = msgfmt_create('de', "{0,number,integer} Affen auf {1,number,integer} Bäumen sind {2,number} Affen pro Baum");
$res = msgfmt_parse($fmt, "4.560 Affen auf 123 Bäumen sind 37,073 Affen pro Baum");
var_export($res);
?>
```
**Example #2 OO example**
```
<?php
$fmt = new MessageFormatter('en_US', "{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree");
$res = $fmt->parse("4,560 monkeys on 123 trees make 37.073 monkeys per tree");
var_export($res);
$fmt = new MessageFormatter('de', "{0,number,integer} Affen auf {1,number,integer} Bäumen sind {2,number} Affen pro Baum");
$res = $fmt->parse("4.560 Affen auf 123 Bäumen sind 37,073 Affen pro Baum");
var_export($res);
?>
```
The above example will output:
```
array (
0 => 4560,
1 => 123,
2 => 37.073,
)
array (
0 => 4560,
1 => 123,
2 => 37.073,
)
```
### See Also
* [msgfmt\_create()](messageformatter.create) - Constructs a new Message Formatter
* [msgfmt\_format()](messageformatter.format) - Format the message
* [msgfmt\_parse\_message()](messageformatter.parsemessage) - Quick parse input string
| programming_docs |
php tidy::cleanRepair tidy::cleanRepair
=================
tidy\_clean\_repair
===================
(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.5.2)
tidy::cleanRepair -- tidy\_clean\_repair — Execute configured cleanup and repair operations on parsed markup
### Description
Object-oriented style
```
public tidy::cleanRepair(): bool
```
Procedural style
```
tidy_clean_repair(tidy $tidy): bool
```
This function cleans and repairs the given tidy `tidy`.
### Parameters
`tidy`
The [Tidy](class.tidy) object.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **tidy::cleanrepair()** example**
```
<?php
$html = '<p>test</I>';
$tidy = tidy_parse_string($html);
$tidy->cleanRepair();
echo $tidy;
?>
```
The above example will output:
```
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title></title>
</head>
<body>
<p>test</p>
</body>
</html>
```
### See Also
* [tidy::repairFile()](tidy.repairfile) - Repair a file and return it as a string
* [tidy::repairString()](tidy.repairstring) - Repair a string using an optionally provided configuration file
php Imagick::unsharpMaskImage Imagick::unsharpMaskImage
=========================
(PECL imagick 2, PECL imagick 3)
Imagick::unsharpMaskImage — Sharpens an image
### Description
```
public Imagick::unsharpMaskImage(
float $radius,
float $sigma,
float $amount,
float $threshold,
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, radius should be larger than sigma. Use a radius of 0 and Imagick::UnsharpMaskImage() selects a suitable radius for you.
### Parameters
`radius`
`sigma`
`amount`
`threshold`
`channel`
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::unsharpMaskImage()****
```
<?php
function unsharpMaskImage($imagePath, $radius, $sigma, $amount, $unsharpThreshold) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->unsharpMaskImage($radius, $sigma, $amount, $unsharpThreshold);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php gnupg_adddecryptkey gnupg\_adddecryptkey
====================
(PECL gnupg >= 0.5)
gnupg\_adddecryptkey — Add a key for decryption
### Description
```
gnupg_adddecryptkey(resource $identifier, string $fingerprint, string $passphrase): bool
```
### Parameters
`identifier`
The gnupg identifier, from a call to [gnupg\_init()](function.gnupg-init) or **gnupg**.
`fingerprint`
The fingerprint key.
`passphrase`
The pass phrase.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Procedural **gnupg\_adddecryptkey()** example**
```
<?php
$res = gnupg_init();
gnupg_adddecryptkey($res,"8660281B6051D071D94B5B230549F9DC851566DC","test");
?>
```
**Example #2 OO **gnupg\_adddecryptkey()** example**
```
<?php
$gpg = new gnupg();
$gpg->adddecryptkey("8660281B6051D071D94B5B230549F9DC851566DC","test");
?>
```
php IntlDateFormatter::getLocale IntlDateFormatter::getLocale
============================
datefmt\_get\_locale
====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
IntlDateFormatter::getLocale -- datefmt\_get\_locale — Get the locale used by formatter
### Description
Object-oriented style
```
public IntlDateFormatter::getLocale(int $type = ULOC_ACTUAL_LOCALE): string|false
```
Procedural style
```
datefmt_get_locale(IntlDateFormatter $formatter, int $type = ULOC_ACTUAL_LOCALE): string|false
```
Get locale used by the formatter.
### Parameters
`formatter`
The formatter resource
`type`
You can choose between valid and actual locale ( **`Locale::VALID_LOCALE`**, **`Locale::ACTUAL_LOCALE`**, respectively). The default is the actual locale.
### Return Values
The locale of this formatter, or **`false`** on failure.
### Examples
**Example #1 **datefmt\_get\_locale()** example**
```
<?php
$fmt = datefmt_create(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'locale of the formatter is : ' . datefmt_get_locale($fmt);
echo 'First Formatted output is ' . datefmt_format($fmt, 0);
$fmt = datefmt_create(
'de-DE',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'locale of the formatter is : ' . datefmt_get_locale($fmt);
echo 'Second Formatted output is ' . datefmt_format($fmt, 0);
?>
```
**Example #2 OO example**
```
<?php
$fmt = new IntlDateFormatter(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'locale of the formatter is : ' . $fmt->getLocale();
echo 'First Formatted output is ' . $fmt->format(0);
$fmt = new IntlDateFormatter(
'de-DE',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'locale of the formatter is : ' . $fmt->getLocale();
echo 'Second Formatted output is ' . $fmt->format(0);
?>
```
The above example will output:
```
locale of the formatter is : en
First Formatted output is Wednesday, December 31, 1969 4:00:00 PM PT
locale of the formatter is : de
Second Formatted output is Mittwoch, 31. Dezember 1969 16:00 Uhr GMT-08:00
```
### See Also
* [datefmt\_create()](intldateformatter.create) - Create a date formatter
php imagecopy imagecopy
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
imagecopy — Copy part of an image
### Description
```
imagecopy(
GdImage $dst_image,
GdImage $src_image,
int $dst_x,
int $dst_y,
int $src_x,
int $src_y,
int $src_width,
int $src_height
): bool
```
Copy a part of `src_image` onto `dst_image` starting at the x,y coordinates `src_x`, `src_y` with a width of `src_width` and a height of `src_height`. The portion defined will be copied onto the x,y coordinates, `dst_x` and `dst_y`.
### Parameters
`dst_image`
Destination image resource.
`src_image`
Source image resource.
`dst_x`
x-coordinate of destination point.
`dst_y`
y-coordinate of destination point.
`src_x`
x-coordinate of source point.
`src_y`
y-coordinate of source point.
`src_width`
Source width.
`src_height`
Source height.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `dst_image` and `src_image` expect [GdImage](class.gdimage) instances now; previously, resources were expected. |
### Examples
**Example #1 Cropping the PHP.net logo**
```
<?php
// Create image instances
$src = imagecreatefromgif('php.gif');
$dest = imagecreatetruecolor(80, 40);
// Copy
imagecopy($dest, $src, 0, 0, 20, 13, 80, 40);
// Output and free from memory
header('Content-Type: image/gif');
imagegif($dest);
imagedestroy($dest);
imagedestroy($src);
?>
```
The above example will output something similar to:
### See Also
* [imagecrop()](function.imagecrop) - Crop an image to the given rectangle
php fdf_next_field_name fdf\_next\_field\_name
======================
(PHP 4, PHP 5 < 5.3.0, PECL fdf SVN)
fdf\_next\_field\_name — Get the next field name
### Description
```
fdf_next_field_name(resource $fdf_document, string $fieldname = ?): string
```
Gets the name of the field after the given field. This name can be used with several functions.
### 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. If not given, the first field will be assumed.
### Return Values
Returns the field name as a string.
### Examples
**Example #1 Detecting all fieldnames in a FDF**
```
<?php
$fdf = fdf_open($HTTP_FDF_DATA);
for ($field = fdf_next_field_name($fdf);
$field != "";
$field = fdf_next_field_name($fdf, $field)) {
echo "field: $field\n";
}
?>
```
### See Also
* [fdf\_get\_value()](function.fdf-get-value) - Get the value of a field
php sodium_crypto_stream_keygen sodium\_crypto\_stream\_keygen
==============================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_stream\_keygen — Generate a random sodium\_crypto\_stream key.
### Description
```
sodium_crypto_stream_keygen(): string
```
Generate a key for use with [sodium\_crypto\_stream()](function.sodium-crypto-stream) and [sodium\_crypto\_stream\_xor()](function.sodium-crypto-stream-xor).
### Parameters
This function has no parameters.
### Return Values
Encryption key (256-bit).
php CallbackFilterIterator::__construct CallbackFilterIterator::\_\_construct
=====================================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
CallbackFilterIterator::\_\_construct — Create a filtered iterator from another iterator
### Description
public **CallbackFilterIterator::\_\_construct**([Iterator](class.iterator) `$iterator`, [callable](language.types.callable) `$callback`) Creates a filtered iterator using the `callback` to determine which items are accepted or rejected.
### Parameters
`iterator`
The iterator to be filtered.
`callback`
The callback, which should return **`true`** to accept the current item or **`false`** otherwise. See [Examples](class.callbackfilteriterator#callbackfilteriterator.examples).
May be any valid [callable](language.types.callable) value.
### See Also
* [CallbackFilterIterator Examples](class.callbackfilteriterator#callbackfilteriterator.examples)
* [CallbackFilterIterator::accept()](callbackfilteriterator.accept) - Calls the callback with the current value, the current key and the inner iterator as arguments
php Ds\Deque::sum Ds\Deque::sum
=============
(PECL ds >= 1.0.0)
Ds\Deque::sum — Returns the sum of all values in the deque
### Description
```
public Ds\Deque::sum(): int|float
```
Returns the sum of all values in the deque.
>
> **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 deque as either a float or int depending on the values in the deque.
### Examples
**Example #1 **Ds\Deque::sum()** integer example**
```
<?php
$deque = new \Ds\Deque([1, 2, 3]);
var_dump($deque->sum());
?>
```
The above example will output something similar to:
```
int(6)
```
**Example #2 **Ds\Deque::sum()** float example**
```
<?php
$deque = new \Ds\Deque([1, 2.5, 3]);
var_dump($deque->sum());
?>
```
The above example will output something similar to:
```
float(6.5)
```
php SplFileObject::key SplFileObject::key
==================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::key — Get line number
### Description
```
public SplFileObject::key(): int
```
Gets the current line number.
>
> **Note**:
>
>
> This number may not reflect the actual line number in the file if [SplFileObject::setMaxLineLen()](splfileobject.setmaxlinelen) is used to read fixed lengths of the file.
>
>
### Parameters
This function has no parameters.
### Return Values
Returns the current line number.
### Examples
**Example #1 **SplFileObject::key()** example**
```
<?php
$file = new SplFileObject("lipsum.txt");
foreach ($file as $line) {
echo $file->key() . ". " . $line;
}
?>
```
The above example will output something similar to:
```
0. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
1. Duis nec sapien felis, ac sodales nisl.
2. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
```
**Example #2 **SplFileObject::key()** example with [SplFileObject::setMaxLineLen()](splfileobject.setmaxlinelen)**
```
<?php
$file = new SplFileObject("lipsum.txt");
$file->setMaxLineLen(20);
foreach ($file as $line) {
echo $file->key() . ". " . $line . "\n";
}
?>
```
The above example will output something similar to:
```
0. Lorem ipsum dolor s
1. it amet, consectetu
2. r adipiscing elit.
3.
4. Duis nec sapien fel
5. is, ac sodales nisl
6. .
7. Lorem ipsum dolor s
8. it amet, consectetu
9. r adipiscing elit.
```
### See Also
* [SplFileObject::current()](splfileobject.current) - Retrieve current line of file
* [SplFileObject::seek()](splfileobject.seek) - Seek to specified line
* [SplFileObject::next()](splfileobject.next) - Read next line
* [SplFileObject::rewind()](splfileobject.rewind) - Rewind the file to the first line
* [SplFileObject::valid()](splfileobject.valid) - Not at EOF
php dba_fetch dba\_fetch
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
dba\_fetch — Fetch data specified by key
### Description
```
dba_fetch(string|array $key, resource $dba, int $skip = 0): string|false
```
Discouraged overloaded signature:
```
dba_fetch(string $key, int $skip, resource $dba): string
```
**dba\_fetch()** fetches the data specified by `key` from the database specified with `dba`.
### Parameters
`key`
The key the data is specified by.
>
> **Note**:
>
>
> When working with inifiles this function accepts arrays as keys where index 0 is the group and index 1 is the value name. See: [dba\_key\_split()](function.dba-key-split).
>
>
`dba`
The database handler, returned by [dba\_open()](function.dba-open) or [dba\_popen()](function.dba-popen).
`skip`
The number of key-value pairs to ignore when using cdb databases. This value is ignored for all other databases which do not support multiple keys with the same name.
### Return Values
Returns the associated string if the key/data pair is found, **`false`** otherwise.
### Changelog
| Version | Description |
| --- | --- |
| 8.2.0 | **dba\_fetch()**'s optional skip argument is now at the end in line with PHP userland semantics. The previously overloaded signature is still accepted but discouraged. |
### See Also
* [dba\_exists()](function.dba-exists) - Check whether key exists
* [dba\_delete()](function.dba-delete) - Delete DBA entry specified by key
* [dba\_insert()](function.dba-insert) - Insert entry
* [dba\_replace()](function.dba-replace) - Replace or insert entry
* [dba\_key\_split()](function.dba-key-split) - Splits a key in string representation into array representation
php Imagick::getImageChannelDistortions Imagick::getImageChannelDistortions
===================================
(PECL imagick 2 >= 2.3.0, PECL imagick 3)
Imagick::getImageChannelDistortions — Gets channel distortions
### Description
```
public Imagick::getImageChannelDistortions(Imagick $reference, int $metric, int $channel = Imagick::CHANNEL_DEFAULT): float
```
Compares one or more image channels of an image to a reconstructed image and returns the specified distortion metrics This method is available if Imagick has been compiled against ImageMagick version 6.4.4 or newer.
### Parameters
`reference`
Imagick object containing the reference image
`metric`
Refer to this list of [metric type constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.metric).
`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 a float describing the channel distortion.
### Errors/Exceptions
Throws ImagickException on error.
php Iterator::valid Iterator::valid
===============
(PHP 5, PHP 7, PHP 8)
Iterator::valid — Checks if current position is valid
### Description
```
public Iterator::valid(): bool
```
This method is called after [Iterator::rewind()](iterator.rewind) and [Iterator::next()](iterator.next) to check if the current position is valid.
### Parameters
This function has no parameters.
### Return Values
The return value will be casted to bool and then evaluated. Returns **`true`** on success or **`false`** on failure.
php DirectoryIterator::isFile DirectoryIterator::isFile
=========================
(PHP 5, PHP 7, PHP 8)
DirectoryIterator::isFile — Determine if current DirectoryIterator item is a regular file
### Description
```
public DirectoryIterator::isFile(): bool
```
Determines if the current [DirectoryIterator](class.directoryiterator) item is a regular file.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the file exists and is a regular file (not a `link` or `dir`), otherwise **`false`**
### Examples
**Example #1 **DirectoryIterator::isFile()** example**
This example will list all regular files in the directory containing the script.
```
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
foreach ($iterator as $fileinfo) {
if ($fileinfo->isFile()) {
echo $fileinfo->getFilename() . "\n";
}
}
?>
```
The above example will output something similar to:
```
apple.jpg
banana.jpg
example.php
pears.jpg
```
### See Also
* [DirectoryIterator::getType()](directoryiterator.gettype) - Determine the type of the current DirectoryIterator item
* [DirectoryIterator::isDir()](directoryiterator.isdir) - Determine if current DirectoryIterator item is a directory
* [DirectoryIterator::isDot()](directoryiterator.isdot) - Determine if current DirectoryIterator item is '.' or '..'
* [DirectoryIterator::isLink()](directoryiterator.islink) - Determine if current DirectoryIterator item is a symbolic link
php OAuth::setTimestamp OAuth::setTimestamp
===================
(PECL OAuth >= 1.0.0)
OAuth::setTimestamp — Set the timestamp
### Description
```
public OAuth::setTimestamp(string $timestamp): mixed
```
Sets the OAuth timestamp for subsequent requests.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`timestamp`
The timestamp.
### Return Values
Returns **`true`**, unless the `timestamp` is invalid, in which case **`false`** is returned.
### Changelog
| Version | Description |
| --- | --- |
| PECL oauth 1.0.0 | Previously returned **`null`** on failure, instead of **`false`**. |
### See Also
* [OAuth::setNonce()](oauth.setnonce) - Set the nonce for subsequent requests
php IntlChar::isupper IntlChar::isupper
=================
(PHP 7, PHP 8)
IntlChar::isupper — Check if code point has the general category "Lu" (uppercase letter)
### Description
```
public static IntlChar::isupper(int|string $codepoint): ?bool
```
Determines whether the specified code point has the general category "Lu" (uppercase letter).
>
> **Note**:
>
>
> This misses some characters that are also uppercase but have a different general category value. In order to include those, use [IntlChar::isUUppercase()](intlchar.isuuppercase).
>
>
### 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 Lu uppercase letter, **`false`** if not. Returns **`null`** on failure.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::isupper("A"));
var_dump(IntlChar::isupper("a"));
var_dump(IntlChar::isupper("Φ"));
var_dump(IntlChar::isupper("φ"));
var_dump(IntlChar::isupper("1"));
?>
```
The above example will output:
```
bool(true)
bool(false)
bool(true)
bool(false)
bool(false)
```
### See Also
* [IntlChar::islower()](intlchar.islower) - Check if code point is a lowercase 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_UPPERCASE`**
| programming_docs |
php EvTimer::__construct EvTimer::\_\_construct
======================
(PECL ev >= 0.2.0)
EvTimer::\_\_construct — Constructs an EvTimer watcher object
### Description
public **EvTimer::\_\_construct**(
float `$after` ,
float `$repeat` ,
[callable](language.types.callable) `$callback` ,
[mixed](language.types.declarations#language.types.declarations.mixed) `$data` = **`null`** ,
int `$priority` = 0
) Constructs an EvTimer watcher object.
### Parameters
`after` Configures the timer to trigger after `after` seconds.
`repeat` If repeat is **`0.0`** , then it will automatically be stopped once the timeout is reached. If it is positive, then the timer will automatically be configured to trigger again every repeat seconds later, until stopped manually.
`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 Simple timers**
```
<?php
// Create and start timer firing after 2 seconds
$w1 = new EvTimer(2, 0, function () {
echo "2 seconds elapsed\n";
});
// Create and launch timer firing after 2 seconds repeating each second
// until we manually stop it
$w2 = new EvTimer(2, 1, function ($w) {
echo "is called every second, is launched after 2 seconds\n";
echo "iteration = ", Ev::iteration(), PHP_EOL;
// Stop the watcher after 5 iterations
Ev::iteration() == 5 and $w->stop();
// Stop the watcher if further calls cause more than 10 iterations
Ev::iteration() >= 10 and $w->stop();
});
// Create stopped timer. It will be inactive until we start it ourselves
$w_stopped = EvTimer::createStopped(10, 5, function($w) {
echo "Callback of a timer created as stopped\n";
// Stop the watcher after 2 iterations
Ev::iteration() >= 2 and $w->stop();
});
// Loop until Ev::stop() is called or all of watchers stop
Ev::run();
// Start and look if it works
$w_stopped->start();
echo "Run single iteration\n";
Ev::run(Ev::RUN_ONCE);
echo "Restart the second watcher and try to handle the same events, but don't block\n";
$w2->again();
Ev::run(Ev::RUN_NOWAIT);
$w = new EvTimer(10, 0, function() {});
echo "Running a blocking loop\n";
Ev::run();
echo "END\n";
?>
```
The above example will output something similar to:
```
2 seconds elapsed
is called every second, is launched after 2 seconds
iteration = 1
is called every second, is launched after 2 seconds
iteration = 2
is called every second, is launched after 2 seconds
iteration = 3
is called every second, is launched after 2 seconds
iteration = 4
is called every second, is launched after 2 seconds
iteration = 5
Run single iteration
Callback of a timer created as stopped
Restart the second watcher and try to handle the same events, but don't block
Running a blocking loop
is called every second, is launched after 2 seconds
iteration = 8
is called every second, is launched after 2 seconds
iteration = 9
is called every second, is launched after 2 seconds
iteration = 10
END
```
### See Also
* [EvTimer::createStopped()](evtimer.createstopped) - Creates EvTimer stopped watcher object
* [EvPeriodic](class.evperiodic)
* [» ev\_timer - relative and optionally repeating timeouts](http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#code_ev_timer_code_relative_and_opti)
* [» Be smart about timeouts](http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#Be_smart_about_timeouts)
php RarEntry::getUnpackedSize RarEntry::getUnpackedSize
=========================
(PECL rar >= 0.1)
RarEntry::getUnpackedSize — Get unpacked size of the entry
### Description
```
public RarEntry::getUnpackedSize(): int
```
Get unpacked size of the archive entry.
>
> **Note**:
>
>
> Note that on platforms with 32-bit longs (that includes Windows x64), the maximum size returned is capped at 2 GiB. Check the constant **`PHP_INT_MAX`**.
>
>
### Parameters
This function has no parameters.
### Return Values
Returns the unpacked size, or **`false`** on error.
### Changelog
| Version | Description |
| --- | --- |
| PECL rar 2.0.0 | This method now returns correct values of unpacked sizes bigger than 2 GiB on platforms with 64-bit ints and never returns negative values on other platforms. |
### Return Values
**Example #1 **RarEntry::getUnpackedSize()** example**
```
<?php
$rar_file = rar_open('example.rar') or die("Failed to open Rar archive");
$entry = rar_entry_get($rar_file, 'Dir/file.txt') or die("Failed to find such entry");
echo "Unpacked size of " . $entry->getName() . " = " . $entry->getPackedSize() . " bytes";
?>
```
php array_combine array\_combine
==============
(PHP 5, PHP 7, PHP 8)
array\_combine — Creates an array by using one array for keys and another for its values
### Description
```
array_combine(array $keys, array $values): array
```
Creates an array by using the values from the `keys` array as keys and the values from the `values` array as the corresponding values.
### Parameters
`keys`
Array of keys to be used. Illegal values for key will be converted to string.
`values`
Array of values to be used
### Return Values
Returns the combined array.
### Errors/Exceptions
As of PHP 8.0.0, a [ValueError](class.valueerror) is thrown if the number of elements in `keys` and `values` does not match. Prior to PHP 8.0.0, a **`E_WARNING`** was emitted instead.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | **array\_combine()** will now throw a [ValueError](class.valueerror) if the number of elements for each array is not equal; previously this function returned **`false`** instead. |
### Examples
**Example #1 A simple **array\_combine()** example**
```
<?php
$a = array('green', 'red', 'yellow');
$b = array('avocado', 'apple', 'banana');
$c = array_combine($a, $b);
print_r($c);
?>
```
The above example will output:
```
Array
(
[green] => avocado
[red] => apple
[yellow] => banana
)
```
### See Also
* [array\_merge()](function.array-merge) - Merge one or more arrays
* [array\_walk()](function.array-walk) - Apply a user supplied function to every member of an array
* [array\_values()](function.array-values) - Return all the values of an array
php getmyinode getmyinode
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
getmyinode — Gets the inode of the current script
### Description
```
getmyinode(): int|false
```
Gets the inode of the current script.
### Parameters
This function has no parameters.
### Return Values
Returns the current script's inode as an integer, or **`false`** on error.
### See Also
* [getmygid()](function.getmygid) - Get PHP script owner's GID
* [getmyuid()](function.getmyuid) - Gets PHP script owner's UID
* [getmypid()](function.getmypid) - Gets PHP's process ID
* [get\_current\_user()](function.get-current-user) - Gets the name of the owner of the current PHP script
* [getlastmod()](function.getlastmod) - Gets time of last page modification
php None Defining multiple namespaces in the same file
---------------------------------------------
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
Multiple namespaces may also be declared in the same file. There are two allowed syntaxes.
**Example #1 Declaring multiple namespaces, simple combination syntax**
```
<?php
namespace MyProject;
const CONNECT_OK = 1;
class Connection { /* ... */ }
function connect() { /* ... */ }
namespace AnotherProject;
const CONNECT_OK = 1;
class Connection { /* ... */ }
function connect() { /* ... */ }
?>
```
This syntax is not recommended for combining namespaces into a single file. Instead it is recommended to use the alternate bracketed syntax.
**Example #2 Declaring multiple namespaces, bracketed syntax**
```
<?php
namespace MyProject {
const CONNECT_OK = 1;
class Connection { /* ... */ }
function connect() { /* ... */ }
}
namespace AnotherProject {
const CONNECT_OK = 1;
class Connection { /* ... */ }
function connect() { /* ... */ }
}
?>
```
It is strongly discouraged as a coding practice to combine multiple namespaces into the same file. The primary use case is to combine multiple PHP scripts into the same file.
To combine global non-namespaced code with namespaced code, only bracketed syntax is supported. Global code should be encased in a namespace statement with no namespace name as in:
**Example #3 Declaring multiple namespaces and unnamespaced code**
```
<?php
namespace MyProject {
const CONNECT_OK = 1;
class Connection { /* ... */ }
function connect() { /* ... */ }
}
namespace { // global code
session_start();
$a = MyProject\connect();
echo MyProject\Connection::start();
}
?>
```
No PHP code may exist outside of the namespace brackets except for an opening declare statement.
**Example #4 Declaring multiple namespaces and unnamespaced code**
```
<?php
declare(encoding='UTF-8');
namespace MyProject {
const CONNECT_OK = 1;
class Connection { /* ... */ }
function connect() { /* ... */ }
}
namespace { // global code
session_start();
$a = MyProject\connect();
echo MyProject\Connection::start();
}
?>
```
php Imagick::setImage Imagick::setImage
=================
(PECL imagick 2, PECL imagick 3)
Imagick::setImage — Replaces image in the object
### Description
```
public Imagick::setImage(Imagick $replace): bool
```
Replaces the current image sequence with the image from replace object.
### Parameters
`replace`
The replace Imagick object
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 A **Imagick::setImage()** example**
An example of using Imagick::setImage()
```
<?php
/* Create the objects */
$image = new Imagick('source.jpg');
$replace = new Imagick('replace.jpg');
/* source.jpg is replaced with replace.jpg */
$image->setImage($replace);
/* output the image */
header('Content-type: image/jpeg');
echo $image;
?>
```
php mysqli::debug mysqli::debug
=============
mysqli\_debug
=============
(PHP 5, PHP 7, PHP 8)
mysqli::debug -- mysqli\_debug — Performs debugging operations
### Description
Object-oriented style
```
public mysqli::debug(string $options): bool
```
Procedural style
```
mysqli_debug(string $options): bool
```
Performs debugging operations using the Fred Fish debugging library.
### Parameters
`options`
A string representing the debugging operation to perform
The debug control string is a sequence of colon separated fields as follows: ````
<field_1>:<field_2>:<field_N>
```` Each field consists of a mandatory flag character followed by an optional `,` and comma separated list of modifiers: `flag[,modifier,modifier,...,modifier]`
**Recognized Flag Characters**| `option` character | Description |
| --- | --- |
| O | **`MYSQLND_DEBUG_FLUSH`** |
| A/a | **`MYSQLND_DEBUG_APPEND`** |
| F | **`MYSQLND_DEBUG_DUMP_FILE`** |
| i | **`MYSQLND_DEBUG_DUMP_PID`** |
| L | **`MYSQLND_DEBUG_DUMP_LINE`** |
| m | **`MYSQLND_DEBUG_TRACE_MEMORY_CALLS`** |
| n | **`MYSQLND_DEBUG_DUMP_LEVEL`** |
| o | output to file |
| T | **`MYSQLND_DEBUG_DUMP_TIME`** |
| t | **`MYSQLND_DEBUG_DUMP_TRACE`** |
| x | **`MYSQLND_DEBUG_PROFILE_CALLS`** |
### Return Values
Returns **`true`**.
### Examples
**Example #1 Generating a Trace File**
```
<?php
/* Create a trace file in '/tmp/client.trace' on the local (client) machine: */
mysqli_debug("d:t:o,/tmp/client.trace");
?>
```
### Notes
>
> **Note**:
>
>
> To use the **mysqli\_debug()** function you must compile the MySQL client library to support debugging.
>
>
### See Also
* [mysqli\_dump\_debug\_info()](mysqli.dump-debug-info) - Dump debugging information into the log
* [mysqli\_report()](function.mysqli-report) - Alias of mysqli\_driver->report\_mode
php is_real is\_real
========
(PHP 4, PHP 5, PHP 7, PHP 8)
is\_real — Alias of [is\_float()](function.is-float)
### Description
This function is an alias of: [is\_float()](function.is-float).
**Warning**This alias was *DEPRECATED* in PHP 7.4.0, and *REMOVED* as of PHP 8.0.0.
php SolrQuery::getFacetDateOther SolrQuery::getFacetDateOther
============================
(PECL solr >= 0.9.2)
SolrQuery::getFacetDateOther — Returns the value for the facet.date.other parameter
### Description
```
public SolrQuery::getFacetDateOther(string $field_override = ?): array
```
Returns the value for the facet.date.other parameter. This method accepts an optional field override.
### Parameters
`field_override`
The name of the field
### Return Values
Returns an array on success and **`null`** if not set.
php Ds\PriorityQueue::jsonSerialize Ds\PriorityQueue::jsonSerialize
===============================
(PECL ds >= 1.0.0)
Ds\PriorityQueue::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 EvWatcher::start EvWatcher::start
================
(PECL ev >= 0.2.0)
EvWatcher::start — Starts the watcher
### Description
```
public EvWatcher::start(): void
```
Marks the watcher as active. Note that only active watchers will receive events.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### See Also
* [EvWatcher::stop()](evwatcher.stop) - Stops the watcher
php xattr_supported xattr\_supported
================
(PECL xattr >= 1.0.0)
xattr\_supported — Check if filesystem supports extended attributes
### Description
```
xattr_supported(string $filename, int $flags = 0): bool
```
This functions checks if the filesystem holding the given file supports extended attributes. Read access to the file is required.
### Parameters
`filename`
The path of the tested file.
`flags`
**Supported xattr flags**| **`XATTR_DONTFOLLOW`** | Do not follow the symbolic link but operate on symbolic link itself. |
### Return Values
This function returns **`true`** if filesystem supports extended attributes, **`false`** if it doesn't and **`null`** if it can't be determined (for example wrong path or lack of permissions to file).
### Examples
**Example #1 **xattr\_supported()** example**
The following code checks if we can use extended attributes.
```
<?php
$file = 'some_file';
if (xattr_supported($file)) {
/* ... make use of some xattr_* functions ... */
}
?>
```
### See Also
* [xattr\_get()](function.xattr-get) - Get an extended attribute
* [xattr\_list()](function.xattr-list) - Get a list of extended attributes
php Yaf_Dispatcher::disableView Yaf\_Dispatcher::disableView
============================
(Yaf >=1.0.0)
Yaf\_Dispatcher::disableView — Disable view rendering
### Description
```
public Yaf_Dispatcher::disableView(): bool
```
disable view engine, used in some app that user will output by theirself
>
> **Note**:
>
>
> you can simply return **`false`** in a action to prevent the auto-rendering of that action
>
>
### Parameters
This function has no parameters.
### Return Values
php ldap_bind_ext ldap\_bind\_ext
===============
(PHP 7 >= 7.3.0, PHP 8)
ldap\_bind\_ext — Bind to LDAP directory
### Description
```
ldap_bind_ext(
LDAP\Connection $ldap,
?string $dn = null,
?string $password = null,
?array $controls = null
): LDAP\Result|false
```
Does the same thing as [ldap\_bind()](function.ldap-bind) but returns an [LDAP\Result](class.ldap-result) instance to be parsed with [ldap\_parse\_result()](function.ldap-parse-result).
### Parameters
See [ldap\_bind()](function.ldap-bind)
### Return Values
Returns an [LDAP\Result](class.ldap-result) instance, 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 | Returns an [LDAP\Result](class.ldap-result) instance now; previously, a [resource](language.types.resource) was returned. |
| 8.0.0 | `controls` is nullable now; previously, it defaulted to `[]`. |
### See Also
* [ldap\_bind()](function.ldap-bind) - Bind to LDAP directory
* [ldap\_parse\_result()](function.ldap-parse-result) - Extract information from result
php Ds\Map::put Ds\Map::put
===========
(PECL ds >= 1.0.0)
Ds\Map::put — Associates a key with a value
### Description
```
public Ds\Map::put(mixed $key, mixed $value): void
```
Associates a `key` with a `value`, overwriting a previous association if one exists.
>
> **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.
>
>
>
> **Note**:
>
>
> You can also use array syntax to associate values by key, eg. `$map["key"] = $value`.
>
>
**Caution** Be careful when using array syntax. Scalar keys will be coerced to integers by the engine. For example, `$map["1"]` will attempt to access `int(1)`, while `$map->get("1")` will correctly look up the string key.
See [Arrays](language.types.array).
### Parameters
`key`
The key to associate the value with.
`value`
The value to be associated with the key.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Map::put()** example**
```
<?php
$map = new \Ds\Map();
$map->put("a", 1);
$map->put("b", 2);
$map->put("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
)
)
```
**Example #2 **Ds\Map::put()** example using objects as keys**
```
<?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;
}
}
$map = new \Ds\Map();
$obj = new \ArrayIterator([]);
// Using the same instance multiple times will overwrite the previous value.
$map->put($obj, 1);
$map->put($obj, 2);
// Using multiple instances of the same object will create new associations.
$map->put(new \stdClass(), 3);
$map->put(new \stdClass(), 4);
// Using multiple instances of equal hashable objects will overwrite previous values.
$map->put(new \HashableObject(1), 5);
$map->put(new \HashableObject(1), 6);
$map->put(new \HashableObject(2), 7);
$map->put(new \HashableObject(2), 8);
var_dump($map);
?>
```
The above example will output something similar to:
```
object(Ds\Map)#1 (5) {
[0]=>
object(Ds\Pair)#7 (2) {
["key"]=>
object(ArrayIterator)#2 (1) {
["storage":"ArrayIterator":private]=>
array(0) {
}
}
["value"]=>
int(2)
}
[1]=>
object(Ds\Pair)#8 (2) {
["key"]=>
object(stdClass)#3 (0) {
}
["value"]=>
int(3)
}
[2]=>
object(Ds\Pair)#9 (2) {
["key"]=>
object(stdClass)#4 (0) {
}
["value"]=>
int(4)
}
[3]=>
object(Ds\Pair)#10 (2) {
["key"]=>
object(HashableObject)#5 (1) {
["value":"HashableObject":private]=>
int(1)
}
["value"]=>
int(6)
}
[4]=>
object(Ds\Pair)#11 (2) {
["key"]=>
object(HashableObject)#6 (1) {
["value":"HashableObject":private]=>
int(2)
}
["value"]=>
int(8)
}
}
```
| programming_docs |
php spl_object_id spl\_object\_id
===============
(PHP 7 >= 7.2.0, PHP 8)
spl\_object\_id — Return the integer object handle for given object
### Description
```
spl_object_id(object $object): int
```
This function returns a unique identifier for the object. The object id is unique for the lifetime of the object. Once the object is destroyed, its id may be reused for other objects. This behavior is similar to [spl\_object\_hash()](function.spl-object-hash).
### Parameters
`object`
Any object.
### Return Values
An integer identifier that is unique for each currently existing object and is always the same for each object.
### Examples
**Example #1 A **spl\_object\_id()** example**
```
<?php
$id = spl_object_id($object);
$storage[$id] = $object;
?>
```
### Notes
>
> **Note**:
>
>
> When an object is destroyed, its id may be reused for other objects.
>
>
php Ds\Map::toArray Ds\Map::toArray
===============
(PECL ds >= 1.0.0)
Ds\Map::toArray — Converts the map to an array
### Description
```
public Ds\Map::toArray(): array
```
Converts the map to an array.
**Caution** Maps where non-scalar keys are can't be converted to an array.
**Caution** An array will treat all numeric keys as integers, eg. `"1"` and `1` as keys in the map will only result in `1` being included in the 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 map.
### Examples
**Example #1 **Ds\Map::toArray()** example**
```
<?php
$map = new \Ds\Map([
"a" => 1,
"b" => 2,
"c" => 3,
]);
var_dump($map->toArray());
?>
```
The above example will output something similar to:
```
array(3) {
["a"]=>
int(1)
["b"]=>
int(2)
["c"]=>
int(3)
}
```
php PharData::buildFromIterator PharData::buildFromIterator
===========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
PharData::buildFromIterator — Construct a tar or zip archive from an iterator
### Description
```
public PharData::buildFromIterator(Traversable $iterator, ?string $baseDirectory = null): array
```
Populate a tar or zip archive from an iterator. Two styles of iterators are supported, iterators that map the filename within the tar/zip to the name of a file on disk, and iterators like DirectoryIterator that return SplFileInfo objects. For iterators that return SplFileInfo objects, the second parameter is required.
### Parameters
`iterator`
Any iterator that either associatively maps tar/zip file to location or returns SplFileInfo objects
`baseDirectory`
For iterators that return SplFileInfo objects, the portion of each file's full path to remove when adding to the tar/zip archive
### Return Values
**PharData::buildFromIterator()** returns an associative array mapping internal path of file to the full path of the file on the filesystem.
### Errors/Exceptions
This method returns [UnexpectedValueException](class.unexpectedvalueexception) when the iterator returns incorrect values, such as an integer key instead of a string, a [BadMethodCallException](class.badmethodcallexception) when an SplFileInfo-based iterator is passed without a `baseDirectory` parameter, or a [PharException](class.pharexception) if there were errors saving the phar archive.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | **PharData::buildFromIterator()** no longer returns **`false`**. |
| 8.0.0 | `baseDirectory` is now nullable. |
### Examples
**Example #1 A **PharData::buildFromIterator()** with SplFileInfo**
For most tar/zip archives, the archive will reflect an actual directory layout, and the second style is the most useful. For instance, to create a tar/zip archive containing the files in this sample directory layout:
```
/path/to/project/
config/
dist.xml
debug.xml
lib/
file1.php
file2.php
src/
processthing.php
www/
index.php
cli/
index.php
```
This code could be used to add these files to the "project.tar" tar archive:
```
<?php
$phar = new PharData('project.tar');
$phar->buildFromIterator(
new RecursiveIteratorIterator(
new RecursiveDirectoryIterator('/path/to/project')),
'/path/to/project');
?>
```
The file `project.tar` can then be used immediately. **PharData::buildFromIterator()** does not set values such as compression, metadata, and this can be done after creating the tar/zip archive.
As an interesting note, **PharData::buildFromIterator()** can also be used to copy the contents of an existing phar, tar or zip archive, as the PharData object descends from [DirectoryIterator](class.directoryiterator):
```
<?php
$phar = new PharData('project.tar');
$phar->buildFromIterator(
new RecursiveIteratorIterator(
new Phar('/path/to/anotherphar.phar')),
'phar:///path/to/anotherphar.phar/path/to/project');
$phar->setStub($phar->createDefaultStub('cli/index.php', 'www/index.php'));
?>
```
**Example #2 A **PharData::buildFromIterator()** with other iterators**
The second form of the iterator can be used with any iterator that returns a key => value mapping, such as an [ArrayIterator](class.arrayiterator):
```
<?php
$phar = new PharData('project.tar');
$phar->buildFromIterator(
new ArrayIterator(
array(
'internal/file.php' => dirname(__FILE__) . '/somefile.php',
'another/file.jpg' => fopen('/path/to/bigfile.jpg', 'rb'),
)));
?>
```
### See Also
* [Phar::buildFromIterator()](phar.buildfromiterator) - Construct a phar archive from an iterator
php tidy::getConfig tidy::getConfig
===============
tidy\_get\_config
=================
(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.7.0)
tidy::getConfig -- tidy\_get\_config — Get current Tidy configuration
### Description
Object-oriented style
```
public tidy::getConfig(): array
```
Procedural style
```
tidy_get_config(tidy $tidy): array
```
Gets the list of the configuration options in use by the given tidy `tidy`.
### Parameters
`tidy`
The [Tidy](class.tidy) object.
### Return Values
Returns an array of configuration options.
For an explanation about each option, visit [» http://api.html-tidy.org/#quick-reference](http://api.html-tidy.org/#quick-reference).
### Examples
**Example #1 **tidy::getConfig()** example**
```
<?php
$html = '<p>test</p>';
$config = array('indent' => TRUE,
'output-xhtml' => TRUE,
'wrap' => 200);
$tidy = tidy_parse_string($html, $config);
print_r($tidy->getConfig());
?>
```
The above example will output:
```
Array
(
[indent-spaces] => 2
[wrap] => 200
[tab-size] => 8
[char-encoding] => 1
[input-encoding] => 3
[output-encoding] => 1
[newline] => 1
[doctype-mode] => 1
[doctype] =>
[repeated-attributes] => 1
[alt-text] =>
[slide-style] =>
[error-file] =>
[output-file] =>
[write-back] =>
[markup] => 1
[show-warnings] => 1
[quiet] =>
[indent] => 1
[hide-endtags] =>
[input-xml] =>
[output-xml] => 1
[output-xhtml] => 1
[output-html] =>
[add-xml-decl] =>
[uppercase-tags] =>
[uppercase-attributes] =>
[bare] =>
[clean] =>
[logical-emphasis] =>
[drop-proprietary-attributes] =>
[drop-font-tags] =>
[drop-empty-paras] => 1
[fix-bad-comments] => 1
[break-before-br] =>
[split] =>
[numeric-entities] =>
[quote-marks] =>
[quote-nbsp] => 1
[quote-ampersand] => 1
[wrap-attributes] =>
[wrap-script-literals] =>
[wrap-sections] => 1
[wrap-asp] => 1
[wrap-jste] => 1
[wrap-php] => 1
[fix-backslash] => 1
[indent-attributes] =>
[assume-xml-procins] =>
[add-xml-space] =>
[enclose-text] =>
[enclose-block-text] =>
[keep-time] =>
[word-2000] =>
[tidy-mark] =>
[gnu-emacs] =>
[gnu-emacs-file] =>
[literal-attributes] =>
[show-body-only] =>
[fix-uri] => 1
[lower-literals] => 1
[hide-comments] =>
[indent-cdata] =>
[force-output] => 1
[show-errors] => 6
[ascii-chars] => 1
[join-classes] =>
[join-styles] => 1
[escape-cdata] =>
[language] =>
[ncr] => 1
[output-bom] => 2
[replace-color] =>
[css-prefix] =>
[new-inline-tags] =>
[new-blocklevel-tags] =>
[new-empty-tags] =>
[new-pre-tags] =>
[accessibility-check] => 0
[vertical-space] =>
[punctuation-wrap] =>
[merge-divs] => 1
)
```
### See Also
* **tidy\_reset\_config()**
* **tidy\_save\_config()**
php posix_strerror posix\_strerror
===============
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
posix\_strerror — Retrieve the system error message associated with the given errno
### Description
```
posix_strerror(int $error_code): string
```
Returns the POSIX system error message associated with the given `error_code`. You may get the `error_code` parameter by calling [posix\_get\_last\_error()](function.posix-get-last-error).
### Parameters
`error_code`
A POSIX error number, returned by [posix\_get\_last\_error()](function.posix-get-last-error). If set to 0, then the string "Success" is returned.
### Return Values
Returns the error message, as a string.
### Examples
**Example #1 **posix\_strerror()** example**
This example will attempt to kill a process which does not exist, then will print out the corresponding error message.
```
<?php
posix_kill(50,SIGKILL);
echo posix_strerror(posix_get_last_error())."\n";
?>
```
The above example will output something similar to:
```
No such process
```
### See Also
* [posix\_get\_last\_error()](function.posix-get-last-error) - Retrieve the error number set by the last posix function that failed
php RecursiveIteratorIterator::setMaxDepth RecursiveIteratorIterator::setMaxDepth
======================================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
RecursiveIteratorIterator::setMaxDepth — Set max depth
### Description
```
public RecursiveIteratorIterator::setMaxDepth(int $maxDepth = -1): void
```
Set the maximum allowed depth.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`maxDepth`
The maximum allowed depth. `-1` is used for any depth.
### Return Values
No value is returned.
### Errors/Exceptions
Emits an [Exception](class.exception) if `maxDepth` is less than `-1`.
php SolrDisMaxQuery::removeTrigramPhraseField SolrDisMaxQuery::removeTrigramPhraseField
=========================================
(No version information available, might only be in Git)
SolrDisMaxQuery::removeTrigramPhraseField — Removes a Trigram Phrase Field (pf3 parameter)
### Description
```
public SolrDisMaxQuery::removeTrigramPhraseField(string $field): SolrDisMaxQuery
```
Removes a Trigram Phrase Field (pf3 parameter)
### Parameters
`field`
Field Name
### Return Values
[SolrDisMaxQuery](class.solrdismaxquery)
### Examples
**Example #1 **SolrDisMaxQuery::removeTrigramPhraseField()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery('lucene');
$dismaxQuery
->addTrigramPhraseField('cat', 2, 5.1)
->addTrigramPhraseField('feature', 4.5)
;
echo $dismaxQuery.PHP_EOL;
// reverse
$dismaxQuery
->removeTrigramPhraseField('cat');
echo $dismaxQuery.PHP_EOL;
?>
```
The above example will output:
```
q=lucene&defType=%s&pf3=cat~5.1^2 feature^4.5
q=lucene&defType=%s&pf3=feature^4.5
```
### See Also
* [SolrDisMaxQuery::addTrigramPhraseField()](solrdismaxquery.addtrigramphrasefield) - Adds a Trigram Phrase Field (pf3 parameter)
* [SolrDisMaxQuery::setTrigramPhraseFields()](solrdismaxquery.settrigramphrasefields) - Directly Sets Trigram Phrase Fields (pf3 parameter)
* [SolrDisMaxQuery::setTrigramPhraseSlop()](solrdismaxquery.settrigramphraseslop) - Sets Trigram Phrase Slop (ps3 parameter)
php imagegetclip imagegetclip
============
(PHP 7 >= 7.2.0, PHP 8)
imagegetclip — Get the clipping rectangle
### Description
```
imagegetclip(GdImage $image): array
```
**imagegetclip()** retrieves the current clipping rectangle, i.e. the area beyond which no pixels will be drawn.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
### Return Values
The function returns an indexed array with the coordinates of the clipping rectangle which has the following entries:
* x-coordinate of the upper left corner
* y-coordinate of the upper left corner
* x-coordinate of the lower right corner
* y-coordinate of the lower right corner
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 **imagegetclip()** example**
Setting and retrieving the clipping rectangle.
```
<?php
$im = imagecreate(100, 100);
imagesetclip($im, 10,10, 89,89);
print_r(imagegetclip($im));
```
The above example will output:
```
Array
(
[0] => 10
[1] => 10
[2] => 89
[3] => 89
)
```
### See Also
* [imagesetclip()](function.imagesetclip) - Set the clipping rectangle
php SolrResponse::getDigestedResponse SolrResponse::getDigestedResponse
=================================
(PECL solr >= 0.9.2)
SolrResponse::getDigestedResponse — Returns the XML response as serialized PHP data
### Description
```
public SolrResponse::getDigestedResponse(): string
```
Returns the XML response as serialized PHP data
### Parameters
This function has no parameters.
### Return Values
Returns the XML response as serialized PHP data
php wincache_ucache_cas wincache\_ucache\_cas
=====================
(PECL wincache >= 1.1.0)
wincache\_ucache\_cas — Compares the variable with old value and assigns new value to it
### Description
```
wincache_ucache_cas(string $key, int $old_value, int $new_value): bool
```
Compares the variable associated with the `key` with `old_value` and if it matches then assigns the `new_value` to it.
### Parameters
`key`
The `key` that is used to store the variable in the cache. `key` is case sensitive.
`old_value`
Old value of the variable pointed by `key` in the user cache. The value should be of type `long`, otherwise the function returns **`false`**.
`new_value`
New value which will get assigned to variable pointer by `key` if a match is found. The value should be of type `long`, otherwise the function returns **`false`**.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Using **wincache\_ucache\_cas()****
```
<?php
wincache_ucache_set('counter', 2922);
var_dump(wincache_ucache_cas('counter', 2922, 1));
var_dump(wincache_ucache_get('counter'));
?>
```
The above example will output:
```
bool(true)
int(1)
```
### See Also
* [wincache\_ucache\_inc()](function.wincache-ucache-inc) - Increments the value associated with the key
* [wincache\_ucache\_dec()](function.wincache-ucache-dec) - Decrements the value associated with the key
php GlobIterator::__construct GlobIterator::\_\_construct
===========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
GlobIterator::\_\_construct — Construct a directory using glob
### Description
public **GlobIterator::\_\_construct**(string `$pattern`, int `$flags` = FilesystemIterator::KEY\_AS\_PATHNAME | FilesystemIterator::CURRENT\_AS\_FILEINFO) Constructs a new directory iterator from a glob expression.
### Parameters
`pattern`
A [glob()](function.glob) pattern.
`flags`
Option flags, the flags may be a bitmask of the [FilesystemIterator](class.filesystemiterator) constants.
### 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 [GlobIterator](class.globiterator) example**
```
<?php
$iterator = new GlobIterator('*.dll', FilesystemIterator::KEY_AS_FILENAME);
if (!$iterator->count()) {
echo 'No matches';
} else {
$n = 0;
printf("Matched %d item(s)\r\n", $iterator->count());
foreach ($iterator as $item) {
printf("[%d] %s\r\n", ++$n, $iterator->key());
}
}
?>
```
The above example will output something similar to:
```
Matched 2 item(s)
[1] php5ts.dll
[2] php_gd2.dll
```
### See Also
* [DirectoryIterator::\_\_construct()](directoryiterator.construct) - Constructs a new directory iterator from a path
* [GlobIterator::count()](globiterator.count) - Get the number of directories and files
* [glob()](function.glob) - Find pathnames matching a pattern
php DOMCharacterData::deleteData DOMCharacterData::deleteData
============================
(PHP 5, PHP 7, PHP 8)
DOMCharacterData::deleteData — Remove a range of characters from the node
### Description
```
public DOMCharacterData::deleteData(int $offset, int $count): bool
```
Deletes `count` characters starting from position `offset`.
### Parameters
`offset`
The offset from which to start removing.
`count`
The number of characters to delete. If the sum of `offset` and `count` exceeds the length, then all characters to the end of the data are deleted.
### 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, or if `count` is negative.
### See Also
* [DOMCharacterData::appendData()](domcharacterdata.appenddata) - Append the string to the end of the character data of the node
* [DOMCharacterData::insertData()](domcharacterdata.insertdata) - Insert a string at the specified 16-bit unit offset
* [DOMCharacterData::replaceData()](domcharacterdata.replacedata) - Replace a substring within the DOMCharacterData node
* [DOMCharacterData::substringData()](domcharacterdata.substringdata) - Extracts a range of data from the node
php date_date_set date\_date\_set
===============
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
date\_date\_set — Alias of [DateTime::setDate()](datetime.setdate)
### Description
This function is an alias of: [DateTime::setDate()](datetime.setdate)
php Ds\PriorityQueue::copy Ds\PriorityQueue::copy
======================
(PECL ds >= 1.0.0)
Ds\PriorityQueue::copy — Returns a shallow copy of the queue
### Description
```
public Ds\PriorityQueue::copy(): Ds\PriorityQueue
```
Returns a shallow copy of the queue.
### Parameters
This function has no parameters.
### Return Values
Returns a shallow copy of the queue.
### Examples
**Example #1 **Ds\PriorityQueue::copy()** example**
```
<?php
$queue = new \Ds\PriorityQueue();
$queue->push("a", 5);
$queue->push("b", 15);
$queue->push("c", 10);
print_r($queue->copy());
?>
```
The above example will output something similar to:
```
Ds\PriorityQueue Object
(
[0] => b
[1] => c
[2] => a
)
```
php Worker::collect Worker::collect
===============
(PECL pthreads >= 3.0.0)
Worker::collect — Collect references to completed tasks
### Description
```
public Worker::collect(Callable $collector = ?): int
```
Allows the worker to collect references determined to be garbage by the optionally given collector.
### Parameters
`collector`
A Callable collector that returns a boolean on whether the task can be collected or not. Only in rare cases should a custom collector need to be used.
### Return Values
The number of remaining tasks on the worker's stack to be collected.
### Examples
**Example #1 A basic example of **Worker::collect()****
```
<?php
$worker = new Worker();
echo "There are currently {$worker->collect()} tasks on the stack to be collected\n";
for ($i = 0; $i < 15; ++$i) {
$worker->stack(new class extends Threaded {});
}
echo "There are {$worker->collect()} tasks remaining on the stack to be collected\n";
$worker->start();
while ($worker->collect()); // blocks until all tasks have finished executing
echo "There are now {$worker->collect()} tasks on the stack to be collected\n";
$worker->shutdown();
```
The above example will output:
```
There are currently 0 tasks on the stack to be collected
There are 15 tasks remaining on the stack to be collected
There are now 0 tasks on the stack to be collected
```
| programming_docs |
php EvStat::stat EvStat::stat
============
(PECL ev >= 0.2.0)
EvStat::stat — Initiates the stat call
### Description
```
public EvStat::stat(): bool
```
Initiates the stat call(updates internal cache). It stats(using `lstat` ) the path specified in the watcher and sets to the values found.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if path exists. Otherwise **`false`**.
### See Also
* [EvStat::attr()](evstat.attr) - Returns the values most recently detected by Ev
* [EvStat::prev()](evstat.prev) - Returns the previous set of values returned by EvStat::attr
php QuickHashIntStringHash::getSize QuickHashIntStringHash::getSize
===============================
(PECL quickhash >= Unknown)
QuickHashIntStringHash::getSize — Returns the number of elements in the hash
### Description
```
public QuickHashIntStringHash::getSize(): int
```
Returns the number of elements in the hash.
### Parameters
This function has no parameters.
### Return Values
The number of elements in the hash.
### Examples
**Example #1 **QuickHashIntStringHash::getSize()** example**
```
<?php
$hash = new QuickHashIntStringHash( 8 );
var_dump( $hash->add( 2, "two" ) );
var_dump( $hash->add( 3, 5 ) );
var_dump( $hash->getSize() );
?>
```
The above example will output something similar to:
```
bool(true)
bool(true)
int(2)
```
php fdf_get_encoding fdf\_get\_encoding
==================
(PHP 4 >= 4.3.0, PHP 5 < 5.3.0, PECL fdf SVN)
fdf\_get\_encoding — Get the value of the /Encoding key
### Description
```
fdf_get_encoding(resource $fdf_document): string
```
Gets the value of the `/Encoding` key.
### 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).
### Return Values
Returns the encoding as a string. An empty string is returned if the default `PDFDocEncoding/Unicode` scheme is used.
### See Also
* [fdf\_set\_encoding()](function.fdf-set-encoding) - Sets FDF character encoding
php GmagickDraw::getfontsize GmagickDraw::getfontsize
========================
(PECL gmagick >= Unknown)
GmagickDraw::getfontsize — Returns the font pointsize
### Description
```
public GmagickDraw::getfontsize(): float
```
Returns the font pointsize used when annotating with text.
### Parameters
This function has no parameters.
### Return Values
Returns the font size associated with the current [GmagickDraw](class.gmagickdraw) object.
php The SVMModel class
The SVMModel class
==================
Introduction
------------
(PECL svm >= 0.1.0)
The SVMModel is the end result of the training process. It can be used to classify previously unseen data.
Class synopsis
--------------
class **SVMModel** { /\* Methods \*/ public [\_\_construct](svmmodel.construct)(string `$filename` = ?)
```
public checkProbabilityModel(): bool
```
```
public getLabels(): array
```
```
public getNrClass(): int
```
```
public getSvmType(): int
```
```
public getSvrProbability(): float
```
```
public load(string $filename): bool
```
```
public predict_probability(array $data): float
```
```
public predict(array $data): float
```
```
public save(string $filename): bool
```
} Table of Contents
-----------------
* [SVMModel::checkProbabilityModel](svmmodel.checkprobabilitymodel) — Returns true if the model has probability information
* [SVMModel::\_\_construct](svmmodel.construct) — Construct a new SVMModel
* [SVMModel::getLabels](svmmodel.getlabels) — Get the labels the model was trained on
* [SVMModel::getNrClass](svmmodel.getnrclass) — Returns the number of classes the model was trained with
* [SVMModel::getSvmType](svmmodel.getsvmtype) — Get the SVM type the model was trained with
* [SVMModel::getSvrProbability](svmmodel.getsvrprobability) — Get the sigma value for regression types
* [SVMModel::load](svmmodel.load) — Load a saved SVM Model
* [SVMModel::predict\_probability](svmmodel.predict-probability) — Return class probabilities for previous unseen data
* [SVMModel::predict](svmmodel.predict) — Predict a value for previously unseen data
* [SVMModel::save](svmmodel.save) — Save a model to a file
php fbird_rollback fbird\_rollback
===============
(PHP 5, PHP 7 < 7.4.0)
fbird\_rollback — Alias of [ibase\_rollback()](function.ibase-rollback)
### Description
This function is an alias of: [ibase\_rollback()](function.ibase-rollback).
php Yaf_Dispatcher::registerPlugin Yaf\_Dispatcher::registerPlugin
===============================
(Yaf >=1.0.0)
Yaf\_Dispatcher::registerPlugin — Register a plugin
### Description
```
public Yaf_Dispatcher::registerPlugin(Yaf_Plugin_Abstract $plugin): Yaf_Dispatcher
```
Register a plugin(see [Yaf\_Plugin\_Abstract](class.yaf-plugin-abstract)). Generally, we register plugins in Bootstrap(see [Yaf\_Bootstrap\_Abstract](class.yaf-bootstrap-abstract)).
### Parameters
`plugin`
### Return Values
### Examples
**Example #1 **Yaf\_Dispatcher::registerPlugin()** example**
```
<?php
class Bootstrap extends Yaf_Bootstrap_Abstract {
public function _initPlugin(Yaf_Dispatcher $dispatcher) {
/**
* Yaf assumes plugin scripts under [application.directory] . "/plugins"
* for this case, it will be:
* [application.directory] . "/plugins/" . "User" . [application.ext]
*/
$user = new UserPlugin();
$dispatcher->registerPlugin($user);
}
}
?>
```
### See Also
* [Yaf\_Plugin\_Abstract](class.yaf-plugin-abstract)
* [Yaf\_Bootstrap\_Abstract](class.yaf-bootstrap-abstract)
php EventHttpRequest::__construct EventHttpRequest::\_\_construct
===============================
(PECL event >= 1.4.0-beta)
EventHttpRequest::\_\_construct — Constructs EventHttpRequest object
### Description
```
public EventHttpRequest::__construct( callable $callback , mixed $data = null )
```
Constructs EventHttpRequest object.
### Parameters
`callback` Gets invoked on requesting path. Should match the following prototype:
```
callback( EventHttpRequest $req = null , mixed $arg = null ): void
```
`data` User custom data passed to the callback.
### Return Values
Returns EventHttpRequest object.
### Examples
**Example #1 **EventHttpRequest::\_\_construct()** example**
```
<?php
function _request_handler($req, $base) {
echo __FUNCTION__, PHP_EOL;
if (is_null($req)) {
echo "Timed out\n";
} else {
$response_code = $req->getResponseCode();
if ($response_code == 0) {
echo "Connection refused\n";
} elseif ($response_code != 200) {
echo "Unexpected response: $response_code\n";
} else {
echo "Success: $response_code\n";
$buf = $req->getInputBuffer();
echo "Body:\n";
while ($s = $buf->readLine(EventBuffer::EOL_ANY)) {
echo $s, PHP_EOL;
}
}
}
$base->exit(NULL);
}
$address = "127.0.0.1";
$port = 80;
$base = new EventBase();
$conn = new EventHttpConnection($base, NULL, $address, $port);
$conn->setTimeout(5);
$req = new EventHttpRequest("_request_handler", $base);
$req->addHeader("Host", $address, EventHttpRequest::OUTPUT_HEADER);
$req->addHeader("Content-Length", "0", EventHttpRequest::OUTPUT_HEADER);
$conn->makeRequest($req, EventHttpRequest::CMD_GET, "/index.cphp");
$base->loop();
?>
```
### See Also
* [EventHttpRequest::cancel()](eventhttprequest.cancel) - Cancels a pending HTTP request
* [EventHttpRequest::addHeader()](eventhttprequest.addheader) - Adds an HTTP header to the headers of the request
php GearmanTask::taskDenominator GearmanTask::taskDenominator
============================
(PECL gearman >= 0.5.0)
GearmanTask::taskDenominator — Get completion percentage denominator
### Description
```
public GearmanTask::taskDenominator(): int
```
Returns the denominator of the percentage of the task that is complete expressed as a fraction.
### Parameters
This function has no parameters.
### Return Values
A number between 0 and 100, or **`false`** if cannot be determined.
### See Also
* [GearmanTask::taskNumerator()](gearmantask.tasknumerator) - Get completion percentage numerator
php imagecreatefrompng imagecreatefrompng
==================
(PHP 4, PHP 5, PHP 7, PHP 8)
imagecreatefrompng — Create a new image from file or URL
### Description
```
imagecreatefrompng(string $filename): GdImage|false
```
**imagecreatefrompng()** 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 PNG 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 PNG**
```
<?php
function LoadPNG($imgname)
{
/* Attempt to open */
$im = @imagecreatefrompng($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/png');
$img = LoadPNG('bogus.image');
imagepng($img);
imagedestroy($img);
?>
```
The above example will output something similar to:
php urldecode urldecode
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
urldecode — Decodes URL-encoded string
### Description
```
urldecode(string $string): string
```
Decodes any `%##` encoding in the given string. Plus symbols ('`+`') are decoded to a space character.
### Parameters
`string`
The string to be decoded.
### Return Values
Returns the decoded string.
### Examples
**Example #1 **urldecode()** example**
```
<?php
$query = "my=apples&are=green+and+red";
foreach (explode('&', $query) as $chunk) {
$param = explode("=", $chunk);
if ($param) {
printf("Value for parameter \"%s\" is \"%s\"<br/>\n", urldecode($param[0]), urldecode($param[1]));
}
}
?>
```
### Notes
**Warning** The superglobals [$\_GET](reserved.variables.get) and [$\_REQUEST](reserved.variables.request) are already decoded. Using **urldecode()** on an element in [$\_GET](reserved.variables.get) or [$\_REQUEST](reserved.variables.request) could have unexpected and dangerous results.
### See Also
* [urlencode()](function.urlencode) - URL-encodes string
* [rawurlencode()](function.rawurlencode) - URL-encode according to RFC 3986
* [rawurldecode()](function.rawurldecode) - Decode URL-encoded strings
* [» RFC 3986](http://www.faqs.org/rfcs/rfc3986)
php The DOMEntity class
The DOMEntity class
===================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
This interface represents a known entity, either parsed or unparsed, in an XML document.
Class synopsis
--------------
class **DOMEntity** extends [DOMNode](class.domnode) { /\* Properties \*/ public readonly ?string [$publicId](class.domentity#domentity.props.publicid);
public readonly ?string [$systemId](class.domentity#domentity.props.systemid);
public readonly ?string [$notationName](class.domentity#domentity.props.notationname);
public readonly ?string [$actualEncoding](class.domentity#domentity.props.actualencoding) = null;
public readonly ?string [$encoding](class.domentity#domentity.props.encoding) = null;
public readonly ?string [$version](class.domentity#domentity.props.version) = 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); /\* 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
----------
publicId The public identifier associated with the entity if specified, and **`null`** otherwise.
systemId The system identifier associated with the entity if specified, and **`null`** otherwise. This may be an absolute URI or not.
notationName For unparsed entities, the name of the notation for the entity. For parsed entities, this is **`null`**.
actualEncoding An attribute specifying the encoding used for this entity at the time of parsing, when it is an external parsed entity. This is **`null`** if it is an entity from the internal subset or if it is not known.
encoding An attribute specifying, as part of the text declaration, the encoding of this entity, when it is an external parsed entity. This is **`null`** otherwise.
version An attribute specifying, as part of the text declaration, the version number of this entity, when it is an external parsed entity. This is **`null`** otherwise.
php octdec octdec
======
(PHP 4, PHP 5, PHP 7, PHP 8)
octdec — Octal to decimal
### Description
```
octdec(string $octal_string): int|float
```
Returns the decimal equivalent of the octal number represented by the `octal_string` argument.
### Parameters
`octal_string`
The octal string to convert. Any invalid characters in `octal_string` are silently ignored. As of PHP 7.4.0 supplying any invalid characters is deprecated.
### Return Values
The decimal representation of `octal_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 **octdec()** example**
```
<?php
echo octdec('77') . "\n";
echo octdec(decoct(45));
?>
```
The above example will output:
```
63
45
```
### 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
* [decoct()](function.decoct) - Decimal to octal
* [bindec()](function.bindec) - Binary to decimal
* [hexdec()](function.hexdec) - Hexadecimal to decimal
* [base\_convert()](function.base-convert) - Convert a number between arbitrary bases
php The Parle\Stack class
The Parle\Stack class
=====================
Introduction
------------
(PECL parle >= 0.7.0)
**Parle\Stack** is a LIFO stack. The elements are inserted and removed only from one end.
Class synopsis
--------------
class **Parle\Stack** { /\* Properties \*/ public bool [$empty](class.parle-stack#parle-stack.props.empty) = **`true`**;
public int [$size](class.parle-stack#parle-stack.props.size) = 0;
public [mixed](language.types.declarations#language.types.declarations.mixed) [$top](class.parle-stack#parle-stack.props.top); /\* Methods \*/
```
public pop(): void
```
```
public push(mixed $item): void
```
} Properties
----------
empty Whether the stack is empty, readonly.
size Stack size, readonly.
top Element on the top of the stack.
Table of Contents
-----------------
* [Parle\Stack::pop](parle-stack.pop) — Pop an item from the stack
* [Parle\Stack::push](parle-stack.push) — Push an item into the stack
php odbc_fetch_object odbc\_fetch\_object
===================
(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)
odbc\_fetch\_object — Fetch a result row as an object
### Description
```
odbc_fetch_object(resource $statement, int $row = -1): stdClass|false
```
Fetch an object 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 object 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\_array()](function.odbc-fetch-array) - Fetch a result row as an associative array
* [odbc\_num\_rows()](function.odbc-num-rows) - Number of rows in a result
php date_add date\_add
=========
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
date\_add — Alias of [DateTime::add()](datetime.add)
### Description
This function is an alias of: [DateTime::add()](datetime.add)
php Imagick::pingImage Imagick::pingImage
==================
(PECL imagick 2, PECL imagick 3)
Imagick::pingImage — Fetch basic attributes about the image
### Description
```
public Imagick::pingImage(string $filename): bool
```
This method can be used to query image width, height, size, and format without reading the whole image in to memory.
### Parameters
`filename`
The filename to read the information from.
### Return Values
Returns **`true`** on success.
| programming_docs |
php pg_result_status pg\_result\_status
==================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg\_result\_status — Get status of query result
### Description
```
pg_result_status(PgSql\Result $result, int $mode = PGSQL_STATUS_LONG): string|int
```
**pg\_result\_status()** returns the status of the [PgSql\Result](class.pgsql-result) instance, or the PostgreSQL command completion tag associated with the 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).
`mode`
Either **`PGSQL_STATUS_LONG`** to return the numeric status of the `result`, or **`PGSQL_STATUS_STRING`** to return the command tag of the `result`. If not specified, **`PGSQL_STATUS_LONG`** is the default.
### Return Values
Possible return values are **`PGSQL_EMPTY_QUERY`**, **`PGSQL_COMMAND_OK`**, **`PGSQL_TUPLES_OK`**, **`PGSQL_COPY_OUT`**, **`PGSQL_COPY_IN`**, **`PGSQL_BAD_RESPONSE`**, **`PGSQL_NONFATAL_ERROR`** and **`PGSQL_FATAL_ERROR`** if **`PGSQL_STATUS_LONG`** is specified. Otherwise, a string containing the PostgreSQL command tag is returned.
### 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\_status()** example**
```
<?php
// Connect to the database
$conn = pg_pconnect("dbname=publisher");
// Execute a COPY
$result = pg_query($conn, "COPY authors FROM STDIN;");
// Get the result status
$status = pg_result_status($result);
// Determine status
if ($status == PGSQL_COPY_IN)
echo "Copy began.";
else
echo "Copy failed.";
?>
```
The above example will output:
```
Copy began.
```
### See Also
* [pg\_connection\_status()](function.pg-connection-status) - Get connection status
php Imagick::getImageRedPrimary Imagick::getImageRedPrimary
===========================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageRedPrimary — Returns the chromaticity red primary point
### Description
```
public Imagick::getImageRedPrimary(): array
```
Returns the chromaticity red primary point as an array with the keys "x" and "y".
### Parameters
This function has no parameters.
### Return Values
Returns the chromaticity red primary point as an array with the keys "x" and "y". Throw an **ImagickException** on error.
### Errors/Exceptions
Throws ImagickException on error.
php wddx_deserialize wddx\_deserialize
=================
(PHP 4, PHP 5, PHP 7)
wddx\_deserialize — Unserializes a WDDX packet
**Warning**This function was *REMOVED* in PHP 7.4.0.
### Description
```
wddx_deserialize(string $packet): mixed
```
Unserializes a WDDX `packet`.
**Warning** Do not pass untrusted user input to **wddx\_deserialize()**. 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.
### Parameters
`packet`
A WDDX packet, as a string or stream.
### Return Values
Returns the deserialized value which can be a string, a number or an array. Note that structures are deserialized into associative arrays.
php The GearmanJob class
The GearmanJob class
====================
Introduction
------------
(PECL gearman >= 0.5.0)
Class synopsis
--------------
class **GearmanJob** { /\* Methods \*/
```
public complete(string $result): bool
```
```
public __construct()
```
```
public data(string $data): bool
```
```
public exception(string $exception): bool
```
```
public fail(): bool
```
```
public functionName(): string
```
```
public handle(): string
```
```
public returnCode(): int
```
```
public sendComplete(string $result): bool
```
```
public sendData(string $data): bool
```
```
public sendException(string $exception): bool
```
```
public sendFail(): bool
```
```
public sendStatus(int $numerator, int $denominator): bool
```
```
public sendWarning(string $warning): bool
```
```
public setReturn(int $gearman_return_t): bool
```
```
public status(int $numerator, int $denominator): bool
```
```
public unique(): string
```
```
public warning(string $warning): bool
```
```
public workload(): string
```
```
public workloadSize(): int
```
} Table of Contents
-----------------
* [GearmanJob::complete](gearmanjob.complete) — Send the result and complete status (deprecated)
* [GearmanJob::\_\_construct](gearmanjob.construct) — Create a GearmanJob instance
* [GearmanJob::data](gearmanjob.data) — Send data for a running job (deprecated)
* [GearmanJob::exception](gearmanjob.exception) — Send exception for running job (deprecated)
* [GearmanJob::fail](gearmanjob.fail) — Send fail status (deprecated)
* [GearmanJob::functionName](gearmanjob.functionname) — Get function name
* [GearmanJob::handle](gearmanjob.handle) — Get the job handle
* [GearmanJob::returnCode](gearmanjob.returncode) — Get last return code
* [GearmanJob::sendComplete](gearmanjob.sendcomplete) — Send the result and complete status
* [GearmanJob::sendData](gearmanjob.senddata) — Send data for a running job
* [GearmanJob::sendException](gearmanjob.sendexception) — Send exception for running job (exception)
* [GearmanJob::sendFail](gearmanjob.sendfail) — Send fail status
* [GearmanJob::sendStatus](gearmanjob.sendstatus) — Send status
* [GearmanJob::sendWarning](gearmanjob.sendwarning) — Send a warning
* [GearmanJob::setReturn](gearmanjob.setreturn) — Set a return value
* [GearmanJob::status](gearmanjob.status) — Send status (deprecated)
* [GearmanJob::unique](gearmanjob.unique) — Get the unique identifier
* [GearmanJob::warning](gearmanjob.warning) — Send a warning (deprecated)
* [GearmanJob::workload](gearmanjob.workload) — Get workload
* [GearmanJob::workloadSize](gearmanjob.workloadsize) — Get size of work load
php ImagickPixel::getColorAsString ImagickPixel::getColorAsString
==============================
(PECL imagick 2 >= 2.1.0, PECL imagick 3)
ImagickPixel::getColorAsString — Returns the color as a string
### Description
```
public ImagickPixel::getColorAsString(): string
```
Returns the color of the ImagickPixel object as a string.
### Parameters
This function has no parameters.
### Return Values
Returns the color of the ImagickPixel object as a string.
### Examples
**Example #1 Basic **Imagick::getColorAsString()** usage**
```
<?php
//Create an ImagickPixel with the predefined color 'brown'
$color = new ImagickPixel('brown');
$color->setColorValue(Imagick::COLOR_ALPHA, 64 / 256.0);
$colorInfo = $color->getColorAsString();
print_r($colorInfo);
?>
```
The above example will output:
```
rgb(165,42,42)
```
### Notes
>
> **Note**: **Alpha not returned**
>
>
>
> This function does not return the alpha value of the color in the string.
>
>
php openal_stream openal\_stream
==============
(PECL openal >= 0.1.0)
openal\_stream — Begin streaming on a source
### Description
```
openal_stream(resource $source, int $format, int $rate): resource|false
```
### 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)).
`format`
Format of `data`, one of: **`AL_FORMAT_MONO8`**, **`AL_FORMAT_MONO16`**, **`AL_FORMAT_STEREO8`** and **`AL_FORMAT_STEREO16`**
`rate`
Frequency of data to stream given in Hz.
### Return Values
Returns a stream resource on success or **`false`** on failure.
### See Also
* [openal\_source\_create()](function.openal-source-create) - Generate a source resource
* [fwrite()](function.fwrite) - Binary-safe file write
php IntlCalendar::fromDateTime IntlCalendar::fromDateTime
==========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a2)
IntlCalendar::fromDateTime — Create an IntlCalendar from a DateTime object or string
### Description
Object-oriented style
```
public static IntlCalendar::fromDateTime(DateTime|string $datetime, ?string $locale = null): ?IntlCalendar
```
Procedural style
```
intlcal_from_date_time(DateTime|string $datetime, ?string $locale = null): ?IntlCalendar
```
Creates an [IntlCalendar](class.intlcalendar) object either from a [DateTime](class.datetime) object or from a string from which a [DateTime](class.datetime) object can be built.
The new calendar will represent not only the same instant as the given [DateTime](class.datetime) (subject to precision loss for dates very far into the past or future), but also the same timezone (subject to the caveat that different timezone databases will be used, and therefore the results may differ).
### Parameters
`datetime`
A [DateTime](class.datetime) object or a string that can be passed to [DateTime::\_\_construct()](datetime.construct).
### Return Values
The created [IntlCalendar](class.intlcalendar) object or **`null`** in case of failure. If a string is passed, any exception that occurs inside the [DateTime](class.datetime) constructor is propagated.
### Examples
**Example #1 **IntlCalendar::fromDateTime()****
```
<?php
ini_set('date.timezone', 'Europe/Lisbon');
//same as IntlCalendar::fromDateTime(new DateTime(...))
$cal1 = IntlCalendar::fromDateTime('2013-02-28 00:01:02 Europe/Berlin');
//Note the timezone is Europe/Berlin, not the default Europe/Lisbon
echo IntlDateFormatter::formatObject($cal1, 'yyyy MMMM d HH:mm:ss VVVV', 'de_DE'), "\n";
```
The above example will output:
```
2013 Februar 28 00:01:02 Deutschland Zeit
```
php The SolrDisMaxQuery class
The SolrDisMaxQuery class
=========================
Introduction
------------
(No version information available, might only be in Git)
Class synopsis
--------------
class **SolrDisMaxQuery** extends [SolrQuery](class.solrquery) implements [Serializable](class.serializable) { /\* Inherited properties \*/ const int [SolrQuery::ORDER\_ASC](class.solrquery#solrquery.constants.order-asc) = 0;
const int [SolrQuery::ORDER\_DESC](class.solrquery#solrquery.constants.order-desc) = 1;
const int [SolrQuery::FACET\_SORT\_INDEX](class.solrquery#solrquery.constants.facet-sort-index) = 0;
const int [SolrQuery::FACET\_SORT\_COUNT](class.solrquery#solrquery.constants.facet-sort-count) = 1;
const int [SolrQuery::TERMS\_SORT\_INDEX](class.solrquery#solrquery.constants.terms-sort-index) = 0;
const int [SolrQuery::TERMS\_SORT\_COUNT](class.solrquery#solrquery.constants.terms-sort-count) = 1; /\* Methods \*/ public [\_\_construct](solrdismaxquery.construct)(string `$q` = ?)
```
public addBigramPhraseField(string $field, string $boost, string $slop = ?): SolrDisMaxQuery
```
```
public addBoostQuery(string $field, string $value, string $boost = ?): SolrDisMaxQuery
```
```
public addPhraseField(string $field, string $boost, string $slop = ?): SolrDisMaxQuery
```
```
public addQueryField(string $field, string $boost = ?): SolrDisMaxQuery
```
```
public addTrigramPhraseField(string $field, string $boost, string $slop = ?): SolrDisMaxQuery
```
```
public addUserField(string $field): SolrDisMaxQuery
```
```
public removeBigramPhraseField(string $field): SolrDisMaxQuery
```
```
public removeBoostQuery(string $field): SolrDisMaxQuery
```
```
public removePhraseField(string $field): SolrDisMaxQuery
```
```
public removeQueryField(string $field): SolrDisMaxQuery
```
```
public removeTrigramPhraseField(string $field): SolrDisMaxQuery
```
```
public removeUserField(string $field): SolrDisMaxQuery
```
```
public setBigramPhraseFields(string $fields): SolrDisMaxQuery
```
```
public setBigramPhraseSlop(string $slop): SolrDisMaxQuery
```
```
public setBoostFunction(string $function): SolrDisMaxQuery
```
```
public setBoostQuery(string $q): SolrDisMaxQuery
```
```
public setMinimumMatch(string $value): SolrDisMaxQuery
```
```
public setPhraseFields(string $fields): SolrDisMaxQuery
```
```
public setPhraseSlop(string $slop): SolrDisMaxQuery
```
```
public setQueryAlt(string $q): SolrDisMaxQuery
```
```
public setQueryPhraseSlop(string $slop): SolrDisMaxQuery
```
```
public setTieBreaker(string $tieBreaker): SolrDisMaxQuery
```
```
public setTrigramPhraseFields(string $fields): SolrDisMaxQuery
```
```
public setTrigramPhraseSlop(string $slop): SolrDisMaxQuery
```
```
public setUserFields(string $fields): SolrDisMaxQuery
```
```
public useDisMaxQueryParser(): SolrDisMaxQuery
```
```
public useEDisMaxQueryParser(): SolrDisMaxQuery
```
/\* Inherited methods \*/
```
public SolrQuery::addExpandFilterQuery(string $fq): SolrQuery
```
```
public SolrQuery::addExpandSortField(string $field, string $order = ?): SolrQuery
```
```
public SolrQuery::addFacetDateField(string $dateField): SolrQuery
```
```
public SolrQuery::addFacetDateOther(string $value, string $field_override = ?): SolrQuery
```
```
public SolrQuery::addFacetField(string $field): SolrQuery
```
```
public SolrQuery::addFacetQuery(string $facetQuery): SolrQuery
```
```
public SolrQuery::addField(string $field): SolrQuery
```
```
public SolrQuery::addFilterQuery(string $fq): SolrQuery
```
```
public SolrQuery::addGroupField(string $value): SolrQuery
```
```
public SolrQuery::addGroupFunction(string $value): SolrQuery
```
```
public SolrQuery::addGroupQuery(string $value): SolrQuery
```
```
public SolrQuery::addGroupSortField(string $field, int $order = ?): SolrQuery
```
```
public SolrQuery::addHighlightField(string $field): SolrQuery
```
```
public SolrQuery::addMltField(string $field): SolrQuery
```
```
public SolrQuery::addMltQueryField(string $field, float $boost): SolrQuery
```
```
public SolrQuery::addSortField(string $field, int $order = SolrQuery::ORDER_DESC): SolrQuery
```
```
public SolrQuery::addStatsFacet(string $field): SolrQuery
```
```
public SolrQuery::addStatsField(string $field): SolrQuery
```
```
public SolrQuery::collapse(SolrCollapseFunction $collapseFunction): SolrQuery
```
```
public SolrQuery::getExpand(): bool
```
```
public SolrQuery::getExpandFilterQueries(): array
```
```
public SolrQuery::getExpandQuery(): array
```
```
public SolrQuery::getExpandRows(): int
```
```
public SolrQuery::getExpandSortFields(): array
```
```
public SolrQuery::getFacet(): bool
```
```
public SolrQuery::getFacetDateEnd(string $field_override = ?): string
```
```
public SolrQuery::getFacetDateFields(): array
```
```
public SolrQuery::getFacetDateGap(string $field_override = ?): string
```
```
public SolrQuery::getFacetDateHardEnd(string $field_override = ?): string
```
```
public SolrQuery::getFacetDateOther(string $field_override = ?): array
```
```
public SolrQuery::getFacetDateStart(string $field_override = ?): string
```
```
public SolrQuery::getFacetFields(): array
```
```
public SolrQuery::getFacetLimit(string $field_override = ?): int
```
```
public SolrQuery::getFacetMethod(string $field_override = ?): string
```
```
public SolrQuery::getFacetMinCount(string $field_override = ?): int
```
```
public SolrQuery::getFacetMissing(string $field_override = ?): bool
```
```
public SolrQuery::getFacetOffset(string $field_override = ?): int
```
```
public SolrQuery::getFacetPrefix(string $field_override = ?): string
```
```
public SolrQuery::getFacetQueries(): array
```
```
public SolrQuery::getFacetSort(string $field_override = ?): int
```
```
public SolrQuery::getFields(): array
```
```
public SolrQuery::getFilterQueries(): array
```
```
public SolrQuery::getGroup(): bool
```
```
public SolrQuery::getGroupCachePercent(): int
```
```
public SolrQuery::getGroupFacet(): bool
```
```
public SolrQuery::getGroupFields(): array
```
```
public SolrQuery::getGroupFormat(): string
```
```
public SolrQuery::getGroupFunctions(): array
```
```
public SolrQuery::getGroupLimit(): int
```
```
public SolrQuery::getGroupMain(): bool
```
```
public SolrQuery::getGroupNGroups(): bool
```
```
public SolrQuery::getGroupOffset(): int
```
```
public SolrQuery::getGroupQueries(): array
```
```
public SolrQuery::getGroupSortFields(): array
```
```
public SolrQuery::getGroupTruncate(): bool
```
```
public SolrQuery::getHighlight(): bool
```
```
public SolrQuery::getHighlightAlternateField(string $field_override = ?): string
```
```
public SolrQuery::getHighlightFields(): array
```
```
public SolrQuery::getHighlightFormatter(string $field_override = ?): string
```
```
public SolrQuery::getHighlightFragmenter(string $field_override = ?): string
```
```
public SolrQuery::getHighlightFragsize(string $field_override = ?): int
```
```
public SolrQuery::getHighlightHighlightMultiTerm(): bool
```
```
public SolrQuery::getHighlightMaxAlternateFieldLength(string $field_override = ?): int
```
```
public SolrQuery::getHighlightMaxAnalyzedChars(): int
```
```
public SolrQuery::getHighlightMergeContiguous(string $field_override = ?): bool
```
```
public SolrQuery::getHighlightRegexMaxAnalyzedChars(): int
```
```
public SolrQuery::getHighlightRegexPattern(): string
```
```
public SolrQuery::getHighlightRegexSlop(): float
```
```
public SolrQuery::getHighlightRequireFieldMatch(): bool
```
```
public SolrQuery::getHighlightSimplePost(string $field_override = ?): string
```
```
public SolrQuery::getHighlightSimplePre(string $field_override = ?): string
```
```
public SolrQuery::getHighlightSnippets(string $field_override = ?): int
```
```
public SolrQuery::getHighlightUsePhraseHighlighter(): bool
```
```
public SolrQuery::getMlt(): bool
```
```
public SolrQuery::getMltBoost(): bool
```
```
public SolrQuery::getMltCount(): int
```
```
public SolrQuery::getMltFields(): array
```
```
public SolrQuery::getMltMaxNumQueryTerms(): int
```
```
public SolrQuery::getMltMaxNumTokens(): int
```
```
public SolrQuery::getMltMaxWordLength(): int
```
```
public SolrQuery::getMltMinDocFrequency(): int
```
```
public SolrQuery::getMltMinTermFrequency(): int
```
```
public SolrQuery::getMltMinWordLength(): int
```
```
public SolrQuery::getMltQueryFields(): array
```
```
public SolrQuery::getQuery(): string
```
```
public SolrQuery::getRows(): int
```
```
public SolrQuery::getSortFields(): array
```
```
public SolrQuery::getStart(): int
```
```
public SolrQuery::getStats(): bool
```
```
public SolrQuery::getStatsFacets(): array
```
```
public SolrQuery::getStatsFields(): array
```
```
public SolrQuery::getTerms(): bool
```
```
public SolrQuery::getTermsField(): string
```
```
public SolrQuery::getTermsIncludeLowerBound(): bool
```
```
public SolrQuery::getTermsIncludeUpperBound(): bool
```
```
public SolrQuery::getTermsLimit(): int
```
```
public SolrQuery::getTermsLowerBound(): string
```
```
public SolrQuery::getTermsMaxCount(): int
```
```
public SolrQuery::getTermsMinCount(): int
```
```
public SolrQuery::getTermsPrefix(): string
```
```
public SolrQuery::getTermsReturnRaw(): bool
```
```
public SolrQuery::getTermsSort(): int
```
```
public SolrQuery::getTermsUpperBound(): string
```
```
public SolrQuery::getTimeAllowed(): int
```
```
public SolrQuery::removeExpandFilterQuery(string $fq): SolrQuery
```
```
public SolrQuery::removeExpandSortField(string $field): SolrQuery
```
```
public SolrQuery::removeFacetDateField(string $field): SolrQuery
```
```
public SolrQuery::removeFacetDateOther(string $value, string $field_override = ?): SolrQuery
```
```
public SolrQuery::removeFacetField(string $field): SolrQuery
```
```
public SolrQuery::removeFacetQuery(string $value): SolrQuery
```
```
public SolrQuery::removeField(string $field): SolrQuery
```
```
public SolrQuery::removeFilterQuery(string $fq): SolrQuery
```
```
public SolrQuery::removeHighlightField(string $field): SolrQuery
```
```
public SolrQuery::removeMltField(string $field): SolrQuery
```
```
public SolrQuery::removeMltQueryField(string $queryField): SolrQuery
```
```
public SolrQuery::removeSortField(string $field): SolrQuery
```
```
public SolrQuery::removeStatsFacet(string $value): SolrQuery
```
```
public SolrQuery::removeStatsField(string $field): SolrQuery
```
```
public SolrQuery::setEchoHandler(bool $flag): SolrQuery
```
```
public SolrQuery::setEchoParams(string $type): SolrQuery
```
```
public SolrQuery::setExpand(bool $value): SolrQuery
```
```
public SolrQuery::setExpandQuery(string $q): SolrQuery
```
```
public SolrQuery::setExpandRows(int $value): SolrQuery
```
```
public SolrQuery::setExplainOther(string $query): SolrQuery
```
```
public SolrQuery::setFacet(bool $flag): SolrQuery
```
```
public SolrQuery::setFacetDateEnd(string $value, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setFacetDateGap(string $value, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setFacetDateHardEnd(bool $value, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setFacetDateStart(string $value, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setFacetEnumCacheMinDefaultFrequency(int $frequency, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setFacetLimit(int $limit, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setFacetMethod(string $method, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setFacetMinCount(int $mincount, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setFacetMissing(bool $flag, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setFacetOffset(int $offset, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setFacetPrefix(string $prefix, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setFacetSort(int $facetSort, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setGroup(bool $value): SolrQuery
```
```
public SolrQuery::setGroupCachePercent(int $percent): SolrQuery
```
```
public SolrQuery::setGroupFacet(bool $value): SolrQuery
```
```
public SolrQuery::setGroupFormat(string $value): SolrQuery
```
```
public SolrQuery::setGroupLimit(int $value): SolrQuery
```
```
public SolrQuery::setGroupMain(string $value): SolrQuery
```
```
public SolrQuery::setGroupNGroups(bool $value): SolrQuery
```
```
public SolrQuery::setGroupOffset(int $value): SolrQuery
```
```
public SolrQuery::setGroupTruncate(bool $value): SolrQuery
```
```
public SolrQuery::setHighlight(bool $flag): SolrQuery
```
```
public SolrQuery::setHighlightAlternateField(string $field, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setHighlightFormatter(string $formatter, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setHighlightFragmenter(string $fragmenter, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setHighlightFragsize(int $size, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setHighlightHighlightMultiTerm(bool $flag): SolrQuery
```
```
public SolrQuery::setHighlightMaxAlternateFieldLength(int $fieldLength, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setHighlightMaxAnalyzedChars(int $value): SolrQuery
```
```
public SolrQuery::setHighlightMergeContiguous(bool $flag, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setHighlightRegexMaxAnalyzedChars(int $maxAnalyzedChars): SolrQuery
```
```
public SolrQuery::setHighlightRegexPattern(string $value): SolrQuery
```
```
public SolrQuery::setHighlightRegexSlop(float $factor): SolrQuery
```
```
public SolrQuery::setHighlightRequireFieldMatch(bool $flag): SolrQuery
```
```
public SolrQuery::setHighlightSimplePost(string $simplePost, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setHighlightSimplePre(string $simplePre, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setHighlightSnippets(int $value, string $field_override = ?): SolrQuery
```
```
public SolrQuery::setHighlightUsePhraseHighlighter(bool $flag): SolrQuery
```
```
public SolrQuery::setMlt(bool $flag): SolrQuery
```
```
public SolrQuery::setMltBoost(bool $flag): SolrQuery
```
```
public SolrQuery::setMltCount(int $count): SolrQuery
```
```
public SolrQuery::setMltMaxNumQueryTerms(int $value): SolrQuery
```
```
public SolrQuery::setMltMaxNumTokens(int $value): SolrQuery
```
```
public SolrQuery::setMltMaxWordLength(int $maxWordLength): SolrQuery
```
```
public SolrQuery::setMltMinDocFrequency(int $minDocFrequency): SolrQuery
```
```
public SolrQuery::setMltMinTermFrequency(int $minTermFrequency): SolrQuery
```
```
public SolrQuery::setMltMinWordLength(int $minWordLength): SolrQuery
```
```
public SolrQuery::setOmitHeader(bool $flag): SolrQuery
```
```
public SolrQuery::setQuery(string $query): SolrQuery
```
```
public SolrQuery::setRows(int $rows): SolrQuery
```
```
public SolrQuery::setShowDebugInfo(bool $flag): SolrQuery
```
```
public SolrQuery::setStart(int $start): SolrQuery
```
```
public SolrQuery::setStats(bool $flag): SolrQuery
```
```
public SolrQuery::setTerms(bool $flag): SolrQuery
```
```
public SolrQuery::setTermsField(string $fieldname): SolrQuery
```
```
public SolrQuery::setTermsIncludeLowerBound(bool $flag): SolrQuery
```
```
public SolrQuery::setTermsIncludeUpperBound(bool $flag): SolrQuery
```
```
public SolrQuery::setTermsLimit(int $limit): SolrQuery
```
```
public SolrQuery::setTermsLowerBound(string $lowerBound): SolrQuery
```
```
public SolrQuery::setTermsMaxCount(int $frequency): SolrQuery
```
```
public SolrQuery::setTermsMinCount(int $frequency): SolrQuery
```
```
public SolrQuery::setTermsPrefix(string $prefix): SolrQuery
```
```
public SolrQuery::setTermsReturnRaw(bool $flag): SolrQuery
```
```
public SolrQuery::setTermsSort(int $sortType): SolrQuery
```
```
public SolrQuery::setTermsUpperBound(string $upperBound): SolrQuery
```
```
public SolrQuery::setTimeAllowed(int $timeAllowed): SolrQuery
```
} Predefined Constants
--------------------
**`SolrDisMaxQuery::ORDER_ASC`** Used to specify that the sorting should be in acending order (Duplicated for easier migration)
**`SolrDisMaxQuery::ORDER_DESC`** Used to specify that the sorting should be in descending order (Duplicated for easier migration)
**`SolrDisMaxQuery::FACET_SORT_INDEX`** Used to specify that the facet should sort by index (Duplicated for easier migration)
**`SolrDisMaxQuery::FACET_SORT_COUNT`** Used to specify that the facet should sort by count (Duplicated for easier migration)
**`SolrDisMaxQuery::TERMS_SORT_INDEX`** Used in the TermsComponent (Duplicated for easier migration)
**`SolrDisMaxQuery::TERMS_SORT_COUNT`** Used in the TermsComponent (Duplicated for easier migration)
Table of Contents
-----------------
* [SolrDisMaxQuery::addBigramPhraseField](solrdismaxquery.addbigramphrasefield) — Adds a Phrase Bigram Field (pf2 parameter)
* [SolrDisMaxQuery::addBoostQuery](solrdismaxquery.addboostquery) — Adds a boost query field with value and optional boost (bq parameter)
* [SolrDisMaxQuery::addPhraseField](solrdismaxquery.addphrasefield) — Adds a Phrase Field (pf parameter)
* [SolrDisMaxQuery::addQueryField](solrdismaxquery.addqueryfield) — Add a query field with optional boost (qf parameter)
* [SolrDisMaxQuery::addTrigramPhraseField](solrdismaxquery.addtrigramphrasefield) — Adds a Trigram Phrase Field (pf3 parameter)
* [SolrDisMaxQuery::addUserField](solrdismaxquery.adduserfield) — Adds a field to User Fields Parameter (uf)
* [SolrDisMaxQuery::\_\_construct](solrdismaxquery.construct) — Class Constructor
* [SolrDisMaxQuery::removeBigramPhraseField](solrdismaxquery.removebigramphrasefield) — Removes phrase bigram field (pf2 parameter)
* [SolrDisMaxQuery::removeBoostQuery](solrdismaxquery.removeboostquery) — Removes a boost query partial by field name (bq)
* [SolrDisMaxQuery::removePhraseField](solrdismaxquery.removephrasefield) — Removes a Phrase Field (pf parameter)
* [SolrDisMaxQuery::removeQueryField](solrdismaxquery.removequeryfield) — Removes a Query Field (qf parameter)
* [SolrDisMaxQuery::removeTrigramPhraseField](solrdismaxquery.removetrigramphrasefield) — Removes a Trigram Phrase Field (pf3 parameter)
* [SolrDisMaxQuery::removeUserField](solrdismaxquery.removeuserfield) — Removes a field from The User Fields Parameter (uf)
* [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)
* [SolrDisMaxQuery::setBoostFunction](solrdismaxquery.setboostfunction) — Sets a Boost Function (bf parameter)
* [SolrDisMaxQuery::setBoostQuery](solrdismaxquery.setboostquery) — Directly Sets Boost Query Parameter (bq)
* [SolrDisMaxQuery::setMinimumMatch](solrdismaxquery.setminimummatch) — Set Minimum "Should" Match (mm)
* [SolrDisMaxQuery::setPhraseFields](solrdismaxquery.setphrasefields) — Sets Phrase Fields and their boosts (and slops) using pf2 parameter
* [SolrDisMaxQuery::setPhraseSlop](solrdismaxquery.setphraseslop) — Sets the default slop on phrase queries (ps parameter)
* [SolrDisMaxQuery::setQueryAlt](solrdismaxquery.setqueryalt) — Set Query Alternate (q.alt parameter)
* [SolrDisMaxQuery::setQueryPhraseSlop](solrdismaxquery.setqueryphraseslop) — Specifies the amount of slop permitted on phrase queries explicitly included in the user's query string (qf parameter)
* [SolrDisMaxQuery::setTieBreaker](solrdismaxquery.settiebreaker) — Sets Tie Breaker parameter (tie parameter)
* [SolrDisMaxQuery::setTrigramPhraseFields](solrdismaxquery.settrigramphrasefields) — Directly Sets Trigram Phrase Fields (pf3 parameter)
* [SolrDisMaxQuery::setTrigramPhraseSlop](solrdismaxquery.settrigramphraseslop) — Sets Trigram Phrase Slop (ps3 parameter)
* [SolrDisMaxQuery::setUserFields](solrdismaxquery.setuserfields) — Sets User Fields parameter (uf)
* [SolrDisMaxQuery::useDisMaxQueryParser](solrdismaxquery.usedismaxqueryparser) — Switch QueryParser to be DisMax Query Parser
* [SolrDisMaxQuery::useEDisMaxQueryParser](solrdismaxquery.useedismaxqueryparser) — Switch QueryParser to be EDisMax
| programming_docs |
php snmpset snmpset
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
snmpset — Set the value of an SNMP object
### Description
```
snmpset(
string $hostname,
string $community,
array|string $object_id,
array|string $type,
array|string $value,
int $timeout = -1,
int $retries = -1
): bool
```
**snmpset()** 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 **snmpset()****
```
<?php
snmpset("localhost", "public", "IF-MIB::ifAlias.3", "s", "foo");
?>
```
**Example #2 Using **snmpset()** for setting BITS SNMP object id**
```
<?php
snmpset("localhost", "public", 'FOO-MIB::bar.42', 'b', '0 1 2 3 4');
// or
snmpset("localhost", "public", 'FOO-MIB::bar.42', 'x', 'F0');
?>
```
### See Also
* [snmpget()](function.snmpget) - Fetch an SNMP object
php SolrDisMaxQuery::addTrigramPhraseField SolrDisMaxQuery::addTrigramPhraseField
======================================
(No version information available, might only be in Git)
SolrDisMaxQuery::addTrigramPhraseField — Adds a Trigram Phrase Field (pf3 parameter)
### Description
```
public SolrDisMaxQuery::addTrigramPhraseField(string $field, string $boost, string $slop = ?): SolrDisMaxQuery
```
Adds a Trigram Phrase Field (pf3 parameter)
### Parameters
`field`
Field Name
`boost`
Field Boost
`slop`
Field Slop
### Return Values
[SolrDisMaxQuery](class.solrdismaxquery)
### Examples
**Example #1 **SolrDisMaxQuery::addTrigramPhraseField()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery('lucene');
$dismaxQuery
->addTrigramPhraseField('cat', 2, 5.1)
->addTrigramPhraseField('feature', 4.5)
;
echo $dismaxQuery.PHP_EOL;
?>
```
The above example will output:
```
q=lucene&defType=%s&pf3=cat~5.1^2 feature^4.5
```
### See Also
* [SolrDisMaxQuery::removeTrigramPhraseField()](solrdismaxquery.removetrigramphrasefield) - Removes a Trigram Phrase Field (pf3 parameter)
* [SolrDisMaxQuery::setTrigramPhraseFields()](solrdismaxquery.settrigramphrasefields) - Directly Sets Trigram Phrase Fields (pf3 parameter)
* [SolrDisMaxQuery::setTrigramPhraseSlop()](solrdismaxquery.settrigramphraseslop) - Sets Trigram Phrase Slop (ps3 parameter)
php ImagickDraw::setTextInterlineSpacing ImagickDraw::setTextInterlineSpacing
====================================
(PECL imagick 3 >= 3.1.0)
ImagickDraw::setTextInterlineSpacing — Description
### Description
```
public ImagickDraw::setTextInterlineSpacing(float $spacing): bool
```
Sets the text interline spacing.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`spacing`
### Return Values
Returns **`true`** on success.
php Imagick::getImageRenderingIntent Imagick::getImageRenderingIntent
================================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageRenderingIntent — Gets the image rendering intent
### Description
```
public Imagick::getImageRenderingIntent(): int
```
Gets the image rendering intent.
### Parameters
This function has no parameters.
### Return Values
Returns the image [rendering intent](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.renderingintent).
### Errors/Exceptions
Throws ImagickException on error.
php Imagick::valid Imagick::valid
==============
(PECL imagick 2, PECL imagick 3)
Imagick::valid — Checks if the current item is valid
### Description
```
public Imagick::valid(): bool
```
Checks if the current item is valid.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success.
php RegexIterator::getPregFlags RegexIterator::getPregFlags
===========================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
RegexIterator::getPregFlags — Returns the regular expression flags
### Description
```
public RegexIterator::getPregFlags(): int
```
Returns the regular expression flags, see [RegexIterator::\_\_construct()](regexiterator.construct) for the list of flags.
### Parameters
This function has no parameters.
### Return Values
Returns a bitmask of the regular expression flags.
### Examples
**Example #1 **RegexIterator::getPregFlags()** example**
```
<?php
$test = array ('str1' => 'test 1', 'teststr2' => 'another test', 'str3' => 'test 123');
$arrayIterator = new ArrayIterator($test);
$regexIterator = new RegexIterator($arrayIterator, '/\s/', RegexIterator::SPLIT);
$regexIterator->setPregFlags(PREG_SPLIT_NO_EMPTY | PREG_SPLIT_OFFSET_CAPTURE);
if ($regexIterator->getPregFlags() & PREG_SPLIT_NO_EMPTY) {
echo 'Ignoring empty pieces';
} else {
echo 'Not ignoring empty pieces';
}
?>
```
The above example will output:
```
Ignoring empty pieces
```
### See Also
* [RegexIterator::setPregFlags()](regexiterator.setpregflags) - Sets the regular expression flags
php GearmanJob::functionName GearmanJob::functionName
========================
(PECL gearman >= 0.5.0)
GearmanJob::functionName — Get function name
### Description
```
public GearmanJob::functionName(): string
```
Returns the function name for this job. This is the function the work will execute to perform the job.
### Parameters
This function has no parameters.
### Return Values
The name of a function.
### See Also
* [GearmanTask::function()](gearmantask.function) - Get associated function name (deprecated)
php SQLite3::loadExtension SQLite3::loadExtension
======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3::loadExtension — Attempts to load an SQLite extension library
### Description
```
public SQLite3::loadExtension(string $name): bool
```
Attempts to load an SQLite extension library.
### Parameters
`name`
The name of the library to load. The library must be located in the directory specified in the configure option sqlite3.extension\_dir.
### Return Values
Returns **`true`** if the extension is successfully loaded, **`false`** on failure.
### Examples
**Example #1 **SQLite3::loadExtension()** example**
```
<?php
$db = new SQLite3('mysqlitedb.db');
$db->loadExtension('libagg.so');
?>
```
php Imagick::getIteratorIndex Imagick::getIteratorIndex
=========================
(PECL imagick 2, PECL imagick 3)
Imagick::getIteratorIndex — Gets the index of the current active image
### Description
```
public Imagick::getIteratorIndex(): int
```
Returns the index of the current active image within the Imagick object. 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 an integer containing the index of the image in the stack.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 Using **Imagick::getIteratorIndex()**:**
Create images, set and get the iterator index
```
<?php
$im = new Imagick();
$im->newImage(100, 100, new ImagickPixel("red"));
$im->newImage(100, 100, new ImagickPixel("green"));
$im->newImage(100, 100, new ImagickPixel("blue"));
$im->setIteratorIndex(1);
echo $im->getIteratorIndex();
?>
```
### See Also
* [Imagick::setIteratorIndex()](imagick.setiteratorindex) - Set the iterator position
* [Imagick::getImageIndex()](imagick.getimageindex) - Gets the index of the current active image
* [Imagick::setImageIndex()](imagick.setimageindex) - Set the iterator position
php SolrQuery::addStatsField SolrQuery::addStatsField
========================
(PECL solr >= 0.9.2)
SolrQuery::addStatsField — Maps to stats.field parameter
### Description
```
public SolrQuery::addStatsField(string $field): SolrQuery
```
Maps to stats.field parameter This methods adds another stats.field parameter.
### Parameters
`field`
The name of the field
### Return Values
Returns the current SolrQuery object, if the return value is used.
php mcrypt_module_is_block_mode mcrypt\_module\_is\_block\_mode
===============================
(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mcrypt\_module\_is\_block\_mode — Returns if the specified mode outputs blocks 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_mode(string $mode, string $lib_dir = ?): bool
```
This function returns **`true`** if the mode outputs blocks of bytes or **`false`** if it outputs just bytes. (e.g. **`true`** for cbc and ecb, and **`false`** for cfb and stream).
### Parameters
`mode`
One of the **`MCRYPT_MODE_modename`** constants, or one of the following strings: "ecb", "cbc", "cfb", "ofb", "nofb" or "stream".
`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 outputs blocks of bytes or **`false`** if it outputs just bytes. (e.g. **`true`** for cbc and ecb, and **`false`** for cfb and stream).
php ArrayObject::getIterator ArrayObject::getIterator
========================
(PHP 5, PHP 7, PHP 8)
ArrayObject::getIterator — Create a new iterator from an ArrayObject instance
### Description
```
public ArrayObject::getIterator(): Iterator
```
Create a new iterator from an [ArrayObject](class.arrayobject) instance.
### Parameters
This function has no parameters.
### Return Values
An iterator from an [ArrayObject](class.arrayobject).
### Examples
**Example #1 **ArrayObject::getIterator()** example**
```
<?php
$array = array('1' => 'one',
'2' => 'two',
'3' => 'three');
$arrayobject = new ArrayObject($array);
$iterator = $arrayobject->getIterator();
while($iterator->valid()) {
echo $iterator->key() . ' => ' . $iterator->current() . "\n";
$iterator->next();
}
?>
```
The above example will output:
```
1 => one
2 => two
3 => three
```
php DOMText::splitText DOMText::splitText
==================
(PHP 5, PHP 7, PHP 8)
DOMText::splitText — Breaks this node into two nodes at the specified offset
### Description
```
public DOMText::splitText(int $offset): DOMText|false
```
Breaks this node into two nodes at the specified `offset`, keeping both in the tree as siblings.
After being split, this node will contain all the content up to the `offset`. If the original node had a parent node, the new node is inserted as the next sibling of the original node. When the `offset` is equal to the length of this node, the new node has no data.
### Parameters
`offset`
The offset at which to split, starting from 0.
### Return Values
The new node of the same type, which contains all the content at and after the `offset`.
php MultipleIterator::__construct MultipleIterator::\_\_construct
===============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
MultipleIterator::\_\_construct — Constructs a new MultipleIterator
### Description
public **MultipleIterator::\_\_construct**(int `$flags` = MultipleIterator::MIT\_NEED\_ALL | MultipleIterator::MIT\_KEYS\_NUMERIC) Construct a new MultipleIterator.
### Parameters
`flags`
The flags to set, according to the [Flag Constants](class.multipleiterator#multipleiterator.constants).
* **`MultipleIterator::MIT_NEED_ALL`** or **`MultipleIterator::MIT_NEED_ANY`**
* **`MultipleIterator::MIT_KEYS_NUMERIC`** or **`MultipleIterator::MIT_KEYS_ASSOC`**
Defaults to **`MultipleIterator::MIT_NEED_ALL`**|**`MultipleIterator::MIT_KEYS_NUMERIC`**.
### Examples
**Example #1 Iterating a MultipleIterator**
```
<?php
$people = new ArrayIterator(array('John', 'Jane', 'Jack', 'Judy'));
$roles = new ArrayIterator(array('Developer', 'Scrum Master', 'Project Owner'));
$team = new MultipleIterator($flags);
$team->attachIterator($people, 'person');
$team->attachIterator($roles, 'role');
foreach ($team as $member) {
print_r($member);
}
?>
```
Output with `$flags = MIT_NEED_ALL|MIT_KEYS_NUMERIC`
```
Array
(
[0] => John
[1] => Developer
)
Array
(
[0] => Jane
[1] => Scrum Master
)
Array
(
[0] => Jack
[1] => Project Owner
)
```
Output with `$flags = MIT_NEED_ANY|MIT_KEYS_NUMERIC`
```
Array
(
[0] => John
[1] => Developer
)
Array
(
[0] => Jane
[1] => Scrum Master
)
Array
(
[0] => Jack
[1] => Project Owner
)
Array
(
[0] => Judy
[1] =>
)
```
Output with `$flags = MIT_NEED_ALL|MIT_KEYS_ASSOC`
```
Array
(
[person] => John
[role] => Developer
)
Array
(
[person] => Jane
[role] => Scrum Master
)
Array
(
[person] => Jack
[role] => Project Owner
)
```
Output with `$flags = MIT_NEED_ANY|MIT_KEYS_ASSOC`
```
Array
(
[person] => John
[role] => Developer
)
Array
(
[person] => Jane
[role] => Scrum Master
)
Array
(
[person] => Jack
[role] => Project Owner
)
Array
(
[person] => Judy
[role] =>
)
```
### See Also
* [Flag Constants](class.multipleiterator#multipleiterator.constants)
* [MultipleIterator::valid()](multipleiterator.valid) - Checks the validity of sub iterators
php openal_context_create openal\_context\_create
=======================
(PECL openal >= 0.1.0)
openal\_context\_create — Create an audio processing context
### Description
```
openal_context_create(resource $device): resource
```
### Parameters
`device`
An [Open AL(Device)](https://www.php.net/manual/en/openal.resources.php) resource (previously created by [openal\_device\_open()](function.openal-device-open)).
### Return Values
Returns an [Open AL(Context)](https://www.php.net/manual/en/openal.resources.php) resource on success or **`false`** on failure.
### See Also
* [openal\_device\_open()](function.openal-device-open) - Initialize the OpenAL audio layer
* [openal\_context\_destroy()](function.openal-context-destroy) - Destroys a context
php GearmanClient::doLowBackground GearmanClient::doLowBackground
==============================
(PECL gearman >= 0.5.0)
GearmanClient::doLowBackground — Run a low priority task in the background
### Description
```
public GearmanClient::doLowBackground(string $function_name, string $workload, string $unique = ?): string
```
Runs a low priority task in the background, returning a job handle which can be used to get the status of the running task. Normal and high priority tasks take precedence over 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::doHighBackground()](gearmanclient.dohighbackground) - Run a high priority task in the background
php GearmanClient::setWarningCallback GearmanClient::setWarningCallback
=================================
(PECL gearman >= 0.5.0)
GearmanClient::setWarningCallback — Set a callback for worker warnings
### Description
```
public GearmanClient::setWarningCallback(callable $callback): bool
```
Sets a function to be called when a worker sends a warning. The callback 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::setStatusCallback()](gearmanclient.setstatuscallback) - Set a callback for collecting task status
* [GearmanClient::setWorkloadCallback()](gearmanclient.setworkloadcallback) - Set a callback for accepting incremental data updates
php session_write_close session\_write\_close
=====================
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
session\_write\_close — Write session data and end session
### Description
```
session_write_close(): bool
```
End the current session and store session data.
Session data is usually stored after your script terminated without the need to call **session\_write\_close()**, but as session data is locked to prevent concurrent writes only one script may operate on a session at any time. When using framesets together with sessions you will experience the frames loading one by one due to this locking. You can reduce the time needed to load all the frames by ending the session as soon as all changes to session variables are done.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 7.2.0 | The return type of this function is bool now. Formerly, it has been void. |
### See Also
* The [session\_register\_shutdown()](function.session-register-shutdown) - Session shutdown function
| programming_docs |
php Yaf_Dispatcher::getDefaultController Yaf\_Dispatcher::getDefaultController
=====================================
(Yaf >=3.2.0)
Yaf\_Dispatcher::getDefaultController — Retrive the default controller name
### Description
```
public Yaf_Dispatcher::getDefaultController(): string
```
get the default controller name
### Parameters
This function has no parameters.
### Return Values
string, default controller name, default is "Index"
php ReflectionClassConstant::isFinal ReflectionClassConstant::isFinal
================================
(PHP 8 >= 8.1.0)
ReflectionClassConstant::isFinal — Checks if class constant is final
### Description
```
public ReflectionClassConstant::isFinal(): bool
```
Checks if the class constant is final.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the class constant is final, otherwise **`false`**
### See Also
* [ReflectionClassConstant::isPublic()](reflectionclassconstant.ispublic) - Checks if class constant is public
* [ReflectionClassConstant::isPrivate()](reflectionclassconstant.isprivate) - Checks if class constant is private
* [ReflectionClassConstant::isProtected()](reflectionclassconstant.isprotected) - Checks if class constant is protected
php Yaf_Route_Static::assemble Yaf\_Route\_Static::assemble
============================
(Yaf >=2.3.0)
Yaf\_Route\_Static::assemble — Assemble a url
### Description
```
public Yaf_Route_Static::assemble(array $info, array $query = ?): string
```
Assemble a url.
### Parameters
`info`
`query`
### Return Values
Returns a string.
### Errors/Exceptions
Throws [Yaf\_Exception\_TypeError](class.yaf-exception-typeerror) if `info` keys `':c'` and `':a'` are not set.
### Examples
**Example #1 **Yaf\_Route\_Static::assemble()**example**
```
<?php
$router = new Yaf_Router();
$route = new Yaf_Route_Static();
$router->addRoute("static", $route);
var_dump($router->getRoute('static')->assemble(
array(
':a' => 'yafaction',
'tkey' => 'tval',
':c' => 'yafcontroller',
':m' => 'yafmodule'
),
)
);
var_dump($router->getRoute('static')->assemble(
array(
':a' => 'yafaction',
'tkey' => 'tval',
':c' => 'yafcontroller',
':m' => 'yafmodule'
),
array(
'tkey1' => 'tval1',
'tkey2' => 'tval2'
)
)
);
```
The above example will output something similar to:
```
string(%d) "/yafmodule/yafcontroller/yafaction"
string(%d) "/yafmodule/yafcontroller/yafaction?tkey1=tval1&tkey2=tval2"
```
php zip_read zip\_read
=========
(PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.0.0)
zip\_read — Read next entry in 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_read(resource $zip): resource|false
```
Reads the next entry in a zip file archive.
### Parameters
`zip`
A ZIP file previously opened with [zip\_open()](function.zip-open).
### Return Values
Returns a directory entry resource for later use with the `zip_entry_...` functions, or **`false`** if there are no more entries to read, or an error code if an error occurred.
### 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\_close()](function.zip-close) - Close a ZIP file archive
* [zip\_entry\_open()](function.zip-entry-open) - Open a directory entry for reading
* [zip\_entry\_read()](function.zip-entry-read) - Read from an open directory entry
php imagefilltoborder imagefilltoborder
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
imagefilltoborder — Flood fill to specific color
### Description
```
imagefilltoborder(
GdImage $image,
int $x,
int $y,
int $border_color,
int $color
): bool
```
**imagefilltoborder()** performs a flood fill whose border color is defined by `border_color`. The starting point for the fill is `x`, `y` (top left is 0, 0) and the region is filled with color `color`.
### 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.
`y`
y-coordinate of start.
`border_color`
The border color. A color identifier created with [imagecolorallocate()](function.imagecolorallocate).
`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 Filling an ellipse with a color**
```
<?php
// Create the image handle, set the background to white
$im = imagecreatetruecolor(100, 100);
imagefilledrectangle($im, 0, 0, 100, 100, imagecolorallocate($im, 255, 255, 255));
// Draw an ellipse to fill with a black border
imageellipse($im, 50, 50, 50, 50, imagecolorallocate($im, 0, 0, 0));
// Set the border and fill colors
$border = imagecolorallocate($im, 0, 0, 0);
$fill = imagecolorallocate($im, 255, 0, 0);
// Fill the selection
imagefilltoborder($im, 50, 50, $border, $fill);
// Output and free memory
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
```
The above example will output something similar to:
### Notes
The algorithm does not explicitly remember which pixels have already been set, but rather infers that from the color of the pixel, so it cannot distinguish between freshly set pixels and pixels that are already there. That means chosing any fill color that is already used in the image may yield undesired results.
php imap_listmailbox imap\_listmailbox
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_listmailbox — Alias of [imap\_list()](function.imap-list)
### Description
This function is an alias of: [imap\_list()](function.imap-list).
php GearmanWorker::__construct GearmanWorker::\_\_construct
============================
(PECL gearman >= 0.5.0)
GearmanWorker::\_\_construct — Create a GearmanWorker instance
### Description
```
public GearmanWorker::__construct()
```
Creates a [GearmanWorker](class.gearmanworker) instance representing a worker that connects to the job server and accepts tasks to run.
### Parameters
This function has no parameters.
### Return Values
A [GearmanWorker](class.gearmanworker) object
### See Also
* [GearmanWorker::clone()](gearmanworker.clone) - Create a copy of the worker
php fmod fmod
====
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
fmod — Returns the floating point remainder (modulo) of the division of the arguments
### Description
```
fmod(float $num1, float $num2): float
```
Returns the floating point remainder of dividing the dividend (`num1`) by the divisor (`num2`). The remainder (r) is defined as: num1 = i \* num2 + r, for some integer i. If `num2` is non-zero, r has the same sign as `num1` and a magnitude less than the magnitude of `num2`.
### Parameters
`num1`
The dividend
`num2`
The divisor
### Return Values
The floating point remainder of `num1`/`num2`
### Examples
**Example #1 Using **fmod()****
```
<?php
$x = 5.7;
$y = 1.3;
$r = fmod($x, $y);
// $r equals 0.5, because 4 * 1.3 + 0.5 = 5.7
?>
```
### See Also
* [`/`](language.operators.arithmetic) - Floating-point division
* [`%`](language.operators.arithmetic) - Integer modulus
* [intdiv()](function.intdiv) - Integer division
php fdf_remove_item fdf\_remove\_item
=================
(PHP 4 >= 4.3.0, PHP 5 < 5.3.0, PECL fdf SVN)
fdf\_remove\_item — Sets target frame for form
### Description
```
fdf_remove_item(resource $fdf_document, string $fieldname, int $item): bool
```
**Warning**This function is currently not documented; only its argument list is available.
php SolrDisMaxQuery::setMinimumMatch SolrDisMaxQuery::setMinimumMatch
================================
(No version information available, might only be in Git)
SolrDisMaxQuery::setMinimumMatch — Set Minimum "Should" Match (mm)
### Description
```
public SolrDisMaxQuery::setMinimumMatch(string $value): SolrDisMaxQuery
```
Set Minimum "Should" Match parameter (mm). If the default query operator is AND then mm=100%, if the default query operator (q.op) is OR, then mm=0%.
### Parameters
`value`
Minimum match value/expression
### Return Values
[SolrDisMaxQuery](class.solrdismaxquery)
### Examples
**Example #1 **SolrDisMaxQuery::setMinimumMatch()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery("lucene");
// 75% of the query clauses must match
$dismaxQuery->setMinimumMatch("75%");
echo $dismaxQuery . PHP_EOL;
?>
```
The above example will output:
```
q=lucene&defType=edismax&mm=75%
```
php grapheme_extract grapheme\_extract
=================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
grapheme\_extract — Function to extract a sequence of default grapheme clusters from a text buffer, which must be encoded in UTF-8
### Description
Procedural style
```
grapheme_extract(
string $haystack,
int $size,
int $type = GRAPHEME_EXTR_COUNT,
int $offset = 0,
int &$next = null
): string|false
```
Function to extract a sequence of default grapheme clusters from a text buffer, which must be encoded in UTF-8.
### Parameters
`haystack`
String to search.
`size`
Maximum number items - based on the `type` - to return.
`type`
Defines the type of units referred to by the `size` parameter:
* GRAPHEME\_EXTR\_COUNT (default) -`size` is the number of default grapheme clusters to extract.
* GRAPHEME\_EXTR\_MAXBYTES -`size` is the maximum number of bytes returned.
* GRAPHEME\_EXTR\_MAXCHARS - `size` is the maximum number of UTF-8 characters returned.
`offset`
Starting position in `haystack` in bytes - if given, it must be zero or a positive value that is less than or equal to the length of `haystack` in bytes, or a negative value that counts from the end of `haystack`. If `offset` does not point to the first byte of a UTF-8 character, the start position is moved to the next character boundary.
`next`
Reference to a value that will be set to the next starting position. When the call returns, this may point to the first byte position past the end of the string.
### Return Values
A string starting at offset `offset` and ending on a default grapheme cluster boundary that conforms to the `size` and `type` specified, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 7.1.0 | Support for negative `offset`s has been added. |
### Examples
**Example #1 **grapheme\_extract()** 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_extract( $char_a_ring_nfd . $char_o_diaeresis_nfd, 1, GRAPHEME_EXTR_COUNT, 2));
?>
```
The above example will output:
```
o%CC%88
```
### See Also
* [grapheme\_substr()](function.grapheme-substr) - Return part of a string
* [» Unicode Text Segmentation: Grapheme Cluster Boundaries](http://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries)
php odbc_prepare odbc\_prepare
=============
(PHP 4, PHP 5, PHP 7, PHP 8)
odbc\_prepare — Prepares a statement for execution
### Description
```
odbc_prepare(resource $odbc, string $query): resource|false
```
Prepares a statement for execution. The result identifier can be used later to execute the statement with [odbc\_execute()](function.odbc-execute).
Some databases (such as IBM DB2, MS SQL Server, and Oracle) support stored procedures that accept parameters of type IN, INOUT, and OUT as defined by the ODBC specification. However, the Unified ODBC driver currently only supports parameters of type IN to stored procedures.
### Parameters
`odbc`
The ODBC connection identifier, see [odbc\_connect()](function.odbc-connect) for details.
`query`
The query string statement being prepared.
### Return Values
Returns an ODBC result identifier if the SQL command was prepared successfully. Returns **`false`** on error.
### Examples
**Example #1 [odbc\_execute()](function.odbc-execute) and **odbc\_prepare()** example**
In the following code, $success will only be **`true`** if all three parameters to myproc are IN parameters:
```
<?php
$a = 1;
$b = 2;
$c = 3;
$stmt = odbc_prepare($conn, 'CALL myproc(?,?,?)');
$success = odbc_execute($stmt, array($a, $b, $c));
?>
```
If you need to call a stored procedure using INOUT or OUT parameters, the recommended workaround is to use a native extension for your database (for example, [oci8](https://www.php.net/manual/en/ref.oci8.php) for Oracle).
### See Also
* [odbc\_execute()](function.odbc-execute) - Execute a prepared statement
php SVMModel::checkProbabilityModel SVMModel::checkProbabilityModel
===============================
(PECL svm >= 0.1.5)
SVMModel::checkProbabilityModel — Returns true if the model has probability information
### Description
```
public SVMModel::checkProbabilityModel(): bool
```
Returns true if the model contains probability information.
### Parameters
This function has no parameters.
### Return Values
Return a boolean value
php Phar::apiVersion Phar::apiVersion
================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
Phar::apiVersion — Returns the api version
### Description
```
final public static Phar::apiVersion(): string
```
Return the API version of the phar file format that will be used when creating phars. The Phar extension supports reading API version 1.0.0 or newer. API version 1.1.0 is required for SHA-256 and SHA-512 hash, and API version 1.1.1 is required to store empty directories.
### Parameters
### Return Values
The API version string as in `"1.0.0"`.
### Examples
**Example #1 A **Phar::apiVersion()** example**
```
<?php
echo Phar::apiVersion();
?>
```
The above example will output:
```
1.1.1
```
php sqlsrv_rollback sqlsrv\_rollback
================
(No version information available, might only be in Git)
sqlsrv\_rollback — Rolls back a transaction that was begun with [sqlsrv\_begin\_transaction()](function.sqlsrv-begin-transaction)
### Description
```
sqlsrv_rollback(resource $conn): bool
```
Rolls back a transaction that was begun with [sqlsrv\_begin\_transaction()](function.sqlsrv-begin-transaction) and returns the connection to auto-commit mode.
### Parameters
`conn`
The connection resource returned by a call to [sqlsrv\_connect()](function.sqlsrv-connect).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **sqlsrv\_rollback()** example**
The following example demonstrates how to use [sqlsrv\_begin\_transaction()](function.sqlsrv-begin-transaction) together with [sqlsrv\_commit()](function.sqlsrv-commit) and **sqlsrv\_rollback()**.
```
<?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 ));
}
/* Begin the transaction. */
if ( sqlsrv_begin_transaction( $conn ) === false ) {
die( print_r( sqlsrv_errors(), true ));
}
/* Initialize parameter values. */
$orderId = 1; $qty = 10; $productId = 100;
/* Set up and execute the first query. */
$sql1 = "INSERT INTO OrdersTable (ID, Quantity, ProductID)
VALUES (?, ?, ?)";
$params1 = array( $orderId, $qty, $productId );
$stmt1 = sqlsrv_query( $conn, $sql1, $params1 );
/* Set up and execute the second query. */
$sql2 = "UPDATE InventoryTable
SET Quantity = (Quantity - ?)
WHERE ProductID = ?";
$params2 = array($qty, $productId);
$stmt2 = sqlsrv_query( $conn, $sql2, $params2 );
/* If both queries were successful, commit the transaction. */
/* Otherwise, rollback the transaction. */
if( $stmt1 && $stmt2 ) {
sqlsrv_commit( $conn );
echo "Transaction committed.<br />";
} else {
sqlsrv_rollback( $conn );
echo "Transaction rolled back.<br />";
}
?>
```
### See Also
* [sqlsrv\_begin\_transaction()](function.sqlsrv-begin-transaction) - Begins a database transaction
* [sqlsrv\_commit()](function.sqlsrv-commit) - Commits a transaction that was begun with sqlsrv\_begin\_transaction
php pcntl_signal_dispatch pcntl\_signal\_dispatch
=======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
pcntl\_signal\_dispatch — Calls signal handlers for pending signals
### Description
```
pcntl_signal_dispatch(): bool
```
The **pcntl\_signal\_dispatch()** function calls the signal handlers installed by [pcntl\_signal()](function.pcntl-signal) for each pending signal.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **pcntl\_signal\_dispatch()** example**
```
<?php
echo "Installing signal handler...\n";
pcntl_signal(SIGHUP, function($signo) {
echo "signal handler called\n";
});
echo "Generating signal SIGHUP to self...\n";
posix_kill(posix_getpid(), SIGHUP);
echo "Dispatching...\n";
pcntl_signal_dispatch();
echo "Done\n";
?>
```
The above example will output something similar to:
```
Installing signal handler...
Generating signal SIGHUP to self...
Dispatching...
signal handler called
Done
```
### See Also
* [pcntl\_signal()](function.pcntl-signal) - Installs a signal handler
* [pcntl\_sigprocmask()](function.pcntl-sigprocmask) - Sets and retrieves blocked signals
* [pcntl\_sigwaitinfo()](function.pcntl-sigwaitinfo) - Waits for signals
* [pcntl\_sigtimedwait()](function.pcntl-sigtimedwait) - Waits for signals, with a timeout
php spl_autoload_extensions spl\_autoload\_extensions
=========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
spl\_autoload\_extensions — Register and return default file extensions for spl\_autoload
### Description
```
spl_autoload_extensions(?string $file_extensions = null): string
```
This function can modify and check the file extensions that the built in [\_\_autoload()](function.autoload) fallback function [spl\_autoload()](function.spl-autoload) will be using.
> **Note**: There should not be a space between the defined file extensions.
>
>
### Parameters
`file_extensions`
If **`null`**, it simply returns the current list of extensions each separated by comma. To modify the list of file extensions, simply invoke the functions with the new list of file extensions to use in a single string with each extensions separated by comma.
### Return Values
A comma delimited list of default file extensions for [spl\_autoload()](function.spl-autoload).
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `file_extensions` is now nullable. |
### Examples
**Example #1 **spl\_autoload\_extensions()** example**
```
<?php
spl_autoload_extensions(".php,.inc");
?>
```
| programming_docs |
php SoapClient::__setLocation SoapClient::\_\_setLocation
===========================
(PHP 5 >= 5.0.4, PHP 7, PHP 8)
SoapClient::\_\_setLocation — Sets the location of the Web service to use
### Description
```
public SoapClient::__setLocation(?string $location = null): ?string
```
Sets the endpoint URL that will be touched by following SOAP requests. This is equivalent to specifying the `location` option when constructing the SoapClient.
>
> **Note**:
>
>
> Calling this method is optional. The SoapClient uses the endpoint from the WSDL file by default.
>
>
### Parameters
`location`
The new endpoint URL.
### Return Values
The old endpoint URL.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.3 | `location` is nullable now. |
### Examples
**Example #1 **SoapClient::\_\_setLocation()** example**
```
<?php
$client = new SoapClient('http://example.com/webservice.php?wsdl');
$client->__setLocation('http://www.somethirdparty.com');
$old_location = $client->__setLocation(); // unsets the location option
echo $old_location;
?>
```
The above example will output something similar to:
```
http://www.somethirdparty.com
```
### See Also
* [SoapClient::\_\_construct()](soapclient.construct) - SoapClient constructor
php The Yaf_Bootstrap_Abstract class
The Yaf\_Bootstrap\_Abstract class
==================================
Introduction
------------
(No version information available, might only be in Git)
Bootstrap is a mechanism used to do some initial config before a Application run.
User may define their own Bootstrap class by inheriting **Yaf\_Bootstrap\_Abstract**
Any method declared in Bootstrap class with leading "\_init", will be called by [Yaf\_Application::bootstrap()](yaf-application.bootstrap) one by one according to their defined order.
Examples
--------
**Example #1 Bootstrap example**
```
<?php
/* bootstrap class should be defined under ./application/Bootstrap.php */
class Bootstrap extends Yaf_Bootstrap_Abstract {
public function _initConfig(Yaf_Dispatcher $dispatcher) {
var_dump(__METHOD__);
}
public function _initPlugin(Yaf_Dispatcher $dispatcher) {
var_dump(__METHOD__);
}
}
$config = array(
"application" => array(
"directory" => dirname(__FILE__) . "/application/",
),
);
$app = new Yaf_Application($config);
$app->bootstrap();
?>
```
The above example will output something similar to:
```
string(22) "Bootstrap::_initConfig"
string(22) "Bootstrap::_initPlugin"
```
Class synopsis
--------------
abstract class **Yaf\_Bootstrap\_Abstract** { /\* Properties \*/ /\* Methods \*/ }
php tidy::root tidy::root
==========
tidy\_get\_root
===============
(PHP 5, PHP 7, PHP 8, PECL tidy 0.5.2-1.0.0)
tidy::root -- tidy\_get\_root — Returns a [tidyNode](class.tidynode) object representing the root of the tidy parse tree
### Description
Object-oriented style
```
public tidy::root(): ?tidyNode
```
Procedural style
```
tidy_get_root(tidy $tidy): ?tidyNode
```
Returns a [tidyNode](class.tidynode) object representing the root of the tidy parse tree.
### Parameters
`tidy`
The [Tidy](class.tidy) object.
### Return Values
Returns the [tidyNode](class.tidynode) object.
### Examples
**Example #1 **tidy::root()** example**
```
<?php
$html = <<< HTML
<html><body>
<p>paragraph</p>
<br/>
</body></html>
HTML;
$tidy = tidy_parse_string($html);
dump_nodes($tidy->root(), 1);
function dump_nodes($node, $indent) {
if($node->hasChildren()) {
foreach($node->child as $child) {
echo str_repeat('.', $indent*2) . ($child->name ? $child->name : '"'.$child->value.'"'). "\n";
dump_nodes($child, $indent+1);
}
}
}
?>
```
The above example will output:
```
..html
....head
......title
....body
......p
........"paragraph"
......br
```
php XSLTProcessor::__construct XSLTProcessor::\_\_construct
============================
(PHP 5, PHP 7, PHP 8)
XSLTProcessor::\_\_construct — Creates a new XSLTProcessor object
### Description
public **XSLTProcessor::\_\_construct**() Creates a new [XSLTProcessor](class.xsltprocessor) object.
### Parameters
This function has no parameters.
### Examples
**Example #1 Creating an [XSLTProcessor](class.xsltprocessor)**
```
<?php
$xsldoc = new DOMDocument();
$xsldoc->load($xsl_filename);
$xmldoc = new DOMDocument();
$xmldoc->load($xml_filename);
$xsl = new XSLTProcessor();
$xsl->importStyleSheet($xsldoc);
echo $xsl->transformToXML($xmldoc);
?>
```
php IntlTimeZone::getOffset IntlTimeZone::getOffset
=======================
intltz\_get\_offset
===================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlTimeZone::getOffset -- intltz\_get\_offset — Get the time zone raw and GMT offset for the given moment in time
### Description
Object-oriented style (method):
```
public IntlTimeZone::getOffset(
float $timestamp,
bool $local,
int &$rawOffset,
int &$dstOffset
): bool
```
Procedural style:
```
intltz_get_offset(
IntlTimeZone $timezone,
float $timestamp,
bool $local,
int &$rawOffset,
int &$dstOffset
): bool
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`timestamp`
`local`
`rawOffset`
`dstOffset`
### Return Values
php mb_strripos mb\_strripos
============
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
mb\_strripos — Finds position of last occurrence of a string within another, case insensitive
### Description
```
mb_strripos(
string $haystack,
string $needle,
int $offset = 0,
?string $encoding = null
): int|false
```
**mb\_strripos()** performs multi-byte safe [strripos()](function.strripos) operation based on number of characters. `needle` position is counted from the beginning of `haystack`. First character's position is 0. Second character position is 1. Unlike [mb\_strrpos()](function.mb-strrpos), **mb\_strripos()** is case-insensitive.
### Parameters
`haystack`
The string from which to get the position of the last occurrence of `needle`
`needle`
The string to find in `haystack`
`offset`
The position in `haystack` to start searching
`encoding`
Character encoding name to use. If it is omitted, internal character encoding is used.
### Return Values
Return the numeric position of the last occurrence of `needle` in the `haystack` string, or **`false`** if `needle` is not found.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `needle` now accepts an empty string. |
| 8.0.0 | `encoding` is nullable now. |
### See Also
* [strripos()](function.strripos) - Find the position of the last 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
* [mb\_strrpos()](function.mb-strrpos) - Find position of last occurrence of a string in a string
php None Static Keyword
--------------
**Tip** This page describes the use of the `static` keyword to define static methods and properties. `static` can also be used to [define static variables](language.variables.scope#language.variables.scope.static) and for [late static bindings](language.oop5.late-static-bindings). Please refer to those pages for information on those meanings of `static`.
Declaring class properties or methods as static makes them accessible without needing an instantiation of the class. These can also be accessed statically within an instantiated class object.
### Static methods
Because static methods are callable without an instance of the object created, the pseudo-variable $this is not available inside methods declared as static.
**Warning** Calling non-static methods statically throws an [Error](class.error).
Prior to PHP 8.0.0, calling non-static methods statically were deprecated, and generated an **`E_DEPRECATED`** warning.
**Example #1 Static method example**
```
<?php
class Foo {
public static function aStaticMethod() {
// ...
}
}
Foo::aStaticMethod();
$classname = 'Foo';
$classname::aStaticMethod();
?>
```
### Static properties
Static properties are accessed using the [Scope Resolution Operator](language.oop5.paamayim-nekudotayim) (`::`) and cannot be accessed through the object operator (`->`).
It's possible to reference the class using a variable. The variable's value cannot be a keyword (e.g. `self`, `parent` and `static`).
**Example #2 Static property example**
```
<?php
class Foo
{
public static $my_static = 'foo';
public function staticValue() {
return self::$my_static;
}
}
class Bar extends Foo
{
public function fooStatic() {
return parent::$my_static;
}
}
print Foo::$my_static . "\n";
$foo = new Foo();
print $foo->staticValue() . "\n";
print $foo->my_static . "\n"; // Undefined "Property" my_static
print $foo::$my_static . "\n";
$classname = 'Foo';
print $classname::$my_static . "\n";
print Bar::$my_static . "\n";
$bar = new Bar();
print $bar->fooStatic() . "\n";
?>
```
Output of the above example in PHP 8 is similar to:
```
foo
foo
Notice: Accessing static property Foo::$my_static as non static in /in/V0Rvv on line 23
Warning: Undefined property: Foo::$my_static in /in/V0Rvv on line 23
foo
foo
foo
foo
```
php DateTimeImmutable::setISODate DateTimeImmutable::setISODate
=============================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
DateTimeImmutable::setISODate — Sets the ISO date
### Description
```
public DateTimeImmutable::setISODate(int $year, int $week, int $dayOfWeek = 1): DateTimeImmutable
```
Returns a new DateTimeImmutable object with the date set according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
### Parameters
`year`
Year of the date.
`week`
Week of the date.
`dayOfWeek`
Offset from the first day of the week.
### Return Values
Returns a new [DateTimeImmutable](class.datetimeimmutable) object with the modified data.
### Examples
**Example #1 **DateTimeImmutable::setISODate()** example**
Object-oriented style
```
<?php
$date = new DateTimeImmutable();
$date->setISODate(2008, 2);
echo $date->format('Y-m-d') . "\n";
$date->setISODate(2008, 2, 7);
echo $date->format('Y-m-d') . "\n";
?>
```
Procedural style
```
<?php
$date = date_create();
date_isodate_set($date, 2008, 2);
echo date_format($date, 'Y-m-d') . "\n";
date_isodate_set($date, 2008, 2, 7);
echo date_format($date, 'Y-m-d') . "\n";
?>
```
The above examples will output:
```
2008-01-07
2008-01-13
```
**Example #2 Values exceeding ranges are added to their parent values**
```
<?php
$date = new DateTimeImmutable();
$newDate = $date->setISODate(2008, 2, 7);
echo $newDate->format('Y-m-d') . "\n";
$newDate = $date->setISODate(2008, 2, 8);
echo $newDate->format('Y-m-d') . "\n";
$newDate = $date->setISODate(2008, 53, 7);
echo $newDate->format('Y-m-d') . "\n";
?>
```
The above example will output:
```
2008-01-13
2008-01-14
2009-01-04
```
**Example #3 Finding the month a week is in**
```
<?php
$date = new DateTimeImmutable();
$newDate = $date->setISODate(2008, 14);
echo $newDate->format('n');
?>
```
The above examples will output:
```
3
```
### See Also
* [DateTimeImmutable::setDate()](datetimeimmutable.setdate) - Sets the date
* [DateTimeImmutable::setTime()](datetimeimmutable.settime) - Sets the time
php UnitEnum::cases UnitEnum::cases
===============
(PHP 8 >= 8.1.0)
UnitEnum::cases — Generates a list of cases on an enum
### Description
```
public static UnitEnum::cases(): array
```
This method will return a packed array of all cases in an enumeration, in lexical order.
### Parameters
This function has no parameters.
### Return Values
An array of all defined cases of this enumeration, in lexical order.
### Examples
**Example #1 Basic usage**
The following example illustrates how enum cases are returned.
```
<?php
enum Suit
{
case Hearts;
case Diamonds;
case Clubs;
case Spades;
}
var_dump(Suit::cases());
?>
```
The above example will output:
```
array(4) {
[0]=>
enum(Suit::Hearts)
[1]=>
enum(Suit::Diamonds)
[2]=>
enum(Suit::Clubs)
[3]=>
enum(Suit::Spades)
}
```
php Ds\Stack::capacity Ds\Stack::capacity
==================
(PECL ds >= 1.0.0)
Ds\Stack::capacity — Returns the current capacity
### Description
```
public Ds\Stack::capacity(): int
```
Returns the current capacity.
### Parameters
This function has no parameters.
### Return Values
The current capacity.
php EventHttp::accept EventHttp::accept
=================
(PECL event >= 1.2.6-beta)
EventHttp::accept — Makes an HTTP server accept connections on the specified socket stream or resource
### Description
```
public EventHttp::accept( mixed $socket ): bool
```
Makes an HTTP server accept connections on the specified socket stream or resource. The socket should be ready to accept connections.
Can be called multiple times to accept connections on different sockets.
>
> **Note**:
>
>
> To bind a socket, `listen` , and `accept` connections on the socket in s single call use [EventHttp::bind()](eventhttp.bind) . **EventHttp::accept()** is needed only if one already has a socket ready to accept connections.
>
>
### Parameters
`socket` Socket resource, stream or numeric file descriptor representing a socket ready to accept connections.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **EventHttp::accept()** example**
```
<?php
$base = new EventBase();
$http = new EventHttp($base);
$addresses = array (
8091 => "127.0.0.1",
8092 => "127.0.0.2",
);
$i = 0;
$socket = array();
foreach ($addresses as $port => $ip) {
echo $ip, " ", $port, PHP_EOL;
$socket[$i] = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (!socket_bind($socket[$i], $ip, $port)) {
exit("socket_bind failed\n");
}
socket_listen($socket[$i], 0);
socket_set_nonblock($socket[$i]);
if (!$http->accept($socket[$i])) {
echo "Accept failed\n";
exit(1);
}
++$i;
}
$http->setCallback("/some-page", function() {
echo "(some-page)\n";
echo "URI: ", $req->getUri(), PHP_EOL;
$req->sendReply(200, "OK");
echo "OK\n";
});
$http->setDefaultCallback(function($req) {
echo "URI: ", $req->getUri(), PHP_EOL;
$req->sendReply(200, "OK");
echo "OK\n";
});
$signal = Event::signal($base, SIGINT, function () use ($base) {
echo "Caught SIGINT. Stopping...\n";
$base->stop();
});
$signal->add();
$base->dispatch();
echo "END\n";
// We didn't close sockets, since Libevent already sets
// CLOSE_ON_FREE and CLOSE_ON_EXEC flags on the file
// descriptor associated with the sockets.
?>
```
The above example will output something similar to:
```
Client:
$ nc 127.0.0.1 8091
GET /about HTTP/1.0
Connection: close
HTTP/1.0 200 OK
Content-Type: text/html; charset=ISO-8859-1
Connection: close
Server:
127.0.0.1 8091
127.0.0.2 8092
URI: /about
OK
```
### See Also
* [EventHttp::bind()](eventhttp.bind) - Binds an HTTP server on the specified address and port
php EventHttp::removeServerAlias EventHttp::removeServerAlias
============================
(PECL event >= 1.4.0-beta)
EventHttp::removeServerAlias — Removes server alias
### Description
```
public EventHttp::removeServerAlias( string $alias ): bool
```
Removes server alias added with [EventHttp::addServerAlias()](eventhttp.addserveralias)
### Parameters
`alias` The alias to remove.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [EventHttp::addServerAlias()](eventhttp.addserveralias) - Adds a server alias to the HTTP server object
php mysqli_result::getIterator mysqli\_result::getIterator
===========================
(PHP 8)
mysqli\_result::getIterator — Retrieve an external iterator
### Description
```
public mysqli_result::getIterator(): Iterator
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php openssl_error_string openssl\_error\_string
======================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
openssl\_error\_string — Return openSSL error message
### Description
```
openssl_error_string(): string|false
```
**openssl\_error\_string()** returns the last error from the openSSL library. Error messages are queued, so this function should be called multiple times to collect all of the information. The last error will be the most recent one.
### Parameters
This function has no parameters.
### Return Values
Returns an error message string, or **`false`** if there are no more error messages to return.
### Examples
**Example #1 **openssl\_error\_string()** example**
```
<?php
// lets assume you just called an openssl function that failed
while ($msg = openssl_error_string())
echo $msg . "<br />\n";
?>
```
php XSLTProcessor::registerPHPFunctions XSLTProcessor::registerPHPFunctions
===================================
(PHP 5 >= 5.0.4, PHP 7, PHP 8)
XSLTProcessor::registerPHPFunctions — Enables the ability to use PHP functions as XSLT functions
### Description
```
public XSLTProcessor::registerPHPFunctions(array|string|null $functions = null): void
```
This method enables the ability to use PHP functions as XSLT functions within XSL stylesheets.
### Parameters
`functions`
Use this parameter to only allow certain functions to be called from XSLT.
This parameter can be either a string (a function name) or an array of functions.
### Return Values
No value is returned.
### Examples
**Example #1 Simple PHP Function call from a stylesheet**
```
<?php
$xml = <<<EOB
<allusers>
<user>
<uid>bob</uid>
</user>
<user>
<uid>joe</uid>
</user>
</allusers>
EOB;
$xsl = <<<EOB
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:php="http://php.net/xsl">
<xsl:output method="html" encoding="utf-8" indent="yes"/>
<xsl:template match="allusers">
<html><body>
<h2>Users</h2>
<table>
<xsl:for-each select="user">
<tr><td>
<xsl:value-of
select="php:function('ucfirst',string(uid))"/>
</td></tr>
</xsl:for-each>
</table>
</body></html>
</xsl:template>
</xsl:stylesheet>
EOB;
$xmldoc = DOMDocument::loadXML($xml);
$xsldoc = DOMDocument::loadXML($xsl);
$proc = new XSLTProcessor();
$proc->registerPHPFunctions();
$proc->importStyleSheet($xsldoc);
echo $proc->transformToXML($xmldoc);
?>
```
php gzopen gzopen
======
(PHP 4, PHP 5, PHP 7, PHP 8)
gzopen — Open gz-file
### Description
```
gzopen(string $filename, string $mode, int $use_include_path = 0): resource|false
```
Opens a gzip (.gz) file for reading or writing.
**gzopen()** can be used to read a file which is not in gzip format; in this case [gzread()](function.gzread) will directly read from the file without decompression.
### Parameters
`filename`
The file name.
`mode`
As in [fopen()](function.fopen) (`rb` or `wb`) but can also include a compression level (`wb9`) or a strategy: `f` for filtered data as in `wb6f`, `h` for `Huffman only compression` as in `wb1h`. (See the description of `deflateInit2` in zlib.h for more information about the strategy parameter.)
`use_include_path`
You can set this optional parameter to `1`, 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.
### Return Values
Returns a file pointer to the file opened, after that, everything you read from this file descriptor will be transparently decompressed and what you write gets compressed.
If the open fails, the function returns **`false`**.
### Examples
**Example #1 **gzopen()** Example**
```
<?php
$fp = gzopen("/tmp/file.gz", "r");
?>
```
### See Also
* [gzclose()](function.gzclose) - Close an open gz-file pointer
| programming_docs |
php yaml_parse_url yaml\_parse\_url
================
(PECL yaml >= 0.4.0)
yaml\_parse\_url — Parse a Yaml stream from a URL
### Description
```
yaml_parse_url(
string $url,
int $pos = 0,
int &$ndocs = ?,
array $callbacks = null
): mixed
```
Convert all or part of a YAML document stream read from a URL to a PHP variable.
### Parameters
`url`
`url` should be of the form "scheme://...". 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.
`pos`
Document to extract from stream (`-1` for all documents, `0` for first document, ...).
`ndocs`
If `ndocs` is provided, then it is filled with the number of documents found in stream.
`callbacks`
Content handlers for YAML nodes. Associative array of YAML tag => [callable](language.types.callable) mappings. See [parse callbacks](https://www.php.net/manual/en/yaml.callbacks.parse.php) for more
### Return Values
Returns the value encoded in `input` in appropriate PHP type or **`false`** on failure. If `pos` is `-1` an array will be returned with one entry for each document found in the stream.
### Notes
**Warning** Processing untrusted user input with **yaml\_parse\_url()** is dangerous if the use of [unserialize()](function.unserialize) is enabled for nodes using the `!php/object` tag. This behavior can be disabled by using the `yaml.decode_php` ini setting.
### See Also
* [yaml\_parse()](function.yaml-parse) - Parse a YAML stream
* [yaml\_parse\_file()](function.yaml-parse-file) - Parse a YAML stream from a file
* [yaml\_emit()](function.yaml-emit) - Returns the YAML representation of a value
php PDO::__construct PDO::\_\_construct
==================
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0)
PDO::\_\_construct — Creates a PDO instance representing a connection to a database
### Description
public **PDO::\_\_construct**(
string `$dsn`,
?string `$username` = **`null`**,
?string `$password` = **`null`**,
?array `$options` = **`null`**
) Creates a PDO instance to represent a connection to the requested database.
### Parameters
`dsn`
The Data Source Name, or DSN, contains the information required to connect to the database.
In general, a DSN consists of the PDO driver name, followed by a colon, followed by the PDO driver-specific connection syntax. Further information is available from the [PDO driver-specific documentation](https://www.php.net/manual/en/pdo.drivers.php).
The `dsn` parameter supports three different methods of specifying the arguments required to create a database connection:
Driver invocation `dsn` contains the full DSN.
URI invocation `dsn` consists of **`uri:`** followed by a URI that defines the location of a file containing the DSN string. The URI can specify a local file or a remote URL.
**`uri:file:///path/to/dsnfile`**
Aliasing `dsn` consists of a name `name` that maps to `pdo.dsn.`name`` in php.ini defining the DSN string.
>
> **Note**:
>
>
> The alias must be defined in php.ini, and not .htaccess or httpd.conf
>
>
`username`
The user name for the DSN string. This parameter is optional for some PDO drivers.
`password`
The password for the DSN string. This parameter is optional for some PDO drivers.
`options`
A key=>value array of driver-specific connection options.
### Errors/Exceptions
**PDO::\_\_construct()** throws a [PDOException](class.pdoexception) if the attempt to connect to the requested database fails, regardless of which **`PDO::ATTR_ERRMODE`** is currently set.
### Examples
**Example #1 Create a PDO instance via driver invocation**
```
<?php
/* Connect to a MySQL database using driver invocation */
$dsn = 'mysql:dbname=testdb;host=127.0.0.1';
$user = 'dbuser';
$password = 'dbpass';
$dbh = new PDO($dsn, $user, $password);
?>
```
**Example #2 Create a PDO instance via URI invocation**
The following example assumes that the file /usr/local/dbconnect exists with file permissions that enable PHP to read the file. The file contains the PDO DSN to connect to a DB2 database through the PDO\_ODBC driver:
```
odbc:DSN=SAMPLE;UID=john;PWD=mypass
```
The PHP script can then create a database connection by simply passing the `uri:` parameter and pointing to the file URI:
```
<?php
/* Connect to an ODBC database using driver invocation */
$dsn = 'uri:file:///usr/local/dbconnect';
$user = '';
$password = '';
$dbh = new PDO($dsn, $user, $password);
?>
```
**Example #3 Create a PDO instance using an alias**
The following example assumes that php.ini contains the following entry to enable a connection to a MySQL database using only the alias `mydb`:
```
[PDO]
pdo.dsn.mydb="mysql:dbname=testdb;host=localhost"
```
```
<?php
/* Connect to an ODBC database using an alias */
$dsn = 'mydb';
$user = '';
$password = '';
$dbh = new PDO($dsn, $user, $password);
?>
```
php Ds\Sequence::pop Ds\Sequence::pop
================
(PECL ds >= 1.0.0)
Ds\Sequence::pop — Removes and returns the last value
### Description
```
abstract public Ds\Sequence::pop(): mixed
```
Removes and returns the last value.
### Parameters
This function has no parameters.
### Return Values
The removed last value.
### Errors/Exceptions
[UnderflowException](class.underflowexception) if empty.
### Examples
**Example #1 **Ds\Sequence::pop()** example**
```
<?php
$sequence = new \Ds\Vector([1, 2, 3]);
var_dump($sequence->pop());
var_dump($sequence->pop());
var_dump($sequence->pop());
?>
```
The above example will output something similar to:
```
int(3)
int(2)
int(1)
```
php finfo_buffer finfo\_buffer
=============
finfo::buffer
=============
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL fileinfo >= 0.1.0)
finfo\_buffer -- finfo::buffer — Return information about a string buffer
### Description
Procedural style
```
finfo_buffer(
finfo $finfo,
string $string,
int $flags = FILEINFO_NONE,
?resource $context = null
): string|false
```
Object-oriented style
```
public finfo::buffer(string $string, int $flags = FILEINFO_NONE, ?resource $context = null): string|false
```
This function is used to get information about binary data in a string.
### Parameters
`finfo`
An [finfo](class.finfo) instance, returned by [finfo\_open()](function.finfo-open).
`string`
Content of a file to be checked.
`flags`
One or disjunction of more [Fileinfo constants](https://www.php.net/manual/en/fileinfo.constants.php).
`context`
### Return Values
Returns a textual description of the `string` 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\_buffer()](finfo.buffer) example**
```
<?php
$finfo = new finfo(FILEINFO_MIME);
echo $finfo->buffer($_POST["script"]) . "\n";
?>
```
The above example will output something similar to:
```
application/x-sh; charset=us-ascii
```
### See Also
* [finfo\_file()](finfo.file) - Alias of finfo\_file()
php bcadd bcadd
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
bcadd — Add two arbitrary precision numbers
### Description
```
bcadd(string $num1, string $num2, ?int $scale = null): string
```
Sums `num1` and `num2`.
### 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 sum of the two operands, as a string.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `scale` is now nullable. |
### Examples
**Example #1 **bcadd()** example**
```
<?php
$a = '1.234';
$b = '5';
echo bcadd($a, $b); // 6
echo bcadd($a, $b, 4); // 6.2340
?>
```
### See Also
* [bcsub()](function.bcsub) - Subtract one arbitrary precision number from another
php tidyNode::isComment tidyNode::isComment
===================
(PHP 5, PHP 7, PHP 8)
tidyNode::isComment — Checks if a node represents a comment
### Description
```
public tidyNode::isComment(): bool
```
Tells if the node is a comment.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the node is a comment, **`false`** otherwise.
### Examples
**Example #1 Extract comments from a mixed HTML document**
```
<?php
$html = <<< HTML
<html><head>
<?php echo '<title>title</title>'; ?>
<#
/* JSTE code */
alert('Hello World');
#>
</head>
<body>
<?php
// PHP code
echo 'hello world!';
?>
<%
/* ASP code */
response.write("Hello World!")
%>
<!-- Comments -->
Hello World
</body></html>
Outside HTML
HTML;
$tidy = tidy_parse_string($html);
$num = 0;
get_nodes($tidy->html());
function get_nodes($node) {
// check if the current node is of requested type
if($node->isComment()) {
echo "\n\n# comment node #" . ++$GLOBALS['num'] . "\n";
echo $node->value;
}
// check if the current node has childrens
if($node->hasChildren()) {
foreach($node->child as $child) {
get_nodes($child);
}
}
}
?>
```
The above example will output:
```
# comment node #1
<!-- Comments -->
```
php iconv_set_encoding iconv\_set\_encoding
====================
(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)
iconv\_set\_encoding — Set current setting for character encoding conversion
### Description
```
iconv_set_encoding(string $type, string $encoding): bool
```
Changes the value of the internal configuration variable specified by `type` to `encoding`.
### Parameters
`type`
The value of `type` can be any one of these:
* input\_encoding
* output\_encoding
* internal\_encoding
`encoding`
The character set.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **iconv\_set\_encoding()** example**
```
<?php
iconv_set_encoding("internal_encoding", "UTF-8");
iconv_set_encoding("output_encoding", "ISO-8859-1");
?>
```
### See Also
* [iconv\_get\_encoding()](function.iconv-get-encoding) - Retrieve internal configuration variables of iconv extension
* [ob\_iconv\_handler()](function.ob-iconv-handler) - Convert character encoding as output buffer handler
php SolrQuery::getHighlightHighlightMultiTerm SolrQuery::getHighlightHighlightMultiTerm
=========================================
(PECL solr >= 0.9.2)
SolrQuery::getHighlightHighlightMultiTerm — Returns whether or not to enable highlighting for range/wildcard/fuzzy/prefix queries
### Description
```
public SolrQuery::getHighlightHighlightMultiTerm(): bool
```
Returns whether or not to enable highlighting for range/wildcard/fuzzy/prefix queries
### Parameters
This function has no parameters.
### Return Values
Returns a boolean on success and **`null`** if not set.
php xdiff_file_rabdiff xdiff\_file\_rabdiff
====================
(PECL xdiff >= 1.5.0)
xdiff\_file\_rabdiff — Make binary diff of two files using the Rabin's polynomial fingerprinting algorithm
### Description
```
xdiff_file_rabdiff(string $old_file, string $new_file, string $dest): bool
```
Makes a binary diff of two files and stores the result in a patch file. The difference between this function and [xdiff\_file\_bdiff()](function.xdiff-file-bdiff) is different algorithm used which should result in faster execution and smaller diff produced. This function works with both text and binary files. Resulting patch file can be later applied using [xdiff\_file\_bpatch()](function.xdiff-file-bpatch)/[xdiff\_string\_bpatch()](function.xdiff-string-bpatch).
For more details about differences between algorithm used please check [» libxdiff](http://www.xmailserver.org/xdiff-lib.html) website.
### Parameters
`old_file`
Path to the first file. This file acts as "old" file.
`new_file`
Path to the second file. This file acts as "new" file.
`dest`
Path of the resulting patch file. Resulting file contains differences between "old" and "new" files. It is in binary format and is human-unreadable.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **xdiff\_file\_rabdiff()** example**
The following code makes binary diff of two archives.
```
<?php
$old_version = 'my_script_1.0.tgz';
$new_version = 'my_script_1.1.tgz';
xdiff_file_rabdiff($old_version, $new_version, 'my_script.bdiff');
?>
```
### Notes
>
> **Note**:
>
>
> Both files will be loaded into memory so ensure that your memory\_limit is set high enough.
>
>
### See Also
* [xdiff\_file\_bpatch()](function.xdiff-file-bpatch) - Patch a file with a binary diff
php ldap_count_references ldap\_count\_references
=======================
(PHP 8)
ldap\_count\_references — Counts the number of references in a search result
### Description
```
ldap_count_references(LDAP\Connection $ldap, LDAP\Result $result): int
```
Counts the number of references in a search 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).
### Return Values
Returns the number of references in a search result.
### 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\_connect()](function.ldap-connect) - Connect to an LDAP server
php vfprintf vfprintf
========
(PHP 5, PHP 7, PHP 8)
vfprintf — Write a formatted string to a stream
### Description
```
vfprintf(resource $stream, string $format, array $values): int
```
Write a string produced according to `format` to the stream resource specified by `stream`.
Operates as [fprintf()](function.fprintf) but accepts an array of arguments, rather than a variable number of arguments.
### Parameters
`stream`
`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
Returns the length of the outputted string.
### Examples
**Example #1 **vfprintf()**: zero-padded integers**
```
<?php
if (!($fp = fopen('date.txt', 'w')))
return;
vfprintf($fp, "%04d-%02d-%02d", array($year, $month, $day));
// will write the formatted ISO date to date.txt
?>
```
### 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
* [vsprintf()](function.vsprintf) - Return a formatted string
* [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 ldap_get_option ldap\_get\_option
=================
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
ldap\_get\_option — Get the current value for given option
### Description
```
ldap_get_option(LDAP\Connection $ldap, int $option, array|string|int &$value = null): bool
```
Sets `value` to the value of the specified option.
### Parameters
`ldap`
An [LDAP\Connection](class.ldap-connection) instance, returned by [ldap\_connect()](function.ldap-connect).
`option`
The parameter `option` can be one of:
| Option | Type | since |
| --- | --- | --- |
| **`LDAP_OPT_DEREF`** | int | |
| **`LDAP_OPT_SIZELIMIT`** | int | |
| **`LDAP_OPT_TIMELIMIT`** | int | |
| **`LDAP_OPT_NETWORK_TIMEOUT`** | int | |
| **`LDAP_OPT_PROTOCOL_VERSION`** | int | |
| **`LDAP_OPT_ERROR_NUMBER`** | int | |
| **`LDAP_OPT_DIAGNOSTIC_MESSAGE`** | string | |
| **`LDAP_OPT_REFERRALS`** | int | |
| **`LDAP_OPT_RESTART`** | int | |
| **`LDAP_OPT_HOST_NAME`** | string | |
| **`LDAP_OPT_ERROR_STRING`** | string | |
| **`LDAP_OPT_MATCHED_DN`** | string | |
| **`LDAP_OPT_SERVER_CONTROLS`** | array | |
| **`LDAP_OPT_CLIENT_CONTROLS`** | array | |
| **`LDAP_OPT_X_KEEPALIVE_IDLE`** | int | 7.1 |
| **`LDAP_OPT_X_KEEPALIVE_PROBES`** | int | 7.1 |
| **`LDAP_OPT_X_KEEPALIVE_INTERVAL`** | int | 7.1 |
| **`LDAP_OPT_X_TLS_CACERTDIR`** | string | 7.1 |
| **`LDAP_OPT_X_TLS_CACERTFILE`** | string | 7.1 |
| **`LDAP_OPT_X_TLS_CERTFILE`** | string | 7.1 |
| **`LDAP_OPT_X_TLS_CIPHER_SUITE`** | string | 7.1 |
| **`LDAP_OPT_X_TLS_CRLCHECK`** | int | 7.1 |
| **`LDAP_OPT_X_TLS_CRL_NONE`** | int | 7.1 |
| **`LDAP_OPT_X_TLS_CRL_PEER`** | int | 7.1 |
| **`LDAP_OPT_X_TLS_CRL_ALL`** | int | 7.1 |
| **`LDAP_OPT_X_TLS_CRLFILE`** | string | 7.1 |
| **`LDAP_OPT_X_TLS_DHFILE`** | string | 7.1 |
| **`LDAP_OPT_X_TLS_KEYFILE`** | string | 7.1 |
| **`LDAP_OPT_X_TLS_PACKAGE`** | string | 7.1 |
| **`LDAP_OPT_X_TLS_PROTOCOL_MIN`** | int | 7.1 |
| **`LDAP_OPT_X_TLS_RANDOM_FILE`** | string | 7.1 |
| **`LDAP_OPT_X_TLS_REQUIRE_CERT`** | int | |
`value`
This will be set to the option value.
### 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. |
### Examples
**Example #1 Check protocol version**
```
<?php
// $ds is a valid LDAP\Connection instance for a directory server
if (ldap_get_option($ds, LDAP_OPT_PROTOCOL_VERSION, $version)) {
echo "Using protocol version $version\n";
} else {
echo "Unable to determine protocol version\n";
}
?>
```
### Notes
>
> **Note**:
>
>
> This function is only available when using OpenLDAP 2.x.x OR Netscape Directory SDK x.x.
>
>
### See Also
* [ldap\_set\_option()](function.ldap-set-option) - Set the value of the given option
php EventBuffer::unfreeze EventBuffer::unfreeze
=====================
(PECL event >= 1.2.6-beta)
EventBuffer::unfreeze — Re-enable calls that modify an event buffer
### Description
```
public EventBuffer::unfreeze( bool $at_front ): bool
```
Re-enable calls that modify an event buffer.
### Parameters
`at_front` Whether to enable events at the front or at the end of the buffer.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [EventBuffer::freeze()](eventbuffer.freeze) - Prevent calls that modify an event buffer from succeeding
php stats_rand_gen_normal stats\_rand\_gen\_normal
========================
(PECL stats >= 1.0.0)
stats\_rand\_gen\_normal — Generates a single random deviate from a normal distribution
### Description
```
stats_rand_gen_normal(float $av, float $sd): float
```
Returns a random deviate from the normal distribution with mean, `av`, and standard deviation, `sd`.
### Parameters
`av`
The mean of the normal distribution
`sd`
The standard deviation of the normal distribution
### Return Values
A random deviate
php imagecreatefromgd2part imagecreatefromgd2part
======================
(PHP 4 >= 4.0.7, PHP 5, PHP 7, PHP 8)
imagecreatefromgd2part — Create a new image from a given part of GD2 file or URL
### Description
```
imagecreatefromgd2part(
string $filename,
int $x,
int $y,
int $width,
int $height
): GdImage|false
```
Create a new image from a given part of GD2 file or URL.
**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 GD2 image.
`x`
x-coordinate of source point.
`y`
y-coordinate of source point.
`width`
Source width.
`height`
Source height.
### 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 **imagecreatefromgd2part()** example**
```
<?php
// For this example we need the image size before
$image = getimagesize('./test.gd2');
// Create the image instance now we got the image
// sizes
$im = imagecreatefromgd2part('./test.gd2', 4, 4, ($image[0] / 2) - 6, ($image[1] / 2) - 6);
// Do an image operation, in this case we emboss the image
if(function_exists('imagefilter'))
{
imagefilter($im, IMG_FILTER_EMBOSS);
}
// Save optimized image
imagegd2($im, './test_emboss.gd2');
imagedestroy($im);
?>
```
### Notes
**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.
php Yaf_Request_Abstract::getServer Yaf\_Request\_Abstract::getServer
=================================
(Yaf >=1.0.0)
Yaf\_Request\_Abstract::getServer — Retrieve SERVER variable
### Description
```
public Yaf_Request_Abstract::getServer(string $name, string $default = ?): void
```
Retrieve SERVER variable
### Parameters
`name`
the variable name
`default`
if this parameter is provide, this will be returned if the variable can not be found
### Return Values
### See Also
* [Yaf\_Request\_Abstract::getParam()](yaf-request-abstract.getparam) - Retrieve calling parameter
* [Yaf\_Request\_Abstract::getEnv()](yaf-request-abstract.getenv) - Retrieve ENV varialbe
php curl_getinfo curl\_getinfo
=============
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
curl\_getinfo — Get information regarding a specific transfer
### Description
```
curl_getinfo(CurlHandle $handle, ?int $option = null): mixed
```
Gets information about the last transfer.
### Parameters
`handle` A cURL handle returned by [curl\_init()](function.curl-init).
`option`
This may be one of the following constants:
* **`CURLINFO_EFFECTIVE_URL`** - Last effective URL
* **`CURLINFO_HTTP_CODE`** - The last response code. As of cURL 7.10.8, this is a legacy alias of **`CURLINFO_RESPONSE_CODE`**
* **`CURLINFO_FILETIME`** - Remote time of the retrieved document, with the **`CURLOPT_FILETIME`** enabled; if -1 is returned the time of the document is unknown
* **`CURLINFO_TOTAL_TIME`** - Total transaction time in seconds for last transfer
* **`CURLINFO_NAMELOOKUP_TIME`** - Time in seconds until name resolving was complete
* **`CURLINFO_CONNECT_TIME`** - Time in seconds it took to establish the connection
* **`CURLINFO_PRETRANSFER_TIME`** - Time in seconds from start until just before file transfer begins
* **`CURLINFO_STARTTRANSFER_TIME`** - Time in seconds until the first byte is about to be transferred
* **`CURLINFO_REDIRECT_COUNT`** - Number of redirects, with the **`CURLOPT_FOLLOWLOCATION`** option enabled
* **`CURLINFO_REDIRECT_TIME`** - Time in seconds of all redirection steps before final transaction was started, with the **`CURLOPT_FOLLOWLOCATION`** option enabled
* **`CURLINFO_REDIRECT_URL`** - With the **`CURLOPT_FOLLOWLOCATION`** option disabled: redirect URL found in the last transaction, that should be requested manually next. With the **`CURLOPT_FOLLOWLOCATION`** option enabled: this is empty. The redirect URL in this case is available in **`CURLINFO_EFFECTIVE_URL`**
* **`CURLINFO_PRIMARY_IP`** - IP address of the most recent connection
* **`CURLINFO_PRIMARY_PORT`** - Destination port of the most recent connection
* **`CURLINFO_LOCAL_IP`** - Local (source) IP address of the most recent connection
* **`CURLINFO_LOCAL_PORT`** - Local (source) port of the most recent connection
* **`CURLINFO_SIZE_UPLOAD`** - Total number of bytes uploaded
* **`CURLINFO_SIZE_DOWNLOAD`** - Total number of bytes downloaded
* **`CURLINFO_SPEED_DOWNLOAD`** - Average download speed
* **`CURLINFO_SPEED_UPLOAD`** - Average upload speed
* **`CURLINFO_HEADER_SIZE`** - Total size of all headers received
* **`CURLINFO_HEADER_OUT`** - The request string sent. For this to work, add the **`CURLINFO_HEADER_OUT`** option to the handle by calling [curl\_setopt()](function.curl-setopt)
* **`CURLINFO_REQUEST_SIZE`** - Total size of issued requests, currently only for HTTP requests
* **`CURLINFO_SSL_VERIFYRESULT`** - Result of SSL certification verification requested by setting **`CURLOPT_SSL_VERIFYPEER`**
* **`CURLINFO_CONTENT_LENGTH_DOWNLOAD`** - Content length of download, read from `Content-Length:` field
* **`CURLINFO_CONTENT_LENGTH_UPLOAD`** - Specified size of upload
* **`CURLINFO_CONTENT_TYPE`** - `Content-Type:` of the requested document. NULL indicates server did not send valid `Content-Type:` header
* **`CURLINFO_PRIVATE`** - Private data associated with this cURL handle, previously set with the **`CURLOPT_PRIVATE`** option of [curl\_setopt()](function.curl-setopt)
* **`CURLINFO_RESPONSE_CODE`** - The last response code
* **`CURLINFO_HTTP_CONNECTCODE`** - The CONNECT response code
* **`CURLINFO_HTTPAUTH_AVAIL`** - Bitmask indicating the authentication method(s) available according to the previous response
* **`CURLINFO_PROXYAUTH_AVAIL`** - Bitmask indicating the proxy authentication method(s) available according to the previous response
* **`CURLINFO_OS_ERRNO`** - Errno from a connect failure. The number is OS and system specific.
* **`CURLINFO_NUM_CONNECTS`** - Number of connections curl had to create to achieve the previous transfer
* **`CURLINFO_SSL_ENGINES`** - OpenSSL crypto-engines supported
* **`CURLINFO_COOKIELIST`** - All known cookies
* **`CURLINFO_FTP_ENTRY_PATH`** - Entry path in FTP server
* **`CURLINFO_APPCONNECT_TIME`** - Time in seconds it took from the start until the SSL/SSH connect/handshake to the remote host was completed
* **`CURLINFO_CERTINFO`** - TLS certificate chain
* **`CURLINFO_CONDITION_UNMET`** - Info on unmet time conditional
* **`CURLINFO_RTSP_CLIENT_CSEQ`** - Next RTSP client CSeq
* **`CURLINFO_RTSP_CSEQ_RECV`** - Recently received CSeq
* **`CURLINFO_RTSP_SERVER_CSEQ`** - Next RTSP server CSeq
* **`CURLINFO_RTSP_SESSION_ID`** - RTSP session ID
* **`CURLINFO_CONTENT_LENGTH_DOWNLOAD_T`** - The content-length of the download. This is the value read from the `Content-Type:` field. -1 if the size isn't known
* **`CURLINFO_CONTENT_LENGTH_UPLOAD_T`** - The specified size of the upload. -1 if the size isn't known
* **`CURLINFO_HTTP_VERSION`** - The version used in the last HTTP connection. The return value will be one of the defined **`CURL_HTTP_VERSION_*`** constants or 0 if the version can't be determined
* **`CURLINFO_PROTOCOL`** - The protocol used in the last HTTP connection. The returned value will be exactly one of the **`CURLPROTO_*`** values
* **`CURLINFO_PROXY_SSL_VERIFYRESULT`** - The result of the certificate verification that was requested (using the **`CURLOPT_PROXY_SSL_VERIFYPEER`** option). Only used for HTTPS proxies
* **`CURLINFO_SCHEME`** - The URL scheme used for the most recent connection
* **`CURLINFO_SIZE_DOWNLOAD_T`** - Total number of bytes that were downloaded. The number is only for the latest transfer and will be reset again for each new transfer
* **`CURLINFO_SIZE_UPLOAD_T`** - Total number of bytes that were uploaded
* **`CURLINFO_SPEED_DOWNLOAD_T`** - The average download speed in bytes/second that curl measured for the complete download
* **`CURLINFO_SPEED_UPLOAD_T`** - The average upload speed in bytes/second that curl measured for the complete upload
* **`CURLINFO_APPCONNECT_TIME_T`** - Time, in microseconds, it took from the start until the SSL/SSH connect/handshake to the remote host was completed
* **`CURLINFO_CONNECT_TIME_T`** - Total time taken, in microseconds, from the start until the connection to the remote host (or proxy) was completed
* **`CURLINFO_FILETIME_T`** - Remote time of the retrieved document (as Unix timestamp), an alternative to **`CURLINFO_FILETIME`** to allow systems with 32 bit long variables to extract dates outside of the 32bit timestamp range
* **`CURLINFO_NAMELOOKUP_TIME_T`** - Time in microseconds from the start until the name resolving was completed
* **`CURLINFO_PRETRANSFER_TIME_T`** - Time taken from the start until the file transfer is just about to begin, in microseconds
* **`CURLINFO_REDIRECT_TIME_T`** - Total time, in microseconds, it took for all redirection steps include name lookup, connect, pretransfer and transfer before final transaction was started
* **`CURLINFO_STARTTRANSFER_TIME_T`** - Time, in microseconds, it took from the start until the first byte is received
* **`CURLINFO_TOTAL_TIME_T`** - Total time in microseconds for the previous transfer, including name resolving, TCP connect etc.
### Return Values
If `option` is given, returns its value. Otherwise, returns an associative array with the following elements (which correspond to `option`), or **`false`** on failure:
* "url"
* "content\_type"
* "http\_code"
* "header\_size"
* "request\_size"
* "filetime"
* "ssl\_verify\_result"
* "redirect\_count"
* "total\_time"
* "namelookup\_time"
* "connect\_time"
* "pretransfer\_time"
* "size\_upload"
* "size\_download"
* "speed\_download"
* "speed\_upload"
* "download\_content\_length"
* "upload\_content\_length"
* "starttransfer\_time"
* "redirect\_time"
* "certinfo"
* "primary\_ip"
* "primary\_port"
* "local\_ip"
* "local\_port"
* "redirect\_url"
* "request\_header" (This is only set if the **`CURLINFO_HEADER_OUT`** is set by a previous call to [curl\_setopt()](function.curl-setopt))
Note that private data is not included in the associative array and must be retrieved individually with the **`CURLINFO_PRIVATE`** option. ### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `handle` expects a [CurlHandle](class.curlhandle) instance now; previously, a resource was expected. |
| 8.0.0 | `option` is nullable now; previously, the default was `0`. |
| 7.3.0 | Introduced **`CURLINFO_CONTENT_LENGTH_DOWNLOAD_T`**, **`CURLINFO_CONTENT_LENGTH_UPLOAD_T`**, **`CURLINFO_HTTP_VERSION`**, **`CURLINFO_PROTOCOL`**, **`CURLINFO_PROXY_SSL_VERIFYRESULT`**, **`CURLINFO_SCHEME`**, **`CURLINFO_SIZE_DOWNLOAD_T`**, **`CURLINFO_SIZE_UPLOAD_T`**, **`CURLINFO_SPEED_DOWNLOAD_T`**, **`CURLINFO_SPEED_UPLOAD_T`**, **`CURLINFO_APPCONNECT_TIME_T`**, **`CURLINFO_CONNECT_TIME_T`**, **`CURLINFO_FILETIME_T`**, **`CURLINFO_NAMELOOKUP_TIME_T`**, **`CURLINFO_PRETRANSFER_TIME_T`**, **`CURLINFO_REDIRECT_TIME_T`**, **`CURLINFO_STARTTRANSFER_TIME_T`**, **`CURLINFO_TOTAL_TIME_T`**. |
### Examples
**Example #1 **curl\_getinfo()** example**
```
<?php
// Create a cURL handle
$ch = curl_init('http://www.example.com/');
// Execute
curl_exec($ch);
// Check if any error occurred
if (!curl_errno($ch)) {
$info = curl_getinfo($ch);
echo 'Took ', $info['total_time'], ' seconds to send a request to ', $info['url'], "\n";
}
// Close handle
curl_close($ch);
?>
```
**Example #2 **curl\_getinfo()** example with `option` parameter**
```
<?php
// Create a cURL handle
$ch = curl_init('http://www.example.com/');
// Execute
curl_exec($ch);
// Check HTTP status code
if (!curl_errno($ch)) {
switch ($http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE)) {
case 200: # OK
break;
default:
echo 'Unexpected HTTP code: ', $http_code, "\n";
}
}
// Close handle
curl_close($ch);
?>
```
### Notes
>
> **Note**:
>
>
> Information gathered by this function is kept if the handle is re-used. This means that unless a statistic is overridden internally by this function, the previous info is returned.
>
>
php Phar::count Phar::count
===========
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
Phar::count — Returns the number of entries (files) in the Phar archive
### Description
```
public Phar::count(int $mode = COUNT_NORMAL): int
```
### Parameters
### Return Values
The number of files contained within this phar, or `0` (the number zero) if none.
### Examples
**Example #1 A **Phar::count()** example**
```
<?php
// make sure it doesn't exist
@unlink('brandnewphar.phar');
try {
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
} catch (Exception $e) {
echo 'Could not create phar:', $e;
}
echo 'The new phar has ' . $p->count() . " entries\n";
$p['file.txt'] = 'hi';
echo 'The new phar has ' . $p->count() . " entries\n";
?>
```
The above example will output:
```
The new phar has 0 entries
The new phar has 1 entries
```
php ImagickDraw::pathMoveToRelative ImagickDraw::pathMoveToRelative
===============================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::pathMoveToRelative — Starts a new sub-path
### Description
```
public ImagickDraw::pathMoveToRelative(float $x, float $y): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Starts a new sub-path at the given coordinate using relative coordinates. The current point then becomes the specified coordinate.
### Parameters
`x`
target x coordinate
`y`
target y coordinate
### Return Values
No value is returned.
php Imagick::brightnessContrastImage Imagick::brightnessContrastImage
================================
(PECL imagick 3 >= 3.3.0)
Imagick::brightnessContrastImage — Description
### Description
```
public Imagick::brightnessContrastImage(float $brightness, float $contrast, int $channel = Imagick::CHANNEL_DEFAULT): bool
```
Change the brightness and/or contrast of an image. It converts the brightness and contrast parameters into slope and intercept and calls a polynomical function to apply to the image.
### Parameters
`brightness`
`contrast`
`channel`
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::brightnessContrastImage()****
```
<?php
function brightnessContrastImage($imagePath, $brightness, $contrast, $channel) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->brightnessContrastImage($brightness, $contrast, $channel);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php Yaf_Session::offsetUnset Yaf\_Session::offsetUnset
=========================
(Yaf >=1.0.0)
Yaf\_Session::offsetUnset — The offsetUnset purpose
### Description
```
public Yaf_Session::offsetUnset(string $name): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`name`
### Return Values
| programming_docs |
php SolrParams::unserialize SolrParams::unserialize
=======================
(PECL solr >= 0.9.2)
SolrParams::unserialize — Used for custom serialization
### Description
```
final public SolrParams::unserialize(string $serialized): void
```
Used for custom serialization
### Parameters
`serialized`
The serialized representation of the object
### Return Values
None
php The SolrException class
The SolrException class
=======================
Introduction
------------
(PECL solr >= 0.9.2)
This is the base class for all exception thrown by the Solr extension classes.
Class synopsis
--------------
class **SolrException** extends [Exception](class.exception) { /\* Properties \*/ protected int [$sourceline](class.solrexception#solrexception.props.sourceline);
protected string [$sourcefile](class.solrexception#solrexception.props.sourcefile);
protected string [$zif\_name](class.solrexception#solrexception.props.zif-name); /\* 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 getInternalInfo(): array
```
/\* 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
----------
sourceline The line in c-space source file where exception was generated
sourcefile The c-space source file where exception was generated
zif\_name The c-space function where exception was generated
Table of Contents
-----------------
* [SolrException::getInternalInfo](solrexception.getinternalinfo) — Returns internal information where the Exception was thrown
php imageinterlace imageinterlace
==============
(PHP 4, PHP 5, PHP 7, PHP 8)
imageinterlace — Enable or disable interlace
### Description
```
imageinterlace(GdImage $image, ?bool $enable = null): bool
```
**imageinterlace()** turns the interlace bit on or off.
If the interlace bit is set and the image is used as a JPEG image, the image is created as a progressive JPEG.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`interlace`
If **`true`**, the image will be interlaced, if **`false`** the interlace bit is turned off. Passing **`null`** will result in the interlacing behavior not being changed.
### Return Values
Returns **`true`** if the interlace bit is set for the image, **`false`** otherwise.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.5 | **imageinterlace()** returns a bool now; previously it returned an int (non-zero for interlaced images, zero otherwise). |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
| 8.0.0 | `enable` expects a bool now; previously it expected an int. |
### Examples
**Example #1 Turn on interlacing using **imageinterlace()****
```
<?php
// Create an image instance
$im = imagecreatefromgif('php.gif');
// Enable interlancing
imageinterlace($im, true);
// Save the interlaced image
imagegif($im, './php_interlaced.gif');
imagedestroy($im);
?>
```
php MultipleIterator::valid MultipleIterator::valid
=======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
MultipleIterator::valid — Checks the validity of sub iterators
### Description
```
public MultipleIterator::valid(): bool
```
Checks the validity of sub iterators.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if one or all sub iterators are valid depending on flags, otherwise **`false`**
### See Also
* [MultipleIterator::\_\_construct()](multipleiterator.construct) - Constructs a new MultipleIterator
php ftp_get ftp\_get
========
(PHP 4, PHP 5, PHP 7, PHP 8)
ftp\_get — Downloads a file from the FTP server
### Description
```
ftp_get(
FTP\Connection $ftp,
string $local_filename,
string $remote_filename,
int $mode = FTP_BINARY,
int $offset = 0
): bool
```
**ftp\_get()** retrieves a remote file from the FTP server, and saves it into a local file.
### Parameters
`ftp`
An [FTP\Connection](class.ftp-connection) instance.
`local_filename`
The local file path (will be overwritten if the file already exists).
`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 **`true`** on success or **`false`** on failure.
### 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\_get()** example**
```
<?php
// define some variables
$local_file = 'local.zip';
$server_file = 'server.zip';
// 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 download $server_file and save to $local_file
if (ftp_get($ftp, $local_file, $server_file, FTP_BINARY)) {
echo "Successfully written to $local_file\n";
} else {
echo "There was a problem\n";
}
// close the connection
ftp_close($ftp);
?>
```
### See Also
* [ftp\_pasv()](function.ftp-pasv) - Turns passive mode on or off
* [ftp\_fget()](function.ftp-fget) - Downloads a file from the FTP server and saves to an open file
* [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\_fget()](function.ftp-nb-fget) - Retrieves a file from the FTP server and writes it to an open file (non-blocking)
php ftp_fget ftp\_fget
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
ftp\_fget — Downloads a file from the FTP server and saves to an open file
### Description
```
ftp_fget(
FTP\Connection $ftp,
resource $stream,
string $remote_filename,
int $mode = FTP_BINARY,
int $offset = 0
): bool
```
**ftp\_fget()** retrieves `remote_filename` from the FTP server, and writes it to the given file pointer.
### 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 **`true`** on success or **`false`** on failure.
### 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\_fget()** example**
```
<?php
// path to remote file
$remote_file = 'somefile.txt';
$local_file = 'localfile.txt';
// open some file to write to
$handle = fopen($local_file, 'w');
// 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 download $remote_file and save it to $handle
if (ftp_fget($ftp, $handle, $remote_file, FTP_ASCII, 0)) {
echo "successfully written to $local_file\n";
} else {
echo "There was a problem while downloading $remote_file to $local_file\n";
}
// close the connection and the file handler
ftp_close($ftp);
fclose($handle);
?>
```
### See Also
* [ftp\_get()](function.ftp-get) - Downloads a file from the FTP server
* [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\_fget()](function.ftp-nb-fget) - Retrieves a file from the FTP server and writes it to an open file (non-blocking)
php extension_loaded extension\_loaded
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
extension\_loaded — Find out whether an extension is loaded
### Description
```
extension_loaded(string $extension): bool
```
Finds out whether the extension is loaded.
### Parameters
`extension`
The extension name. This parameter is case-insensitive.
You can see the names of various extensions by using [phpinfo()](function.phpinfo) or if you're using the `CGI` or `CLI` version of PHP you can use the **-m** switch to list all available extensions:
```
$ php -m
[PHP Modules]
xml
tokenizer
standard
sockets
session
posix
pcre
overload
mysql
mbstring
ctype
[Zend Modules]
```
### Return Values
Returns **`true`** if the extension identified by `extension` is loaded, **`false`** otherwise.
### Examples
**Example #1 **extension\_loaded()** example**
```
<?php
if (!extension_loaded('gd')) {
if (!dl('gd.so')) {
exit;
}
}
?>
```
### See Also
* [get\_loaded\_extensions()](function.get-loaded-extensions) - Returns an array with the names of all modules compiled and loaded
* [get\_extension\_funcs()](function.get-extension-funcs) - Returns an array with the names of the functions of a module
* [phpinfo()](function.phpinfo) - Outputs information about PHP's configuration
* [dl()](function.dl) - Loads a PHP extension at runtime
* [function\_exists()](function.function-exists) - Return true if the given function has been defined
php restore_exception_handler restore\_exception\_handler
===========================
(PHP 5, PHP 7, PHP 8)
restore\_exception\_handler — Restores the previously defined exception handler function
### Description
```
restore_exception_handler(): bool
```
Used after changing the exception handler function using [set\_exception\_handler()](function.set-exception-handler), to revert to the previous exception handler (which could be the built-in or a user defined function).
### Parameters
This function has no parameters.
### Return Values
This function always returns **`true`**.
### Examples
**Example #1 **restore\_exception\_handler()** example**
```
<?php
function exception_handler_1(Exception $e)
{
echo '[' . __FUNCTION__ . '] ' . $e->getMessage();
}
function exception_handler_2(Exception $e)
{
echo '[' . __FUNCTION__ . '] ' . $e->getMessage();
}
set_exception_handler('exception_handler_1');
set_exception_handler('exception_handler_2');
restore_exception_handler();
throw new Exception('This triggers the first exception handler...');
?>
```
The above example will output:
```
[exception_handler_1] This triggers the first exception handler...
```
### See Also
* [set\_exception\_handler()](function.set-exception-handler) - Sets a user-defined exception handler function
* [set\_error\_handler()](function.set-error-handler) - Sets a user-defined error handler function
* [restore\_error\_handler()](function.restore-error-handler) - Restores the previous error handler function
* [error\_reporting()](function.error-reporting) - Sets which PHP errors are reported
php hash_pbkdf2 hash\_pbkdf2
============
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
hash\_pbkdf2 — Generate a PBKDF2 key derivation of a supplied password
### Description
```
hash_pbkdf2(
string $algo,
string $password,
string $salt,
int $iterations,
int $length = 0,
bool $binary = false
): string
```
### Parameters
`algo`
Name of selected hashing algorithm (i.e. `md5`, `sha256`, `haval160,4`, etc..) See [hash\_algos()](function.hash-algos) for a list of supported algorithms.
`password`
The password to use for the derivation.
`salt`
The salt to use for the derivation. This value should be generated randomly.
`iterations`
The number of internal iterations to perform for the derivation.
`length`
The length of the output string. If `binary` is **`true`** this corresponds to the byte-length of the derived key, if `binary` is **`false`** this corresponds to twice the byte-length of the derived key (as every byte of the key is returned as two hexits).
If `0` is passed, the entire output of the supplied algorithm is used.
`binary`
When set to **`true`**, outputs raw binary data. **`false`** outputs lowercase hexits.
### Return Values
Returns a string containing the derived key as lowercase hexits unless `binary` is set to **`true`** in which case the raw binary representation of the derived key is returned.
### Errors/Exceptions
Throws a [ValueError](class.valueerror) exception if the algorithm is unknown, the `iterations` parameter is less than or equal to `0`, the `length` is less than `0` or the `salt` is too long (greater than **`INT_MAX`** `- 4`).
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Now throws a [ValueError](class.valueerror) exception on error. Previously, **`false`** was returned and an **`E_WARNING`** message was emitted. |
| 7.2.0 | Usage of non-cryptographic hash functions (adler32, crc32, crc32b, fnv132, fnv1a32, fnv164, fnv1a64, joaat) was disabled. |
### Examples
**Example #1 **hash\_pbkdf2()** example, basic usage**
```
<?php
$password = "password";
$iterations = 1000;
// Generate a cryptographically secure random IV using random_bytes()
$salt = random_bytes(16);
$hash = hash_pbkdf2("sha256", $password, $salt, $iterations, 20);
var_dump($hash);
// for raw binary, the $length needs to be halved for equivalent results
$hash = hash_pbkdf2("sha256", $password, $salt, $iterations, 10, true);
var_dump(bin2hex($hash));?>
```
The above example will output something similar to:
```
string(20) "120fb6cffcf8b32c43e7"
string(20) "120fb6cffcf8b32c43e7"
```
### Notes
**Caution** The PBKDF2 method can be used for hashing passwords for storage. However, it should be noted that [password\_hash()](function.password-hash) or [crypt()](function.crypt) with **`CRYPT_BLOWFISH`** are better suited for password storage.
### See Also
* [crypt()](function.crypt) - One-way string hashing
* [password\_hash()](function.password-hash) - Creates a password hash
* [hash()](function.hash) - Generate a hash value (message digest)
* [hash\_algos()](function.hash-algos) - Return a list of registered hashing algorithms
* [hash\_init()](function.hash-init) - Initialize an incremental hashing context
* [hash\_hmac()](function.hash-hmac) - Generate a keyed hash value using the HMAC method
* [hash\_hmac\_file()](function.hash-hmac-file) - Generate a keyed hash value using the HMAC method and the contents of a given file
* [openssl\_pbkdf2()](function.openssl-pbkdf2) - Generates a PKCS5 v2 PBKDF2 string
php The PharFileInfo class
The PharFileInfo class
======================
Introduction
------------
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
The PharFileInfo class provides a high-level interface to the contents and attributes of a single file within a phar archive.
Class synopsis
--------------
class **PharFileInfo** extends [SplFileInfo](class.splfileinfo) { /\* Methods \*/ public [\_\_construct](pharfileinfo.construct)(string `$filename`)
```
public chmod(int $perms): void
```
```
public compress(int $compression): bool
```
```
public decompress(): bool
```
```
public delMetadata(): bool
```
```
public getCRC32(): int
```
```
public getCompressedSize(): int
```
```
public getContent(): string
```
```
public getMetadata(array $unserializeOptions = []): mixed
```
```
public getPharFlags(): int
```
```
public hasMetadata(): bool
```
```
public isCRCChecked(): bool
```
```
public isCompressed(?int $compression = null): bool
```
```
public setMetadata(mixed $metadata): void
```
public [\_\_destruct](pharfileinfo.destruct)() /\* Inherited methods \*/
```
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
-----------------
* [PharFileInfo::chmod](pharfileinfo.chmod) — Sets file-specific permission bits
* [PharFileInfo::compress](pharfileinfo.compress) — Compresses the current Phar entry with either zlib or bzip2 compression
* [PharFileInfo::\_\_construct](pharfileinfo.construct) — Construct a Phar entry object
* [PharFileInfo::decompress](pharfileinfo.decompress) — Decompresses the current Phar entry within the phar
* [PharFileInfo::delMetadata](pharfileinfo.delmetadata) — Deletes the metadata of the entry
* [PharFileInfo::\_\_destruct](pharfileinfo.destruct) — Destructs a Phar entry object
* [PharFileInfo::getCRC32](pharfileinfo.getcrc32) — Returns CRC32 code or throws an exception if CRC has not been verified
* [PharFileInfo::getCompressedSize](pharfileinfo.getcompressedsize) — Returns the actual size of the file (with compression) inside the Phar archive
* [PharFileInfo::getContent](pharfileinfo.getcontent) — Get the complete file contents of the entry
* [PharFileInfo::getMetadata](pharfileinfo.getmetadata) — Returns file-specific meta-data saved with a file
* [PharFileInfo::getPharFlags](pharfileinfo.getpharflags) — Returns the Phar file entry flags
* [PharFileInfo::hasMetadata](pharfileinfo.hasmetadata) — Returns the metadata of the entry
* [PharFileInfo::isCRCChecked](pharfileinfo.iscrcchecked) — Returns whether file entry has had its CRC verified
* [PharFileInfo::isCompressed](pharfileinfo.iscompressed) — Returns whether the entry is compressed
* [PharFileInfo::setMetadata](pharfileinfo.setmetadata) — Sets file-specific meta-data saved with a file
| programming_docs |
php gnupg_export gnupg\_export
=============
(PECL gnupg >= 0.1)
gnupg\_export — Exports a key
### Description
```
gnupg_export(resource $identifier, string $fingerprint): string
```
Exports the key `fingerprint`.
### Parameters
`identifier`
The gnupg identifier, from a call to [gnupg\_init()](function.gnupg-init) or **gnupg**.
`fingerprint`
The fingerprint key.
### Return Values
On success, this function returns the keydata. On failure, this function returns **`false`**.
### Examples
**Example #1 Procedural **gnupg\_export()** example**
```
<?php
$res = gnupg_init();
$export = gnupg_export($res,"8660281B6051D071D94B5B230549F9DC851566DC");
echo $export;
?>
```
**Example #2 OO **gnupg\_export()** example**
```
<?php
$gpg = new gnupg();
$export = $gpg->export("8660281B6051D071D94B5B230549F9DC851566DC");
?>
```
php SolrQueryResponse::__construct SolrQueryResponse::\_\_construct
================================
(PECL solr >= 0.9.2)
SolrQueryResponse::\_\_construct — Constructor
### Description
public **SolrQueryResponse::\_\_construct**() Constructor
### Parameters
This function has no parameters.
### Return Values
None
php curl_multi_getcontent curl\_multi\_getcontent
=======================
(PHP 5, PHP 7, PHP 8)
curl\_multi\_getcontent — Return the content of a cURL handle if **`CURLOPT_RETURNTRANSFER`** is set
### Description
```
curl_multi_getcontent(CurlHandle $handle): ?string
```
If **`CURLOPT_RETURNTRANSFER`** is an option that is set for a specific handle, then this function will return the content of that cURL handle in the form of a string.
### Parameters
`handle` A cURL handle returned by [curl\_init()](function.curl-init).
### Return Values
Return the content of a cURL handle if **`CURLOPT_RETURNTRANSFER`** is set.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `handle` expects a [CurlHandle](class.curlhandle) instance now; previously, a resource was expected. |
### See Also
* [curl\_multi\_init()](function.curl-multi-init) - Returns a new cURL multi handle
php ZipArchive::unchangeIndex ZipArchive::unchangeIndex
=========================
(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.1.0)
ZipArchive::unchangeIndex — Revert all changes done to an entry at the given index
### Description
```
public ZipArchive::unchangeIndex(int $index): bool
```
Revert all changes done to an entry at the given index.
### Parameters
`index`
Index of the entry.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php bind_textdomain_codeset bind\_textdomain\_codeset
=========================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
bind\_textdomain\_codeset — Specify or get the character encoding in which the messages from the DOMAIN message catalog will be returned
### Description
```
bind_textdomain_codeset(string $domain, ?string $codeset): string|false
```
**bind\_textdomain\_codeset()** allows to set or get the encoding in which messages from `domain` will be returned by [gettext()](function.gettext) and similar functions.
### Parameters
`domain`
The domain.
`codeset`
The code set. If **`null`**, the currently set encoding is returned.
### Return Values
A string on success.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.3 | `codeset` is nullable now. Previously, it was not possible to retrieve the currently set encoding. |
### Notes
>
> **Note**:
>
>
> The **bind\_textdomain\_codeset()** information is maintained per process, not per thread.
>
>
php QuickHashIntStringHash::loadFromFile QuickHashIntStringHash::loadFromFile
====================================
(PECL quickhash >= Unknown)
QuickHashIntStringHash::loadFromFile — This factory method creates a hash from a file
### Description
```
public static QuickHashIntStringHash::loadFromFile(string $filename, int $size = 0, int $options = 0): QuickHashIntStringHash
```
This factory method creates a new hash from a definition file on disk. The file format consists of a signature `'QH\0x12\0'`, the number of elements as a 32 bit signed integer in system Endianness, an unsigned 32 bit integer containing the number of element data to follow in characters. This element data contains all the strings. After the header and the strings, the elements follow in pairs of two unsigned 32 bit integers where the first one is the key, and the second one the index in the element data string. An example could be:
**Example #1 QuickHash IntString file format**
```
00000000 51 48 12 00 02 00 00 00 09 00 00 00 4f 4e 45 00 |QH..........ONE.|
00000010 4e 49 4e 45 00 01 00 00 00 00 00 00 00 03 00 00 |NINE............|
00000020 00 04 00 00 00 |.....|
00000025
```
**Example #2 QuickHash IntString file format**
```
header signature ('QH'; key type: 1; value type: 2; filler: \0x00)
00000000 51 48 12 00
number of elements:
00000004 02 00 00 00
length of string values (9 characters):
00000008 09 00 00 00
string values:
0000000C 4f 4e 45 00 4e 49 4e 45 00
data string:
00000015 01 00 00 00 00 00 00 00 03 00 00 00 04 00 00 00
key/value 1 (key = 1, string index = 0 ("ONE")):
01 00 00 00 00 00 00 00
key/value 2 (key = 3, string index = 4 ("NINE")):
03 00 00 00 04 00 00 00
```
### Parameters
`filename`
The filename of the file to read the hash 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 hash, rounded up to the nearest power of two with a maximum limit of `4194304`.
### Return Values
Returns a new [QuickHashIntStringHash](class.quickhashintstringhash).
### Examples
**Example #3 **QuickHashIntStringHash::loadFromFile()** example**
```
<?php
$file = dirname( __FILE__ ) . "/simple.string.hash";
$hash = QuickHashIntStringHash::loadFromFile(
$file,
QuickHashIntStringHash::DO_NOT_USE_ZEND_ALLOC
);
foreach( range( 0, 0x0f ) as $key )
{
printf( "Key %3d (%2x) is %s\n",
$key, $key,
$hash->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 EvSignal::createStopped EvSignal::createStopped
=======================
(PECL ev >= 0.2.0)
EvSignal::createStopped — Create stopped EvSignal watcher object
### Description
```
final public static EvSignal::createStopped(
int $signum ,
callable $callback ,
mixed $data = null ,
int $priority = 0
): EvSignal
```
Create stopped EvSignal watcher object. Unlike [EvSignal::\_\_construct()](evsignal.construct) , this method does't start the watcher automatically.
### 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)
### Return Values
Returns EvSignal object on success.
### See Also
* [EvWatcher::start()](evwatcher.start) - Starts the watcher
* [EvSignal::\_\_construct()](evsignal.construct) - Constructs EvSignal watcher object
php mysqli::__construct mysqli::\_\_construct
=====================
mysqli::connect
===============
mysqli\_connect
===============
(PHP 5, PHP 7, PHP 8)
mysqli::\_\_construct -- mysqli::connect -- mysqli\_connect — Open a new connection to the MySQL server
### Description
Object-oriented style
public **mysqli::\_\_construct**(
string `$hostname` = ini\_get("mysqli.default\_host"),
string `$username` = ini\_get("mysqli.default\_user"),
string `$password` = ini\_get("mysqli.default\_pw"),
string `$database` = "",
int `$port` = ini\_get("mysqli.default\_port"),
string `$socket` = ini\_get("mysqli.default\_socket")
)
```
public mysqli::connect(
string $hostname = ini_get("mysqli.default_host"),
string $username = ini_get("mysqli.default_user"),
string $password = ini_get("mysqli.default_pw"),
string $database = "",
int $port = ini_get("mysqli.default_port"),
string $socket = ini_get("mysqli.default_socket")
): void
```
Procedural style
```
mysqli_connect(
string $hostname = ini_get("mysqli.default_host"),
string $username = ini_get("mysqli.default_user"),
string $password = ini_get("mysqli.default_pw"),
string $database = "",
int $port = ini_get("mysqli.default_port"),
string $socket = ini_get("mysqli.default_socket")
): mysqli|false
```
Opens a connection to the MySQL Server.
### Parameters
`hostname`
Can be either a host name or an IP address. The local host is assumed when passing the **`null`** value or the string "localhost" to this parameter. When possible, pipes will be used instead of the TCP/IP protocol. The TCP/IP protocol is used if a host name and port number are provided together e.g. `localhost:3308`.
Prepending host by `p:` opens a persistent connection. [mysqli\_change\_user()](mysqli.change-user) is automatically called on connections opened from the connection pool.
`username`
The MySQL user name.
`password`
If not 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 is provided or not).
`database`
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 `hostname` parameter.
>
>
### Return Values
**mysqli::\_\_construct()** always returns an object which represents the connection to a MySQL Server, regardless of it being successful or not.
[mysqli\_connect()](function.mysqli-connect) returns an object which represents the connection to a MySQL Server, or **`false`** on failure.
[mysqli::connect()](function.mysqli-connect) returns **`null`** on success or **`false`** on failure.
### Errors/Exceptions
If **`MYSQLI_REPORT_STRICT`** is enabled and the attempt to connect to the requested database fails, a [mysqli\_sql\_exception](class.mysqli-sql-exception) is thrown.
### Examples
**Example #1 **mysqli::\_\_construct()** example**
Object-oriented style
```
<?php
/* You should enable error reporting for mysqli before attempting to make a connection */
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');
/* Set the desired charset after establishing a connection */
$mysqli->set_charset('utf8mb4');
printf("Success... %s\n", $mysqli->host_info);
```
Procedural style
```
<?php
/* You should enable error reporting for mysqli before attempting to make a connection */
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = mysqli_connect('localhost', 'my_user', 'my_password', 'my_db');
/* Set the desired charset after establishing a connection */
mysqli_set_charset($mysqli, 'utf8mb4');
printf("Success... %s\n", mysqli_get_host_info($mysqli));
```
The above examples will output something similar to:
```
Success... localhost via TCP/IP
```
**Example #2 Extending mysqli class**
```
<?php
class FooMysqli extends mysqli {
public function __construct($host, $user, $pass, $db, $port, $socket, $charset) {
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
parent::__construct($host, $user, $pass, $db, $port, $socket);
$this->set_charset($charset);
}
}
$db = new FooMysqli('localhost', 'my_user', 'my_password', 'my_db', 3306, null, 'utf8mb4');
```
**Example #3 Manual error handling**
If error reporting is disabled, the developer is responsible for checking and handling failures
Object-oriented style
```
<?php
error_reporting(0);
mysqli_report(MYSQLI_REPORT_OFF);
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');
if ($mysqli->connect_errno) {
throw new RuntimeException('mysqli connection error: ' . $mysqli->connect_error);
}
/* Set the desired charset after establishing a connection */
$mysqli->set_charset('utf8mb4');
if ($mysqli->errno) {
throw new RuntimeException('mysqli error: ' . $mysqli->error);
}
```
Procedural style
```
<?php
error_reporting(0);
mysqli_report(MYSQLI_REPORT_OFF);
$mysqli = mysqli_connect('localhost', 'my_user', 'my_password', 'my_db');
if (mysqli_connect_errno()) {
throw new RuntimeException('mysqli connection error: ' . mysqli_connect_error());
}
/* Set the desired charset after establishing a connection */
mysqli_set_charset($mysqli, 'utf8mb4');
if (mysqli_errno($mysqli)) {
throw new RuntimeException('mysqli error: ' . mysqli_error($mysqli));
}
```
### 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()](mysqli.real-connect), but after [mysqli\_init()](mysqli.init).
>
>
>
>
> **Note**:
>
>
> Object-oriented style only: If the connection fails, an object is still returned. To check whether the connection failed, use either the [mysqli\_connect\_error()](mysqli.connect-error) function or the [mysqli->connect\_error](mysqli.connect-error) property as in the preceding examples.
>
>
>
> **Note**:
>
>
> If it is necessary to set options, such as the connection timeout, [mysqli\_real\_connect()](mysqli.real-connect) must be used instead.
>
>
>
> **Note**:
>
>
> Calling the constructor with no parameters is the same as calling [mysqli\_init()](mysqli.init).
>
>
>
> **Note**:
>
>
> Error "Can't create TCP/IP socket (10106)" usually means that the [variables\_order](https://www.php.net/manual/en/ini.core.php#ini.variables-order) configure directive doesn't contain character `E`. On Windows, if the environment is not copied the `SYSTEMROOT` environment variable won't be available and PHP will have problems loading Winsock.
>
>
### See Also
* [mysqli\_real\_connect()](mysqli.real-connect) - Opens a connection to a mysql server
* [mysqli\_options()](mysqli.options) - Set options
* [mysqli\_connect\_errno()](mysqli.connect-errno) - Returns the error code from last connect call
* [mysqli\_connect\_error()](mysqli.connect-error) - Returns a description of the last connection error
* [mysqli\_close()](mysqli.close) - Closes a previously opened database connection
php OAuth::setNonce OAuth::setNonce
===============
(PECL OAuth >= 0.99.1)
OAuth::setNonce — Set the nonce for subsequent requests
### Description
```
public OAuth::setNonce(string $nonce): mixed
```
Sets the nonce for all subsequent requests.
### Parameters
`nonce`
The value for oauth\_nonce.
### Return Values
Returns **`true`** on success, or **`false`** if the `nonce` is considered invalid.
### Changelog
| Version | Description |
| --- | --- |
| PECL oauth 1.0.0 | Previously returned **`null`** on failure, instead of **`false`**. |
### See Also
* [OAuth::setToken()](oauth.settoken) - Sets the token and secret
* [OAuth::setAuthType()](oauth.setauthtype) - Set authorization type
* [OAuth::setVersion()](oauth.setversion) - Set the OAuth version
php SolrResponse::success SolrResponse::success
=====================
(PECL solr >= 0.9.2)
SolrResponse::success — Was the request a success
### Description
```
public SolrResponse::success(): bool
```
Used to check if the request to the server was successful.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if it was successful and **`false`** if it was not.
php ReflectionExtension::getFunctions ReflectionExtension::getFunctions
=================================
(PHP 5, PHP 7, PHP 8)
ReflectionExtension::getFunctions — Gets extension functions
### Description
```
public ReflectionExtension::getFunctions(): array
```
Get defined functions from an extension.
### Parameters
This function has no parameters.
### Return Values
An associative array of [ReflectionFunction](class.reflectionfunction) objects, for each function defined in the extension with the keys being the function names. If no function are defined, an empty array is returned.
### Examples
**Example #1 **ReflectionExtension::getFunctions()** example**
```
<?php
$dom = new ReflectionExtension('SimpleXML');
print_r($dom->getFunctions());
?>
```
The above example will output something similar to:
```
Array
(
[simplexml_load_file] => ReflectionFunction Object
(
[name] => simplexml_load_file
)
[simplexml_load_string] => ReflectionFunction Object
(
[name] => simplexml_load_string
)
[simplexml_import_dom] => ReflectionFunction Object
(
[name] => simplexml_import_dom
)
)
```
### See Also
* [ReflectionExtension::getClasses()](reflectionextension.getclasses) - Gets classes
* [get\_extension\_funcs()](function.get-extension-funcs) - Returns an array with the names of the functions of a module
php Imagick::getFilename Imagick::getFilename
====================
(PECL imagick 2, PECL imagick 3)
Imagick::getFilename — The filename associated with an image sequence
### Description
```
public Imagick::getFilename(): string
```
Returns the filename associated with an image sequence.
### Parameters
This function has no parameters.
### Return Values
Returns a string on success.
### Errors/Exceptions
Throws ImagickException on error.
php GmagickDraw::setstrokecolor GmagickDraw::setstrokecolor
===========================
(PECL gmagick >= Unknown)
GmagickDraw::setstrokecolor — Sets the color used for stroking object outlines
### Description
```
public GmagickDraw::setstrokecolor(mixed $color): GmagickDraw
```
Sets the color used for stroking object outlines.
### Parameters
`color`
[GmagickPixel](class.gmagickpixel) or string representing the color for the stroke.
### Return Values
The [GmagickDraw](class.gmagickdraw) object on success.
php fstat fstat
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
fstat — Gets information about a file using an open file pointer
### Description
```
fstat(resource $stream): array|false
```
Gathers the statistics of the file opened by the file pointer `stream`. This function is similar to the [stat()](function.stat) function except that it operates on an open file pointer instead of a filename.
### Parameters
`stream`
A file system pointer resource that is typically created using [fopen()](function.fopen).
### Return Values
Returns an array with the statistics of the file; the format of the array is described in detail on the [stat()](function.stat) manual page. Returns **`false`** on failure.
### Examples
**Example #1 **fstat()** example**
```
<?php
// open a file
$fp = fopen("/etc/passwd", "r");
// gather statistics
$fstat = fstat($fp);
// close the file
fclose($fp);
// print only the associative part
print_r(array_slice($fstat, 13));
?>
```
The above example will output something similar to:
```
Array
(
[dev] => 771
[ino] => 488704
[mode] => 33188
[nlink] => 1
[uid] => 0
[gid] => 0
[rdev] => 0
[size] => 1114
[atime] => 1061067181
[mtime] => 1056136526
[ctime] => 1056136526
[blksize] => 4096
[blocks] => 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.
>
>
| programming_docs |
php The stdClass class
The stdClass class
==================
Introduction
------------
(PHP 4, PHP 5, PHP 7, PHP 8)
A generic empty class with dynamic properties.
Objects of this class can be instantiated with [new](language.oop5.basic#language.oop5.basic.new) operator or created by [typecasting to object](language.types.object#language.types.object.casting). Several PHP functions also create instances of this class, e.g. [json\_decode()](function.json-decode), [mysqli\_fetch\_object()](mysqli-result.fetch-object) or [PDOStatement::fetchObject()](pdostatement.fetchobject).
Despite not implementing [\_\_get()](language.oop5.overloading#object.get)/[\_\_set()](language.oop5.overloading#object.set) magic methods, this class allows dynamic properties and does not require the `#[\AllowDynamicProperties]` attribute.
This is not a base class as PHP does not have a concept of a universal base class. However, it is possible to create a custom class that extends from **stdClass** and as a result inherits the functionality of dynamic properties.
Class synopsis
--------------
class **stdClass** { } This class has no methods or default properties.
Examples
--------
**Example #1 Created as a result of typecasting to object**
```
<?php
$obj = (object) array('foo' => 'bar');
var_dump($obj);
```
The above example will output:
```
object(stdClass)#1 (1) {
["foo"]=>
string(3) "bar"
}
```
**Example #2 Created as a result of [json\_decode()](function.json-decode)**
```
<?php
$json = '{"foo":"bar"}';
var_dump(json_decode($json));
```
The above example will output:
```
object(stdClass)#1 (1) {
["foo"]=>
string(3) "bar"
}
```
**Example #3 Declaring dynamic properties**
```
<?php
$obj = new stdClass();
$obj->foo = 42;
$obj->{1} = 42;
var_dump($obj);
```
The above example will output:
```
object(stdClass)#1 (2) {
["foo"]=>
int(42)
["1"]=>
int(42)
}
```
php DateTimeImmutable::setTimezone DateTimeImmutable::setTimezone
==============================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
DateTimeImmutable::setTimezone — Sets the time zone
### Description
```
public DateTimeImmutable::setTimezone(DateTimeZone $timezone): DateTimeImmutable
```
Returns a new DateTimeImmutable object with a new timezone set.
### Parameters
`timezone`
A [DateTimeZone](class.datetimezone) object representing the desired time zone.
### Return Values
Returns a new modified [DateTimeImmutable](class.datetimeimmutable) object for method chaining. The underlaying point-in-time is not changed when calling this method.
### Examples
**Example #1 **DateTimeImmutable::setTimeZone()** example**
Object-oriented style
```
<?php
$date = new DateTimeImmutable('2000-01-01', new DateTimeZone('Pacific/Nauru'));
echo $date->format('Y-m-d H:i:sP') . "\n";
$newDate = $date->setTimezone(new DateTimeZone('Pacific/Chatham'));
echo $newDate->format('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::getTimezone()](datetime.gettimezone) - Return time zone relative to given DateTime
* [DateTimeZone::\_\_construct()](datetimezone.construct) - Creates new DateTimeZone object
php xml_set_notation_decl_handler xml\_set\_notation\_decl\_handler
=================================
(PHP 4, PHP 5, PHP 7, PHP 8)
xml\_set\_notation\_decl\_handler — Set up notation declaration handler
### Description
```
xml_set_notation_decl_handler(XMLParser $parser, callable $handler): bool
```
Sets the notation declaration handler function for the XML parser `parser`.
A notation declaration is part of the document's DTD and has the following format:
```
<!NOTATION <parameter>name</parameter>
{ <parameter>systemId</parameter> | <parameter>publicId</parameter>?>
```
See [» section 4.7 of the XML 1.0 spec](http://www.w3.org/TR/1998/REC-xml-19980210#Notations) for the definition of notation declarations. ### Parameters
`parser`
A reference to the XML parser to set up notation declaration handler function.
`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 five parameters:
```
handler(
XMLParser $parser,
string $notation_name,
string $base,
string $system_id,
string $public_id
)
```
`parser` The first parameter, parser, is a reference to the XML parser calling the handler. `notation_name`
This is the notation's `name`, as per the notation format described above. `base` This is the base for resolving the system identifier (`system_id`) of the notation declaration. Currently this parameter will always be set to an empty string. `system_id`
System identifier of the external notation declaration. `public_id` Public identifier of the external notation declaration. 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. |
php tidyNode::isPhp tidyNode::isPhp
===============
(PHP 5, PHP 7, PHP 8)
tidyNode::isPhp — Checks if a node is PHP
### Description
```
public tidyNode::isPhp(): bool
```
Tells if the node is PHP.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the current node is PHP code, **`false`** otherwise.
### Examples
**Example #1 Extract PHP code from a mixed HTML document**
```
<?php
$html = <<< HTML
<html><head>
<?php echo '<title>title</title>'; ?>
<#
/* JSTE code */
alert('Hello World');
#>
</head>
<body>
<?php
// PHP code
echo 'hello world!';
?>
<%
/* ASP code */
response.write("Hello World!")
%>
<!-- Comments -->
Hello World
</body></html>
Outside HTML
HTML;
$tidy = tidy_parse_string($html);
$num = 0;
get_nodes($tidy->html());
function get_nodes($node) {
// check if the current node is of requested type
if($node->isPhp()) {
echo "\n\n# php node #" . ++$GLOBALS['num'] . "\n";
echo $node->value;
}
// check if the current node has childrens
if($node->hasChildren()) {
foreach($node->child as $child) {
get_nodes($child);
}
}
}
?>
```
The above example will output:
```
# php node #1
<?php echo '<title>title</title>'; ?>
# php node #2
<?php
// PHP code
echo 'hello world!';
?>
```
php msg_remove_queue msg\_remove\_queue
==================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
msg\_remove\_queue — Destroy a message queue
### Description
```
msg_remove_queue(SysvMessageQueue $queue): bool
```
**msg\_remove\_queue()** destroys the message queue specified by the `queue`. Only use this function when all processes have finished working with the message queue and you need to release the system resources held by it.
### Parameters
`queue`
The message queue.
### 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\_get\_queue()](function.msg-get-queue) - Create or attach to 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\_set\_queue()](function.msg-set-queue) - Set information in the message queue data structure
php Ds\Deque::pop Ds\Deque::pop
=============
(PECL ds >= 1.0.0)
Ds\Deque::pop — Removes and returns the last value
### Description
```
public Ds\Deque::pop(): mixed
```
Removes and returns the last value.
### Parameters
This function has no parameters.
### Return Values
The removed last value.
### Errors/Exceptions
[UnderflowException](class.underflowexception) if empty.
### Examples
**Example #1 **Ds\Deque::pop()** example**
```
<?php
$deque = new \Ds\Deque([1, 2, 3]);
var_dump($deque->pop());
var_dump($deque->pop());
var_dump($deque->pop());
?>
```
The above example will output something similar to:
```
int(3)
int(2)
int(1)
```
php InflateContext::__construct InflateContext::\_\_construct
=============================
(PHP 8)
InflateContext::\_\_construct — Construct a new InflateContext instance
### Description
public **InflateContext::\_\_construct**() Throws an [Error](class.error), since [InflateContext](class.inflatecontext) is not constructable directly. Use [inflate\_init()](function.inflate-init) instead.
### Parameters
This function has no parameters.
php ftp_site ftp\_site
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
ftp\_site — Sends a SITE command to the server
### Description
```
ftp_site(FTP\Connection $ftp, string $command): bool
```
**ftp\_site()** sends the given `SITE` command to the FTP server.
`SITE` commands are not standardized, and vary from server to server. They are useful for handling such things as file permissions and group membership.
### Parameters
`ftp`
An [FTP\Connection](class.ftp-connection) instance.
`command`
The SITE command. Note that this parameter isn't escaped so there may be some issues with filenames containing spaces and other characters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### 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 Sending a SITE command to an ftp server**
```
<?php
// Connect to FTP server
$ftp = ftp_connect('ftp.example.com');
if (!$ftp) die('Unable to connect to ftp.example.com');
// Login as "user" with password "pass"
if (!ftp_login($ftp, 'user', 'pass')) die('Error logging into ftp.example.com');
// Issue: "SITE CHMOD 0600 /home/user/privatefile" command to ftp server
if (ftp_site($ftp, 'CHMOD 0600 /home/user/privatefile')) {
echo "Command executed successfully.\n";
} else {
die('Command failed.');
}
?>
```
### See Also
* [ftp\_raw()](function.ftp-raw) - Sends an arbitrary command to an FTP server
php PhpToken::tokenize PhpToken::tokenize
==================
(PHP 8)
PhpToken::tokenize — Splits given source into PHP tokens, represented by PhpToken objects.
### Description
```
public static PhpToken::tokenize(string $code, int $flags = 0): array
```
Returns an array of PhpToken objects representing given `code`.
### Parameters
`code`
The PHP source to parse.
`flags`
Valid flags:
* **`TOKEN_PARSE`** - Recognises the ability to use reserved words in specific contexts.
### Return Values
An array of PHP tokens represented by instances of PhpToken or its descendants. This method returns static[] so that PhpToken can be seamlessly extended.
### Examples
**Example #1 **PhpToken::tokenize()** example**
```
<?php
$tokens = PhpToken::tokenize('<?php echo; ?>');
foreach ($tokens as $token) {
echo "Line {$token->line}: {$token->getTokenName()} ('{$token->text}')", PHP_EOL;
}
```
The above examples will output:
```
Line 1: T_OPEN_TAG ('<?php ')
Line 1: T_ECHO ('echo')
Line 1: ; (';')
Line 1: T_WHITESPACE (' ')
Line 1: T_CLOSE_TAG ('?>')
```
**Example #2 Extending PhpToken**
```
<?php
class MyPhpToken extends PhpToken {
public function getUpperText() {
return strtoupper($this->text);
}
}
$tokens = MyPhpToken::tokenize('<?php echo; ?>');
echo "'{$tokens[0]->getUpperText()}'";
```
The above examples will output:
```
'<?PHP '
```
### See Also
* [token\_get\_all()](function.token-get-all) - Split given source into PHP tokens
php openal_source_rewind openal\_source\_rewind
======================
(PECL openal >= 0.1.0)
openal\_source\_rewind — Rewind the source
### Description
```
openal_source_rewind(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\_pause()](function.openal-source-pause) - Pause the source
* [openal\_source\_play()](function.openal-source-play) - Start playing the source
php session_set_save_handler session\_set\_save\_handler
===========================
(PHP 4, PHP 5, PHP 7, PHP 8)
session\_set\_save\_handler — Sets user-level session storage functions
### Description
```
session_set_save_handler(
callable $open,
callable $close,
callable $read,
callable $write,
callable $destroy,
callable $gc,
callable $create_sid = ?,
callable $validate_sid = ?,
callable $update_timestamp = ?
): bool
```
It is possible to register the following prototype:
```
session_set_save_handler(object $sessionhandler, bool $register_shutdown = true): bool
```
**session\_set\_save\_handler()** sets the user-level session storage functions which are used for storing and retrieving data associated with a session. This is most useful when a storage method other than those supplied by PHP sessions is preferred, e.g. storing the session data in a local database.
### Parameters
This function has two prototypes.
`sessionhandler`
An instance of a class implementing [SessionHandlerInterface](class.sessionhandlerinterface), and optionally [SessionIdInterface](class.sessionidinterface) and/or [SessionUpdateTimestampHandlerInterface](class.sessionupdatetimestamphandlerinterface), such as [SessionHandler](class.sessionhandler), to register as the session handler.
`register_shutdown`
Register [session\_write\_close()](function.session-write-close) as a [register\_shutdown\_function()](function.register-shutdown-function) function.
or `open`
A callable with the following signature:
```
open(string $savePath, string $sessionName): bool
```
The open callback works like a constructor in classes and is executed when the session is being opened. It is the first callback function executed when the session is started automatically or manually with [session\_start()](function.session-start). Return value is **`true`** for success, **`false`** for failure.
`close`
A callable with the following signature:
```
close(): bool
```
The close callback works like a destructor in classes and is executed after the session write callback has been called. It is also invoked when [session\_write\_close()](function.session-write-close) is called. Return value should be **`true`** for success, **`false`** for failure.
`read`
A callable with the following signature:
```
read(string $sessionId): string
```
The `read` callback must always return a session encoded (serialized) string, or an empty string if there is no data to read.
This callback is called internally by PHP when the session starts or when [session\_start()](function.session-start) is called. Before this callback is invoked PHP will invoke the `open` callback.
The value this callback returns must be in exactly the same serialized format that was originally passed for storage to the `write` callback. The value returned will be unserialized automatically by PHP and used to populate the [$\_SESSION](reserved.variables.session) superglobal. While the data looks similar to [serialize()](function.serialize) please note it is a different format which is specified in the [session.serialize\_handler](https://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler) ini setting.
`write`
A callable with the following signature:
```
write(string $sessionId, string $data): bool
```
The `write` callback is called when the session needs to be saved and closed. This callback receives the current session ID a serialized version the [$\_SESSION](reserved.variables.session) superglobal. The serialization method used internally by PHP is specified in the [session.serialize\_handler](https://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler) ini setting.
The serialized session data passed to this callback should be stored against the passed session ID. When retrieving this data, the `read` callback must return the exact value that was originally passed to the `write` callback.
This callback is invoked when PHP shuts down or explicitly when [session\_write\_close()](function.session-write-close) is called. Note that after executing this function PHP will internally execute the `close` callback.
>
> **Note**:
>
>
> The "write" handler is not executed until after the output stream is closed. Thus, output from debugging statements in the "write" handler will never be seen in the browser. If debugging output is necessary, it is suggested that the debug output be written to a file instead.
>
>
`destroy`
A callable with the following signature:
```
destroy(string $sessionId): bool
```
This callback is executed when a session is destroyed with [session\_destroy()](function.session-destroy) or with [session\_regenerate\_id()](function.session-regenerate-id) with the destroy parameter set to **`true`**. Return value should be **`true`** for success, **`false`** for failure.
`gc`
A callable with the following signature:
```
gc(int $lifetime): bool
```
The garbage collector callback is invoked internally by PHP periodically in order to purge old session data. The frequency is controlled by [session.gc\_probability](https://www.php.net/manual/en/session.configuration.php#ini.session.gc-probability) and [session.gc\_divisor](https://www.php.net/manual/en/session.configuration.php#ini.session.gc-divisor). The value of lifetime which is passed to this callback can be set in [session.gc\_maxlifetime](https://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime). Return value should be **`true`** for success, **`false`** for failure.
`create_sid`
A callable with the following signature:
```
create_sid(): string
```
This callback is executed when a new session ID is required. No parameters are provided, and the return value should be a string that is a valid session ID for your handler.
`validate_sid`
A callable with the following signature:
```
validate_sid(string $key): bool
```
This callback is executed when a session is to be started, a session ID is supplied and [session.use\_strict\_mode](https://www.php.net/manual/en/session.configuration.php#ini.session.use-strict-mode) is enabled. The `key` is the session ID to validate. A session ID is valid, if a session with that ID already exists. The return value should be **`true`** for success, **`false`** for failure.
`update_timestamp`
A callable with the following signature:
```
update_timestamp(string $key, string $val): bool
```
This callback is executed when a session is updated. `key` is the session ID, `val` is the session data. The return value should be **`true`** for success, **`false`** for failure.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Custom session handler: see full code in [SessionHandlerInterface](class.sessionhandlerinterface) synopsis.**
We just show the invocation here, the full example can be seen in the [SessionHandlerInterface](class.sessionhandlerinterface) synopsis linked above.
Note we use the OOP prototype with **session\_set\_save\_handler()** and register the shutdown function using the function's parameter flag. This is generally advised when registering objects as session save handlers.
```
<?php
class MySessionHandler implements SessionHandlerInterface
{
// implement interfaces here
}
$handler = new MySessionHandler();
session_set_save_handler($handler, true);
session_start();
// proceed to set and retrieve values by key from $_SESSION
```
### Notes
**Warning** The `write` and `close` handlers are called after object destruction and therefore cannot use objects or throw exceptions. Exceptions are not able to be caught since will not be caught nor will any exception trace be displayed and the execution will just cease unexpectedly. The object destructors can however use sessions.
It is possible to call [session\_write\_close()](function.session-write-close) from the destructor to solve this chicken and egg problem but the most reliable way is to register the shutdown function as described above.
**Warning** Current working directory is changed with some SAPIs if session is closed in the script termination. It is possible to close the session earlier with [session\_write\_close()](function.session-write-close).
### See Also
* The [session.save\_handler](https://www.php.net/manual/en/session.configuration.php#ini.session.save-handler) configuration directive
* The [session.serialize\_handler](https://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler) configuration directive.
* The [register\_shutdown\_function()](function.register-shutdown-function) - Register a function for execution on shutdown
* The [session\_register\_shutdown()](function.session-register-shutdown) - Session shutdown function
* Refer to [» save\_handler.inc](https://github.com/php/php-src/blob/master/ext/session/tests/save_handler.inc) for a full procedural reference implementation
| programming_docs |
php uopz_set_mock uopz\_set\_mock
===============
(PECL uopz 5, PECL uopz 6, PECL uopz 7)
uopz\_set\_mock — Use mock instead of class for new objects
### Description
```
uopz_set_mock(string $class, mixed $mock): void
```
If `mock` is a string containing the name of a class then it will be instantiated instead of `class`. `mock` can also be an object.
>
> **Note**:
>
>
> Only dynamic access to properties and methods will use the `mock` object. Static access still uses the original `class`. See [example](function.uopz-set-mock#uopz_set_mock.example.static) below.
>
>
### Parameters
`class`
The name of the class to be mocked.
`mock`
The mock to use in the form of a string containing the name of the class to use or an object. If a string is passed, it has to be the fully qualified class name. It is recommended to use the `::class` magic constant in this case.
### Return Values
No value is returned.
### Changelog
| Version | Description |
| --- | --- |
| uopz 6.0.0 | Mocking static members is no longer supported by this function. [uopz\_redefine()](function.uopz-redefine) and [uopz\_set\_return()](function.uopz-set-return), or [Componere](https://www.php.net/manual/en/book.componere.php) can be used instead. |
### Examples
**Example #1 **uopz\_set\_mock()** example**
```
<?php
class A {
public function who() {
echo "A";
}
}
class mockA {
public function who() {
echo "mockA";
}
}
uopz_set_mock(A::class, mockA::class);
(new A)->who();
?>
```
The above example will output:
```
mockA
```
**Example #2 **uopz\_set\_mock()** example**
```
<?php
class A {
public function who() {
echo "A";
}
}
uopz_set_mock(A::class, new class {
public function who() {
echo "mockA";
}
});
(new A)->who();
?>
```
The above example will output:
```
mockA
```
**Example #3 **uopz\_set\_mock()** and static members**
As of uopz 6.0.0 mocking static members is no longer supported.
```
<?php
class A {
const CON = 'A';
public static function who() {
echo "A";
}
}
uopz_set_mock(A::class, new class {
const CON = 'mockA';
public static function who() {
echo "mockA";
}
});
echo A::CON, PHP_EOL;
A::who();
?>
```
The above example will output:
```
A
A
```
Output of the above example in uopz 5:
```
mockA
mockA
```
### See Also
* [uopz\_get\_mock()](function.uopz-get-mock) - Get the current mock for a class
* [uopz\_unset\_mock()](function.uopz-unset-mock) - Unset previously set mock
php Ds\Queue::copy Ds\Queue::copy
==============
(PECL ds >= 1.0.0)
Ds\Queue::copy — Returns a shallow copy of the queue
### Description
```
public Ds\Queue::copy(): Ds\Queue
```
Returns a shallow copy of the queue.
### Parameters
This function has no parameters.
### Return Values
Returns a shallow copy of the queue.
### Examples
**Example #1 **Ds\Queue::copy()** example**
```
<?php
$a = new \Ds\Queue([1, 2, 3]);
$b = $a->copy();
// Updating the copy doesn't affect the original
$b->push(4);
print_r($a);
print_r($b);
?>
```
The above example will output something similar to:
```
Ds\Queue Object
(
[0] => 1
[1] => 2
[2] => 3
)
Ds\Queue Object
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
)
```
php SolrQuery::setGroupFacet SolrQuery::setGroupFacet
========================
(PECL solr >= 2.2.0)
SolrQuery::setGroupFacet — Sets group.facet parameter
### Description
```
public SolrQuery::setGroupFacet(bool $value): SolrQuery
```
Determines whether to compute grouped facets for the field facets specified in facet.field parameters. Grouped facets are computed based on the first specified group.
### 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::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 session_unset session\_unset
==============
(PHP 4, PHP 5, PHP 7, PHP 8)
session\_unset — Free all session variables
### Description
```
session_unset(): bool
```
The **session\_unset()** function frees all session variables currently registered.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 7.2.0 | The return type of this function is bool now. Formerly, it has been void. |
### Notes
>
> **Note**:
>
>
> If [$\_SESSION](reserved.variables.session) is used, use [unset()](function.unset) to unregister a session variable, i.e. `unset($_SESSION['varname']);`.
>
>
**Caution** Do NOT unset the whole [$\_SESSION](reserved.variables.session) with `unset($_SESSION)` as this will disable the registering of session variables through the [$\_SESSION](reserved.variables.session) superglobal.
>
> **Note**:
>
>
> The use of **session\_unset()** is identical to `$_SESSION = []`.
>
>
php None Traits
------
PHP implements a way to reuse code called Traits.
Traits are a mechanism for code reuse in single inheritance languages such as PHP. A Trait is intended to reduce some limitations of single inheritance by enabling a developer to reuse sets of methods freely in several independent classes living in different class hierarchies. The semantics of the combination of Traits and classes is defined in a way which reduces complexity, and avoids the typical problems associated with multiple inheritance and Mixins.
A Trait is similar to a class, but only intended to group functionality in a fine-grained and consistent way. It is not possible to instantiate a Trait on its own. It is an addition to traditional inheritance and enables horizontal composition of behavior; that is, the application of class members without requiring inheritance.
**Example #1 Trait example**
```
<?php
trait ezcReflectionReturnInfo {
function getReturnType() { /*1*/ }
function getReturnDescription() { /*2*/ }
}
class ezcReflectionMethod extends ReflectionMethod {
use ezcReflectionReturnInfo;
/* ... */
}
class ezcReflectionFunction extends ReflectionFunction {
use ezcReflectionReturnInfo;
/* ... */
}
?>
```
### Precedence
An inherited member from a base class is overridden by a member inserted by a Trait. The precedence order is that members from the current class override Trait methods, which in turn override inherited methods.
**Example #2 Precedence Order Example**
An inherited method from a base class is overridden by the method inserted into MyHelloWorld from the SayWorld Trait. The behavior is the same for methods defined in the MyHelloWorld class. The precedence order is that methods from the current class override Trait methods, which in turn override methods from the base class.
```
<?php
class Base {
public function sayHello() {
echo 'Hello ';
}
}
trait SayWorld {
public function sayHello() {
parent::sayHello();
echo 'World!';
}
}
class MyHelloWorld extends Base {
use SayWorld;
}
$o = new MyHelloWorld();
$o->sayHello();
?>
```
The above example will output:
```
Hello World!
```
**Example #3 Alternate Precedence Order Example**
```
<?php
trait HelloWorld {
public function sayHello() {
echo 'Hello World!';
}
}
class TheWorldIsNotEnough {
use HelloWorld;
public function sayHello() {
echo 'Hello Universe!';
}
}
$o = new TheWorldIsNotEnough();
$o->sayHello();
?>
```
The above example will output:
```
Hello Universe!
```
### Multiple Traits
Multiple Traits can be inserted into a class by listing them in the `use` statement, separated by commas.
**Example #4 Multiple Traits Usage**
```
<?php
trait Hello {
public function sayHello() {
echo 'Hello ';
}
}
trait World {
public function sayWorld() {
echo 'World';
}
}
class MyHelloWorld {
use Hello, World;
public function sayExclamationMark() {
echo '!';
}
}
$o = new MyHelloWorld();
$o->sayHello();
$o->sayWorld();
$o->sayExclamationMark();
?>
```
The above example will output:
```
Hello World!
```
### Conflict Resolution
If two Traits insert a method with the same name, a fatal error is produced, if the conflict is not explicitly resolved.
To resolve naming conflicts between Traits used in the same class, the `insteadof` operator needs to be used to choose exactly one of the conflicting methods.
Since this only allows one to exclude methods, the `as` operator can be used to add an alias to one of the methods. Note the `as` operator does not rename the method and it does not affect any other method either.
**Example #5 Conflict Resolution**
In this example, Talker uses the traits A and B. Since A and B have conflicting methods, it defines to use the variant of smallTalk from trait B, and the variant of bigTalk from trait A.
The Aliased\_Talker makes use of the `as` operator to be able to use B's bigTalk implementation under an additional alias `talk`.
```
<?php
trait A {
public function smallTalk() {
echo 'a';
}
public function bigTalk() {
echo 'A';
}
}
trait B {
public function smallTalk() {
echo 'b';
}
public function bigTalk() {
echo 'B';
}
}
class Talker {
use A, B {
B::smallTalk insteadof A;
A::bigTalk insteadof B;
}
}
class Aliased_Talker {
use A, B {
B::smallTalk insteadof A;
A::bigTalk insteadof B;
B::bigTalk as talk;
}
}
?>
```
### Changing Method Visibility
Using the `as` syntax, one can also adjust the visibility of the method in the exhibiting class.
**Example #6 Changing Method Visibility**
```
<?php
trait HelloWorld {
public function sayHello() {
echo 'Hello World!';
}
}
// Change visibility of sayHello
class MyClass1 {
use HelloWorld { sayHello as protected; }
}
// Alias method with changed visibility
// sayHello visibility not changed
class MyClass2 {
use HelloWorld { sayHello as private myPrivateHello; }
}
?>
```
### Traits Composed from Traits
Just as classes can make use of traits, so can other traits. By using one or more traits in a trait definition, it can be composed partially or entirely of the members defined in those other traits.
**Example #7 Traits Composed from Traits**
```
<?php
trait Hello {
public function sayHello() {
echo 'Hello ';
}
}
trait World {
public function sayWorld() {
echo 'World!';
}
}
trait HelloWorld {
use Hello, World;
}
class MyHelloWorld {
use HelloWorld;
}
$o = new MyHelloWorld();
$o->sayHello();
$o->sayWorld();
?>
```
The above example will output:
```
Hello World!
```
### Abstract Trait Members
Traits support the use of abstract methods in order to impose requirements upon the exhibiting class. Public, protected, and private methods are supported. Prior to PHP 8.0.0, only public and protected abstract methods were supported.
**Caution** A concrete class fulfills this requirement by defining a concrete method with the same name; its signature may be different.
**Example #8 Express Requirements by Abstract Methods**
```
<?php
trait Hello {
public function sayHelloWorld() {
echo 'Hello'.$this->getWorld();
}
abstract public function getWorld();
}
class MyHelloWorld {
private $world;
use Hello;
public function getWorld() {
return $this->world;
}
public function setWorld($val) {
$this->world = $val;
}
}
?>
```
### Static Trait Members
Traits can define static variables, static methods and static properties.
>
> **Note**:
>
>
> As of PHP 8.1.0, calling a static method, or accessing a static property directly on a trait is deprecated. Static methods and properties should only be accessed on a class using the trait.
>
>
**Example #9 Static Variables**
```
<?php
trait Counter {
public function inc() {
static $c = 0;
$c = $c + 1;
echo "$c\n";
}
}
class C1 {
use Counter;
}
class C2 {
use Counter;
}
$o = new C1(); $o->inc(); // echo 1
$p = new C2(); $p->inc(); // echo 1
?>
```
**Example #10 Static Methods**
```
<?php
trait StaticExample {
public static function doSomething() {
return 'Doing something';
}
}
class Example {
use StaticExample;
}
Example::doSomething();
?>
```
**Example #11 Static Properties**
```
<?php
trait StaticExample {
public static $static = 'foo';
}
class Example {
use StaticExample;
}
echo Example::$static;
?>
```
### Properties
Traits can also define properties.
**Example #12 Defining Properties**
```
<?php
trait PropertiesTrait {
public $x = 1;
}
class PropertiesExample {
use PropertiesTrait;
}
$example = new PropertiesExample;
$example->x;
?>
```
If a trait defines a property then a class can not define a property with the same name unless it is compatible (same visibility and type, readonly modifier, and initial value), otherwise a fatal error is issued.
**Example #13 Conflict Resolution**
```
<?php
trait PropertiesTrait {
public $same = true;
public $different1 = false;
public bool $different2;
readonly public bool $different3;
}
class PropertiesExample {
use PropertiesTrait;
public $same = true;
public $different1 = true; // Fatal error
public string $different2; // Fatal error
readonly public bool $different3; // Fatal error
}
?>
```
### Constants
Traits can, as of PHP 8.2.0, also define constants.
**Example #14 Defining Constants**
```
<?php
trait ConstantsTrait {
public const FLAG_MUTABLE = 1;
final public const FLAG_IMMUTABLE = 5;
}
class ConstantsExample {
use ConstantTrait;
}
$example = new ConstantExample;
$example::FLAG;
?>
```
If a trait defines a constants then a class can not define a constants with the same name unless it is compatible (same visibility, initial value, and finality), otherwise a fatal error is issued.
**Example #15 Conflict Resolution**
```
<?php
trait ConstantsTrait {
public const FLAG_MUTABLE = 1;
final public const FLAG_IMMUTABLE = 5;
}
class ConstantsExample {
use ConstantTrait;
public const FLAG_IMMUTABLE = 5; // Fatal error
}
?>
```
php getservbyname getservbyname
=============
(PHP 4, PHP 5, PHP 7, PHP 8)
getservbyname — Get port number associated with an Internet service and protocol
### Description
```
getservbyname(string $service, string $protocol): int|false
```
**getservbyname()** returns the Internet port which corresponds to `service` for the specified `protocol` as per /etc/services.
### Parameters
`service`
The Internet service name, as a string.
`protocol`
`protocol` is either `"tcp"` or `"udp"` (in lowercase).
### Return Values
Returns the port number, or **`false`** if `service` or `protocol` is not found.
### Examples
**Example #1 **getservbyname()** example**
```
<?php
$services = array('http', 'ftp', 'ssh', 'telnet', 'imap',
'smtp', 'nicname', 'gopher', 'finger', 'pop3', 'www');
foreach ($services as $service) {
$port = getservbyname($service, 'tcp');
echo $service . ": " . $port . "<br />\n";
}
?>
```
### See Also
* [getservbyport()](function.getservbyport) - Get Internet service which corresponds to port and protocol
* [» http://www.iana.org/assignments/port-numbers](http://www.iana.org/assignments/port-numbers) for a complete list of port numbers.
php IntlChar::isspace IntlChar::isspace
=================
(PHP 7, PHP 8)
IntlChar::isspace — Check if code point is a space character
### Description
```
public static IntlChar::isspace(int|string $codepoint): ?bool
```
Determines if the specified character is a space character or not.
### 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 space character, **`false`** if not. Returns **`null`** on failure.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::isspace("A"));
var_dump(IntlChar::isspace(" "));
var_dump(IntlChar::isspace("\n"));
var_dump(IntlChar::isspace("\t"));
var_dump(IntlChar::isspace("\u{00A0}"));
?>
```
The above example will output:
```
bool(false)
bool(true)
bool(true)
bool(true)
bool(true)
```
### See Also
* [IntlChar::isJavaSpaceChar()](intlchar.isjavaspacechar) - Check if code point is a space character according to Java
* [IntlChar::isWhitespace()](intlchar.iswhitespace) - Check if code point is a whitespace character according to ICU
* [IntlChar::isUWhiteSpace()](intlchar.isuwhitespace) - Check if code point has the White\_Space Unicode property
php GearmanJob::sendComplete GearmanJob::sendComplete
========================
(PECL gearman >= 0.6.0)
GearmanJob::sendComplete — Send the result and complete status
### Description
```
public GearmanJob::sendComplete(string $result): bool
```
Sends result data and the complete status update for this job.
### Parameters
`result`
Serialized result data.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [GearmanJob::sendFail()](gearmanjob.sendfail) - Send fail status
* [GearmanJob::setReturn()](gearmanjob.setreturn) - Set a return value
php The Yaf_Exception class
The Yaf\_Exception class
========================
Introduction
------------
(Yaf >=1.0.0)
Class synopsis
--------------
class **Yaf\_Exception** 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 \*/ public [\_\_construct](yaf-exception.construct)()
```
public getPrevious(): void
```
/\* 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
```
} Table of Contents
-----------------
* [Yaf\_Exception::\_\_construct](yaf-exception.construct) — The \_\_construct purpose
* [Yaf\_Exception::getPrevious](yaf-exception.getprevious) — The getPrevious purpose
| programming_docs |
php eio_read eio\_read
=========
(PECL eio >= 0.0.1dev)
eio\_read — Read from a file descriptor at given offset
### Description
```
eio_read(
mixed $fd,
int $length,
int $offset,
int $pri,
callable $callback,
mixed $data = NULL
): resource
```
**eio\_read()** reads up to `length` bytes from `fd` file descriptor at `offset`. The read bytes are stored in `result` argument of `callback`.
### Parameters
`fd`
Stream, Socket resource, or numeric file descriptor
`length`
Maximum number of bytes to read.
`offset`
Offset within the file.
`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\_read()** stores read bytes in `result` argument of `callback` function.
### Examples
**Example #1 **eio\_read()** example**
```
<?php
// Open a temporary file and write some bytes there
$temp_filename = "eio-temp-file.tmp";
$fp = fopen($temp_filename, "w");
fwrite($fp, "1234567890");
fclose($fp);
/* Is called when eio_read() is done */
function my_read_cb($data, $result) {
global $temp_filename;
// Output read bytes
var_dump($result);
// Close file
eio_close($data);
eio_event_loop();
// Remove temporary file
@unlink($temp_filename);
}
/* Is called when eio_open() is done */
function my_file_opened_callback($data, $result) {
// $result should contain the file descriptor
if ($result > 0) {
// Read 5 bytes starting from third
eio_read($result, 5, 2, EIO_PRI_DEFAULT, "my_read_cb", $result);
eio_event_loop();
} else {
// eio_open() failed
unlink($data);
}
}
// Open the file for reading and writing
eio_open($temp_filename, EIO_O_RDWR, NULL,
EIO_PRI_DEFAULT, "my_file_opened_callback", $temp_filename);
eio_event_loop();
?>
```
The above example will output something similar to:
```
string(5) "34567"
```
### See Also
* [eio\_open()](function.eio-open) - Opens a file
* [eio\_write()](function.eio-write) - Write to file
* [eio\_close()](function.eio-close) - Close file
* [eio\_event\_loop()](function.eio-event-loop) - Polls libeio until all requests proceeded
php snmprealwalk snmprealwalk
============
(PHP 4, PHP 5, PHP 7, PHP 8)
snmprealwalk — Return all objects including their respective object ID within the specified one
### Description
```
snmprealwalk(
string $hostname,
string $community,
array|string $object_id,
int $timeout = -1,
int $retries = -1
): array|false
```
The **snmprealwalk()** 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 **snmprealwalk()****
```
<?php
print_r(snmprealwalk("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
* [snmpwalk()](function.snmpwalk) - Fetch all the SNMP objects from an agent
php SplObjectStorage::current SplObjectStorage::current
=========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplObjectStorage::current — Returns the current storage entry
### Description
```
public SplObjectStorage::current(): object
```
Returns the current storage entry.
### Parameters
This function has no parameters.
### Return Values
The object at the current iterator position.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | **SplObjectStorage::current()** now throws an [Error](class.error) exception if the current position is invalid. Previously, **`false`** was returned instead. |
### Examples
**Example #1 **SplObjectStorage::current()** 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::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::getInfo()](splobjectstorage.getinfo) - Returns the data associated with the current iterator entry
php get_loaded_extensions get\_loaded\_extensions
=======================
(PHP 4, PHP 5, PHP 7, PHP 8)
get\_loaded\_extensions — Returns an array with the names of all modules compiled and loaded
### Description
```
get_loaded_extensions(bool $zend_extensions = false): array
```
This function returns the names of all the modules compiled and loaded in the PHP interpreter.
### Parameters
`zend_extensions`
Only return Zend extensions, if not then regular extensions, like mysqli are listed. Defaults to **`false`** (return regular extensions).
### Return Values
Returns an indexed array of all the modules names.
### Examples
**Example #1 **get\_loaded\_extensions()** Example**
```
<?php
print_r(get_loaded_extensions());
?>
```
The above example will output something similar to:
```
Array
(
[0] => Core
[1] => date
[2] => libxml
[3] => pcre
[4] => sqlite3
[5] => zlib
[6] => ctype
[7] => dom
[8] => fileinfo
[9] => filter
[10] => hash
[11] => json
[12] => mbstring
[13] => SPL
[14] => PDO
[15] => session
[16] => posix
[17] => Reflection
[18] => standard
[19] => SimpleXML
[20] => pdo_sqlite
[21] => Phar
[22] => tokenizer
[23] => xml
[24] => xmlreader
[25] => xmlwriter
[26] => gmp
[27] => iconv
[28] => intl
[29] => bcmath
[30] => sodium
[31] => Zend OPcache
)
```
### See Also
* [get\_extension\_funcs()](function.get-extension-funcs) - Returns an array with the names of the functions of a module
* [extension\_loaded()](function.extension-loaded) - Find out whether an extension is loaded
* [dl()](function.dl) - Loads a PHP extension at runtime
* [phpinfo()](function.phpinfo) - Outputs information about PHP's configuration
php pg_escape_string pg\_escape\_string
==================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg\_escape\_string — Escape a string for query
### Description
```
pg_escape_string(PgSql\Connection $connection = ?, string $data): string
```
**pg\_escape\_string()** escapes a string for querying the database. It returns an escaped string in the PostgreSQL format without quotes. [pg\_escape\_literal()](function.pg-escape-literal) is more preferred way to escape SQL parameters for PostgreSQL. [addslashes()](function.addslashes) must not be used with PostgreSQL. If the type of the column is bytea, [pg\_escape\_bytea()](function.pg-escape-bytea) must be used instead. [pg\_escape\_identifier()](function.pg-escape-identifier) must be used to escape identifiers (e.g. table names, field names)
>
> **Note**:
>
>
> This function requires PostgreSQL 7.2 or later.
>
>
### 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\_string()** example**
```
<?php
// Connect to the database
$dbconn = pg_connect('dbname=foo');
// Read in a text file (containing apostrophes and backslashes)
$data = file_get_contents('letter.txt');
// Escape the text data
$escaped = pg_escape_string($data);
// Insert it into the database
pg_query("INSERT INTO correspondence (name, data) VALUES ('My letter', '{$escaped}')");
?>
```
### See Also
* [pg\_escape\_bytea()](function.pg-escape-bytea) - Escape a string for insertion into a bytea field
php Pool::resize Pool::resize
============
(PECL pthreads >= 2.0.0)
Pool::resize — Resize the Pool
### Description
```
public Pool::resize(int $size): void
```
Resize the Pool
### Parameters
`size`
The maximum number of Workers this Pool can create
### Return Values
No value is returned.
php DOMImplementation::createDocument DOMImplementation::createDocument
=================================
(PHP 5, PHP 7, PHP 8)
DOMImplementation::createDocument — Creates a DOMDocument object of the specified type with its document element
### Description
```
public DOMImplementation::createDocument(?string $namespace = null, string $qualifiedName = "", ?DOMDocumentType $doctype = null): DOMDocument|false
```
Creates a [DOMDocument](class.domdocument) object of the specified type with its document element.
### Parameters
`namespace`
The namespace URI of the document element to create.
`qualifiedName`
The qualified name of the document element to create.
`doctype`
The type of document to create or **`null`**.
### Return Values
A new [DOMDocument](class.domdocument) object. If `namespace`, `qualifiedName`, and `doctype` are null, the returned [DOMDocument](class.domdocument) is empty with no document element
### Errors/Exceptions
**`DOM_WRONG_DOCUMENT_ERR`**
Raised if `doctype` has already been used with a different document or was created from a different implementation.
**`DOM_NAMESPACE_ERR`**
Raised if there is an error with the namespace, as determined by `namespace` and `qualifiedName`.
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
### Changelog
| Version | Description |
| --- | --- |
| 8.0.3 | `namespace` is now nullable. |
| 8.0.0 | `doctype` is now nullable. |
### See Also
* [DOMDocument::\_\_construct()](domdocument.construct) - Creates a new DOMDocument object
* [DOMImplementation::createDocumentType()](domimplementation.createdocumenttype) - Creates an empty DOMDocumentType object
php sodium_crypto_box_keypair_from_secretkey_and_publickey sodium\_crypto\_box\_keypair\_from\_secretkey\_and\_publickey
=============================================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_box\_keypair\_from\_secretkey\_and\_publickey — Create a unified keypair string from a secret key and public key
### Description
```
sodium_crypto_box_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string
```
This function exists to satisfy the API requirements of e.g. **crypto\_box()**. Pass in one party's secret key and the other's public key, and you will obtain a "keypair" for your conversation.
### Parameters
`secret_key`
Secret key.
`public_key`
Public key.
### Return Values
X25519 Keypair.
php DOMNodeList::count DOMNodeList::count
==================
(PHP 7 >= 7.2.0, PHP 8)
DOMNodeList::count — Get number of nodes in the list
### Description
```
public DOMNodeList::count(): int
```
Gets the number of nodes in the list.
### Parameters
This function has no parameters.
### Return Values
Returns the number of nodes in the list, which is identical to the [length](class.domnodelist#domnodelist.props.length) property.
php sodium_crypto_secretstream_xchacha20poly1305_push sodium\_crypto\_secretstream\_xchacha20poly1305\_push
=====================================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_secretstream\_xchacha20poly1305\_push — Encrypt a chunk of data so that it can safely be decrypted in a streaming API
### Description
```
sodium_crypto_secretstream_xchacha20poly1305_push(
string &$state,
string $message,
string $additional_data = "",
int $tag = SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE
): string
```
Encrypt a chunk of data so that it can safely be decrypted in a streaming API.
### 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)
`message`
`additional_data`
`tag`
Optional. Can be used to assert decryption behavior (i.e. re-keying or indicating the final chunk in a stream).
* **`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.
### Return Values
Returns the encrypted ciphertext.
php The EventUtil class
The EventUtil class
===================
Introduction
------------
(PECL event >= 1.5.0)
**EventUtil** is a singleton with supplimentary methods and constants.
Class synopsis
--------------
final class **EventUtil** { /\* Constants \*/ const int [AF\_INET](class.eventutil#eventutil.constants.af-inet) = 2;
const int [AF\_INET6](class.eventutil#eventutil.constants.af-inet6) = 10;
const int [AF\_UNSPEC](class.eventutil#eventutil.constants.af-unspec) = 0;
const int [LIBEVENT\_VERSION\_NUMBER](class.eventutil#eventutil.constants.libevent-version-number) = 33559808;
const int [SO\_DEBUG](class.eventutil#eventutil.constants.so-debug) = 1;
const int [SO\_REUSEADDR](class.eventutil#eventutil.constants.so-reuseaddr) = 2;
const int [SO\_KEEPALIVE](class.eventutil#eventutil.constants.so-keepalive) = 9;
const int [SO\_DONTROUTE](class.eventutil#eventutil.constants.so-dontroute) = 5;
const int [SO\_LINGER](class.eventutil#eventutil.constants.so-linger) = 13;
const int [SO\_BROADCAST](class.eventutil#eventutil.constants.so-broadcast) = 6;
const int [SO\_OOBINLINE](class.eventutil#eventutil.constants.so-oobinline) = 10;
const int [SO\_SNDBUF](class.eventutil#eventutil.constants.so-sndbuf) = 7;
const int [SO\_RCVBUF](class.eventutil#eventutil.constants.so-rcvbuf) = 8;
const int [SO\_SNDLOWAT](class.eventutil#eventutil.constants.so-sndlowat) = 19;
const int [SO\_RCVLOWAT](class.eventutil#eventutil.constants.so-rcvlowat) = 18;
const int [SO\_SNDTIMEO](class.eventutil#eventutil.constants.so-sndtimeo) = 21;
const int [SO\_RCVTIMEO](class.eventutil#eventutil.constants.so-rcvtimeo) = 20;
const int [SO\_TYPE](class.eventutil#eventutil.constants.so-type) = 3;
const int [SO\_ERROR](class.eventutil#eventutil.constants.so-error) = 4;
const int [SOL\_SOCKET](class.eventutil#eventutil.constants.sol-socket) = 1;
const int [SOL\_TCP](class.eventutil#eventutil.constants.sol-tcp) = 6;
const int [SOL\_UDP](class.eventutil#eventutil.constants.sol-udp) = 17;
const int [IPPROTO\_IP](class.eventutil#eventutil.constants.ipproto-ip) = 0;
const int [IPPROTO\_IPV6](class.eventutil#eventutil.constants.ipproto-ipv6) = 41; /\* Methods \*/
```
abstract public __construct()
```
```
public static getLastSocketErrno( mixed $socket = null ): int
```
```
public static getLastSocketError( mixed $socket = ?): string
```
```
public static getSocketFd( mixed $socket ): int
```
```
public static getSocketName( mixed $socket , string &$address , mixed &$port = ?): bool
```
```
public static setSocketOption(
mixed $socket ,
int $level ,
int $optname ,
mixed $optval
): bool
```
```
public static sslRandPoll(): void
```
} Predefined Constants
--------------------
**`EventUtil::AF_INET`** IPv4 address family
**`EventUtil::AF_INET6`** IPv6 address family
**`EventUtil::AF_UNSPEC`** Unspecified IP address family
**`EventUtil::SO_DEBUG`** Socket option. Enable socket debugging. Only allowed for processes with the `CAP_NET_ADMIN` capability or an effective user ID of **`0`** . (Added in event-1.6.0.)
**`EventUtil::SO_REUSEADDR`** Socket option. Indicates that the rules used in validating addresses supplied in a `bind(2)` call should allow reuse of local addresses. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SO_KEEPALIVE`** Socket option. Enable sending of keep-alive messages on connection-oriented sockets. Expects an integer boolean flag. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SO_DONTROUTE`** Socket option. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SO_LINGER`** Socket option. When enabled, a `close(2)` or `shutdown(2)` will not return until all queued messages for the socket have been successfully sent or the linger timeout has been reached. Otherwise, the call returns immediately and the closing is done in the background. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SO_BROADCAST`** Socket option. Reports whether transmission of broadcast messages is supported. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SO_OOBINLINE`** Socket option. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SO_SNDBUF`** Socket option. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SO_RCVBUF`** Socket option. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SO_SNDLOWAT`** Socket option. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SO_RCVLOWAT`** Socket option. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SO_SNDTIMEO`** Socket option. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SO_RCVTIMEO`** Socket option. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SO_TYPE`** Socket option. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SO_ERROR`** Socket option. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SOL_SOCKET`** Socket option level. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SOL_TCP`** Socket option level. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::SOL_UDP`** Socket option level. See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::IPPROTO_IP`** See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::IPPROTO_IPV6`** See the `socket(7)` manual page. (Added in event-1.6.0.)
**`EventUtil::LIBEVENT_VERSION_NUMBER`** Libevent' version number at the time when Event extension had been compiled with the library.
Table of Contents
-----------------
* [EventUtil::\_\_construct](eventutil.construct) — The abstract constructor
* [EventUtil::getLastSocketErrno](eventutil.getlastsocketerrno) — Returns the most recent socket error number
* [EventUtil::getLastSocketError](eventutil.getlastsocketerror) — Returns the most recent socket error
* [EventUtil::getSocketFd](eventutil.getsocketfd) — Returns numeric file descriptor of a socket, or stream
* [EventUtil::getSocketName](eventutil.getsocketname) — Retreives the current address to which the socket is bound
* [EventUtil::setSocketOption](eventutil.setsocketoption) — Sets socket options
* [EventUtil::sslRandPoll](eventutil.sslrandpoll) — Generates entropy by means of OpenSSL's RAND\_poll()
| programming_docs |
php SolrCollapseFunction::getHint SolrCollapseFunction::getHint
=============================
(PECL solr >= 2.2.0)
SolrCollapseFunction::getHint — Returns collapse hint
### Description
```
public SolrCollapseFunction::getHint(): string
```
Returns collapse hint
### Parameters
This function has no parameters.
### Return Values
### See Also
* [SolrCollapseFunction::setHint()](solrcollapsefunction.sethint) - Sets collapse hint
php mysqli::$client_info mysqli::$client\_info
=====================
mysqli::get\_client\_info
=========================
mysqli\_get\_client\_info
=========================
(PHP 5, PHP 7, PHP 8)
mysqli::$client\_info -- mysqli::get\_client\_info -- mysqli\_get\_client\_info — Get MySQL client info
### Description
Object-oriented style
string [$mysqli->client\_info](mysqli.get-client-info);
```
public mysqli::get_client_info(): string
```
Procedural style
```
mysqli_get_client_info(?mysqli $mysql = null): string
```
Returns a string that represents the MySQL client library version.
### Parameters
This function has no parameters.
### Return Values
A string that represents the MySQL client library version.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | Calling **mysqli\_get\_client\_info()** with the `mysql` argument has been deprecated. This function never required a parameter, but incorrectly allowed it as an optional parameter. |
| 8.1.0 | The object-oriented style **mysqli::get\_client\_info()** has been deprecated. |
### Examples
**Example #1 mysqli\_get\_client\_info**
```
<?php
/* We don't need a connection to determine
the version of mysql client library */
printf("Client library version: %s\n", mysqli_get_client_info());
?>
```
### See Also
* [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
* [mysqli\_get\_server\_version()](mysqli.get-server-version) - Returns the version of the MySQL server as an integer
php None Relative class types
--------------------
These types declarations can only be used within classes.
### self
The value must be an [`instanceof`](language.operators.type) the same class as the one in which the type declaration is used.
### parent
The value must be an [`instanceof`](language.operators.type) a parent of the class in which the type declaration is used.
### static
static is a return-only type which requires that the value returned must be an [`instanceof`](language.operators.type) the same class as the one the method is called in. Available as of PHP 8.0.0.
php The StompException class
The StompException class
========================
Introduction
------------
(PECL stomp >= 0.1.0)
Represents an error raised by the stomp extension. See [Exceptions](language.exceptions) for more information about Exceptions in PHP.
Class synopsis
--------------
class **StompException** extends [Exception](class.exception) { /\* 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
```
/\* Methods \*/
```
public getDetails(): string
```
} Table of Contents
-----------------
* [StompException::getDetails](stomp.getdetails) — Get exception details
php The PgSql\Connection class
The PgSql\Connection class
==========================
Introduction
------------
(PHP 8 >= 8.1.0)
A fully opaque class which replaces a `pgsql link` resource as of PHP 8.1.0.
Class synopsis
--------------
final class **PgSql\Connection** { }
php Spoofchecker::areConfusable Spoofchecker::areConfusable
===========================
(PHP 5 >= 5.4.0, PHP 7, PHP 8, PECL intl >= 2.0.0)
Spoofchecker::areConfusable — Checks if given strings can be confused
### Description
```
public Spoofchecker::areConfusable(string $string1, string $string2, int &$errorCode = null): bool
```
Checks whether two given strings can easily be mistaken.
### Parameters
`string1`
First string to check.
`string2`
Second string to check.
`errorCode`
This variable is set by-reference to int containing an error, if there was any.
### Return Values
Returns **`true`** if two given strings can be confused, **`false`** otherwise.
### Examples
**Example #1 **Spoofchecker::areConfusable()** example**
```
<?php
$checker = new Spoofchecker();
$checker->areConfusable('google.com', 'goog1e.com'); // true
// Lower l can be confused with digit one
$checker->areConfusable('google.com', 'g00g1e.com'); // false
// Zero (0) cannot be easily confused with "o" letter
```
php SessionHandler::create_sid SessionHandler::create\_sid
===========================
(PHP 5 >= 5.5.1, PHP 7, PHP 8)
SessionHandler::create\_sid — Return a new session ID
### Description
```
public SessionHandler::create_sid(): string
```
Generates and returns a new session ID.
### Parameters
This function has no parameters.
### Return Values
A session ID valid for the default session handler.
### See Also
* [session\_id()](function.session-id) - Get and/or set the current session id
* [session\_create\_id()](function.session-create-id) - Create new session id
php xml_parse_into_struct xml\_parse\_into\_struct
========================
(PHP 4, PHP 5, PHP 7, PHP 8)
xml\_parse\_into\_struct — Parse XML data into an array structure
### Description
```
xml_parse_into_struct(
XMLParser $parser,
string $data,
array &$values,
array &$index = null
): int
```
This function parses an XML string into 2 parallel array structures, one (`index`) containing pointers to the location of the appropriate values in the `values` array. These last two parameters must be passed by reference.
### Parameters
`parser`
A reference to the XML parser.
`data`
A string containing the XML data.
`values`
An array containing the values of the XML data
`index`
An array containing pointers to the location of the appropriate values in the $values.
### Return Values
**xml\_parse\_into\_struct()** returns 0 for failure and 1 for success. This is not the same as **`false`** and **`true`**, be careful with operators such as ===.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `parser` expects an [XMLParser](class.xmlparser) instance now; previously, a resource was expected. |
### Examples
Below is an example that illustrates the internal structure of the arrays being generated by the function. We use a simple `note` tag embedded inside a `para` tag, and then we parse this and print out the structures generated:
**Example #1 **xml\_parse\_into\_struct()** example**
```
<?php
$simple = "<para><note>simple note</note></para>";
$p = xml_parser_create();
xml_parse_into_struct($p, $simple, $vals, $index);
xml_parser_free($p);
echo "Index array\n";
print_r($index);
echo "\nVals array\n";
print_r($vals);
?>
```
When we run that code, the output will be:
```
Index array
Array
(
[PARA] => Array
(
[0] => 0
[1] => 2
)
[NOTE] => Array
(
[0] => 1
)
)
Vals array
Array
(
[0] => Array
(
[tag] => PARA
[type] => open
[level] => 1
)
[1] => Array
(
[tag] => NOTE
[type] => complete
[level] => 2
[value] => simple note
)
[2] => Array
(
[tag] => PARA
[type] => close
[level] => 1
)
)
```
Event-driven parsing (based on the expat library) can get complicated when you have an XML document that is complex. This function does not produce a DOM style object, but it generates structures amenable of being traversed in a tree fashion. Thus, we can create objects representing the data in the XML file easily. Let's consider the following XML file representing a small database of aminoacids information:
**Example #2 moldb.xml - small database of molecular information**
```
<?xml version="1.0"?>
<moldb>
<molecule>
<name>Alanine</name>
<symbol>ala</symbol>
<code>A</code>
<type>hydrophobic</type>
</molecule>
<molecule>
<name>Lysine</name>
<symbol>lys</symbol>
<code>K</code>
<type>charged</type>
</molecule>
</moldb>
```
And some code to parse the document and generate the appropriate objects: **Example #3 parsemoldb.php - parses moldb.xml into an array of molecular objects**
```
<?php
class AminoAcid {
var $name; // aa name
var $symbol; // three letter symbol
var $code; // one letter code
var $type; // hydrophobic, charged or neutral
function __construct ($aa)
{
foreach ($aa as $k=>$v)
$this->$k = $aa[$k];
}
}
function readDatabase($filename)
{
// read the XML database of aminoacids
$data = file_get_contents($filename);
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, $data, $values, $tags);
xml_parser_free($parser);
// loop through the structures
foreach ($tags as $key=>$val) {
if ($key == "molecule") {
$molranges = $val;
// each contiguous pair of array entries are the
// lower and upper range for each molecule definition
for ($i=0; $i < count($molranges); $i+=2) {
$offset = $molranges[$i] + 1;
$len = $molranges[$i + 1] - $offset;
$tdb[] = parseMol(array_slice($values, $offset, $len));
}
} else {
continue;
}
}
return $tdb;
}
function parseMol($mvalues)
{
for ($i=0; $i < count($mvalues); $i++) {
$mol[$mvalues[$i]["tag"]] = $mvalues[$i]["value"];
}
return new AminoAcid($mol);
}
$db = readDatabase("moldb.xml");
echo "** Database of AminoAcid objects:\n";
print_r($db);
?>
```
After executing parsemoldb.php, the variable $db contains an array of **AminoAcid** objects, and the output of the script confirms that:
```
** Database of AminoAcid objects:
Array
(
[0] => aminoacid Object
(
[name] => Alanine
[symbol] => ala
[code] => A
[type] => hydrophobic
)
[1] => aminoacid Object
(
[name] => Lysine
[symbol] => lys
[code] => K
[type] => charged
)
)
```
php None require\_once
-------------
(PHP 4, PHP 5, PHP 7, PHP 8)
The `require_once` expression is identical to [require](function.require) except PHP will check if the file has already been included, and if so, not include (require) it again.
See the [include\_once](function.include-once) documentation for information about the `_once` behaviour, and how it differs from its non `_once` siblings.
php ImagickPixelIterator::newPixelIterator ImagickPixelIterator::newPixelIterator
======================================
(PECL imagick 2, PECL imagick 3)
ImagickPixelIterator::newPixelIterator — Returns a new pixel iterator
### Description
```
public ImagickPixelIterator::newPixelIterator(Imagick $wand): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Returns a new pixel iterator.
### Return Values
Returns **`true`** on success. Throwing ImagickPixelIteratorException.
php sodium_crypto_sign_keypair_from_secretkey_and_publickey sodium\_crypto\_sign\_keypair\_from\_secretkey\_and\_publickey
==============================================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_sign\_keypair\_from\_secretkey\_and\_publickey — Join a secret key and public key together
### Description
```
sodium_crypto_sign_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string
```
Join a secret key and public key together.
### Parameters
`secret_key`
Ed25519 secret key
`public_key`
Ed25519 public key
### Return Values
Keypair
php Ds\Queue::count Ds\Queue::count
===============
(PECL ds >= 1.0.0)
Ds\Queue::count — Returns the number of values in the queue
See [Countable::count()](countable.count)
php SplFileInfo::getBasename SplFileInfo::getBasename
========================
(PHP 5 >= 5.2.2, PHP 7, PHP 8)
SplFileInfo::getBasename — Gets the base name of the file
### Description
```
public SplFileInfo::getBasename(string $suffix = ""): string
```
This method returns the base name of the file, directory, or link without path info.
**Caution** **SplFileInfo::getBasename()** is locale aware, so for it to see the correct basename with multibyte character paths, the matching locale must be set using the [setlocale()](function.setlocale) function.
### Parameters
`suffix`
Optional suffix to omit from the base name returned.
### Return Values
Returns the base name without path information.
### Examples
**Example #1 **SplFileInfo::getBasename()** example**
```
<?php
$info = new SplFileInfo('file.txt');
var_dump($info->getBasename());
$info = new SplFileInfo('/path/to/file.txt');
var_dump($info->getBasename());
$info = new SplFileInfo('/path/to/file.txt');
var_dump($info->getBasename('.txt'));
?>
```
The above example will output something similar to:
```
string(8) "file.txt"
string(8) "file.txt"
string(4) "file"
```
### See Also
* [SplFileInfo::getFilename()](splfileinfo.getfilename) - Gets the filename
php QuickHashIntHash::set QuickHashIntHash::set
=====================
(PECL quickhash >= Unknown)
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
### Description
```
public QuickHashIntHash::set(int $key, int $value): bool
```
This method tries to update an entry with a new value. In case the entry did not yet exist, it will instead add a new entry. It returns whether the entry was added or 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 add or update.
`value`
The new value to set the entry with.
### Return Values
2 if the entry was found and updated, 1 if the entry was newly added or 0 if there was an error.
### Examples
**Example #1 **QuickHashIntHash::set()** example**
```
<?php
$hash = new QuickHashIntHash( 1024 );
echo "Set->Add\n";
var_dump( $hash->get( 46692 ) );
var_dump( $hash->set( 46692, 16091 ) );
var_dump( $hash->get( 46692 ) );
echo "Set->Update\n";
var_dump( $hash->set( 46692, 29906 ) );
var_dump( $hash->get( 46692 ) );
?>
```
The above example will output something similar to:
```
bool(false)
int(2)
int(16091)
Set->Update
int(1)
int(29906)
```
php DOMDocument::getElementById DOMDocument::getElementById
===========================
(PHP 5, PHP 7, PHP 8)
DOMDocument::getElementById — Searches for an element with a certain id
### Description
```
public DOMDocument::getElementById(string $elementId): ?DOMElement
```
This function is similar to [DOMDocument::getElementsByTagName](domdocument.getelementsbytagname) but searches for an element with a given id.
For this function to work, you will need either to set some ID attributes with [DOMElement::setIdAttribute](domelement.setidattribute) or a DTD which defines an attribute to be of type ID. In the later case, you will need to validate your document with [DOMDocument::validate](domdocument.validate) or [DOMDocument::$validateOnParse](class.domdocument#domdocument.props.validateonparse) before using this function.
### Parameters
`elementId`
The unique id value for an element.
### Return Values
Returns the [DOMElement](class.domelement) or **`null`** if the element is not found.
### Examples
**Example #1 DOMDocument::getElementById() Example**
The following examples use book.xml which contains the following:
```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE books [
<!ELEMENT books (book+)>
<!ELEMENT book (title, author+, xhtml:blurb?)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT blurb (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ATTLIST books xmlns CDATA #IMPLIED>
<!ATTLIST books xmlns:xhtml CDATA #IMPLIED>
<!ATTLIST book id ID #IMPLIED>
<!ATTLIST author email CDATA #IMPLIED>
]>
<?xml-stylesheet type="text/xsl" href="style.xsl"?>
<books xmlns="http://books.php/" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<book id="php-basics">
<title>PHP Basics</title>
<author email="[email protected]">Jim Smith</author>
<author email="[email protected]">Jane Smith</author>
<xhtml:blurb><![CDATA[
<p><em>PHP Basics</em> provides an introduction to PHP.</p>
]]></xhtml:blurb>
</book>
<book id="php-advanced">
<title>PHP Advanced Programming</title>
<author email="[email protected]">Jon Doe</author>
</book>
</books>
```
```
<?php
$doc = new DomDocument;
// We need to validate our document before referring to the id
$doc->validateOnParse = true;
$doc->Load('book.xml');
echo "The element whose id is 'php-basics' is: " . $doc->getElementById('php-basics')->tagName . "\n";
?>
```
The above example will output:
```
The element whose id is 'php-basics' is: book
```
### See Also
* [DOMDocument::getElementsByTagName()](domdocument.getelementsbytagname) - Searches for all elements with given local tag name
php stats_cdf_f stats\_cdf\_f
=============
(PECL stats >= 1.0.0)
stats\_cdf\_f — Calculates any one parameter of the F distribution given values for the others
### Description
```
stats_cdf_f(
float $par1,
float $par2,
float $par3,
int $which
): float
```
Returns the cumulative distribution function, its inverse, or one of its parameters, of the F 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, d1, and d2 denotes cumulative distribution function, the value of the random variable, and the degree of freedoms of the F distribution, respectively.
**Return value and parameters**| `which` | Return value | `par1` | `par2` | `par3` |
| --- | --- | --- | --- | --- |
| 1 | CDF | x | d1 | d2 |
| 2 | x | CDF | d1 | d2 |
| 3 | d1 | x | CDF | d2 |
| 4 | d2 | x | CDF | d1 |
### 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, d1, or d2, determined by `which`.
php pg_last_notice pg\_last\_notice
================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
pg\_last\_notice — Returns the last notice message from PostgreSQL server
### Description
```
pg_last_notice(PgSql\Connection $connection, int $mode = PGSQL_NOTICE_LAST): array|string|bool
```
**pg\_last\_notice()** returns the last notice message from the PostgreSQL server on the specified `connection`. The PostgreSQL server sends notice messages in several cases, for instance when creating a `SERIAL` column in a table.
With **pg\_last\_notice()**, you can avoid issuing useless queries by checking whether or not the notice is related to your transaction.
Notice message tracking can be set to optional by setting 1 for `pgsql.ignore_notice` in php.ini.
Notice message logging can be set to optional by setting 0 for `pgsql.log_notice` in php.ini. Unless `pgsql.ignore_notice` is set to 0, notice message cannot be logged.
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance.
`mode`
One of **`PGSQL_NOTICE_LAST`** (to return last notice), **`PGSQL_NOTICE_ALL`** (to return all notices), or **`PGSQL_NOTICE_CLEAR`** (to clear notices).
### Return Values
A string containing the last notice on the given `connection` with **`PGSQL_NOTICE_LAST`**, an array with **`PGSQL_NOTICE_ALL`**, a bool with **`PGSQL_NOTICE_CLEAR`**.
### 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. |
| 7.1.0 | The `mode` parameter was added. |
### Examples
**Example #1 **pg\_last\_notice()** example**
```
<?php
$pgsql_conn = pg_connect("dbname=mark host=localhost");
$res = pg_query("CREATE TABLE test (id SERIAL)");
$notice = pg_last_notice($pgsql_conn);
echo $notice;
?>
```
The above example will output:
```
CREATE TABLE will create implicit sequence "test_id_seq" for "serial" column "test.id"
```
### See Also
* [pg\_query()](function.pg-query) - Execute a query
* [pg\_last\_error()](function.pg-last-error) - Get the last error message string of a connection
| programming_docs |
php connection_status connection\_status
==================
(PHP 4, PHP 5, PHP 7, PHP 8)
connection\_status — Returns connection status bitfield
### Description
```
connection_status(): int
```
Gets the connection status bitfield.
### Parameters
This function has no parameters.
### Return Values
Returns the connection status bitfield, which can be used against the `CONNECTION_XXX` constants to determine the connection status.
### See Also
* [connection\_aborted()](function.connection-aborted) - Check whether client disconnected
* [ignore\_user\_abort()](function.ignore-user-abort) - Set whether a client disconnect should abort script execution
* [Connection Handling](https://www.php.net/manual/en/features.connection-handling.php) for a complete description of connection handling in PHP.
php Phar::buildFromDirectory Phar::buildFromDirectory
========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
Phar::buildFromDirectory — Construct a phar archive from the files within a directory
### Description
```
public Phar::buildFromDirectory(string $directory, string $pattern = ""): array
```
>
> **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.
>
>
>
Populate a phar archive from directory contents. The optional second parameter is a regular expression (pcre) that is used to exclude files. Any filename that matches the regular expression will be included, all others will be excluded. For more fine-grained control, use [Phar::buildFromIterator()](phar.buildfromiterator).
### Parameters
`directory`
The full or relative path to the directory that contains all files to add to the archive.
`pattern`
An optional pcre regular expression that is used to filter the list of files. Only file paths matching the regular expression will be included in the archive.
### Return Values
**Phar::buildFromDirectory()** returns an associative array mapping internal path of file to the full path of the file on the filesystem.
### Errors/Exceptions
This method throws [BadMethodCallException](class.badmethodcallexception) when unable to instantiate the internal directory iterators, or a [PharException](class.pharexception) if there were errors saving the phar archive.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | **Phar::buildFromDirectory()** no longer returns **`false`**. |
### Examples
**Example #1 A **Phar::buildFromDirectory()** example**
```
<?php
// create with alias "project.phar"
$phar = new Phar('project.phar', 0, 'project.phar');
// add all files in the project
$phar->buildFromDirectory(dirname(__FILE__) . '/project');
$phar->setStub($phar->createDefaultStub('cli/index.php', 'www/index.php'));
$phar2 = new Phar('project2.phar', 0, 'project2.phar');
// add all files in the project, only include php files
$phar2->buildFromDirectory(dirname(__FILE__) . '/project', '/\.php$/');
$phar2->setStub($phar->createDefaultStub('cli/index.php', 'www/index.php'));
?>
```
### See Also
* [Phar::buildFromIterator()](phar.buildfromiterator) - Construct a phar archive from an iterator
php The FilterIterator class
The FilterIterator class
========================
Introduction
------------
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
This abstract iterator filters out unwanted values. This class should be extended to implement custom iterator filters. The [FilterIterator::accept()](filteriterator.accept) must be implemented in the subclass.
Class synopsis
--------------
abstract class **FilterIterator** extends [IteratorIterator](class.iteratoriterator) { /\* Methods \*/ public [\_\_construct](filteriterator.construct)([Iterator](class.iterator) `$iterator`)
```
public accept(): bool
```
```
public current(): mixed
```
```
public getInnerIterator(): Iterator
```
```
public key(): mixed
```
```
public next(): void
```
```
public rewind(): void
```
```
public valid(): bool
```
/\* 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
-----------------
* [FilterIterator::accept](filteriterator.accept) — Check whether the current element of the iterator is acceptable
* [FilterIterator::\_\_construct](filteriterator.construct) — Construct a filterIterator
* [FilterIterator::current](filteriterator.current) — Get the current element value
* [FilterIterator::getInnerIterator](filteriterator.getinneriterator) — Get the inner iterator
* [FilterIterator::key](filteriterator.key) — Get the current key
* [FilterIterator::next](filteriterator.next) — Move the iterator forward
* [FilterIterator::rewind](filteriterator.rewind) — Rewind the iterator
* [FilterIterator::valid](filteriterator.valid) — Check whether the current element is valid
php ReflectionProperty::__construct ReflectionProperty::\_\_construct
=================================
(PHP 5, PHP 7, PHP 8)
ReflectionProperty::\_\_construct — Construct a ReflectionProperty object
### Description
public **ReflectionProperty::\_\_construct**(object|string `$class`, string `$property`) ### Parameters
`class`
Either a string containing the name of the class to reflect, or an object.
`property`
The name of the property being reflected.
### Errors/Exceptions
Trying to get or set private or protected class property's values will result in an exception being thrown.
### Examples
**Example #1 **ReflectionProperty::\_\_construct()** example**
```
<?php
class Str
{
public $length = 5;
}
// Create an instance of the ReflectionProperty class
$prop = new ReflectionProperty('Str', 'length');
// Print out basic information
printf(
"===> The%s%s%s%s property '%s' (which was %s)\n" .
" having the modifiers %s\n",
$prop->isPublic() ? ' public' : '',
$prop->isPrivate() ? ' private' : '',
$prop->isProtected() ? ' protected' : '',
$prop->isStatic() ? ' static' : '',
$prop->getName(),
$prop->isDefault() ? 'declared at compile-time' : 'created at run-time',
var_export(Reflection::getModifierNames($prop->getModifiers()), 1)
);
// Create an instance of Str
$obj= new Str();
// Get current value
printf("---> Value is: ");
var_dump($prop->getValue($obj));
// Change value
$prop->setValue($obj, 10);
printf("---> Setting value to 10, new value is: ");
var_dump($prop->getValue($obj));
// Dump object
var_dump($obj);
?>
```
The above example will output something similar to:
```
===> The public property 'length' (which was declared at compile-time)
having the modifiers array (
0 => 'public',
)
---> Value is: int(5)
---> Setting value to 10, new value is: int(10)
object(Str)#2 (1) {
["length"]=>
int(10)
}
```
**Example #2 Getting value from private and protected properties using [ReflectionProperty](class.reflectionproperty) class**
```
<?php
class Foo {
public $x = 1;
protected $y = 2;
private $z = 3;
}
$obj = new Foo;
$prop = new ReflectionProperty('Foo', 'y');
$prop->setAccessible(true);
var_dump($prop->getValue($obj)); // int(2)
$prop = new ReflectionProperty('Foo', 'z');
$prop->setAccessible(true);
var_dump($prop->getValue($obj)); // int(2)
?>
```
The above example will output something similar to:
```
int(2)
int(3)
```
### See Also
* [ReflectionProperty::getName()](reflectionproperty.getname) - Gets property name
* [Constructors](language.oop5.decon#language.oop5.decon.constructor)
php Imagick::writeImageFile Imagick::writeImageFile
=======================
(PECL imagick 2 >= 2.3.0, PECL imagick 3)
Imagick::writeImageFile — Writes an image to a filehandle
### Description
```
public Imagick::writeImageFile(resource $filehandle, string $format = ?): bool
```
Writes the image sequence to an open filehandle. The handle must be opened with for example fopen. This method is available if Imagick has been compiled against ImageMagick version 6.3.6 or newer.
### Parameters
`filehandle`
Filehandle where to write the image.
`format`
The image format. The list of valid format specifiers depends on the compiled feature set of ImageMagick, and can be queried at runtime via [Imagick::queryFormats()](imagick.queryformats).
### Return Values
Returns **`true`** on success.
### See Also
* [Imagick::queryFormats()](imagick.queryformats) - Returns formats supported by Imagick
php Normalizer::normalize Normalizer::normalize
=====================
normalizer\_normalize
=====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
Normalizer::normalize -- normalizer\_normalize — Normalizes the input provided and returns the normalized string
### Description
Object-oriented style
```
public static Normalizer::normalize(string $string, int $form = Normalizer::FORM_C): string|false
```
Procedural style
```
normalizer_normalize(string $string, int $form = Normalizer::FORM_C): string|false
```
Normalizes the input provided and returns the normalized string
### Parameters
`string`
The input string to normalize
`form`
One of the normalization forms.
### Return Values
The normalized string or **`false`** if an error occurred.
### Examples
**Example #1 **normalizer\_normalize()** example**
```
<?php
$char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5)
$char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A)
$char_1 = normalizer_normalize( $char_A_ring, Normalizer::FORM_C );
$char_2 = normalizer_normalize( 'A' . $char_combining_ring_above, Normalizer::FORM_C );
echo urlencode($char_1);
echo ' ';
echo urlencode($char_2);
?>
```
**Example #2 OO example**
```
<?php
$char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5)
$char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A)
$char_1 = Normalizer::normalize( $char_A_ring, Normalizer::FORM_C );
$char_2 = Normalizer::normalize( 'A' . $char_combining_ring_above, Normalizer::FORM_C );
echo urlencode($char_1);
echo ' ';
echo urlencode($char_2);
?>
```
The above example will output:
```
%C3%85 %C3%85
```
### See Also
* [normalizer\_is\_normalized()](normalizer.isnormalized) - Checks if the provided string is already in the specified normalization form
php svn_client_version svn\_client\_version
====================
(PECL svn >= 0.1.0)
svn\_client\_version — Returns the version of the SVN client libraries
### Description
```
svn_client_version(): string
```
Returns the version of the SVN client libraries
### Parameters
This function has no parameters.
### Return Values
String version number, usually in form of x.y.z.
### Examples
**Example #1 Basic example**
```
<?php
echo svn_client_version();
?>
```
The above example will output something similar to:
```
1.3.1
```
### 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 RarEntry::getMethod RarEntry::getMethod
===================
(PECL rar >= 0.1)
RarEntry::getMethod — Get pack method of the entry
### Description
```
public RarEntry::getMethod(): int
```
**RarEntry::getMethod()** returns number of the method used when adding current archive entry.
### Parameters
This function has no parameters.
### Return Values
Returns the method number or **`false`** on error.
### Examples
**Example #1 **RarEntry::getMethod()** example**
```
<?php
$rar_file = rar_open('example.rar') or die("Failed to open Rar archive");
$entry = rar_entry_get($rar_file, 'Dir/file.txt') or die("Failed to find such entry");
echo "Method number: " . $entry->getMethod();
?>
```
php Parle\RParser::consume Parle\RParser::consume
======================
(PECL parle >= 0.7.0)
Parle\RParser::consume — Consume the data for processing
### Description
```
public Parle\RParser::consume(string $data, Parle\RLexer $rlexer): 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 ArrayIterator::serialize ArrayIterator::serialize
========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
ArrayIterator::serialize — Serialize
### Description
```
public ArrayIterator::serialize(): string
```
Serialize.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
The serialized [ArrayIterator](class.arrayiterator).
### See Also
* [ArrayIterator::unserialize()](arrayiterator.unserialize) - Unserialize
php VarnishAdmin::ban VarnishAdmin::ban
=================
(PECL varnish >= 0.3)
VarnishAdmin::ban — Ban URLs using a VCL expression
### Description
```
public VarnishAdmin::ban(string $vcl_regex): int
```
### Parameters
`vcl_regex`
Varnish VCL expression. It's based on the varnish ban command.
### Return Values
Returns the varnish command status.
php PDO::query PDO::query
==========
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.2.0)
PDO::query — Prepares and executes an SQL statement without placeholders
### Description
```
public PDO::query(string $query, ?int $fetchMode = null): PDOStatement|false
```
```
public PDO::query(string $query, ?int $fetchMode = PDO::FETCH_COLUMN, int $colno): PDOStatement|false
```
```
public PDO::query(
string $query,
?int $fetchMode = PDO::FETCH_CLASS,
string $classname,
array $constructorArgs
): PDOStatement|false
```
```
public PDO::query(string $query, ?int $fetchMode = PDO::FETCH_INTO, object $object): PDOStatement|false
```
**PDO::query()** prepares and executes an SQL statement in a single function call, returning the statement as a [PDOStatement](class.pdostatement) object.
For a query that you need to issue multiple times, you will realize better performance if you prepare a [PDOStatement](class.pdostatement) object using [PDO::prepare()](pdo.prepare) and issue the statement with multiple calls to [PDOStatement::execute()](pdostatement.execute).
If you do not fetch all of the data in a result set before issuing your next call to **PDO::query()**, your call may fail. Call [PDOStatement::closeCursor()](pdostatement.closecursor) to release the database resources associated with the [PDOStatement](class.pdostatement) object before issuing your next call to **PDO::query()**.
>
> **Note**:
>
>
> If the `query` contains placeholders, the statement must be prepared and executed separately using [PDO::prepare()](pdo.prepare) and [PDOStatement::execute()](pdostatement.execute) methods.
>
>
### Parameters
`query`
The SQL statement to prepare and execute.
If the SQL contains placeholders, [PDO::prepare()](pdo.prepare) and [PDOStatement::execute()](pdostatement.execute) must be used instead. Alternatively, the SQL can be prepared manually before calling **PDO::query()**, with the data properly formatted using [PDO::quote()](pdo.quote) if the driver supports it.
`fetchMode`
The default fetch mode for the returned [PDOStatement](class.pdostatement). It must be one of the [`PDO::FETCH_*`](https://www.php.net/manual/en/pdo.constants.php) constants.
If this argument is passed to the function, the remaining arguments will be treated as though [PDOStatement::setFetchMode()](pdostatement.setfetchmode) was called on the resultant statement object. The subsequent arguments vary depending on the selected fetch mode.
### Return Values
Returns a [PDOStatement](class.pdostatement) object or **`false`** on failure.
### Examples
**Example #1 SQL with no placeholders can be executed using **PDO::query()****
```
<?php
$sql = 'SELECT name, color, calories FROM fruit ORDER BY name';
foreach ($conn->query($sql) as $row) {
print $row['name'] . "\t";
print $row['color'] . "\t";
print $row['calories'] . "\n";
}
?>
```
The above example will output:
```
apple red 150
banana yellow 250
kiwi brown 75
lemon yellow 25
orange orange 300
pear green 150
watermelon pink 90
```
### See Also
* [PDO::exec()](pdo.exec) - Execute an SQL statement and return the number of affected rows
* [PDO::prepare()](pdo.prepare) - Prepares a statement for execution and returns a statement object
* [PDOStatement::execute()](pdostatement.execute) - Executes a prepared statement
php ReflectionFunctionAbstract::getParameters ReflectionFunctionAbstract::getParameters
=========================================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
ReflectionFunctionAbstract::getParameters — Gets parameters
### Description
```
public ReflectionFunctionAbstract::getParameters(): array
```
Get the parameters as an array of [ReflectionParameter](class.reflectionparameter), in the order in which they are defined in the source.
### Parameters
This function has no parameters.
### Return Values
The parameters, as a [ReflectionParameter](class.reflectionparameter) object.
### See Also
* [ReflectionFunctionAbstract::getNumberOfParameters()](reflectionfunctionabstract.getnumberofparameters) - Gets number of parameters
* [func\_get\_args()](function.func-get-args) - Returns an array comprising a function's argument list
php pg_flush pg\_flush
=========
(PHP 5 >= 5.6.0, PHP 7, PHP 8)
pg\_flush — Flush outbound query data on the connection
### Description
```
pg_flush(PgSql\Connection $connection): int|bool
```
**pg\_flush()** flushes any outbound query data waiting to be sent on the connection.
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance.
### Return Values
Returns **`true`** if the flush was successful or no data was waiting to be flushed, `0` if part of the pending data was flushed but more remains 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. |
php Componere\Patch::derive Componere\Patch::derive
=======================
(Componere 2 >= 2.1.1)
Componere\Patch::derive — Patch Derivation
### Description
```
public Componere\Patch::derive(object $instance): Patch
```
Shall derive a Patch for the given `instance`
### Parameters
`instance`
The target for the derived Patch
### Return Values
Patch for `instance` derived from the current Patch
### Exceptions
**Warning** Shall throw [InvalidArgumentException](class.invalidargumentexception) if `instance` is not compatible
php is_numeric is\_numeric
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
is\_numeric — Finds whether a variable is a number or a numeric string
### Description
```
is_numeric(mixed $value): bool
```
Determines if the given variable is a number or a [numeric string](language.types.numeric-strings).
### Parameters
`value`
The variable being evaluated.
### Return Values
Returns **`true`** if `value` is a number or a [numeric string](language.types.numeric-strings), **`false`** otherwise.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Numeric strings ending with whitespace (`"42 "`) will now return **`true`**. Previously, **`false`** was return instead. |
### Examples
**Example #1 **is\_numeric()** examples**
```
<?php
$tests = array(
"42",
1337,
0x539,
02471,
0b10100111001,
1337e0,
"0x539",
"02471",
"0b10100111001",
"1337e0",
"not numeric",
array(),
9.1,
null,
'',
);
foreach ($tests as $element) {
if (is_numeric($element)) {
echo var_export($element, true) . " is numeric", PHP_EOL;
} else {
echo var_export($element, true) . " is NOT numeric", PHP_EOL;
}
}
?>
```
The above example will output:
```
'42' is numeric
1337 is numeric
1337 is numeric
1337 is numeric
1337 is numeric
1337.0 is numeric
'0x539' is NOT numeric
'02471' is numeric
'0b10100111001' is NOT numeric
'1337e0' is numeric
'not numeric' is NOT numeric
array (
) is NOT numeric
9.1 is numeric
NULL is NOT numeric
'' is NOT numeric
```
**Example #2 **is\_numeric()** with whitespace**
```
<?php
$tests = [
" 42",
"42 ",
"\u{A0}9001", // non-breaking space
"9001\u{A0}", // non-breaking space
];
foreach ($tests as $element) {
if (is_numeric($element)) {
echo var_export($element, true) . " is numeric", PHP_EOL;
} else {
echo var_export($element, true) . " is NOT numeric", PHP_EOL;
}
}
?>
```
Output of the above example in PHP 8:
```
' 42' is numeric
'42 ' is numeric
' 9001' is NOT numeric
'9001 ' is NOT numeric
```
Output of the above example in PHP 7:
```
' 42' is numeric
'42 ' is NOT numeric
' 9001' is NOT numeric
'9001 ' is NOT numeric
```
### See Also
* [Numeric strings](language.types.numeric-strings)
* [ctype\_digit()](function.ctype-digit) - Check for numeric character(s)
* [is\_bool()](function.is-bool) - Finds out whether a variable is a boolean
* [is\_null()](function.is-null) - Finds whether a variable is null
* [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
* [filter\_var()](function.filter-var) - Filters a variable with a specified filter
| programming_docs |
php PharFileInfo::hasMetadata PharFileInfo::hasMetadata
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.2.0)
PharFileInfo::hasMetadata — Returns the metadata of the entry
### Description
```
public PharFileInfo::hasMetadata(): bool
```
Returns the metadata of a file within a phar archive.
### Parameters
No parameters.
### Return Values
Returns **`false`** if no metadata is set or is **`null`**, **`true`** if metadata is not **`null`**
### See Also
* [PharFileInfo::setMetadata()](pharfileinfo.setmetadata) - Sets file-specific meta-data saved with a file
* [PharFileInfo::getMetadata()](pharfileinfo.getmetadata) - Returns file-specific meta-data saved with a file
* [PharFileInfo::delMetadata()](pharfileinfo.delmetadata) - Deletes the metadata of the entry
* [Phar::setMetadata()](phar.setmetadata) - Sets phar archive meta-data
* [Phar::hasMetadata()](phar.hasmetadata) - Returns whether phar has global meta-data
* [Phar::getMetadata()](phar.getmetadata) - Returns phar archive meta-data
php GearmanWorker::addServer GearmanWorker::addServer
========================
(PECL gearman >= 0.5.0)
GearmanWorker::addServer — Add a job server
### Description
```
public GearmanWorker::addServer(string $host = 127.0.0.1, int $port = 4730): bool
```
Adds a job server to this worker. This goes into a list of servers than can be used to run jobs. No socket I/O happens here.
### Parameters
`host`
The job server host name.
`port`
The job server port.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Add alternate Gearman servers**
```
<?php
$worker= new GearmanWorker();
$worker->addServer("10.0.0.1");
$worker->addServer("10.0.0.2", 7003);
?>
```
### See Also
* [GearmanWorker::addServers()](gearmanworker.addservers) - Add job servers
php ImagickDraw::pushPattern ImagickDraw::pushPattern
========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::pushPattern — Indicates that subsequent commands up to a ImagickDraw::opPattern() command comprise the definition of a named pattern
### Description
```
public ImagickDraw::pushPattern(
string $pattern_id,
float $x,
float $y,
float $width,
float $height
): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Indicates that subsequent commands up to a DrawPopPattern() command comprise the definition of a named pattern. The pattern space is assigned top left corner coordinates, a width and height, and becomes its own drawing space. Anything which can be drawn may be used in a pattern definition. Named patterns may be used as stroke or brush definitions.
### Parameters
`pattern_id`
the pattern Id
`x`
x coordinate of the top-left corner
`y`
y coordinate of the top-left corner
`width`
width of the pattern
`height`
height of the pattern
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **ImagickDraw::pushPattern()** example**
```
<?php
function pushPattern($strokeColor, $fillColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(1);
$draw->setStrokeOpacity(1);
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(1);
$draw->pushPattern("MyFirstPattern", 0, 0, 50, 50);
for ($x = 0; $x < 50; $x += 10) {
for ($y = 0; $y < 50; $y += 5) {
$positionX = $x + (($y / 5) % 5);
$draw->rectangle($positionX, $y, $positionX + 5, $y + 5);
}
}
$draw->popPattern();
$draw->setFillOpacity(0);
$draw->rectangle(100, 100, 400, 400);
$draw->setFillOpacity(1);
$draw->setFillOpacity(1);
$draw->push();
$draw->setFillPatternURL('#MyFirstPattern');
$draw->setFillColor('yellow');
$draw->rectangle(100, 100, 400, 400);
$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 svn_fs_txn_root svn\_fs\_txn\_root
==================
(PECL svn >= 0.2.0)
svn\_fs\_txn\_root — Creates and returns a transaction root
### Description
```
svn_fs_txn_root(resource $txn): resource
```
**Warning**This function is currently not documented; only its argument list is available.
Creates and returns a transaction root
### 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 Imagick::destroy Imagick::destroy
================
(PECL imagick 2, PECL imagick 3)
Imagick::destroy — Destroys the Imagick object
### Description
```
public Imagick::destroy(): bool
```
Destroys the Imagick object and frees all resources associated with it. This method is deprecated in favour of [Imagick::clear](imagick.clear).
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success.
php uopz_set_static uopz\_set\_static
=================
(PECL uopz 5, PECL uopz , PECL uopz 7)
uopz\_set\_static — Sets the static variables in function or method scope
### Description
```
uopz_set_static(string $function, array $static): void
```
```
uopz_set_static(string $class, string $function, array $static): void
```
Sets the static variables in function or method scope.
### Parameters
`class`
The name of the class.
`function`
The name of the function or method.
`static`
The associative array of variable names mapped to their values.
### Return Values
No value is returned.
### Examples
**Example #1 Basic **uopz\_set\_static()** Usage**
```
<?php
function foo() {
static $bar = 'baz';
var_dump($bar);
}
uopz_set_static('foo', ['bar' => 'qux']);
foo();
?>
```
The above example will output:
```
string(3) "qux"
```
### See Also
* [uopz\_get\_static()](function.uopz-get-static) - Gets the static variables from function or method scope
php checkdnsrr checkdnsrr
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
checkdnsrr — Check DNS records corresponding to a given Internet host name or IP address
### Description
```
checkdnsrr(string $hostname, string $type = "MX"): bool
```
Searches DNS for records of type `type` corresponding to `hostname`.
### Parameters
`hostname`
`hostname` may either be the IP address in dotted-quad notation or the host name.
`type`
`type` may be any one of: A, MX, NS, SOA, PTR, CNAME, AAAA, A6, SRV, NAPTR, TXT or ANY.
### Return Values
Returns **`true`** if any records are found; returns **`false`** if no records were found or if an error occurred.
### Notes
>
> **Note**:
>
>
> For compatibility with Windows before this was implemented, then try the [» PEAR](https://pear.php.net/) class [» Net\_DNS](https://pear.php.net/package/Net_DNS).
>
>
### See Also
* [dns\_get\_record()](function.dns-get-record) - Fetch DNS Resource Records associated with a hostname
* [getmxrr()](function.getmxrr) - Get MX records corresponding to a given Internet host name
* [gethostbyaddr()](function.gethostbyaddr) - Get the Internet host name corresponding to a given IP address
* [gethostbyname()](function.gethostbyname) - Get the IPv4 address corresponding to a given Internet host name
* [gethostbynamel()](function.gethostbynamel) - Get a list of IPv4 addresses corresponding to a given Internet host name
* the named(8) manual page
php UConverter::__construct UConverter::\_\_construct
=========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
UConverter::\_\_construct — Create UConverter object
### Description
public **UConverter::\_\_construct**(?string `$destination_encoding` = **`null`**, ?string `$source_encoding` = **`null`**)
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`destination_encoding`
`source_encoding`
### Return Values
php ob_tidyhandler ob\_tidyhandler
===============
(PHP 5, PHP 7, PHP 8)
ob\_tidyhandler — ob\_start callback function to repair the buffer
### Description
```
ob_tidyhandler(string $input, int $mode = ?): string
```
Callback function for [ob\_start()](function.ob-start) to repair the buffer.
### Parameters
`input`
The buffer.
`mode`
The buffer mode.
### Return Values
Returns the modified buffer.
### Examples
**Example #1 **ob\_tidyhandler()** example**
```
<?php
ob_start('ob_tidyhandler');
echo '<p>test</i>';
?>
```
The above example will output:
```
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title></title>
</head>
<body>
<p>test</p>
</body>
</html>
```
### See Also
* [ob\_start()](function.ob-start) - Turn on output buffering
php None Differences from objects
------------------------
Although Enums are built on classes and objects, they do not support all object-related functionality. In particular, Enum cases are forbidden from having state.
* Constructors and Destructors are forbidden.
* Inheritance is not supported. Enums may not extend or be extended.
* Static or object properties are not allowed.
* Cloning an Enum case is not supported, as cases must be singleton instances.
* [Magic methods](language.oop5.magic), except for those listed below, are disallowed.
* Enums must always be declared before they are used.
The following object functionality is available, and behaves just as it does on any other object:
* Public, private, and protected methods.
* Public, private, and protected static methods.
* Public, private, and protected constants.
* Enums may implement any number of interfaces.
* Enums and cases may have [attributes](https://www.php.net/manual/en/language.attributes.php) attached to them. The **`TARGET_CLASS`** target filter includes Enums themselves. The **`TARGET_CLASS_CONST`** target filter includes Enum Cases.
* [\_\_call](language.oop5.overloading#object.call), [\_\_callStatic](language.oop5.overloading#object.callstatic), and [\_\_invoke](language.oop5.magic#object.invoke) magic methods
* **`__CLASS__`** and **`__FUNCTION__`** constants behave as normal
The `::class` magic constant on an Enum type evaluates to the type name including any namespace, exactly the same as an object. The `::class` magic constant on a Case instance also evaluates to the Enum type, as it is an instance of that type.
Additionally, enum cases may not be instantiated directly with `new`, nor with [ReflectionClass::newInstanceWithoutConstructor()](reflectionclass.newinstancewithoutconstructor) in reflection. Both will result in an error.
```
<?php
$clovers = new Suit();
// Error: Cannot instantiate enum Suit
$horseshoes = (new ReflectionClass(Suit::class))->newInstanceWithoutConstructor()
// Error: Cannot instantiate enum Suit
?>
```
php Ds\Map::diff Ds\Map::diff
============
(PECL ds >= 1.0.0)
Ds\Map::diff — Creates a new map using keys that aren't in another map
### Description
```
public Ds\Map::diff(Ds\Map $map): Ds\Map
```
Returns the result of removing all keys from the current instance that are present in a given `map`.
`A \ B = {x ∈ A | x ∉ B}`
### Parameters
`map`
The map containing the keys to exclude in the resulting map.
### Return Values
The result of removing all keys from the current instance that are present in a given `map`.
### See Also
* [» Complement](https://en.wikipedia.org/wiki/Complement_(set_theory)) on Wikipedia
### Examples
**Example #1 **Ds\Map::diff()** 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->diff($b));
?>
```
The above example will output something similar to:
```
object(Ds\Map)#3 (1) {
[0]=>
object(Ds\Pair)#4 (2) {
["key"]=>
string(1) "a"
["value"]=>
int(1)
}
}
```
php Imagick::stripImage Imagick::stripImage
===================
(PECL imagick 2, PECL imagick 3)
Imagick::stripImage — Strips an image of all profiles and comments
### Description
```
public Imagick::stripImage(): bool
```
Strips an image of all profiles and comments.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
php Closure::fromCallable Closure::fromCallable
=====================
(PHP 7 >= 7.1.0)
Closure::fromCallable — Converts a callable into a closure
### Description
```
public static Closure::fromCallable(callable $callback): Closure
```
Create and return a new [anonymous function](functions.anonymous) from given `callback` using the current scope. This method checks if the `callback` is callable in the current scope and throws a [TypeError](class.typeerror) if it is not.
>
> **Note**:
>
>
> As of PHP 8.1.0, [First class callable syntax](functions.first_class_callable_syntax) has the same semantics as this method.
>
>
### Parameters
`callback`
The callable to convert.
### Return Values
Returns the newly created [Closure](class.closure) or throws a [TypeError](class.typeerror) if the `callback` is not callable in the current scope.
### See Also
* [Anonymous functions](functions.anonymous)
* [First class callable syntax](functions.first_class_callable_syntax)
php Ds\Deque::find Ds\Deque::find
==============
(PECL ds >= 1.0.0)
Ds\Deque::find — Attempts to find a value's index
### Description
```
public Ds\Deque::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\Deque::find()** example**
```
<?php
$deque = new \Ds\Deque(["a", 1, true]);
var_dump($deque->find("a")); // 0
var_dump($deque->find("b")); // false
var_dump($deque->find("1")); // false
var_dump($deque->find(1)); // 1
?>
```
The above example will output something similar to:
```
int(0)
bool(false)
bool(false)
int(1)
```
php socket_get_status socket\_get\_status
===================
(PHP 4, PHP 5, PHP 7, PHP 8)
socket\_get\_status — Alias of [stream\_get\_meta\_data()](function.stream-get-meta-data)
### Description
This function is an alias of: [stream\_get\_meta\_data()](function.stream-get-meta-data).
php Yaf_Dispatcher::getDefaultAction Yaf\_Dispatcher::getDefaultAction
=================================
(Yaf >=3.2.0)
Yaf\_Dispatcher::getDefaultAction — Retrive the default action name
### Description
```
public Yaf_Dispatcher::getDefaultAction(): string
```
get the default action name
### Parameters
This function has no parameters.
### Return Values
string, default action name, default is "index"
php gmp_init gmp\_init
=========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_init — Create GMP number
### Description
```
gmp_init(int|string $num, int $base = 0): GMP
```
Creates a GMP number from an integer or string.
### Parameters
`num`
An integer or a string. The string representation can be decimal, hexadecimal or octal.
`base`
The base.
The base may vary from 2 to 62. If base is 0 (default value), the actual base is determined from the leading characters: if the first two characters are `0x` or `0X`, hexadecimal is assumed, if the first two characters are `0b` or `0B`, binary is assumed, otherwise if the first character is `0`, octal is assumed, otherwise decimal is assumed. For bases up to 36, case is ignored; upper-case and lower-case letters have the same value. For bases 37 to 62, upper-case letter represent the usual 10 to 35 while lower-case letter represent 36 to 61.
### Return Values
A [GMP](class.gmp) object.
### Examples
**Example #1 Creating GMP number**
```
<?php
$a = gmp_init(123456);
$b = gmp_init("0xFFFFDEBACDFEDF7200");
?>
```
### Notes
>
> **Note**:
>
>
> It is not necessary to call this function in order to use integers or strings in place of GMP numbers in GMP functions (such as with [gmp\_add()](function.gmp-add)). Function arguments are automatically converted to GMP numbers, if such conversion is possible and needed, using the same rules as **gmp\_init()**.
>
>
php Yaf_Request_Abstract::setControllerName Yaf\_Request\_Abstract::setControllerName
=========================================
(Yaf >=1.0.0)
Yaf\_Request\_Abstract::setControllerName — Set controller name
### Description
```
public Yaf_Request_Abstract::setControllerName(string $controller, bool $format_name = true): void
```
set controller name to request, this is usually used by custom router to set route result controller name.
### Parameters
`controller`
string, controller name, this should be in camel style, like "Index" or "Foo\_Bar"
`format_name`
this is introduced in Yaf 3.2.0, by default Yaf will format the name into camel mode, if this is set to **`false`** , Yaf will set the original name to request.
### Return Values
php EmptyIterator::current EmptyIterator::current
======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
EmptyIterator::current — The current() method
### Description
```
public EmptyIterator::current(): never
```
This function must not be called. It throws an exception upon access.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Errors/Exceptions
Throws an [Exception](class.exception) if called.
### Return Values
No value is returned.
php mysqli::options mysqli::options
===============
mysqli\_options
===============
(PHP 5, PHP 7, PHP 8)
mysqli::options -- mysqli\_options — Set options
### Description
Object-oriented style
```
public mysqli::options(int $option, string|int $value): bool
```
Procedural style
```
mysqli_options(mysqli $mysql, int $option, string|int $value): bool
```
Used to set extra connect options and affect behavior for a connection.
This function may be called multiple times to set several options.
**mysqli\_options()** should be called after [mysqli\_init()](mysqli.init) and before [mysqli\_real\_connect()](mysqli.real-connect).
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
`option`
The option that you want to set. It can be one of the following values:
**Valid options**| Name | Description |
| --- | --- |
| **`MYSQLI_OPT_CONNECT_TIMEOUT`** | Connection timeout in seconds |
| **`MYSQLI_OPT_READ_TIMEOUT`** | Command execution result timeout in seconds. Available as of PHP 7.2.0. |
| **`MYSQLI_OPT_LOCAL_INFILE`** | Enable/disable use of `LOAD LOCAL INFILE` |
| **`MYSQLI_INIT_COMMAND`** | Command to execute after when connecting to MySQL server |
| **`MYSQLI_SET_CHARSET_NAME`** | The charset to be set as default. |
| **`MYSQLI_READ_DEFAULT_FILE`** | Read options from named option file instead of my.cnf Not supported by mysqlnd. |
| **`MYSQLI_READ_DEFAULT_GROUP`** | Read options from the named group from my.cnf or the file specified with **`MYSQL_READ_DEFAULT_FILE`**. Not supported by mysqlnd. |
| **`MYSQLI_SERVER_PUBLIC_KEY`** | RSA public key file used with the SHA-256 based authentication. |
| **`MYSQLI_OPT_NET_CMD_BUFFER_SIZE`** | The size of the internal command/network buffer. Only valid for mysqlnd. |
| **`MYSQLI_OPT_NET_READ_BUFFER_SIZE`** | Maximum read chunk size in bytes when reading the body of a MySQL command packet. Only valid for mysqlnd. |
| **`MYSQLI_OPT_INT_AND_FLOAT_NATIVE`** | Convert integer and float columns back to PHP numbers. Only valid for mysqlnd. |
| **`MYSQLI_OPT_SSL_VERIFY_SERVER_CERT`** | Whether to verify server certificate or not. |
`value`
The value for the option.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
See [mysqli\_real\_connect()](mysqli.real-connect).
### 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()** prior to calling [mysqli\_real\_connect()](mysqli.real-connect), but after [mysqli\_init()](mysqli.init).
>
>
>
### See Also
* [mysqli\_init()](mysqli.init) - Initializes MySQLi and returns an object for use with mysqli\_real\_connect()
* [mysqli\_real\_connect()](mysqli.real-connect) - Opens a connection to a mysql server
| programming_docs |
php Yaf_Route_Regex::__construct Yaf\_Route\_Regex::\_\_construct
================================
(Yaf >=1.0.0)
Yaf\_Route\_Regex::\_\_construct — Yaf\_Route\_Regex constructor
### Description
public **Yaf\_Route\_Regex::\_\_construct**(
string `$match`,
array `$route`,
array `$map` = ?,
array `$verify` = ?,
string `$reverse` = ?
) ### Parameters
`match`
A complete Regex pattern, will be used to match a request uri, if doesn't matched, [Yaf\_Route\_Regex](class.yaf-route-regex) will return **`false`**.
`route`
When the match pattern matches the request uri, [Yaf\_Route\_Regex](class.yaf-route-regex) will use this to decide which m/c/a to routed.
either of m/c/a in this array is optianl, if you don't assgian a specific value, it will be routed to default.
`map`
A array to assign name to the captrues in the match result.
`verify`
`reverse`
a string, used to assemble url, see [Yaf\_Route\_Regex::assemble()](yaf-route-regex.assemble).
>
> **Note**:
>
>
> this parameter is introduced in 2.3.0
>
>
### Return Values
### Examples
**Example #1 **Yaf\_Route\_Regex()**example**
```
<?php
/**
* Add a regex route to Yaf_Router route stack
*/
Yaf_Dispatcher::getInstance()->getRouter()->addRoute("name",
new Yaf_Route_Regex(
"#^/product/([^/]+)/([^/])+#", //match request uri leading "/product"
array(
'controller' => "product", //route to product controller,
),
array(
1 => "name", // now you can call $request->getParam("name")
2 => "id", // to get the first captrue in the match pattern.
)
)
);
?>
```
**Example #2 **Yaf\_Route\_Regex(as of 2.3.0)()**example**
```
<?php
/**
* Use match result as MVC name
*/
Yaf_Dispatcher::getInstance()->getRouter()->addRoute("name",
new Yaf_Route_Regex(
"#^/product/([^/]+)/([^/])+#i", //match request uri leading "/product"
array(
'controller' => ":name", // route to :name, which is $1 in the match result as controller name
),
array(
1 => "name", // now you can call $request->getParam("name")
2 => "id", // to get the first captrue in the match pattern.
)
)
);
?>
```
**Example #3 **Yaf\_Route\_Regex and named capture ground(as of 2.3.0)()**example**
```
<?php
/**
* Use match result as MVC name
*/
Yaf_Dispatcher::getInstance()->getRouter()->addRoute("name",
new Yaf_Route_Regex(
"#^/product/(?<name>[^/]+)/([^/])+#i", //match request uri leading "/product"
array(
'controller' => ":name", // route to :name,
// which is named capture group 'name' in the match result as controller name
),
array(
2 => "id", // to get the first captrue in the match pattern.
)
)
);
?>
```
**Example #4 **Yaf\_Route\_Regex()**example**
```
<?php
/**
* Add a regex route to Yaf_Router route stack by calling addconfig
*/
$config = array(
"name" => array(
"type" => "regex", //Yaf_Route_Regex route
"match" => "#(.*)#", //match arbitrary request uri
"route" => array(
'controller' => "product", //route to product controller,
'action' => "dummy", //route to dummy action
),
"map" => array(
1 => "uri", // now you can call $request->getParam("uri")
),
),
);
Yaf_Dispatcher::getInstance()->getRouter()->addConfig(
new Yaf_Config_Simple($config));
?>
```
### 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\_Rewrite](class.yaf-route-rewrite)
* [Yaf\_Route\_Map](class.yaf-route-map)
php EventDnsBase::parseResolvConf EventDnsBase::parseResolvConf
=============================
(PECL event >= 1.2.6-beta)
EventDnsBase::parseResolvConf — Scans the resolv.conf-formatted file
### Description
```
public EventDnsBase::parseResolvConf( int $flags , string $filename ): bool
```
Scans the resolv.conf-formatted file stored in filename, and read in all the options from it that are listed in flags
### Parameters
`flags` Determines what information is parsed from the `resolv.conf` file. See the man page for `resolv.conf` for the format of this file.
The following directives are not parsed from the file: `sortlist, rotate, no-check-names, inet6, debug` .
If this function encounters an error, the possible return values are:
* **`1`** = failed to open file
* **`2`** = failed to stat file
* **`3`** = file too large
* **`4`** = out of memory
* **`5`** = short read from file
* **`6`** = no nameservers listed in the file
`filename` Path to `resolv.conf` file.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php openssl_private_decrypt openssl\_private\_decrypt
=========================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
openssl\_private\_decrypt — Decrypts data with private key
### Description
```
openssl_private_decrypt(
string $data,
string &$decrypted_data,
OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key,
int $padding = OPENSSL_PKCS1_PADDING
): bool
```
**openssl\_private\_decrypt()** decrypts `data` that was previously encrypted via [openssl\_public\_encrypt()](function.openssl-public-encrypt) and stores the result into `decrypted_data`.
You can use this function e.g. to decrypt data which is supposed to only be available to you.
### Parameters
`data`
`decrypted_data`
`private_key`
`private_key` must be the private key corresponding that was used to encrypt the data.
`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 | `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 xmlrpc_server_add_introspection_data xmlrpc\_server\_add\_introspection\_data
========================================
(PHP 4 >= 4.1.0, PHP 5, PHP 7)
xmlrpc\_server\_add\_introspection\_data — Adds introspection documentation
### Description
```
xmlrpc_server_add_introspection_data(resource $server, array $desc): 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.
**Warning**This function is currently not documented; only its argument list is available.
php Imagick::setImageGamma Imagick::setImageGamma
======================
(PECL imagick 2, PECL imagick 3)
Imagick::setImageGamma — Sets the image gamma
### Description
```
public Imagick::setImageGamma(float $gamma): bool
```
Sets the image gamma.
### Parameters
`gamma`
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
php ZipArchive::addGlob ZipArchive::addGlob
===================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL zip >= 1.9.0)
ZipArchive::addGlob — Add files from a directory by glob pattern
### Description
```
public ZipArchive::addGlob(string $pattern, int $flags = 0, array $options = []): array|false
```
Add files from a directory which match the glob `pattern`.
> **Note**: For maximum portability, it is recommended to always use forward slashes (`/`) as directory separator in ZIP filenames.
>
>
### Parameters
`pattern`
A [glob()](function.glob) pattern against which files will be matched.
`flags`
A bit mask of `glob()` flags.
`options`
An associative array of options. Available options are:
* `"add_path"`
Prefix to prepend when translating to the local path of the file within the archive. This is applied after any remove operations defined by the `"remove_path"` or `"remove_all_path"` options.
* `"remove_path"`
Prefix to remove from matching file paths before adding to the archive.
* `"remove_all_path"`
**`true`** to use the file name only and add to the root of the archive.
* `"flags"`
Bitmask consisting of **`ZipArchive::FL_OVERWRITE`**, **`ZipArchive::FL_ENC_GUESS`**, **`ZipArchive::FL_ENC_UTF_8`**, **`ZipArchive::FL_ENC_CP437`**. The behaviour of these constants is described on the [ZIP constants](https://www.php.net/manual/en/zip.constants.php) page.
* `"comp_method"`
Compression method, one of the **`ZipArchive::CM_*`** constants, see [ZIP constants](https://www.php.net/manual/en/zip.constants.php) page.
* `"comp_flags"`
Compression level.
* `"enc_method"`
Encryption method, one of the **`ZipArchive::EM_*`** constants, see [ZIP constants](https://www.php.net/manual/en/zip.constants.php) page.
* `"enc_password"`
Password used for encryption.
### Return Values
An array of added files on success or **`false`** on failure
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 / 1.18.0 | `"flags"` in `options` was added. |
| 8.0.0 / 1.18.1 | `"comp_method"`, `"comp_flags"`, `"enc_method"` and `"enc_password"` in `options` were added. |
### Examples
**Example #1 **ZipArchive::addGlob()** example**
Add all php scripts and text files from current working directory
```
<?php
$zip = new ZipArchive();
$ret = $zip->open('application.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE);
if ($ret !== TRUE) {
printf('Failed with code %d', $ret);
} else {
$options = array('add_path' => 'sources/', 'remove_all_path' => TRUE);
$zip->addGlob('*.{php,txt}', GLOB_BRACE, $options);
$zip->close();
}
?>
```
### See Also
* [ZipArchive::addFile()](ziparchive.addfile) - Adds a file to a ZIP archive from the given path
* [ZipArchive::addPattern()](ziparchive.addpattern) - Add files from a directory by PCRE pattern
php EventBuffer::add EventBuffer::add
================
(PECL event >= 1.2.6-beta)
EventBuffer::add — Append data to the end of an event buffer
### Description
```
public EventBuffer::add( string $data ): bool
```
Append data to the end of an event buffer.
### Parameters
`data` String to be appended to the end of the buffer.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [EventBuffer::addBuffer()](eventbuffer.addbuffer) - Move all data from a buffer provided to the current instance of EventBuffer
php Imagick::setImageMatte Imagick::setImageMatte
======================
(PECL imagick 2, PECL imagick 3)
Imagick::setImageMatte — Sets the image matte channel
### Description
```
public Imagick::setImageMatte(bool $matte): bool
```
Sets the image matte channel. This method is available if Imagick has been compiled against ImageMagick version 6.2.9 or newer.
### Parameters
`matte`
True activates the matte channel and false disables it.
### Return Values
Returns **`true`** on success.
php gmp_powm gmp\_powm
=========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_powm — Raise number into power with modulo
### Description
```
gmp_powm(GMP|int|string $num, GMP|int|string $exponent, GMP|int|string $modulus): GMP
```
Calculate (`num` raised into power `exponent`) modulo `modulus`. If `exponent` is negative, result is undefined.
### Parameters
`num`
The base number.
A [GMP](class.gmp) object, an int or a numeric string.
`exponent`
The positive power to raise the `num`.
A [GMP](class.gmp) object, an int or a numeric string.
`modulus`
The modulo.
A [GMP](class.gmp) object, an int or a numeric string.
### Return Values
The new (raised) number, as a GMP number.
### Examples
**Example #1 **gmp\_powm()** example**
```
<?php
$pow1 = gmp_powm("2", "31", "2147483649");
echo gmp_strval($pow1) . "\n";
?>
```
The above example will output:
```
2147483648
```
php odbc_next_result odbc\_next\_result
==================
(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)
odbc\_next\_result — Checks if multiple results are available
### Description
```
odbc_next_result(resource $statement): bool
```
Checks if there are more result sets available as well as allowing access to the next result set via [odbc\_fetch\_array()](function.odbc-fetch-array), [odbc\_fetch\_row()](function.odbc-fetch-row), [odbc\_result()](function.odbc-result), etc.
### Parameters
`statement`
The result identifier.
### Return Values
Returns **`true`** if there are more result sets, **`false`** otherwise.
### Examples
**Example #1 **odbc\_next\_result()****
```
<?php
$r_Connection = odbc_connect($dsn, $username, $password);
$s_SQL = <<<END_SQL
SELECT 'A'
SELECT 'B'
SELECT 'C'
END_SQL;
$r_Results = odbc_exec($r_Connection, $s_SQL);
$a_Row1 = odbc_fetch_array($r_Results);
$a_Row2 = odbc_fetch_array($r_Results);
echo "Dump first result set";
var_dump($a_Row1, $a_Row2);
echo "Get second results set ";
var_dump(odbc_next_result($r_Results));
$a_Row1 = odbc_fetch_array($r_Results);
$a_Row2 = odbc_fetch_array($r_Results);
echo "Dump second result set ";
var_dump($a_Row1, $a_Row2);
echo "Get third results set ";
var_dump(odbc_next_result($r_Results));
$a_Row1 = odbc_fetch_array($r_Results);
$a_Row2 = odbc_fetch_array($r_Results);
echo "Dump third result set ";
var_dump($a_Row1, $a_Row2);
echo "Try for a fourth result set ";
var_dump(odbc_next_result($r_Results));
?>
```
The above example will output:
```
Dump first result set array(1) {
["A"]=>
string(1) "A"
}
bool(false)
Get second results set bool(true)
Dump second result set array(1) {
["B"]=>
string(1) "B"
}
bool(false)
Get third results set bool(true)
Dump third result set array(1) {
["C"]=>
string(1) "C"
}
bool(false)
Try for a fourth result set bool(false)
```
php ArrayIterator::next ArrayIterator::next
===================
(PHP 5, PHP 7, PHP 8)
ArrayIterator::next — Move to next entry
### Description
```
public ArrayIterator::next(): void
```
The iterator to the next entry.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Examples
**Example #1 **ArrayIterator::next()** example**
```
<?php
$arrayobject = new ArrayObject();
$arrayobject[] = 'zero';
$arrayobject[] = 'one';
$iterator = $arrayobject->getIterator();
while($iterator->valid()) {
echo $iterator->key() . ' => ' . $iterator->current() . "\n";
$iterator->next();
}
?>
```
The above example will output:
```
0 => zero
1 => one
```
php tidy::getHtmlVer tidy::getHtmlVer
================
tidy\_get\_html\_ver
====================
(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.5.2)
tidy::getHtmlVer -- tidy\_get\_html\_ver — Get the Detected HTML version for the specified document
### Description
Object-oriented style
```
public tidy::getHtmlVer(): int
```
Procedural style
```
tidy_get_html_ver(tidy $tidy): int
```
Returns the detected HTML version for the specified tidy `tidy`.
### Parameters
`tidy`
The [Tidy](class.tidy) object.
### Return Values
Returns the detected HTML version.
**Warning** This function is not yet implemented in the Tidylib itself, so it always return `0`.
php RecursiveIteratorIterator::key RecursiveIteratorIterator::key
==============================
(PHP 5, PHP 7, PHP 8)
RecursiveIteratorIterator::key — Access the current key
### Description
```
public RecursiveIteratorIterator::key(): mixed
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
The current key.
php $_ENV $\_ENV
======
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
$\_ENV — Environment variables
### Description
An associative array of variables passed to the current script via the environment method.
These variables are imported into PHP's global namespace from the environment under which the PHP parser is running. Many are provided by the shell under which PHP is running and different systems are likely running different kinds of shells, a definitive list is impossible. Please see your shell's documentation for a list of defined environment variables.
Other environment variables include the CGI variables, placed there regardless of whether PHP is running as a server module or CGI processor.
### Examples
**Example #1 $\_ENV example**
```
<?php
echo 'My username is ' .$_ENV["USER"] . '!';
?>
```
Assuming "bjori" executes this script
The above example will output something similar to:
```
My username is bjori!
```
### 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
* [getenv()](function.getenv) - Gets the value of an environment variable
* [The filter extension](https://www.php.net/manual/en/book.filter.php)
php mhash_get_hash_name mhash\_get\_hash\_name
======================
(PHP 4, PHP 5, PHP 7, PHP 8)
mhash\_get\_hash\_name — Gets the name of the specified hash
**Warning**This function has been *DEPRECATED* as of PHP 8.1.0. Relying on this function is highly discouraged.
### Description
```
mhash_get_hash_name(int $algo): string|false
```
Gets the name of the specified `algo`.
### Parameters
`algo`
The hash ID. One of the **`MHASH_hashname`** constants.
### Return Values
Returns the name of the hash or **`false`**, if the hash does not exist.
### 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 **mhash\_get\_hash\_name()** Example**
```
<?php
echo mhash_get_hash_name(MHASH_MD5); // MD5
?>
```
php ReflectionFunction::__toString ReflectionFunction::\_\_toString
================================
(PHP 5, PHP 7, PHP 8)
ReflectionFunction::\_\_toString — To string
### Description
```
public ReflectionFunction::__toString(): string
```
To string.
### Parameters
This function has no parameters.
### Return Values
Returns [ReflectionFunction::export()](reflectionfunction.export)-like output for the function.
### Examples
**Example #1 **ReflectionFunction::\_\_toString()** example**
```
<?php
function title($title, $name)
{
return sprintf("%s. %s\r\n", $title, $name);
}
echo new ReflectionFunction('title');
?>
```
The above example will output something similar to:
```
Function [ <user> function title ] {
@@ Command line code 1 - 1
- Parameters [2] {
Parameter #0 [ <required> $title ]
Parameter #1 [ <required> $name ]
}
}
```
### See Also
* [ReflectionFunction::export()](reflectionfunction.export) - Exports function
* [\_\_toString()](language.oop5.magic#object.tostring)
| programming_docs |
php Imagick::magnifyImage Imagick::magnifyImage
=====================
(PECL imagick 2, PECL imagick 3)
Imagick::magnifyImage — Scales an image proportionally 2x
### Description
```
public Imagick::magnifyImage(): bool
```
Is a convenience method that scales an image proportionally to twice its original size.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::magnifyImage()****
```
<?php
function magnifyImage($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->magnifyImage();
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php openal_source_destroy openal\_source\_destroy
=======================
(PECL openal >= 0.1.0)
openal\_source\_destroy — Destroy a source resource
### Description
```
openal_source_destroy(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\_create()](function.openal-source-create) - Generate a source resource
php ParentIterator::__construct ParentIterator::\_\_construct
=============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
ParentIterator::\_\_construct — Constructs a ParentIterator
### Description
public **ParentIterator::\_\_construct**([RecursiveIterator](class.recursiveiterator) `$iterator`) Constructs a [ParentIterator](class.parentiterator) on an iterator.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`iterator`
The iterator being constructed upon.
php Yaf_Request_Abstract::getException Yaf\_Request\_Abstract::getException
====================================
(Yaf >=1.0.0)
Yaf\_Request\_Abstract::getException — The getException purpose
### Description
```
public Yaf_Request_Abstract::getException(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php SolrQuery::setHighlightRegexSlop SolrQuery::setHighlightRegexSlop
================================
(PECL solr >= 0.9.2)
SolrQuery::setHighlightRegexSlop — Sets the factor by which the regex fragmenter can stray from the ideal fragment size
### Description
```
public SolrQuery::setHighlightRegexSlop(float $factor): SolrQuery
```
The factor by which the regex fragmenter can stray from the ideal fragment size ( specfied by SolrQuery::setHighlightFragsize )to accommodate the regular expression
### Parameters
`factor`
The factor by which the regex fragmenter can stray from the ideal fragment size
### Return Values
Returns the current SolrQuery object, if the return value is used.
php imagefilledpolygon imagefilledpolygon
==================
(PHP 4, PHP 5, PHP 7, PHP 8)
imagefilledpolygon — Draw a filled polygon
### Description
Signature as of PHP 8.0.0 (not supported with named arguments)
```
imagefilledpolygon(GdImage $image, array $points, int $color): bool
```
Alternative signature (deprecated as of PHP 8.1.0)
```
imagefilledpolygon(
GdImage $image,
array $points,
int $num_points,
int $color
): bool
```
**imagefilledpolygon()** creates a filled polygon in the given `image`.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`points`
An array containing the `x` and `y` coordinates of the polygons vertices consecutively.
`num_points`
Total number of points (vertices), which must be at least 3.
If this parameter is omitted as per the second signature, `points` must have an even number of elements, and `num_points` is assumed to be `count($points)/2`. `color`
A color identifier created with [imagecolorallocate()](function.imagecolorallocate).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The parameter `num_points` has been deprecated. |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 **imagefilledpolygon()** example**
```
<?php
// set up array of points for polygon
$values = array(
40, 50, // Point 1 (x, y)
20, 240, // Point 2 (x, y)
60, 60, // Point 3 (x, y)
240, 20, // Point 4 (x, y)
50, 40, // Point 5 (x, y)
10, 10 // Point 6 (x, y)
);
// create image
$image = imagecreatetruecolor(250, 250);
// allocate colors
$bg = imagecolorallocate($image, 0, 0, 0);
$blue = imagecolorallocate($image, 0, 0, 255);
// fill the background
imagefilledrectangle($image, 0, 0, 249, 249, $bg);
// draw a polygon
imagefilledpolygon($image, $values, 6, $blue);
// flush image
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>
```
The above example will output something similar to:
### See Also
* [imagepolygon()](function.imagepolygon) - Draws a polygon
php geoip_continent_code_by_name geoip\_continent\_code\_by\_name
================================
(PECL geoip >= 1.0.3)
geoip\_continent\_code\_by\_name — Get the two letter continent code
### Description
```
geoip_continent_code_by_name(string $hostname): string
```
The **geoip\_continent\_code\_by\_name()** function will return the two letter continent code corresponding to a hostname or an IP address.
### Parameters
`hostname`
The hostname or IP address whose location is to be looked-up.
### Return Values
Returns the two letter continent code on success, or **`false`** if the address cannot be found in the database.
**Continent codes**| Code | Continent name |
| --- | --- |
| `AF` | Africa |
| `AN` | Antarctica |
| `AS` | Asia |
| `EU` | Europe |
| `NA` | North america |
| `OC` | Oceania |
| `SA` | South america |
### Examples
**Example #1 A **geoip\_continent\_code\_by\_name()** example**
This will print where the host example.com is located.
```
<?php
$continent = geoip_continent_code_by_name('www.example.com');
if ($continent) {
echo 'This host is located in: ' . $continent;
}
?>
```
The above example will output:
```
This host is located in: NA
```
### See Also
* [geoip\_country\_code\_by\_name()](function.geoip-country-code-by-name) - Get the two letter country code
php SplFileObject::fpassthru SplFileObject::fpassthru
========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::fpassthru — Output all remaining data on a file pointer
### Description
```
public SplFileObject::fpassthru(): int
```
Reads to EOF on the given file pointer from the current position and writes the results to the output buffer.
You may need to call [SplFileObject::rewind()](splfileobject.rewind) to reset the file pointer to the beginning of the file if you have already written data to the file.
### Parameters
This function has no parameters.
### Return Values
Returns the number of characters read from `handle` and passed through to the output.
### Examples
**Example #1 **SplFileObject::fpassthru()** example**
```
<?php
// Open the file in binary mode
$file = new SplFileObject("./img/ok.png", "rb");
// Send the right headers
header("Content-Type: image/png");
header("Content-Length: " . $file->getSize());
// Dump the picture and end script
$file->fpassthru();
exit;
?>
```
### See Also
* [fpassthru()](function.fpassthru) - Output all remaining data on a file pointer
php posix_get_last_error posix\_get\_last\_error
=======================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
posix\_get\_last\_error — Retrieve the error number set by the last posix function that failed
### Description
```
posix_get_last_error(): int
```
Retrieve the error number set by the last posix function that failed. The system error message associated with the errno may be checked with [posix\_strerror()](function.posix-strerror).
### Parameters
This function has no parameters.
### Return Values
Returns the errno (error number) set by the last posix function that failed. If no errors exist, 0 is returned.
### Examples
**Example #1 **posix\_get\_last\_error()** example**
This example attempt to kill a bogus process id, which will set the last error. We will then print out the last errno.
```
<?php
posix_kill(999459,SIGKILL);
echo 'Your error returned was '.posix_get_last_error(); //Your error was ___
?>
```
### See Also
* [posix\_strerror()](function.posix-strerror) - Retrieve the system error message associated with the given errno
php Ds\Stack::allocate Ds\Stack::allocate
==================
(PECL ds >= 1.0.0)
Ds\Stack::allocate — Allocates enough memory for a required capacity
### Description
```
public Ds\Stack::allocate(int $capacity): void
```
Ensures that enough memory is allocated for a required capacity. This removes the need to reallocate the internal as values are added.
### Parameters
`capacity`
The number of values for which capacity should be allocated.
>
> **Note**:
>
>
> Capacity will stay the same if this value is less than or equal to the current capacity.
>
>
### Return Values
No value is returned.
php Imagick::removeImage Imagick::removeImage
====================
(PECL imagick 2, PECL imagick 3)
Imagick::removeImage — Removes an image from the image list
### Description
```
public Imagick::removeImage(): bool
```
Removes an image from the image list.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
php SplHeap::isEmpty SplHeap::isEmpty
================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplHeap::isEmpty — Checks whether the heap is empty
### Description
```
public SplHeap::isEmpty(): bool
```
### Parameters
This function has no parameters.
### Return Values
Returns whether the heap is empty.
php ZookeeperConfig::remove ZookeeperConfig::remove
=======================
(PECL zookeeper >= 0.6.0, ZooKeeper >= 3.5.0)
ZookeeperConfig::remove — Remove servers from the ensemble
### Description
```
public ZookeeperConfig::remove(string $id_list, int $version = -1, array &$stat = null): void
```
### Parameters
`id_list`
Comma separated list of server IDs to be removed from the ensemble. Each has an id of a server to be removed, only for maj. quorums.
`version`
The expected version of the node. The function will fail if the actual version of the node does not match the expected version. If -1 is used the version check will not take place.
`stat`
If not NULL, will hold the value of stat for the path on return.
### Return Values
No value is returned.
### Errors/Exceptions
This method emits [ZookeeperException](class.zookeeperexception) and it's derivatives when parameters count or types are wrong or fail to save value to node.
### Examples
**Example #1 **ZookeeperConfig::remove()** example**
Remove members.
```
<?php
$client = new Zookeeper();
$client->connect('localhost:2181');
$client->addAuth('digest', 'timandes:timandes');
$zkConfig = $client->getConfig();
$zkConfig->set("server.1=localhost:2888:3888:participant;0.0.0.0:2181,server.2=localhost:2889:3889:participant;0.0.0.0:2182");
$zkConfig->remove("2");
echo $zkConfig->get();
if ($r)
echo $r;
else
echo 'ERR';
?>
```
The above example will output:
```
server.1=localhost:2888:3888:participant;0.0.0.0:2181
version=0xca01e881a2
```
### See Also
* [ZookeeperConfig::get()](zookeeperconfig.get) - Gets the last committed configuration of the ZooKeeper cluster as it is known to the server to which the client is connected, synchronously
* [ZookeeperConfig::add()](zookeeperconfig.add) - Add servers to the ensemble
* [ZookeeperConfig::set()](zookeeperconfig.set) - Change ZK cluster ensemble membership and roles of ensemble peers
* [ZookeeperException](class.zookeeperexception)
php Phar::getModified Phar::getModified
=================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
Phar::getModified — Return whether phar was modified
### Description
```
public Phar::getModified(): bool
```
This method can be used to determine whether a phar has either had an internal file deleted, or contents of a file changed in some way.
### Parameters
No parameters.
### Return Values
**`true`** if the phar has been modified since opened, **`false`** if not.
php EventListener::getSocketName EventListener::getSocketName
============================
(PECL event >= 1.5.0)
EventListener::getSocketName — Retreives the current address to which the listener's socket is bound
### Description
```
public static EventListener::getSocketName( string &$address , mixed &$port = ?): bool
```
Retreives the current address to which the listener's socket is bound.
### Parameters
`address` Output parameter. IP-address depending on the socket address family.
`port` Output parameter. The port the socket is bound to.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php gnupg_import gnupg\_import
=============
(PECL gnupg >= 0.3)
gnupg\_import — Imports a key
### Description
```
gnupg_import(resource $identifier, string $keydata): array
```
Imports the key `keydata` and returns an array with information about the importprocess.
### Parameters
`identifier`
The gnupg identifier, from a call to [gnupg\_init()](function.gnupg-init) or **gnupg**.
`keydata`
The data key that is being imported.
### Return Values
On success, this function returns and info-array about the importprocess. On failure, this function returns **`false`**.
### Examples
**Example #1 Procedural **gnupg\_import()** example**
```
<?php
$res = gnupg_init();
$info = gnupg_import($res,$keydata);
print_r($info);
?>
```
**Example #2 OO **gnupg\_import()** example**
```
<?php
$gpg = new gnupg();
$info = $gpg->import($keydata);
print_r($info);
?>
```
php stats_cdf_exponential stats\_cdf\_exponential
=======================
(PECL stats >= 1.0.0)
stats\_cdf\_exponential — Calculates any one parameter of the exponential distribution given values for the others
### Description
```
stats_cdf_exponential(float $par1, float $par2, int $which): float
```
Returns the cumulative distribution function, its inverse, or one of its parameters, of the exponential 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 rate parameter of the exponential 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 Imagick::deleteImageProperty Imagick::deleteImageProperty
============================
(PECL imagick 3 >= 3.3.0)
Imagick::deleteImageProperty — Description
### Description
```
public Imagick::deleteImageProperty(string $name): bool
```
Deletes an image property.
### Parameters
`name`
The name of the property to delete.
### Return Values
Returns **`true`** on success.
php dba_handlers dba\_handlers
=============
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
dba\_handlers — List all the handlers available
### Description
```
dba_handlers(bool $full_info = false): array
```
**dba\_handlers()** list all the handlers supported by this extension.
### Parameters
`full_info`
Turns on/off full information display in the result.
### Return Values
Returns an array of database handlers. If `full_info` is set to **`true`**, the array will be associative with the handlers names as keys, and their version information as value. Otherwise, the result will be an indexed array of handlers names.
>
> **Note**:
>
>
> When the internal cdb library is used you will see `cdb` and `cdb_make`.
>
>
### Examples
**Example #1 **dba\_handlers()** Example**
```
<?php
echo "Available DBA handlers:\n";
foreach (dba_handlers(true) as $handler_name => $handler_version) {
// clean the versions
$handler_version = str_replace('$', '', $handler_version);
echo " - $handler_name: $handler_version\n";
}
?>
```
The above example will output something similar to:
```
Available DBA handlers:
- cdb: 0.75, Revision: 1.3.2.3
- cdb_make: 0.75, Revision: 1.2.2.4
- db2: Sleepycat Software: Berkeley DB 2.7.7: (08/20/99)
- inifile: 1.0, Revision: 1.6.2.3
- flatfile: 1.0, Revision: 1.5.2.4
```
php ob_get_level ob\_get\_level
==============
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
ob\_get\_level — Return the nesting level of the output buffering mechanism
### Description
```
ob_get_level(): int
```
Returns the nesting level of the output buffering mechanism.
### Parameters
This function has no parameters.
### Return Values
Returns the level of nested output buffering handlers or zero if output buffering is not active.
### See Also
* [ob\_start()](function.ob-start) - Turn on output buffering
* [ob\_get\_contents()](function.ob-get-contents) - Return the contents of the output buffer
php Ds\Sequence::sum Ds\Sequence::sum
================
(PECL ds >= 1.0.0)
Ds\Sequence::sum — Returns the sum of all values in the sequence
### Description
```
abstract public Ds\Sequence::sum(): int|float
```
Returns the sum of all values in the sequence.
>
> **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 sequence as either a float or int depending on the values in the sequence.
### Examples
**Example #1 **Ds\Sequence::sum()** integer example**
```
<?php
$sequence = new \Ds\Vector([1, 2, 3]);
var_dump($sequence->sum());
?>
```
The above example will output something similar to:
```
int(6)
```
**Example #2 **Ds\Sequence::sum()** float example**
```
<?php
$sequence = new \Ds\Vector([1, 2.5, 3]);
var_dump($sequence->sum());
?>
```
The above example will output something similar to:
```
float(6.5)
```
php SplPriorityQueue::valid SplPriorityQueue::valid
=======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplPriorityQueue::valid — Check whether the queue contains more nodes
### Description
```
public SplPriorityQueue::valid(): bool
```
Checks if the queue contains any more nodes.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the queue contains any more nodes, **`false`** otherwise.
| programming_docs |
php The SolrMissingMandatoryParameterException class
The SolrMissingMandatoryParameterException class
================================================
Introduction
------------
(No version information available, might only be in Git)
Class synopsis
--------------
class **SolrMissingMandatoryParameterException** extends [SolrException](class.solrexception) { /\* 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;
protected int [$sourceline](class.solrexception#solrexception.props.sourceline);
protected string [$sourcefile](class.solrexception#solrexception.props.sourcefile);
protected string [$zif\_name](class.solrexception#solrexception.props.zif-name); /\* 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
```
```
public SolrException::getInternalInfo(): array
```
}
php The SoapParam class
The SoapParam class
===================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
Represents parameter to a SOAP call.
Class synopsis
--------------
class **SoapParam** { /\* Properties \*/ public string [$param\_name](class.soapparam#soapparam.props.param-name);
public [mixed](language.types.declarations#language.types.declarations.mixed) [$param\_data](class.soapparam#soapparam.props.param-data); /\* Methods \*/ public [\_\_construct](soapparam.construct)([mixed](language.types.declarations#language.types.declarations.mixed) `$data`, string `$name`) } Properties
----------
param\_data param\_name Table of Contents
-----------------
* [SoapParam::\_\_construct](soapparam.construct) — SoapParam constructor
php The Attribute class
The Attribute class
===================
Introduction
------------
(PHP 8)
Attributes offer the ability to add structured, machine-readable metadata information on declarations in code: Classes, methods, functions, parameters, properties and class constants can be the target of an attribute. The metadata defined by attributes can then be inspected at runtime using the [Reflection APIs](https://www.php.net/manual/en/book.reflection.php). Attributes could therefore be thought of as a configuration language embedded directly into code.
Class synopsis
--------------
final class **Attribute** { } See Also
--------
[Attributes overview](https://www.php.net/manual/en/language.attributes.php)
php ArrayIterator::uksort ArrayIterator::uksort
=====================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
ArrayIterator::uksort — Sort by keys using a user-defined comparison function
### Description
```
public ArrayIterator::uksort(callable $callback): bool
```
This method sorts the elements by keys using a user-supplied comparison function.
>
> **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`**.
### See Also
* [ArrayIterator::asort()](arrayiterator.asort) - Sort entries by values
* [ArrayIterator::ksort()](arrayiterator.ksort) - Sort entries by keys
* [ArrayIterator::natcasesort()](arrayiterator.natcasesort) - Sort entries naturally, case insensitive
* [ArrayIterator::natsort()](arrayiterator.natsort) - Sort entries naturally
* **ArrayIterator::uksort()**
* [uksort()](function.uksort) - Sort an array by keys using a user-defined comparison function
php XMLWriter::setIndent XMLWriter::setIndent
====================
xmlwriter\_set\_indent
======================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::setIndent -- xmlwriter\_set\_indent — Toggle indentation on/off
### Description
Object-oriented style
```
public XMLWriter::setIndent(bool $enable): bool
```
Procedural style
```
xmlwriter_set_indent(XMLWriter $writer, bool $enable): bool
```
Toggles indentation on or off.
### 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).
`enable`
Whether indentation is enabled.
### 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 **XMLWriter::setIndent()** and mixed Content**
Enabling indentation is not suitable for mixed content, because the indent string is also inserted before inline elements.
```
<?php
$writer = new XMLWriter();
$writer->openMemory();
$writer->setIndent(2);
$writer->startDocument();
$writer->startElement('p');
$writer->text('before');
$writer->writeElement('a', 'element');
$writer->text('after');
$writer->endElement();
$writer->endDocument();
echo $writer->outputMemory();
?>
```
The above example will output:
```
<?xml version="1.0"?>
<p>before <a>element</a>
after</p>
```
### Notes
>
> **Note**:
>
>
> The indent is reset when an xmlwriter is opened.
>
>
### See Also
* [XMLWriter::setIndentString()](xmlwriter.setindentstring) - Set string used for indenting
php IntlBreakIterator::createTitleInstance IntlBreakIterator::createTitleInstance
======================================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlBreakIterator::createTitleInstance — Create break iterator for title-casing breaks
### Description
```
public static IntlBreakIterator::createTitleInstance(?string $locale = null): ?IntlBreakIterator
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`locale`
### Return Values
php ImagickDraw::setFillAlpha ImagickDraw::setFillAlpha
=========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setFillAlpha — Sets the opacity to use when drawing using the fill color or fill texture
### Description
```
public ImagickDraw::setFillAlpha(float $opacity): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Sets the opacity to use when drawing using the fill color or fill texture. Fully opaque is 1.0.
### Parameters
`opacity`
fill alpha
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::setFillAlpha()** example**
```
<?php
function setFillAlpha($strokeColor, $fillColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeOpacity(1);
$draw->setStrokeWidth(2);
$draw->rectangle(100, 200, 200, 300);
@$draw->setFillAlpha(0.4);
$draw->rectangle(300, 200, 400, 300);
$imagick = new \Imagick();
$imagick->newImage(500, 500, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
php SplFileObject::fstat SplFileObject::fstat
====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::fstat — Gets information about the file
### Description
```
public SplFileObject::fstat(): array
```
Gathers the statistics of the file. Behaves identically to [fstat()](function.fstat).
### Parameters
This function has no parameters.
### Return Values
Returns an array with the statistics of the file; the format of the array is described in detail on the [stat()](function.stat) manual page.
### Examples
**Example #1 **SplFileObject::fstat()** example**
```
<?php
$file = new SplFileObject("/etc/passwd");
$stat = $file->fstat();
// Print only the associative part
print_r(array_slice($stat, 13));
?>
```
The above example will output something similar to:
```
Array
(
[dev] => 771
[ino] => 488704
[mode] => 33188
[nlink] => 1
[uid] => 0
[gid] => 0
[rdev] => 0
[size] => 1114
[atime] => 1061067181
[mtime] => 1056136526
[ctime] => 1056136526
[blksize] => 4096
[blocks] => 8
)
```
### See Also
* [fstat()](function.fstat) - Gets information about a file using an open file pointer
* [stat()](function.stat) - Gives information about a file
php None Object Iteration
----------------
PHP provides a way for objects to be defined so it is possible to iterate through a list of items, with, for example a [foreach](control-structures.foreach) statement. By default, all [visible](language.oop5.visibility) properties will be used for the iteration.
**Example #1 Simple Object Iteration**
```
<?php
class MyClass
{
public $var1 = 'value 1';
public $var2 = 'value 2';
public $var3 = 'value 3';
protected $protected = 'protected var';
private $private = 'private var';
function iterateVisible() {
echo "MyClass::iterateVisible:\n";
foreach ($this as $key => $value) {
print "$key => $value\n";
}
}
}
$class = new MyClass();
foreach($class as $key => $value) {
print "$key => $value\n";
}
echo "\n";
$class->iterateVisible();
?>
```
The above example will output:
```
var1 => value 1
var2 => value 2
var3 => value 3
MyClass::iterateVisible:
var1 => value 1
var2 => value 2
var3 => value 3
protected => protected var
private => private var
```
As the output shows, the [foreach](control-structures.foreach) iterated through all of the [visible](language.oop5.visibility) properties that could be accessed.
### See Also
* [Generators](https://www.php.net/manual/en/language.generators.php)
* [Iterator](class.iterator)
* [IteratorAggregate](class.iteratoraggregate)
* [SPL Iterators](https://www.php.net/manual/en/spl.iterators.php)
php stream_set_chunk_size stream\_set\_chunk\_size
========================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
stream\_set\_chunk\_size — Set the stream chunk size
### Description
```
stream_set_chunk_size(resource $stream, int $size): int
```
Set the stream chunk size.
### Parameters
`stream`
The target stream.
`size`
The desired new chunk size.
### Return Values
Returns the previous chunk size on success.
Will return **`false`** if `size` is less than 1 or greater than **`PHP_INT_MAX`**.
### Errors/Exceptions
Will emit an **`E_WARNING`** level error if `size` is less than 1 or greater than **`PHP_INT_MAX`**.
php Ds\Deque::push Ds\Deque::push
==============
(PECL ds >= 1.0.0)
Ds\Deque::push — Adds values to the end of the deque
### Description
```
public Ds\Deque::push(mixed ...$values): void
```
Adds values to the end of the deque.
### Parameters
`values`
The values to add.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Deque::push()** example**
```
<?php
$deque = new \Ds\Deque();
$deque->push("a");
$deque->push("b");
$deque->push("c", "d");
$deque->push(...["e", "f"]);
print_r($deque);
?>
```
The above example will output something similar to:
```
Ds\Deque Object
(
[0] => a
[1] => b
[2] => c
[3] => d
[4] => e
[5] => f
)
```
php openssl_spki_export openssl\_spki\_export
=====================
(PHP 5 >= 5.6.0, PHP 7, PHP 8)
openssl\_spki\_export — Exports a valid PEM formatted public key signed public key and challenge
### Description
```
openssl_spki_export(string $spki): string|false
```
Exports PEM formatted public key from encoded signed public key and challenge
### Parameters
`spki`
Expects a valid signed public key and challenge
### Return Values
Returns the associated PEM formatted public key or **`false`** on failure.
### Errors/Exceptions
Emits an **`E_WARNING`** level error if an invalid argument is passed via the `spki` parameter.
### Examples
**Example #1 **openssl\_spki\_export()** example**
Extracts the associated PEM formatted public key or NULL on failure.
```
<?php
$pkey = openssl_pkey_new('secret password');
$spkac = openssl_spki_new($pkey, 'challenge string');
$pubKey = openssl_spki_export(preg_replace('/SPKAC=/', '', $spkac));
if ($pubKey) {
echo $pubKey;
}
?>
```
**Example #2 **openssl\_spki\_export()** example from <keygen>**
Extracts the associated PEM formatted public key issued from the <keygen> element
```
<?php
$spkac = openssl_spki_export(preg_replace('/SPKAC=/', '', $_POST['spkac']));
if ($spkac != NULL) {
echo $spkac;
} else {
echo "Extraction of pub key failed";
}
?>
<keygen name="spkac" challenge="challenge string" keytype="RSA">
```
### See Also
* [openssl\_spki\_new()](function.openssl-spki-new) - Generate a new signed public key and challenge
* [openssl\_spki\_verify()](function.openssl-spki-verify) - Verifies a signed public key and challenge
* [openssl\_spki\_export\_challenge()](function.openssl-spki-export-challenge) - Exports the challenge associated with a signed public key and challenge
* [openssl\_get\_md\_methods()](function.openssl-get-md-methods) - Gets available digest methods
* [openssl\_csr\_new()](function.openssl-csr-new) - Generates a CSR
* [openssl\_csr\_sign()](function.openssl-csr-sign) - Sign a CSR with another certificate (or itself) and generate a certificate
php OAuth::getRequestHeader OAuth::getRequestHeader
=======================
(No version information available, might only be in Git)
OAuth::getRequestHeader — Generate OAuth header string signature
### Description
```
public OAuth::getRequestHeader(string $http_method, string $url, mixed $extra_parameters = ?): string|false
```
Generate OAuth header string signature based on the final HTTP method, URL and a string/array of parameters
### Parameters
`http_method`
HTTP method for request.
`url`
URL for request.
`extra_parameters`
String or array of additional parameters.
### Return Values
A string containing the generated request header or **`false`** on failure
php Transliterator::getErrorMessage Transliterator::getErrorMessage
===============================
transliterator\_get\_error\_message
===================================
(PHP 5 >= 5.4.0, PHP 7, PHP 8, PECL intl >= 2.0.0)
Transliterator::getErrorMessage -- transliterator\_get\_error\_message — Get last error message
### Description
Object-oriented style
```
public Transliterator::getErrorMessage(): string|false
```
Procedural style
```
transliterator_get_error_message(Transliterator $transliterator): string|false
```
Gets the last error message for this transliterator.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`transliterator`
### Return Values
The error message on success, or **`false`** if none exists, or on failure.
### See Also
* [Transliterator::getErrorCode()](transliterator.geterrorcode) - Get last error code
* [Transliterator::listIDs()](transliterator.listids) - Get transliterator IDs
php eio_nreqs eio\_nreqs
==========
(PECL eio >= 0.0.1dev)
eio\_nreqs — Returns number of requests to be processed
### Description
```
eio_nreqs(): int
```
**eio\_nreqs()** could be called in a custom loop calling [eio\_poll()](function.eio-poll).
### Parameters
This function has no parameters.
### Return Values
**eio\_nreqs()** returns number of requests to be processed.
### Examples
**Example #1 **eio\_nreqs()** example**
```
<?php
function res_cb($data, $result) {
var_dump($data);
var_dump($result);
}
eio_nop(EIO_PRI_DEFAULT, "res_cb", "1");
eio_nop(EIO_PRI_DEFAULT, "res_cb", "2");
eio_nop(EIO_PRI_DEFAULT, "res_cb", "3");
while (eio_nreqs()) {
eio_poll();
}
?>
```
The above example will output something similar to:
```
string(1) "1"
int(0)
string(1) "3"
int(0)
string(1) "2"
int(0)
```
### See Also
* [eio\_poll()](function.eio-poll) - Can be to be called whenever there are pending requests that need finishing
* [eio\_nready()](function.eio-nready) - Returns number of not-yet handled requests
php Imagick::contrastStretchImage Imagick::contrastStretchImage
=============================
(PECL imagick 2, PECL imagick 3)
Imagick::contrastStretchImage — Enhances the contrast of a color image
### Description
```
public Imagick::contrastStretchImage(float $black_point, float $white_point, int $channel = Imagick::CHANNEL_DEFAULT): bool
```
Enhances the contrast of a color image by adjusting the pixels color to span the entire range of colors available. This method is available if Imagick has been compiled against ImageMagick version 6.2.9 or newer.
### Parameters
`black_point`
The black point.
`white_point`
The white 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. **`Imagick::CHANNEL_ALL`**. 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.
php ftp_systype ftp\_systype
============
(PHP 4, PHP 5, PHP 7, PHP 8)
ftp\_systype — Returns the system type identifier of the remote FTP server
### Description
```
ftp_systype(FTP\Connection $ftp): string|false
```
Returns the system type identifier of the remote FTP server.
### Parameters
`ftp`
An [FTP\Connection](class.ftp-connection) instance.
### Return Values
Returns the remote system type, 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\_systype()** example**
```
<?php
// ftp connection
$ftp = ftp_connect('ftp.example.com');
ftp_login($ftp, 'user', 'password');
// get the system type
if ($type = ftp_systype($ftp)) {
echo "Example.com is powered by $type\n";
} else {
echo "Couldn't get the systype";
}
?>
```
The above example will output something similar to:
```
Example.com is powered by UNIX
```
php IntlTimeZone::getIDForWindowsID IntlTimeZone::getIDForWindowsID
===============================
intltz\_get\_id\_for\_windows\_id
=================================
(PHP 7 >= 7.1.0, PHP 8)
IntlTimeZone::getIDForWindowsID -- intltz\_get\_id\_for\_windows\_id — Translate a Windows timezone into a system timezone
### Description
Object-oriented style (method):
```
public static IntlTimeZone::getIDForWindowsID(string $timezoneId, ?string $region = null): string|false
```
Procedural style:
```
intltz_get_id_for_windows_id(string $timezoneId, ?string $region = null): string|false
```
Translates a Windows timezone (e.g. "Pacific Standard Time") into a system timezone (e.g. "America/Los\_Angeles").
> **Note**: This function requires ICU version ≥ 52.
>
>
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`timezoneId`
`region`
### Return Values
Returns the system timezone or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `region` is now nullable. |
### See Also
* [IntlTimeZone::getWindowsID()](intltimezone.getwindowsid) - Translate a system timezone into a Windows timezone
| programming_docs |
php Yaf_Loader::import Yaf\_Loader::import
===================
(Yaf >=1.0.0)
Yaf\_Loader::import — The import purpose
### Description
```
public static Yaf_Loader::import(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php SolrQuery::getGroupFacet SolrQuery::getGroupFacet
========================
(PECL solr >= 2.2.0)
SolrQuery::getGroupFacet — Returns the group.facet parameter value
### Description
```
public SolrQuery::getGroupFacet(): bool
```
Returns the group.facet parameter value
### Parameters
This function has no parameters.
### Return Values
### See Also
* [SolrQuery::setGroupFacet()](solrquery.setgroupfacet) - Sets group.facet parameter
php session_status session\_status
===============
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
session\_status — Returns the current session status
### Description
```
session_status(): int
```
**session\_status()** is used to return the current session status.
### Parameters
This function has no parameters.
### Return Values
* **`PHP_SESSION_DISABLED`** if sessions are disabled.
* **`PHP_SESSION_NONE`** if sessions are enabled, but none exists.
* **`PHP_SESSION_ACTIVE`** if sessions are enabled, and one exists.
### See Also
* [session\_start()](function.session-start) - Start new or resume existing session
php uopz_set_hook uopz\_set\_hook
===============
(PECL uopz 5, PECL uopz 6, PECL uopz 7)
uopz\_set\_hook — Sets hook to execute when entering a function or method
### Description
```
uopz_set_hook(string $function, Closure $hook): bool
```
```
uopz_set_hook(string $class, string $function, Closure $hook): bool
```
Sets a hook to execute when entering a function or method.
### Parameters
`class`
The name of the class.
`function`
The name of the function or method.
`hook`
A closure to execute when entering the function or method.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Basic **uopz\_set\_hook()** Usage**
```
<?php
function foo() {
echo 'foo';
}
uopz_set_hook('foo', function () {echo 'bar';});
foo();
?>
```
The above example will output:
```
barfoo
```
### See Also
* [uopz\_get\_hook()](function.uopz-get-hook) - Gets previously set hook on function or method
* [uopz\_unset\_hook()](function.uopz-unset-hook) - Removes previously set hook on function or method
php EmptyIterator::key EmptyIterator::key
==================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
EmptyIterator::key — The key() method
### Description
```
public EmptyIterator::key(): never
```
This function must not be called. It throws an exception upon access.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Errors/Exceptions
Throws an [Exception](class.exception) if called.
### Return Values
No value is returned.
php imap_rfc822_parse_adrlist imap\_rfc822\_parse\_adrlist
============================
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_rfc822\_parse\_adrlist — Parses an address string
### Description
```
imap_rfc822_parse_adrlist(string $string, string $default_hostname): array
```
Parses the address string as defined in [» RFC2822](http://www.faqs.org/rfcs/rfc2822) and for each address.
### Parameters
`string`
A string containing addresses
`default_hostname`
The default host name
### Return Values
Returns an array of objects. The objects properties are:
* mailbox - the mailbox name (username)
* host - the host name
* personal - the personal name
* adl - at domain source route
### Examples
**Example #1 **imap\_rfc822\_parse\_adrlist()** example**
```
<?php
$address_string = "Joe Doe <[email protected]>, [email protected], root";
$address_array = imap_rfc822_parse_adrlist($address_string, "example.com");
if (!is_array($address_array) || count($address_array) < 1) {
die("something is wrong\n");
}
foreach ($address_array as $id => $val) {
echo "# $id\n";
echo " mailbox : " . $val->mailbox . "\n";
echo " host : " . $val->host . "\n";
echo " personal: " . $val->personal . "\n";
echo " adl : " . $val->adl . "\n";
}
?>
```
The above example will output:
```
# 0
mailbox : doe
host : example.com
personal: Joe Doe
adl :
# 1
mailbox : postmaster
host : example.com
personal:
adl :
# 2
mailbox : root
host : example.com
personal:
adl :
```
### See Also
* [imap\_rfc822\_parse\_headers()](function.imap-rfc822-parse-headers) - Parse mail headers from a string
php stats_cdf_noncentral_chisquare stats\_cdf\_noncentral\_chisquare
=================================
(PECL stats >= 1.0.0)
stats\_cdf\_noncentral\_chisquare — Calculates any one parameter of the non-central chi-square distribution given values for the others
### Description
```
stats_cdf_noncentral_chisquare(
float $par1,
float $par2,
float $par3,
int $which
): float
```
Returns the cumulative distribution function, its inverse, or one of its parameters, of the non-central chi-square 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, k, and lambda denotes cumulative distribution function, the value of the random variable, the degree of freedom and the non-centrality parameter of the distribution, respectively.
**Return value and parameters**| `which` | Return value | `par1` | `par2` | `par3` |
| --- | --- | --- | --- | --- |
| 1 | CDF | x | k | lambda |
| 2 | x | CDF | k | lambda |
| 3 | k | x | CDF | lambda |
| 4 | lambda | x | CDF | k |
### 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, k, or lambda, determined by `which`.
php IntlCalendar::setTime IntlCalendar::setTime
=====================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::setTime — Set the calendar time in milliseconds since the epoch
### Description
Object-oriented style
```
public IntlCalendar::setTime(float $timestamp): bool
```
Procedural style
```
intlcal_set_time(IntlCalendar $calendar, float $timestamp): bool
```
Sets the instant represented by this object. The instant is represented by a float whose value should be an integer number of milliseconds since the epoch (1 Jan 1970 00:00:00.000 UTC), ignoring leap seconds. All the field values will be recalculated accordingly.
### Parameters
`calendar`
An [IntlCalendar](class.intlcalendar) instance.
`timestamp`
An instant represented by the number of number of milliseconds between such instant and the epoch, ignoring leap seconds.
### Return Values
Returns **`true`** on success and **`false`** on failure.
### Examples
**Example #1 **IntlCalendar::setTime()****
```
<?php
ini_set('date.timezone', 'Europe/Lisbon');
ini_set('intl.default_locale', 'fr_FR');
$cal = new IntlGregorianCalendar(2013, 5 /* May */, 1, 12, 0, 0);
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
/* In Europe/Lisbon, on 2013-10-27 at 0200, the clock goes back one hour and
the timezone from UTC+01 to UTC+00 */
$cal->setTime(strtotime('2013-10-27 00:30:00 UTC') * 1000.);
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
$cal->setTime(strtotime('2013-10-27 01:30:00 UTC') * 1000.);
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL), "\n";
```
The above example will output:
```
samedi 1 juin 2013 12:00:00 heure avancée d’Europe de l’Ouest
dimanche 27 octobre 2013 01:30:00 heure avancée d’Europe de l’Ouest
dimanche 27 octobre 2013 01:30:00 heure normale d’Europe de l’Ouest
```
php GmagickDraw::setstrokewidth GmagickDraw::setstrokewidth
===========================
(PECL gmagick >= Unknown)
GmagickDraw::setstrokewidth — Sets the width of the stroke used to draw object outlines
### Description
```
public GmagickDraw::setstrokewidth(float $width): GmagickDraw
```
Sets the width of the stroke used to draw object outlines
### Parameters
`width`
Stroke width
### Return Values
The [GmagickDraw](class.gmagickdraw) object.
php DOMComment::__construct DOMComment::\_\_construct
=========================
(PHP 5, PHP 7, PHP 8)
DOMComment::\_\_construct — Creates a new DOMComment object
### Description
public **DOMComment::\_\_construct**(string `$data` = "") Creates a new [DOMComment](class.domcomment) 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::createComment](domdocument.createcomment).
### Parameters
`data`
The value of the comment.
### Examples
**Example #1 Creating a new DOMComment**
```
<?php
$dom = new DOMDocument('1.0', 'iso-8859-1');
$element = $dom->appendChild(new DOMElement('root'));
$comment = $element->appendChild(new DOMComment('root comment'));
echo $dom->saveXML(); /* <?xml version="1.0" encoding="iso-8859-1"?><root><!--root comment--></root> */
?>
```
### See Also
* [DOMDocument::createComment()](domdocument.createcomment) - Create new comment node
php imagetruecolortopalette imagetruecolortopalette
=======================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
imagetruecolortopalette — Convert a true color image to a palette image
### Description
```
imagetruecolortopalette(GdImage $image, bool $dither, int $num_colors): bool
```
**imagetruecolortopalette()** converts a truecolor image to a palette image. The code for this function was originally drawn from the Independent JPEG Group library code, which is excellent. The code has been modified to preserve as much alpha channel information as possible in the resulting palette, in addition to preserving colors as well as possible. This does not work as well as might be hoped. It is usually best to simply produce a truecolor output image instead, which guarantees the highest output quality.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`dither`
Indicates if the image should be dithered - if it is **`true`** then dithering will be used which will result in a more speckled image but with better color approximation.
`num_colors`
Sets the maximum number of colors that should be retained in the palette.
### 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 Converting a true color image to a palette-based image**
```
<?php
// Create a new true color image
$im = imagecreatetruecolor(100, 100);
// Convert to palette-based with no dithering and 255 colors
imagetruecolortopalette($im, false, 255);
// Save the image
imagepng($im, './paletteimage.png');
imagedestroy($im);
?>
```
php SolrQuery::setTermsLowerBound SolrQuery::setTermsLowerBound
=============================
(PECL solr >= 0.9.2)
SolrQuery::setTermsLowerBound — Specifies the Term to start from
### Description
```
public SolrQuery::setTermsLowerBound(string $lowerBound): SolrQuery
```
Specifies the Term to start from
### Parameters
`lowerBound`
The lower bound Term
### Return Values
Returns the current SolrQuery object, if the return value is used.
php DateTimeInterface::getOffset DateTimeInterface::getOffset
============================
DateTimeImmutable::getOffset
============================
DateTime::getOffset
===================
date\_offset\_get
=================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
DateTimeInterface::getOffset -- DateTimeImmutable::getOffset -- DateTime::getOffset -- date\_offset\_get — Returns the timezone offset
### Description
Object-oriented style
```
public DateTimeInterface::getOffset(): int
```
```
public DateTimeImmutable::getOffset(): int
```
```
public DateTime::getOffset(): int
```
Procedural style
```
date_offset_get(DateTimeInterface $object): int
```
Returns the timezone offset.
### Parameters
`object`
Procedural style only: A [DateTime](class.datetime) object returned by [date\_create()](function.date-create)
### Return Values
Returns the timezone offset in seconds from UTC on success.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Prior to this version, **`false`** was returned on failure. |
### Examples
**Example #1 **DateTime::getOffset()** example**
Object-oriented style
```
<?php
$winter = new DateTimeImmutable('2010-12-21', new DateTimeZone('America/New_York'));
$summer = new DateTimeImmutable('2008-06-21', new DateTimeZone('America/New_York'));
echo $winter->getOffset() . "\n";
echo $summer->getOffset() . "\n";
?>
```
Procedural style
```
<?php
$winter = date_create('2010-12-21', timezone_open('America/New_York'));
$summer = date_create('2008-06-21', timezone_open('America/New_York'));
echo date_offset_get($winter) . "\n";
echo date_offset_get($summer) . "\n";
?>
```
The above examples will output:
```
-18000
-14400
```
Note: -18000 = -5 hours, -14400 = -4 hours.
php ReflectionExtension::getClassNames ReflectionExtension::getClassNames
==================================
(PHP 5, PHP 7, PHP 8)
ReflectionExtension::getClassNames — Gets class names
### Description
```
public ReflectionExtension::getClassNames(): array
```
Gets a listing of class names as defined in the extension.
### Parameters
This function has no parameters.
### Return Values
An array of class names, as defined in the extension. If no classes are defined, an empty array is returned.
### Examples
**Example #1 **ReflectionExtension::getClassNames()** example**
```
<?php
$ext = new ReflectionExtension('XMLWriter');
var_dump($ext->getClassNames());
?>
```
The above example will output something similar to:
```
array(1) {
[0]=>
string(9) "XMLWriter"
}
```
### See Also
* [ReflectionExtension::getClasses()](reflectionextension.getclasses) - Gets classes
* [ReflectionExtension::getName()](reflectionextension.getname) - Gets extension name
php ReflectionParameter::export ReflectionParameter::export
===========================
(PHP 5, PHP 7)
ReflectionParameter::export — Exports
**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 ReflectionParameter::export(string $function, string $parameter, bool $return = ?): string
```
Exports.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`function`
The function name.
`parameter`
The parameter name.
`return`
Setting to **`true`** will return the export, as opposed to emitting it. Setting to **`false`** (the default) will do the opposite.
### Return Values
The exported reflection.
### See Also
* [ReflectionParameter::\_\_toString()](reflectionparameter.tostring) - To string
php fbird_rollback_ret fbird\_rollback\_ret
====================
(PHP 5, PHP 7 < 7.4.0)
fbird\_rollback\_ret — Alias of [ibase\_rollback\_ret()](function.ibase-rollback-ret)
### Description
This function is an alias of: [ibase\_rollback\_ret()](function.ibase-rollback-ret).
php QuickHashStringIntHash::saveToString QuickHashStringIntHash::saveToString
====================================
(No version information available, might only be in Git)
QuickHashStringIntHash::saveToString — This method returns a serialized version of the hash
### Description
```
public QuickHashStringIntHash::saveToString(): string
```
This method returns a serialized version of the hash in the same format that [QuickHashStringIntHash::loadFromString()](quickhashstringinthash.loadfromstring) can read.
### Parameters
This function has no parameters.
### Return Values
This method returns a serialized format of an existing hash, in the same format that [QuickHashStringIntHash::loadFromString()](quickhashstringinthash.loadfromstring) can read.
### Examples
**Example #1 **QuickHashStringIntHash::saveToString()** example**
```
<?php
$hash = new QuickHashStringIntHash( 1024 );
var_dump( $hash->add( "forty three", 42 ) );
var_dump( $hash->add( "fifty two", 52 ) );
var_dump( $hash->saveToString() );
?>
```
php SolrDocument::getFieldCount SolrDocument::getFieldCount
===========================
(PECL solr >= 0.9.2)
SolrDocument::getFieldCount — Returns the number of fields in this document
### Description
```
public SolrDocument::getFieldCount(): int
```
Returns the number of fields in this document. Multi-value fields are only counted once.
### Parameters
This function has no parameters.
### Return Values
Returns an integer on success and **`false`** on failure.
php getmygid getmygid
========
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
getmygid — Get PHP script owner's GID
### Description
```
getmygid(): int|false
```
Gets the group ID of the current script.
### Parameters
This function has no parameters.
### Return Values
Returns the group ID of the current script, or **`false`** on error.
### See Also
* [getmyuid()](function.getmyuid) - Gets PHP script owner's UID
* [getmypid()](function.getmypid) - Gets PHP's process ID
* [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 Imagick::fxImage Imagick::fxImage
================
(PECL imagick 2, PECL imagick 3)
Imagick::fxImage — Evaluate expression for each pixel in the image
### Description
```
public Imagick::fxImage(string $expression, int $channel = Imagick::CHANNEL_DEFAULT): Imagick
```
Evaluate expression for each pixel in the image. Consult [» The Fx Special Effects Image Operator](http://www.imagemagick.org/script/fx.php) for more information.
### Parameters
`expression`
The expression.
`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::fxImage()****
```
<?php
function fxImage() {
$imagick = new \Imagick();
$imagick->newPseudoImage(200, 200, "xc:white");
$fx = 'xx=i-w/2; yy=j-h/2; rr=hypot(xx,yy); (.5-rr/140)*1.2+.5';
$fxImage = $imagick->fxImage($fx);
header("Content-Type: image/png");
$fxImage->setimageformat('png');
echo $fxImage->getImageBlob();
}
?>
```
php ftp_nb_put ftp\_nb\_put
============
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
ftp\_nb\_put — Stores a file on the FTP server (non-blocking)
### Description
```
ftp_nb_put(
FTP\Connection $ftp,
string $remote_filename,
string $local_filename,
int $mode = FTP_BINARY,
int $offset = 0
): int|false
```
**ftp\_nb\_put()** stores a local file on the FTP server.
The difference between this function and the [ftp\_put()](function.ftp-put) 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.
`local_filename`
The local file path.
`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`**, or **`false`** on failure to open the local file.
### 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\_put()** example**
```
<?php
// Initiate the Upload
$ret = ftp_nb_put($ftp, "test.remote", "test.local", FTP_BINARY);
while ($ret == FTP_MOREDATA) {
// Do whatever you want
echo ".";
// Continue uploading...
$ret = ftp_nb_continue($ftp);
}
if ($ret != FTP_FINISHED) {
echo "There was an error uploading the file...";
exit(1);
}
?>
```
**Example #2 Resuming an upload with **ftp\_nb\_put()****
```
<?php
// Initiate
$ret = ftp_nb_put($ftp, "test.remote", "test.local",
FTP_BINARY, ftp_size("test.remote"));
// OR: $ret = ftp_nb_put($ftp, "test.remote", "test.local",
// FTP_BINARY, FTP_AUTORESUME);
while ($ret == FTP_MOREDATA) {
// Do whatever you want
echo ".";
// Continue uploading...
$ret = ftp_nb_continue($ftp);
}
if ($ret != FTP_FINISHED) {
echo "There was an error uploading the file...";
exit(1);
}
?>
```
### See Also
* [ftp\_nb\_fput()](function.ftp-nb-fput) - Stores a file from an open file to 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
| programming_docs |
php SQLite3Result::fetchArray SQLite3Result::fetchArray
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3Result::fetchArray — Fetches a result row as an associative or numerically indexed array or both
### Description
```
public SQLite3Result::fetchArray(int $mode = SQLITE3_BOTH): array|false
```
Fetches a result row as an associative or numerically indexed array or both. By default, fetches as both.
### Parameters
`mode`
Controls how the next row will be returned to the caller. This value must be one of either `SQLITE3_ASSOC`, `SQLITE3_NUM`, or `SQLITE3_BOTH`.
* `SQLITE3_ASSOC`: returns an array indexed by column name as returned in the corresponding result set
* `SQLITE3_NUM`: returns an array indexed by column number as returned in the corresponding result set, starting at column 0
* `SQLITE3_BOTH`: returns an array indexed by both column name and number as returned in the corresponding result set, starting at column 0
### Return Values
Returns a result row as an associatively or numerically indexed array or both. Alternately will return **`false`** if there are no more rows.
The types of the values of the returned array are mapped from SQLite3 types as follows: integers are mapped to int if they fit into the range **`PHP_INT_MIN`**..**`PHP_INT_MAX`**, and to string otherwise. Floats are mapped to float, `NULL` values are mapped to null, and strings and blobs are mapped to string.
php SplFileObject::next SplFileObject::next
===================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::next — Read next line
### Description
```
public SplFileObject::next(): void
```
Moves ahead to the next line in the file.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Examples
**Example #1 **SplFileObject::next()** example**
```
<?php
// Read through file line by line
$file = new SplFileObject("misc.txt");
while (!$file->eof()) {
echo $file->current();
$file->next();
}
?>
```
### 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::rewind()](splfileobject.rewind) - Rewind the file to the first line
* [SplFileObject::valid()](splfileobject.valid) - Not at EOF
php ldap_connect ldap\_connect
=============
(PHP 4, PHP 5, PHP 7, PHP 8)
ldap\_connect — Connect to an LDAP server
### Description
```
ldap_connect(?string $uri = null): LDAP\Connection|false
```
**Warning** The *following* signature is still supported for backwards compatibility (except for using named parameters), but is considered deprecated and should not be used anymore!
```
ldap_connect(?string $uri = null, int $port = 389): LDAP\Connection|false
```
Creates an [LDAP\Connection](class.ldap-connection) connection and checks whether the given `uri` is plausible.
> **Note**: This function does *not* open a connection. It checks whether the given parameters are plausible and can be used to open a connection as soon as one is needed.
>
>
### Parameters
`uri`
A full LDAP URI of the form `ldap://hostname:port` or `ldaps://hostname:port` for SSL encryption.
You can also provide multiple LDAP-URIs separated by a space as one string
Note that `hostname:port` is not a supported LDAP URI as the schema is missing.
`uri`
The hostname to connect to.
`port`
The port to connect to.
### Return Values
Returns an [LDAP\Connection](class.ldap-connection) instance when the provided LDAP URI seems plausible. It's a syntactic check of the provided parameter but the server(s) will not be contacted! If the syntactic check fails it returns **`false`**. **ldap\_connect()** will otherwise return a [LDAP\Connection](class.ldap-connection) instance as it does not actually connect but just initializes the connecting parameters. The actual connect happens with the next calls to ldap\_\* functions, usually with [ldap\_bind()](function.ldap-bind).
If no argument is specified then the [LDAP\Connection](class.ldap-connection) instance of the already opened connection will be returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | Returns an [LDAP\Connection](class.ldap-connection) instance now; previously, a [resource](language.types.resource) was returned. |
### Examples
**Example #1 Example of connecting to LDAP server.**
```
<?php
// LDAP variables
$ldapuri = "ldap://ldap.example.com:389"; // your ldap-uri
// Connecting to LDAP
$ldapconn = ldap_connect($ldapuri)
or die("That LDAP-URI was not parseable");
?>
```
**Example #2 Example of connecting securely to LDAP server.**
```
<?php
// make sure your host is the correct one
// that you issued your secure certificate to
$ldaphost = "ldaps://ldap.example.com/";
// Connecting to LDAP
$ldapconn = ldap_connect($ldaphost)
or die("That LDAP-URI was not parseable");
?>
```
### See Also
* [ldap\_bind()](function.ldap-bind) - Bind to LDAP directory
php ibase_delete_user ibase\_delete\_user
===================
(PHP 5, PHP 7 < 7.4.0)
ibase\_delete\_user — Delete a user from a security database
### Description
```
ibase_delete_user(resource $service_handle, string $user_name): bool
```
### Parameters
`service_handle`
The handle on the database server service.
`user_name`
The login name of the user you want to delete from the database.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [ibase\_add\_user()](function.ibase-add-user) - Add a user to a security database
* [ibase\_modify\_user()](function.ibase-modify-user) - Modify a user to a security database
php Fibers
Fibers
======
### Fibers overview
(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.
Fibers pause the entire execution stack, so the direct caller of the function does not need to change how it invokes the function.
Execution may be interrupted anywhere in the call stack using [Fiber::suspend()](fiber.suspend) (that is, the call to [Fiber::suspend()](fiber.suspend) may be in a deeply nested function or not even exist at all).
Unlike stack-less [Generator](class.generator)s, each [Fiber](class.fiber) has its own call stack, allowing them to be paused within deeply nested function calls. A function declaring an interruption point (that is, calling [Fiber::suspend()](fiber.suspend)) need not change its return type, unlike a function using [yield](language.generators.syntax#control-structures.yield) which must return a [Generator](class.generator) instance.
Fibers can be suspended in any function call, including those called from within the PHP VM, such as functions provided to [array\_map()](function.array-map) or methods called by foreach on an [Iterator](class.iterator) object.
Once suspended, execution of the fiber may be resumed with any value using [Fiber::resume()](fiber.resume) or by throwing an exception into the fiber using [Fiber::throw()](fiber.throw). The value is returned (or exception thrown) from [Fiber::suspend()](fiber.suspend).
> **Note**: Due to current limitations it is not possible to switch fibers in the destructor of an object.
>
>
**Example #1 Basic usage**
```
<?php
$fiber = new Fiber(function (): void {
$value = Fiber::suspend('fiber');
echo "Value used to resume fiber: ", $value, PHP_EOL;
});
$value = $fiber->start();
echo "Value from fiber suspending: ", $value, PHP_EOL;
$fiber->resume('test');
?>
```
The above example will output:
```
Value from fiber suspending: fiber
Value used to resume fiber: test
```
php imagecolorallocate imagecolorallocate
==================
(PHP 4, PHP 5, PHP 7, PHP 8)
imagecolorallocate — Allocate a color for an image
### Description
```
imagecolorallocate(
GdImage $image,
int $red,
int $green,
int $blue
): int|false
```
Returns a color identifier representing the color composed of the given RGB components.
**imagecolorallocate()** must be called to create each color that is to be used in the image represented by `image`.
>
> **Note**:
>
>
> The first call to **imagecolorallocate()** fills the background color in palette-based images - images created using [imagecreate()](function.imagecreate).
>
>
### 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.
These parameters are integers between 0 and 255 or hexadecimals between 0x00 and 0xFF. ### Return Values
A color identifier or **`false`** if the allocation failed.
**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 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 **imagecolorallocate()** example**
```
<?php
$im = imagecreate(100, 100);
// sets background to red
$background = imagecolorallocate($im, 255, 0, 0);
// sets some colors
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// hexadecimal way
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
$black = imagecolorallocate($im, 0x00, 0x00, 0x00);
?>
```
### See Also
* [imagecolorallocatealpha()](function.imagecolorallocatealpha) - Allocate a color for an image
* [imagecolordeallocate()](function.imagecolordeallocate) - De-allocate a color for an image
php Locale::setDefault Locale::setDefault
==================
locale\_set\_default
====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
Locale::setDefault -- locale\_set\_default — Sets the default runtime locale
### Description
Object-oriented style
```
public static Locale::setDefault(string $locale): bool
```
Procedural style
```
locale_set_default(string $locale): bool
```
Sets the default runtime locale to `locale`. This changes the value of INTL global 'default\_locale' locale identifier. UAX #35 extensions are accepted.
### Parameters
`locale`
Is a BCP 47 compliant language tag.
### Return Values
Returns **`true`**.
### Examples
**Example #1 **locale\_set\_default()** example**
```
<?php
locale_set_default('de-DE');
echo locale_get_default();
?>
```
**Example #2 OO example**
```
<?php
Locale::setDefault('de-DE');
echo Locale::getDefault();
?>
```
The above example will output:
```
de-DE
```
### See Also
* [locale\_get\_default()](locale.getdefault) - Gets the default locale value from the INTL global 'default\_locale'
php mysqli::stmt_init mysqli::stmt\_init
==================
mysqli\_stmt\_init
==================
(PHP 5, PHP 7, PHP 8)
mysqli::stmt\_init -- mysqli\_stmt\_init — Initializes a statement and returns an object for use with mysqli\_stmt\_prepare
### Description
Object-oriented style
```
public mysqli::stmt_init(): mysqli_stmt|false
```
Procedural style
```
mysqli_stmt_init(mysqli $mysql): mysqli_stmt|false
```
Allocates and initializes a statement object suitable for [mysqli\_stmt\_prepare()](mysqli-stmt.prepare).
>
> **Note**:
>
>
> Any subsequent calls to any mysqli\_stmt function will fail until [mysqli\_stmt\_prepare()](mysqli-stmt.prepare) was called.
>
>
### 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 object.
### See Also
* [mysqli\_stmt\_prepare()](mysqli-stmt.prepare) - Prepares an SQL statement for execution
php Ds\Vector::get Ds\Vector::get
==============
(PECL ds >= 1.0.0)
Ds\Vector::get — Returns the value at a given index
### Description
```
public Ds\Vector::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\Vector::get()** example**
```
<?php
$vector = new \Ds\Vector(["a", "b", "c"]);
var_dump($vector->get(0));
var_dump($vector->get(1));
var_dump($vector->get(2));
?>
```
The above example will output something similar to:
```
string(1) "a"
string(1) "b"
string(1) "c"
```
**Example #2 **Ds\Vector::get()** example using array syntax**
```
<?php
$vector = new \Ds\Vector(["a", "b", "c"]);
var_dump($vector[0]);
var_dump($vector[1]);
var_dump($vector[2]);
?>
```
The above example will output something similar to:
```
string(1) "a"
string(1) "b"
string(1) "c"
```
php EventHttp::setMaxBodySize EventHttp::setMaxBodySize
=========================
(PECL event >= 1.4.0-beta)
EventHttp::setMaxBodySize — Sets maximum request body size
### Description
```
public EventHttp::setMaxBodySize( int $value ): void
```
Sets maximum request body size.
### Parameters
`value` The body size in bytes.
### Return Values
No value is returned.
### See Also
* [EventHttp::setMaxHeadersSize()](eventhttp.setmaxheaderssize) - Sets maximum HTTP header size
php Lua::call Lua::call
=========
Lua::\_\_call
=============
(PECL lua >=0.9.0)
Lua::call -- Lua::\_\_call — Call Lua functions
### Description
```
public Lua::call(callable $lua_func, array $args = ?, int $use_self = 0): mixed
```
```
public Lua::__call(callable $lua_func, array $args = ?, int $use_self = 0): mixed
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`lua_func`
Function name in lua
`args`
Arguments passed to the Lua function
`use_self`
Whether to use `self`
### Return Values
Returns result of the called function, **`null`** for wrong arguments or **`false`** on other failure.
### Examples
**Example #1 **Lua::call()**example**
```
<?php
$lua = new Lua();
$lua->eval(<<<CODE
function dummy(foo, bar)
print(foo, ",", bar)
end
CODE
);
$lua->call("dummy", array("Lua", "geiliable\n"));
$lua->dummy("Lua", "geiliable"); // __call()
var_dump($lua->call(array("table", "concat"), array(array(1=>1, 2=>2, 3=>3), "-")));
?>
```
The above example will output:
```
Lua,geiliable
Lua,geiliable
string(5) "1-2-3"
```
### See Also
* [\_\_call()](language.oop5.overloading#object.call)
php SolrQuery::getFacetSort SolrQuery::getFacetSort
=======================
(PECL solr >= 0.9.2)
SolrQuery::getFacetSort — Returns the facet sort type
### Description
```
public SolrQuery::getFacetSort(string $field_override = ?): int
```
Returns an integer (SolrQuery::FACET\_SORT\_INDEX or SolrQuery::FACET\_SORT\_COUNT)
### Parameters
`field_override`
The name of the field
### Return Values
Returns an integer (SolrQuery::FACET\_SORT\_INDEX or SolrQuery::FACET\_SORT\_COUNT) on success or **`null`** if not set.
php NoRewindIterator::rewind NoRewindIterator::rewind
========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
NoRewindIterator::rewind — Prevents the rewind operation on the inner iterator
### Description
```
public NoRewindIterator::rewind(): void
```
Prevents the rewind operation on the inner iterator.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Examples
**Example #1 **NoRewindIterator::rewind()** example**
This example demonstrates that calling rewind on a NoRewindIterator object has no effect.
```
<?php
$fruits = array("lemon", "orange", "apple", "pear");
$noRewindIterator = new NoRewindIterator(new ArrayIterator($fruits));
echo $noRewindIterator->current() . "\n";
$noRewindIterator->next();
// now rewind the iterator (nothing should happen)
$noRewindIterator->rewind();
echo $noRewindIterator->current() . "\n";
?>
```
The above example will output:
```
lemon
orange
```
php zip_close zip\_close
==========
(PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.0.0)
zip\_close — Close 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_close(resource $zip): void
```
Closes the given ZIP file archive.
### Parameters
`zip`
A ZIP file previously opened with [zip\_open()](function.zip-open).
### Return Values
No value is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function is deprecated in favor of the Object API, see [ZipArchive::close()](ziparchive.close). |
### 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 Imagick::getImageCompressionQuality Imagick::getImageCompressionQuality
===================================
(PECL imagick 2 >= 2.2.2, PECL imagick 3)
Imagick::getImageCompressionQuality — Gets the current image's compression quality
### Description
```
public Imagick::getImageCompressionQuality(): int
```
Gets the current image's compression quality
### Parameters
This function has no parameters.
### Return Values
Returns integer describing the images compression quality
php Zookeeper::getRecvTimeout Zookeeper::getRecvTimeout
=========================
(PECL zookeeper >= 0.1.0)
Zookeeper::getRecvTimeout — Return the timeout for this session, only valid if the connections is currently connected (ie. last watcher state is ZOO\_CONNECTED\_STATE). This value may change after a server re-connect
### Description
```
public Zookeeper::getRecvTimeout(): int
```
### Parameters
This function has no parameters.
### Return Values
Returns the timeout for this session on success, and false on failure.
### Errors/Exceptions
This method emits PHP error/warning when operation fails.
**Caution** Since version 0.3.0, this method emits [ZookeeperException](class.zookeeperexception) and it's derivatives.
### See Also
* [Zookeeper::\_\_construct()](zookeeper.construct) - Create a handle to used communicate with zookeeper
* [Zookeeper::connect()](zookeeper.connect) - Create a handle to used communicate with zookeeper
* [ZookeeperException](class.zookeeperexception)
php AppendIterator::valid AppendIterator::valid
=====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
AppendIterator::valid — Checks validity of the current element
### Description
```
public AppendIterator::valid(): bool
```
Checks validity of the current element.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the current iteration is valid, **`false`** otherwise.
### See Also
* [AppendIterator::current()](appenditerator.current) - Gets the current value
* [AppendIterator::key()](appenditerator.key) - Gets the current key
* [AppendIterator::next()](appenditerator.next) - Moves to the next element
* [AppendIterator::rewind()](appenditerator.rewind) - Rewinds the Iterator
| programming_docs |
php Imagick::getImageGamma Imagick::getImageGamma
======================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageGamma — Gets the image gamma
### Description
```
public Imagick::getImageGamma(): float
```
Gets the image gamma.
### Parameters
This function has no parameters.
### Return Values
Returns the image gamma on success.
### Errors/Exceptions
Throws ImagickException on error.
php image2wbmp image2wbmp
==========
(PHP 4 >= 4.0.5, PHP 5, PHP 7)
image2wbmp — Output image to browser or file
**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
```
image2wbmp(resource $image, string $filename = ?, int $foreground = ?): bool
```
**image2wbmp()** outputs or save a WBMP version of the given `image`.
### Parameters
`image`
An image resource, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`filename`
Path to the saved file. If not given, the raw image stream will be output directly.
`foreground`
You can set the foreground color with this parameter by setting an identifier obtained from [imagecolorallocate()](function.imagecolorallocate). The default foreground color is black.
### Return Values
Returns **`true`** on success or **`false`** on failure.
**Caution**However, if libgd fails to output the image, this function returns **`true`**.
### Examples
**Example #1 **image2wbmp()** example**
```
<?php
$file = 'php.png';
$image = imagecreatefrompng($file);
header('Content-Type: ' . image_type_to_mime_type(IMAGETYPE_WBMP));
image2wbmp($image); // output the stream directly
imagedestroy($image);
?>
```
### See Also
* [imagewbmp()](function.imagewbmp) - Output image to browser or file
php Imagick::getImageMatte Imagick::getImageMatte
======================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageMatte — Return if the image has a matte channel
**Warning**This function has been *DEPRECATED* as of Imagick 3.4.4. Relying on this function is highly discouraged.
### Description
```
public Imagick::getImageMatte(): bool
```
Returns **`true`** if the image has a matte channel otherwise false. 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.
php Imagick::getImageArtifact Imagick::getImageArtifact
=========================
(PECL imagick 3)
Imagick::getImageArtifact — Get image artifact
### Description
```
public Imagick::getImageArtifact(string $artifact): string
```
Gets an artifact associated with the image. The difference between image properties and image artifacts is that properties are public and artifacts are private. This method is available if Imagick has been compiled against ImageMagick version 6.5.7 or newer.
### Parameters
`artifact`
The name of the artifact
### Return Values
Returns the artifact value on success.
### Errors/Exceptions
Throws ImagickException on error.
### See Also
* [Imagick::setImageArtifact()](imagick.setimageartifact) - Set image artifact
* [Imagick::deleteImageArtifact()](imagick.deleteimageartifact) - Delete image artifact
php array_flip array\_flip
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
array\_flip — Exchanges all keys with their associated values in an array
### Description
```
array_flip(array $array): array
```
**array\_flip()** returns an array in flip order, i.e. keys from `array` become values and values from `array` become keys.
Note that the values of `array` need to be valid keys, i.e. they need to be either int or string. A warning will be emitted if a value has the wrong type, and the key/value pair in question *will not be included in the result*.
If a value has several occurrences, the latest key will be used as its value, and all others will be lost.
### Parameters
`array`
An array of key/value pairs to be flipped.
### Return Values
Returns the flipped array.
### Examples
**Example #1 **array\_flip()** example**
```
<?php
$input = array("oranges", "apples", "pears");
$flipped = array_flip($input);
print_r($flipped);
?>
```
The above example will output:
```
Array
(
[oranges] => 0
[apples] => 1
[pears] => 2
)
```
**Example #2 **array\_flip()** example : collision**
```
<?php
$input = array("a" => 1, "b" => 1, "c" => 2);
$flipped = array_flip($input);
print_r($flipped);
?>
```
The above example will output:
```
Array
(
[1] => b
[2] => c
)
```
### See Also
* [array\_values()](function.array-values) - Return all the values of an array
* [array\_keys()](function.array-keys) - Return all the keys or a subset of the keys of an array
* [array\_reverse()](function.array-reverse) - Return an array with elements in reverse order
php RecursiveCallbackFilterIterator::hasChildren RecursiveCallbackFilterIterator::hasChildren
============================================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
RecursiveCallbackFilterIterator::hasChildren — Check whether the inner iterator's current element has children
### Description
```
public RecursiveCallbackFilterIterator::hasChildren(): bool
```
Returns **`true`** if the current element has children, **`false`** otherwise.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the current element has children, **`false`** otherwise.
### Examples
**Example #1 **RecursiveCallbackFilterIterator::hasChildren()** basic usage**
```
<?php
$dir = new RecursiveDirectoryIterator(__DIR__);
// Recursively iterate over XML files
$files = new RecursiveCallbackFilterIterator($dir, function ($current, $key, $iterator) {
// Allow recursion into directories
if ($iterator->hasChildren()) {
return TRUE;
}
// Check for XML file
if (!strcasecmp($current->getExtension(), 'xml')) {
return TRUE;
}
return FALSE;
});
?>
```
### See Also
* [RecursiveCallbackFilterIterator Examples](class.recursivecallbackfilteriterator#recursivecallbackfilteriterator.examples)
* [RecursiveCallbackFilterIterator::\_\_construct()](recursivecallbackfilteriterator.construct) - Create a RecursiveCallbackFilterIterator from a RecursiveIterator
* [RecursiveCallbackFilteriterator::getChildren()](recursivecallbackfilteriterator.getchildren) - Return the inner iterator's children contained in a RecursiveCallbackFilterIterator
php asort asort
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
asort — Sort an array in ascending order and maintain index association
### Description
```
asort(array &$array, int $flags = SORT_REGULAR): bool
```
Sorts `array` in place in ascending order, such that its keys maintain their correlation with the values they are associated with.
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.
>
>
>
> **Note**:
>
>
> Resets array's internal pointer to the first element.
>
>
### Parameters
`array`
The input array.
`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 **asort()** example**
```
<?php
$fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple");
asort($fruits);
foreach ($fruits as $key => $val) {
echo "$key = $val\n";
}
?>
```
The above example will output:
```
c = apple
b = banana
d = lemon
a = orange
```
The fruits have been sorted in alphabetical order, and the index associated with each element has been maintained.
### See Also
* [sort()](function.sort) - Sort an array in ascending order
* [arsort()](function.arsort) - Sort an array in descending order and maintain index association
* The [comparison of array sorting functions](https://www.php.net/manual/en/array.sorting.php)
php eio_grp_limit eio\_grp\_limit
===============
(PECL eio >= 0.0.1dev)
eio\_grp\_limit — Set group limit
### Description
```
eio_grp_limit(resource $grp, int $limit): void
```
Limit number of requests in the request group.
### Parameters
`grp`
The request group resource.
`limit`
Number of requests in the group.
### Return Values
No value is returned.
### See Also
* [eio\_grp\_add()](function.eio-grp-add) - Adds a request to the request group
php Ds\Set::merge Ds\Set::merge
=============
(PECL ds >= 1.0.3)
Ds\Set::merge — Returns the result of adding all given values to the set
### Description
```
public Ds\Set::merge(mixed $values): Ds\Set
```
Returns the result of adding all given values to the set.
### Parameters
`values`
A [traversable](class.traversable) object or an array.
### Return Values
The result of adding all given values to the set, effectively the same as adding the values to a copy, then returning that copy.
>
> **Note**:
>
>
> The current instance won't be affected.
>
>
### Examples
**Example #1 **Ds\Set::merge()** example**
```
<?php
$set = new \Ds\Set([1, 2, 3]);
var_dump($set->merge([3, 4, 5]));
var_dump($set);
?>
```
The above example will output something similar to:
```
object(Ds\Set)#2 (6) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
[4]=>
int(5)
}
object(Ds\Set)#1 (3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
```
php DOMNamedNodeMap::item DOMNamedNodeMap::item
=====================
(PHP 5, PHP 7, PHP 8)
DOMNamedNodeMap::item — Retrieves a node specified by index
### Description
```
public DOMNamedNodeMap::item(int $index): ?DOMNode
```
Retrieves a node specified by `index` within the [DOMNamedNodeMap](class.domnamednodemap) object.
### Parameters
`index`
Index into this map.
### Return Values
The node at the `index`th position in the map, or **`null`** if that is not a valid index (greater than or equal to the number of nodes in this map).
php SolrGenericResponse::__construct SolrGenericResponse::\_\_construct
==================================
(PECL solr >= 0.9.2)
SolrGenericResponse::\_\_construct — Constructor
### Description
public **SolrGenericResponse::\_\_construct**() Constructor
### Parameters
This function has no parameters.
### Return Values
None
php LimitIterator::next LimitIterator::next
===================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
LimitIterator::next — Move the iterator forward
### Description
```
public LimitIterator::next(): void
```
Moves the iterator forward.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### 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::seek()](limititerator.seek) - Seek to the given position
* [LimitIterator::valid()](limititerator.valid) - Check whether the current element is valid
php ZipArchive::registerProgressCallback ZipArchive::registerProgressCallback
====================================
(PHP >= 8.0.0, PECL zip >= 1.17.0)
ZipArchive::registerProgressCallback — Register a callback to provide updates during archive close.
### Description
```
public ZipArchive::registerProgressCallback(float $rate, callable $callback): bool
```
Register a `callback` function to provide updates during archive close.
### Parameters
`rate`
Change between each call of the callback (from 0.0 to 1.0).
`callback`
This function will receive the current `state` as a float (from 0.0 to 1.0).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
This example creates a ZIP file archive php.zip and show progression.
**Example #1 Archive a file**
```
$zip = new ZipArchive();
if ($zip->open('php.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE)) {
$zip->addFile(PHP_BINARY, 'php');
$zip->registerProgressCallback(0.05, function ($r) {
printf("%d%%\n", $r * 100);
});
$zip->close();
}
```
### Notes
>
> **Note**:
>
>
> This function is only available if built against libzip ≥ 1.3.0.
>
>
### See Also
* [ZipArchive::registerCancelCallback()](ziparchive.registercancelcallback) - Register a callback to allow cancellation during archive close.
php Imagick::setImageVirtualPixelMethod Imagick::setImageVirtualPixelMethod
===================================
(PECL imagick 2, PECL imagick 3)
Imagick::setImageVirtualPixelMethod — Sets the image virtual pixel method
### Description
```
public Imagick::setImageVirtualPixelMethod(int $method): bool
```
Sets the image virtual pixel method.
### Parameters
`method`
### Return Values
Returns **`true`** on success.
php imap_rename imap\_rename
============
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_rename — Alias of [imap\_renamemailbox()](function.imap-renamemailbox)
### Description
This function is an alias of: [imap\_renamemailbox()](function.imap-renamemailbox).
php Ds\Vector::isEmpty Ds\Vector::isEmpty
==================
(PECL ds >= 1.0.0)
Ds\Vector::isEmpty — Returns whether the vector is empty
### Description
```
public Ds\Vector::isEmpty(): bool
```
Returns whether the vector is empty.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the vector is empty, **`false`** otherwise.
### Examples
**Example #1 **Ds\Vector::isEmpty()** example**
```
<?php
$a = new \Ds\Vector([1, 2, 3]);
$b = new \Ds\Vector();
var_dump($a->isEmpty());
var_dump($b->isEmpty());
?>
```
The above example will output something similar to:
```
bool(false)
bool(true)
```
php SplFileInfo::getSize SplFileInfo::getSize
====================
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
SplFileInfo::getSize — Gets file size
### Description
```
public SplFileInfo::getSize(): int|false
```
Returns the filesize in bytes for the file referenced.
### Parameters
This function has no parameters.
### Return Values
The filesize in bytes on success, or **`false`** on failure.
### Errors/Exceptions
A [RuntimeException](class.runtimeexception) will be thrown if the file does not exist or an error occurs.
### See Also
* [filesize()](function.filesize) - Gets file size
php UConverter::getDestinationEncoding UConverter::getDestinationEncoding
==================================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
UConverter::getDestinationEncoding — Get the destination encoding
### Description
```
public UConverter::getDestinationEncoding(): string|false|null
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php None PHP tags
--------
When PHP parses a file, it looks for opening and closing tags, which are `<?php` and `?>` which tell PHP to start and stop interpreting the code between them. Parsing in this manner allows PHP to be embedded in all sorts of different documents, as everything outside of a pair of opening and closing tags is ignored by the PHP parser.
PHP includes a short echo tag `<?=` which is a short-hand to the more verbose `<?php echo`.
**Example #1 PHP Opening and Closing Tags**
```
1. <?php echo 'if you want to serve PHP code in XHTML or XML documents,
use these tags'; ?>
2. You can use the short echo tag to <?= 'print this string' ?>.
It's equivalent to <?php echo 'print this string' ?>.
3. <? echo 'this code is within short tags, but will only work '.
'if short_open_tag is enabled'; ?>
```
Short tags (example three) are available by default but can be disabled either via the [short\_open\_tag](https://www.php.net/manual/en/ini.core.php#ini.short-open-tag) php.ini configuration file directive, or are disabled by default if PHP is built with the **--disable-short-tags** configuration.
>
> **Note**:
>
>
> As short tags can be disabled it is recommended to only use the normal tags (`<?php ?>` and `<?= ?>`) to maximise compatibility.
>
>
If a file contains only PHP code, it is preferable to omit the PHP closing tag at the end of the file. This prevents accidental whitespace or new lines being added after the PHP closing tag, which may cause unwanted effects because PHP will start output buffering when there is no intention from the programmer to send any output at that point in the script.
```
<?php
echo "Hello world";
// ... more code
echo "Last statement";
// the script ends here with no PHP closing tag
```
php Imagick::segmentImage Imagick::segmentImage
=====================
(PECL imagick 2 >= 2.3.0, PECL imagick 3)
Imagick::segmentImage — Segments an image
### Description
```
public Imagick::segmentImage(
int $COLORSPACE,
float $cluster_threshold,
float $smooth_threshold,
bool $verbose = false
): bool
```
Analyses the image and identifies units that are similar. This method is available if Imagick has been compiled against ImageMagick version 6.4.5 or newer.
### Parameters
`COLORSPACE`
One of the [COLORSPACE constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.colorspace).
`cluster_threshold`
A percentage describing minimum number of pixels contained in hexedra before it is considered valid.
`smooth_threshold`
Eliminates noise from the histogram.
`verbose`
Whether to output detailed information about recognised classes.
### Return Values
### Examples
**Example #1 **Imagick::segmentImage()****
```
<?php
function segmentImage($imagePath, $colorSpace, $clusterThreshold, $smoothThreshold) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->segmentImage($colorSpace, $clusterThreshold, $smoothThreshold);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
segmentImage($imagePath, \Imagick::COLORSPACE_RGB, 5, 5);
?>
```
php xml_set_default_handler xml\_set\_default\_handler
==========================
(PHP 4, PHP 5, PHP 7, PHP 8)
xml\_set\_default\_handler — Set up default handler
### Description
```
xml_set_default_handler(XMLParser $parser, callable $handler): bool
```
Sets the default handler function for the XML parser `parser`.
### Parameters
`parser`
A reference to the XML parser to set up default handler function.
`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 two parameters:
```
handler(XMLParser $parser, string $data)
```
`parser` The first parameter, parser, is a reference to the XML parser calling the handler. `data` The second parameter, `data`, contains the character data.This may be the XML declaration, document type declaration, entities or other data for which no other handler exists. 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. |
| programming_docs |
php EventBufferEvent::sslFilter EventBufferEvent::sslFilter
===========================
(PECL event >= 1.2.6-beta)
EventBufferEvent::sslFilter — Create a new SSL buffer event to send its data over another buffer event
### Description
```
public static EventBufferEvent::sslFilter(
EventBase $base ,
EventBufferEvent $underlying ,
EventSslContext $ctx ,
int $state ,
int $options = 0
): EventBufferEvent
```
Create a new SSL buffer event to send its data over another buffer event
>
> **Note**:
>
>
> This function is available only if `Event` is compiled with OpenSSL support.
>
>
### Parameters
`base` Associated event base.
`underlying` A socket buffer event to use for this SSL.
`ctx` Object of [EventSslContext](class.eventsslcontext) class.
`state` The current state of SSL connection: **`EventBufferEvent::SSL_OPEN`** , **`EventBufferEvent::SSL_ACCEPTING`** or **`EventBufferEvent::SSL_CONNECTING`** .
`options` One or more buffer event options.
### Return Values
Returns a new SSL [EventBufferEvent](class.eventbufferevent) object.
### Examples
**Example #1 Simple SMTP server**
```
<?php
/*
* Author: Andrew Rose <hello at andrewrose dot co dot uk>
*
* Usage:
* 1) Prepare cert.pem certificate and privkey.pem private key files.
* 2) Launch the server script
* 3) Open TLS connection, e.g.:
* $ openssl s_client -connect localhost:25 -starttls smtp -crlf
* 4) Start testing the commands listed in `cmd` method below.
*/
class Handler {
public $domainName = FALSE;
public $connections = [];
public $buffers = [];
public $maxRead = 256000;
public function __construct() {
$this->ctx = new EventSslContext(EventSslContext::SSLv3_SERVER_METHOD, [
EventSslContext::OPT_LOCAL_CERT => 'cert.pem',
EventSslContext::OPT_LOCAL_PK => 'privkey.pem',
//EventSslContext::OPT_PASSPHRASE => '',
EventSslContext::OPT_VERIFY_PEER => false, // change to true with authentic cert
EventSslContext::OPT_ALLOW_SELF_SIGNED => true // change to false with authentic cert
]);
$this->base = new EventBase();
if (!$this->base) {
exit("Couldn't open event base\n");
}
if (!$this->listener = new EventListener($this->base,
[$this, 'ev_accept'],
$this->ctx,
EventListener::OPT_CLOSE_ON_FREE | EventListener::OPT_REUSEABLE,
-1,
'0.0.0.0:25'))
{
exit("Couldn't create listener\n");
}
$this->listener->setErrorCallback([$this, 'ev_error']);
$this->base->dispatch();
}
public function ev_accept($listener, $fd, $address, $ctx) {
static $id = 0;
$id += 1;
$this->connections[$id]['clientData'] = '';
$this->connections[$id]['cnx'] = new EventBufferEvent($this->base, $fd,
EventBufferEvent::OPT_CLOSE_ON_FREE);
if (!$this->connections[$id]['cnx']) {
echo "Failed creating buffer\n";
$this->base->exit(NULL);
exit(1);
}
$this->connections[$id]['cnx']->setCallbacks([$this, "ev_read"], NULL,
[$this, 'ev_error'], $id);
$this->connections[$id]['cnx']->enable(Event::READ | Event::WRITE);
$this->ev_write($id, '220 '.$this->domainName." wazzzap?\r\n");
}
function ev_error($listener, $ctx) {
$errno = EventUtil::getLastSocketErrno();
fprintf(STDERR, "Got an error %d (%s) on the listener. Shutting down.\n",
$errno, EventUtil::getLastSocketError());
if ($errno != 0) {
$this->base->exit(NULL);
exit();
}
}
public function ev_close($id) {
$this->connections[$id]['cnx']->disable(Event::READ | Event::WRITE);
unset($this->connections[$id]);
}
protected function ev_write($id, $string) {
echo 'S('.$id.'): '.$string;
$this->connections[$id]['cnx']->write($string);
}
public function ev_read($buffer, $id) {
while($buffer->input->length > 0) {
$this->connections[$id]['clientData'] .= $buffer->input->read($this->maxRead);
$clientDataLen = strlen($this->connections[$id]['clientData']);
if($this->connections[$id]['clientData'][$clientDataLen-1] == "\n"
&& $this->connections[$id]['clientData'][$clientDataLen-2] == "\r")
{
// remove the trailing \r\n
$line = substr($this->connections[$id]['clientData'], 0,
strlen($this->connections[$id]['clientData']) - 2);
$this->connections[$id]['clientData'] = '';
$this->cmd($buffer, $id, $line);
}
}
}
protected function cmd($buffer, $id, $line) {
switch ($line) {
case strncmp('EHLO ', $line, 4):
$this->ev_write($id, "250-STARTTLS\r\n");
$this->ev_write($id, "250 OK ehlo\r\n");
break;
case strncmp('HELO ', $line, 4):
$this->ev_write($id, "250-STARTTLS\r\n");
$this->ev_write($id, "250 OK helo\r\n");
break;
case strncmp('QUIT', $line, 3):
$this->ev_write($id, "250 OK quit\r\n");
$this->ev_close($id);
break;
case strncmp('STARTTLS', $line, 3):
$this->ev_write($id, "220 Ready to start TLS\r\n");
$this->connections[$id]['cnx'] = EventBufferEvent::sslFilter($this->base,
$this->connections[$id]['cnx'], $this->ctx,
EventBufferEvent::SSL_ACCEPTING,
EventBufferEvent::OPT_CLOSE_ON_FREE);
$this->connections[$id]['cnx']->setCallbacks([$this, "ev_read"], NULL, [$this, 'ev_error'], $id);
$this->connections[$id]['cnx']->enable(Event::READ | Event::WRITE);
break;
default:
echo 'unknown command: '.$line."\n";
break;
}
}
}
new Handler();
```
### See Also
* [EventBufferEvent::sslSocket()](eventbufferevent.sslsocket) - Creates a new SSL buffer event to send its data over an SSL on a socket
php SplFileObject::getFlags SplFileObject::getFlags
=======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::getFlags — Gets flags for the SplFileObject
### Description
```
public SplFileObject::getFlags(): int
```
Gets the flags set for an instance of SplFileObject as an int.
### Parameters
This function has no parameters.
### Return Values
Returns an int representing the flags.
### Examples
**Example #1 **SplFileObject::getFlags()** example**
```
<?php
$file = new SplFileObject(__FILE__, "r");
if ($file->getFlags() & SplFileObject::SKIP_EMPTY) {
echo "Skipping empty lines\n";
} else {
echo "Not skipping empty lines\n";
}
$file->setFlags(SplFileObject::SKIP_EMPTY);
if ($file->getFlags() & SplFileObject::SKIP_EMPTY) {
echo "Skipping empty lines\n";
} else {
echo "Not skipping empty lines\n";
}
?>
```
The above example will output something similar to:
```
Not skipping empty lines
Skipping empty lines
```
### See Also
* [SplFileObject::setFlags()](splfileobject.setflags) - Sets flags for the SplFileObject
php Ds\PriorityQueue::__construct Ds\PriorityQueue::\_\_construct
===============================
(PECL ds >= 1.0.0)
Ds\PriorityQueue::\_\_construct — Creates a new instance
### Description
public **Ds\PriorityQueue::\_\_construct**() Creates a new instance.
### Examples
**Example #1 **Ds\PriorityQueue::\_\_construct()** example**
```
<?php
$queue = new \Ds\PriorityQueue();
var_dump($queue);
?>
```
The above example will output something similar to:
```
object(Ds\PriorityQueue)#1 (0) {
}
```
php Phar::setSignatureAlgorithm Phar::setSignatureAlgorithm
===========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.1.0)
Phar::setSignatureAlgorithm — Set the signature algorithm for a phar and apply it
### Description
```
public Phar::setSignatureAlgorithm(int $algo, ?string $privateKey = 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.
>
>
>
set the signature algorithm for a phar and apply it. The signature algorithm must be one of `Phar::MD5`, `Phar::SHA1`, `Phar::SHA256`, `Phar::SHA512`, or `Phar::OPENSSL`.
Note that all executable phar archives have a signature created automatically, `SHA1` by default. data tar- or zip-based archives (archives created with the [PharData](class.phardata) class) must have their signature created and set explicitly via **Phar::setSignatureAlgorithm()**.
### Parameters
`algo`
One of `Phar::MD5`, `Phar::SHA1`, `Phar::SHA256`, `Phar::SHA512`, or `Phar::OPENSSL`
`privateKey`
The contents of an OpenSSL private key, as extracted from a certificate or OpenSSL key file:
```
<?php
$private = openssl_get_privatekey(file_get_contents('private.pem'));
$pkey = '';
openssl_pkey_export($private, $pkey);
$p->setSignatureAlgorithm(Phar::OPENSSL, $pkey);
?>
```
See [phar introduction](https://www.php.net/manual/en/phar.using.php) for instructions on naming and placement of the public key file. ### Return Values
No value is returned.
### Errors/Exceptions
Throws [UnexpectedValueException](class.unexpectedvalueexception) for many errors, and a [PharException](class.pharexception) if any problems occur flushing changes to disk.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `privateKey` is now nullable. |
### See Also
* [Phar::getSupportedSignatures()](phar.getsupportedsignatures) - Return array of supported signature types
* [Phar::getSignature()](phar.getsignature) - Return MD5/SHA1/SHA256/SHA512/OpenSSL signature of a Phar archive
php SolrQuery::getExpandFilterQueries SolrQuery::getExpandFilterQueries
=================================
(PECL solr >= 2.2.0)
SolrQuery::getExpandFilterQueries — Returns the expand filter queries
### Description
```
public SolrQuery::getExpandFilterQueries(): array
```
Returns the expand filter queries
### Parameters
This function has no parameters.
### Return Values
Returns the expand filter queries.
php apcu_fetch apcu\_fetch
===========
(PECL apcu >= 4.0.0)
apcu\_fetch — Fetch a stored variable from the cache
### Description
```
apcu_fetch(mixed $key, bool &$success = ?): mixed
```
Fetches an entry from the cache.
### Parameters
`key`
The `key` used to store the value (with [apcu\_store()](function.apcu-store)). If an array is passed then each element is fetched and returned.
`success`
Set to **`true`** in success and **`false`** in failure.
### Return Values
The stored variable or array of variables on success; **`false`** on failure
### Changelog
| Version | Description |
| --- | --- |
| PECL apcu 3.0.17 | The `success` parameter was added. |
### Examples
**Example #1 A **apcu\_fetch()** example**
```
<?php
$bar = 'BAR';
apcu_store('foo', $bar);
var_dump(apcu_fetch('foo'));
?>
```
The above example will output:
```
string(3) "BAR"
```
### See Also
* [apcu\_store()](function.apcu-store) - Cache a variable in the data store
* [apcu\_delete()](function.apcu-delete) - Removes a stored variable from the cache
* [APCUIterator](class.apcuiterator)
php DOMNode::C14N DOMNode::C14N
=============
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
DOMNode::C14N — Canonicalize nodes to a string
### Description
```
public DOMNode::C14N(
bool $exclusive = false,
bool $withComments = false,
?array $xpath = null,
?array $nsPrefixes = null
): string|false
```
Canonicalize nodes to a string
### Parameters
`exclusive`
Enable exclusive parsing of only the nodes matched by the provided xpath or namespace prefixes.
`withComments`
Retain comments in output.
`xpath`
An array of `xpath`s to filter the nodes by.
`nsPrefixes`
An array of namespace prefixes to filter the nodes by.
### Return Values
Returns canonicalized nodes as a string or **`false`** on failure
### See Also
* [DOMNode::C14NFile()](domnode.c14nfile) - Canonicalize nodes to a file
php imagegif imagegif
========
(PHP 4, PHP 5, PHP 7, PHP 8)
imagegif — Output image to browser or file
### Description
```
imagegif(GdImage $image, resource|string|null $file = null): bool
```
**imagegif()** creates the GIF file in `file` from the image `image`. The `image` argument is the return from the [imagecreate()](function.imagecreate) or `imagecreatefrom*` function.
The image format will be GIF87a unless the image has been made transparent with [imagecolortransparent()](function.imagecolortransparent), in which case the image format will be GIF89a.
### 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.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 Outputting an image using **imagegif()****
```
<?php
// Create a new image instance
$im = imagecreatetruecolor(100, 100);
// Make the background white
imagefilledrectangle($im, 0, 0, 99, 99, 0xFFFFFF);
// Draw a text string on the image
imagestring($im, 3, 40, 20, 'GD Library', 0xFFBA00);
// Output the image to browser
header('Content-Type: image/gif');
imagegif($im);
imagedestroy($im);
?>
```
**Example #2 Converting a PNG image to GIF using **imagegif()****
```
<?php
// Load the PNG
$png = imagecreatefrompng('./php.png');
// Save the image as a GIF
imagegif($png, './php.gif');
// Free from memory
imagedestroy($png);
// We're done
echo 'Converted PNG image to GIF with success!';
?>
```
### Notes
>
> **Note**:
>
>
> The following code snippet allows you to write more portable PHP applications by auto-detecting the type of GD support which is available. Replace the sequence `header ("Content-Type: image/gif");
> imagegif ($im);` by the more flexible sequence:
>
>
>
> ```
> <?php
> // Create a new image instance
> $im = imagecreatetruecolor(100, 100);
>
> // Do some image operations here
>
> // Handle output
> if(function_exists('imagegif'))
> {
> // For GIF
> header('Content-Type: image/gif');
>
> imagegif($im);
> }
> elseif(function_exists('imagejpeg'))
> {
> // For JPEG
> header('Content-Type: image/jpeg');
>
> imagejpeg($im, NULL, 100);
> }
> elseif(function_exists('imagepng'))
> {
> // For PNG
> header('Content-Type: image/png');
>
> imagepng($im);
> }
> elseif(function_exists('imagewbmp'))
> {
> // For WBMP
> header('Content-Type: image/vnd.wap.wbmp');
>
> imagewbmp($im);
> }
> else
> {
> imagedestroy($im);
>
> die('No image support in this PHP server');
> }
>
> // If image support was found for one of these
> // formats, then free it from memory
> if($im)
> {
> imagedestroy($im);
> }
> ?>
> ```
>
>
> **Note**:
>
>
> You can use the function [imagetypes()](function.imagetypes) for checking the presence of the various supported image formats:
>
>
>
> ```
> <?php
> if(imagetypes() & IMG_GIF)
> {
> header('Content-Type: image/gif');
> imagegif($im);
> }
> elseif(imagetypes() & IMG_JPG)
> {
> /* ... etc. */
> }
> ?>
> ```
>
### See Also
* [imagepng()](function.imagepng) - Output a PNG image to either the browser or a file
* [imagewbmp()](function.imagewbmp) - Output image to browser or file
* [imagejpeg()](function.imagejpeg) - Output image to browser or file
* [imagetypes()](function.imagetypes) - Return the image types supported by this PHP build
php The APCUIterator class
The APCUIterator class
======================
Introduction
------------
(PECL apcu >= 5.0.0)
The **APCUIterator** class makes it easier to iterate over large APCu caches. This is helpful as it allows iterating over large caches in steps, while grabbing a defined number of entries per lock instance, so it frees the cache locks for other activities rather than hold up the entire cache to grab 100 (the default) entries. Also, using regular expression matching is more efficient as it's been moved to the C level.
Class synopsis
--------------
class **APCUIterator** implements [Iterator](class.iterator) { /\* Methods \*/ public [\_\_construct](apcuiterator.construct)(
array|string|null `$search` = **`null`**,
int `$format` = APC\_ITER\_ALL,
int `$chunk_size` = 100,
int `$list` = APC\_LIST\_ACTIVE
)
```
public current(): mixed
```
```
public getTotalCount(): int
```
```
public getTotalHits(): int
```
```
public getTotalSize(): int
```
```
public key(): string
```
```
public next(): bool
```
```
public rewind(): void
```
```
public valid(): bool
```
} Table of Contents
-----------------
* [APCUIterator::\_\_construct](apcuiterator.construct) — Constructs an APCUIterator iterator object
* [APCUIterator::current](apcuiterator.current) — Get current item
* [APCUIterator::getTotalCount](apcuiterator.gettotalcount) — Get total count
* [APCUIterator::getTotalHits](apcuiterator.gettotalhits) — Get total cache hits
* [APCUIterator::getTotalSize](apcuiterator.gettotalsize) — Get total cache size
* [APCUIterator::key](apcuiterator.key) — Get iterator key
* [APCUIterator::next](apcuiterator.next) — Move pointer to next item
* [APCUIterator::rewind](apcuiterator.rewind) — Rewinds iterator
* [APCUIterator::valid](apcuiterator.valid) — Checks if current position is valid
php SplFileObject::valid SplFileObject::valid
====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::valid — Not at EOF
### Description
```
public SplFileObject::valid(): bool
```
Check whether EOF has been reached.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if not reached EOF, **`false`** otherwise.
### Examples
**Example #1 **SplFileObject::valid()** example**
```
<?php
// Loop over a file, line by line
$file = new SplFileObject("file.txt");
while ($file->valid()) {
echo $file->fgets();
}
?>
```
### 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::rewind()](splfileobject.rewind) - Rewind the file to the first line
php ReflectionAttribute::getName ReflectionAttribute::getName
============================
(PHP 8)
ReflectionAttribute::getName — Gets attribute name
### Description
```
public ReflectionAttribute::getName(): string
```
Gets the attributes name.
### Parameters
This function has no parameters.
### Return Values
The name of the attribute.
php ssh2_sftp ssh2\_sftp
==========
(PECL ssh2 >= 0.9.0)
ssh2\_sftp — Initialize SFTP subsystem
### Description
```
ssh2_sftp(resource $session): resource|false
```
Request the SFTP subsystem from an already connected SSH2 server.
### Parameters
`session`
An SSH connection link identifier, obtained from a call to [ssh2\_connect()](function.ssh2-connect).
### Return Values
This method returns an `SSH2 SFTP` resource for use with all other ssh2\_sftp\_\*() methods and the [ssh2.sftp://](https://www.php.net/manual/en/wrappers.ssh2.php) fopen wrapper, or **`false`** on failure.
### Examples
**Example #1 Opening a file via SFTP**
```
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$sftp = ssh2_sftp($connection);
$stream = fopen('ssh2.sftp://' . intval($sftp) . '/path/to/file', 'r');
?>
```
### See Also
* [ssh2\_scp\_recv()](function.ssh2-scp-recv) - Request a file via SCP
* [ssh2\_scp\_send()](function.ssh2-scp-send) - Send a file via SCP
| programming_docs |
php geoip_asnum_by_name geoip\_asnum\_by\_name
======================
(PECL geoip >= 1.1.0)
geoip\_asnum\_by\_name — Get the Autonomous System Numbers (ASN)
### Description
```
geoip_asnum_by_name(string $hostname): string
```
The **geoip\_asnum\_by\_name()** function will return the Autonomous System Numbers (ASN) associated with an IP address.
### Parameters
`hostname`
The hostname or IP address.
### Return Values
Returns the ASN on success, or **`false`** if the address cannot be found in the database.
### Examples
**Example #1 A **geoip\_asnum\_by\_name()** example**
This will output the ASN of the host www.example.com.
```
<?php
$asn = geoip_asnum_by_name('www.example.com');
if ($asn) {
echo 'The ASN is: ' . $asn;
}
?>
```
The above example will output:
```
The ASN is: AS15133 EdgeCast Networks, Inc
```
php RecursiveIteratorIterator::endChildren RecursiveIteratorIterator::endChildren
======================================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
RecursiveIteratorIterator::endChildren — End children
### Description
```
public RecursiveIteratorIterator::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 DateTime::modify DateTime::modify
================
date\_modify
============
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
DateTime::modify -- date\_modify — Alters the timestamp
### Description
Object-oriented style
```
public DateTime::modify(string $modifier): DateTime|false
```
Procedural style
```
date_modify(DateTime $object, string $modifier): DateTime|false
```
Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by [DateTimeImmutable::\_\_construct()](datetimeimmutable.construct).
### Parameters
`object`
Procedural style only: A [DateTime](class.datetime) object returned by [date\_create()](function.date-create). The function modifies this object.
`modifier`
A date/time string. Valid formats are explained in [Date and Time Formats](https://www.php.net/manual/en/datetime.formats.php).
### Return Values
Returns the modified [DateTime](class.datetime) object for method chaining or **`false`** on failure.
### Examples
**Example #1 **DateTime::modify()** example**
Object-oriented style
```
<?php
$date = new DateTime('2006-12-12');
$date->modify('+1 day');
echo $date->format('Y-m-d');
?>
```
Procedural style
```
<?php
$date = date_create('2006-12-12');
date_modify($date, '+1 day');
echo date_format($date, 'Y-m-d');
?>
```
The above examples will output:
```
2006-12-13
```
**Example #2 Beware when adding or subtracting months**
```
<?php
$date = new DateTime('2000-12-31');
$date->modify('+1 month');
echo $date->format('Y-m-d') . "\n";
$date->modify('+1 month');
echo $date->format('Y-m-d') . "\n";
?>
```
The above example will output:
```
2001-01-31
2001-03-03
```
### See Also
* [strtotime()](function.strtotime) - Parse about any English textual datetime description into a Unix timestamp
* [DateTimeImmutable::modify()](datetimeimmutable.modify) - Creates a new object with modified timestamp
* [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
* [DateTime::setDate()](datetime.setdate) - Sets the date
* [DateTime::setISODate()](datetime.setisodate) - Sets the ISO date
* [DateTime::setTime()](datetime.settime) - Sets the time
* [DateTime::setTimestamp()](datetime.settimestamp) - Sets the date and time based on an Unix timestamp
php SolrClient::deleteByQueries SolrClient::deleteByQueries
===========================
(PECL solr >= 0.9.2)
SolrClient::deleteByQueries — Removes all documents matching any of the queries
### Description
```
public SolrClient::deleteByQueries(array $queries): SolrUpdateResponse
```
Removes all documents matching any of the queries
### Parameters
`queries`
The array of queries. This must be an actual php variable.
### Return Values
Returns a SolrUpdateResponse on success and throws a SolrClientException 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.
### See Also
* [SolrClient::deleteById()](solrclient.deletebyid) - Delete by Id
* [SolrClient::deleteByIds()](solrclient.deletebyids) - Deletes by Ids
* [SolrClient::deleteByQuery()](solrclient.deletebyquery) - Deletes all documents matching the given query
php Lua::__construct Lua::\_\_construct
==================
(PECL lua >=0.9.0)
Lua::\_\_construct — Lua constructor
### Description
```
public Lua::__construct(string $lua_script_file = NULL)
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`lua_script_file`
### Return Values
php Imagick::setImageProperty Imagick::setImageProperty
=========================
(PECL imagick 2, PECL imagick 3)
Imagick::setImageProperty — Sets an image property
### Description
```
public Imagick::setImageProperty(string $name, string $value): bool
```
Sets a named property to the image. This method is available if Imagick has been compiled against ImageMagick version 6.3.2 or newer.
### Parameters
`name`
`value`
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 Using **Imagick::setImageProperty()**:**
Setting and getting image properties
```
<?php
$image = new Imagick();
$image->newImage(300, 200, "black");
$image->setImageProperty('Exif:Make', 'Imagick');
echo $image->getImageProperty('Exif:Make');
?>
```
### See Also
* [Imagick::getImageProperty()](imagick.getimageproperty) - Returns the named image property
php Thread::isStarted Thread::isStarted
=================
(PECL pthreads >= 2.0.0)
Thread::isStarted — State Detection
### Description
```
public Thread::isStarted(): bool
```
Tell if the referenced Thread was started
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Tell if the referenced Thread was started**
```
<?php
$worker = new Worker();
$worker->start();
var_dump($worker->isStarted());
?>
```
The above example will output:
```
bool(true)
```
php Memcached::getVersion Memcached::getVersion
=====================
(PECL memcached >= 0.1.5)
Memcached::getVersion — Get server pool version info
### Description
```
public Memcached::getVersion(): array
```
**Memcached::getVersion()** returns an array containing the version info for all available memcache servers.
### Parameters
This function has no parameters.
### Return Values
Array of server versions, one entry per server.
### Examples
**Example #1 **Memcached::getVersion()** example**
```
<?php
$m = new Memcached();
$m->addServer('localhost', 11211);
print_r($m->getVersion());
?>
```
The above example will output something similar to:
```
Array
(
[localhost:11211] => 1.2.6
)
```
php $_REQUEST $\_REQUEST
==========
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
$\_REQUEST — HTTP Request variables
### Description
An associative array that by default contains the contents of [$\_GET](reserved.variables.get), [$\_POST](reserved.variables.post) and [$\_COOKIE](reserved.variables.cookies).
### 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.
>
>
>
>
> **Note**:
>
>
> When running on the [command line](https://www.php.net/manual/en/features.commandline.php) , this will *not* include the [argv](reserved.variables.argv) and [argc](reserved.variables.argc) entries; these are present in the [$\_SERVER](reserved.variables.server) array.
>
>
>
> **Note**:
>
>
> The variables in $\_REQUEST are provided to the script via the GET, POST, and COOKIE input mechanisms and therefore could be modified by the remote user and cannot be trusted. The presence and order of variables listed in this array is defined according to the PHP [request\_order](https://www.php.net/manual/en/ini.core.php#ini.request-order), and [variables\_order](https://www.php.net/manual/en/ini.core.php#ini.variables-order) configuration directives.
>
>
### See Also
* [Handling external variables](language.variables.external)
* [The filter extension](https://www.php.net/manual/en/book.filter.php)
php mb_eregi_replace mb\_eregi\_replace
==================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
mb\_eregi\_replace — Replace regular expression with multibyte support ignoring case
### Description
```
mb_eregi_replace(
string $pattern,
string $replacement,
string $string,
?string $options = null
): string|false|null
```
Scans `string` for matches to `pattern`, then replaces the matched text with `replacement`.
### Parameters
`pattern`
The regular expression pattern. Multibyte characters may be used. The case will be ignored.
`replacement`
The replacement text.
`string`
The searched string.
`options`
The search option. See [mb\_regex\_set\_options()](function.mb-regex-set-options) for explanation. ### Return Values
The resultant string or **`false`** on error. If `string` is not valid for the current encoding, **`null`** is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `options` is nullable now. |
| 7.1.0 | The function checks whether `string` is valid for the current encoding. |
| 7.1.0 | The `e` modifier has been deprecated. |
### 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.
>
>
>
**Warning**Never use the `e` modifier when working on untrusted input. No automatic escaping will happen (as known from [preg\_replace()](function.preg-replace)). Not taking care of this will most likely create remote code execution vulnerabilities in your application.
### See Also
* [mb\_regex\_encoding()](function.mb-regex-encoding) - Set/Get character encoding for multibyte regex
* [mb\_ereg\_replace()](function.mb-ereg-replace) - Replace regular expression with multibyte support
php dcngettext dcngettext
==========
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
dcngettext — Plural version of dcgettext
### Description
```
dcngettext(
string $domain,
string $singular,
string $plural,
int $count,
int $category
): string
```
This function allows you to override the current domain for a single plural message lookup.
### Parameters
`domain`
The domain
`singular`
`plural`
`count`
`category`
### Return Values
A string on success.
### See Also
* [ngettext()](function.ngettext) - Plural version of gettext
php IntlBreakIterator::createWordInstance IntlBreakIterator::createWordInstance
=====================================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlBreakIterator::createWordInstance — Create break iterator for word breaks
### Description
```
public static IntlBreakIterator::createWordInstance(?string $locale = null): ?IntlBreakIterator
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`locale`
### Return Values
php iconv_substr iconv\_substr
=============
(PHP 5, PHP 7, PHP 8)
iconv\_substr — Cut out part of a string
### Description
```
iconv_substr(
string $string,
int $offset,
?int $length = null,
?string $encoding = null
): string|false
```
Cuts a portion of `string` specified by the `offset` and `length` parameters.
### Parameters
`string`
The original string.
`offset`
If `offset` is non-negative, **iconv\_substr()** cuts the portion out of `string` beginning at `offset`'th character, counting from zero.
If `offset` is negative, **iconv\_substr()** cuts out the portion beginning at the position, `offset` characters away from the end of `string`.
`length`
If `length` is given and is positive, the return value will contain at most `length` characters of the portion that begins at `offset` (depending on the length of `string`).
If negative `length` is passed, **iconv\_substr()** cuts the portion out of `string` from the `offset`'th character up to the character that is `length` characters away from the end of the string. In case `offset` is also negative, the start position is calculated beforehand according to the rule explained above.
`encoding`
If `encoding` parameter is omitted or **`null`**, `string` are assumed to be encoded in [iconv.internal\_encoding](https://www.php.net/manual/en/iconv.configuration.php).
Note that `offset` and `length` parameters are always deemed to represent offsets that are calculated on the basis of the character set determined by `encoding`, whilst the counterpart [substr()](function.substr) always takes these for byte offsets.
### Return Values
Returns the portion of `string` specified by the `offset` and `length` parameters.
If `string` is shorter than `offset` characters long, **`false`** will be returned. If `string` is exactly `offset` characters long, an empty string will be returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `length` and `encoding` are nullable now. |
| 7.0.11 | If `string` is equal to `offset` characters long, an empty string will be returned. Prior to this version, **`false`** was returned in this case. |
### See Also
* [substr()](function.substr) - Return part of a string
* [mb\_substr()](function.mb-substr) - Get part of string
* [mb\_strcut()](function.mb-strcut) - Get part of string
php svn_repos_hotcopy svn\_repos\_hotcopy
===================
(PECL svn >= 0.1.0)
svn\_repos\_hotcopy — Make a hot-copy of the repos at repospath; copy it to destpath
### Description
```
svn_repos_hotcopy(string $repospath, string $destpath, bool $cleanlogs): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Make a hot-copy of the repos at repospath; copy it to destpath
### 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 Gmagick::getimagechanneldepth Gmagick::getimagechanneldepth
=============================
(PECL gmagick >= Unknown)
Gmagick::getimagechanneldepth — Gets the depth for a particular image channel
### Description
```
public Gmagick::getimagechanneldepth(int $channel_type): int
```
Gets the depth for a particular image channel.
### Parameters
This function has no parameters.
### Return Values
Depth of image channel
### Errors/Exceptions
Throws an **GmagickException** on error.
php sodium_crypto_core_ristretto255_scalar_invert sodium\_crypto\_core\_ristretto255\_scalar\_invert
==================================================
(PHP 8 >= 8.1.0)
sodium\_crypto\_core\_ristretto255\_scalar\_invert — Inverts a scalar value
### Description
```
sodium_crypto_core_ristretto255_scalar_invert(string $s): string
```
Inverts a scalar value. Available as of libsodium 1.0.18.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`s`
Scalar value.
### Return Values
Returns a 32-byte random string.
### Examples
**Example #1 **sodium\_crypto\_core\_ristretto255\_scalar\_invert()** example**
```
<?php
$foo = sodium_crypto_core_ristretto255_scalar_random();
$inverted = sodium_crypto_core_ristretto255_scalar_invert($foo);
$reInverted = sodium_crypto_core_ristretto255_scalar_invert($inverted);
var_dump(hash_equals($foo, $reInverted));
?>
```
The above example will output:
```
bool(true)
```
### See Also
* [sodium\_crypto\_core\_ristretto255\_scalar\_random()](function.sodium-crypto-core-ristretto255-scalar-random) - Generates a random key
php ssh2_connect ssh2\_connect
=============
(PECL ssh2 >= 0.9.0)
ssh2\_connect — Connect to an SSH server
### Description
```
ssh2_connect(
string $host,
int $port = 22,
array $methods = ?,
array $callbacks = ?
): resource|false
```
Establish a connection to a remote SSH server.
Once connected, the client should verify the server's hostkey using [ssh2\_fingerprint()](function.ssh2-fingerprint), then authenticate using either password or public key.
### Parameters
`host`
`port`
`methods`
`methods` may be an associative array with up to four parameters as described below.
**`methods` may be an associative array with any or all of the following parameters.**| Index | Meaning | Supported Values\* |
| --- | --- | --- |
| kex | List of key exchange methods to advertise, comma separated in order of preference. | `diffie-hellman-group1-sha1`, `diffie-hellman-group14-sha1`, and `diffie-hellman-group-exchange-sha1` |
| hostkey | List of hostkey methods to advertise, comma separated in order of preference. | `ssh-rsa` and `ssh-dss` |
| client\_to\_server | Associative array containing crypt, compression, and message authentication code (MAC) method preferences for messages sent from client to server. | |
| server\_to\_client | Associative array containing crypt, compression, and message authentication code (MAC) method preferences for messages sent from server to client. | |
\* - Supported Values are dependent on methods supported by underlying library. See [» libssh2](http://libssh2.org/) documentation for additional information.
**`client_to_server` and `server_to_client` may be an associative array with any or all of the following parameters.** | Index | Meaning | Supported Values\* |
| --- | --- | --- |
| crypt | List of crypto methods to advertise, comma separated in order of preference. | `[email protected]`, `aes256-cbc`, `aes192-cbc`, `aes128-cbc`, `3des-cbc`, `blowfish-cbc`, `cast128-cbc`, `arcfour`, and `none**` |
| comp | List of compression methods to advertise, comma separated in order of preference. | `zlib` and `none` |
| mac | List of MAC methods to advertise, comma separated in order of preference. | `hmac-sha1`, `hmac-sha1-96`, `hmac-ripemd160`, `[email protected]`, and `none**` |
>
> **Note**: **Crypt and MAC method "`none`"**
>
>
>
> For security reasons, `none` is disabled by the underlying [» libssh2](http://libssh2.org/) library unless explicitly enabled during build time by using the appropriate ./configure options. See documentation for the underlying library for more information.
>
>
`callbacks`
`callbacks` may be an associative array with any or all of the following parameters.
**Callbacks parameters** | Index | Meaning | Prototype |
| --- | --- | --- |
| ignore | Name of function to call when an **`SSH2_MSG_IGNORE`** packet is received | void ignore\_cb($message) |
| debug | Name of function to call when an **`SSH2_MSG_DEBUG`** packet is received | void debug\_cb($message, $language, $always\_display) |
| macerror | Name of function to call when a packet is received but the message authentication code failed. If the callback returns **`true`**, the mismatch will be ignored, otherwise the connection will be terminated. | bool macerror\_cb($packet) |
| disconnect | Name of function to call when an **`SSH2_MSG_DISCONNECT`** packet is received | void disconnect\_cb($reason, $message, $language) |
### Return Values
Returns a resource on success, or **`false`** on error.
### Examples
**Example #1 **ssh2\_connect()** example**
Open a connection forcing 3des-cbc when sending packets, any strength aes cipher when receiving packets, no compression in either direction, and Group1 key exchange.
```
<?php
/* Notify the user if the server terminates the connection */
function my_ssh_disconnect($reason, $message, $language) {
printf("Server disconnected with reason code [%d] and message: %s\n",
$reason, $message);
}
$methods = array(
'kex' => 'diffie-hellman-group1-sha1',
'client_to_server' => array(
'crypt' => '3des-cbc',
'comp' => 'none'),
'server_to_client' => array(
'crypt' => 'aes256-cbc,aes192-cbc,aes128-cbc',
'comp' => 'none'));
$callbacks = array('disconnect' => 'my_ssh_disconnect');
$connection = ssh2_connect('shell.example.com', 22, $methods, $callbacks);
if (!$connection) die('Connection failed');
?>
```
### See Also
* [ssh2\_fingerprint()](function.ssh2-fingerprint) - Retrieve fingerprint of remote server
* [ssh2\_auth\_none()](function.ssh2-auth-none) - Authenticate as "none"
* [ssh2\_auth\_password()](function.ssh2-auth-password) - Authenticate over SSH using a plain password
* [ssh2\_auth\_pubkey\_file()](function.ssh2-auth-pubkey-file) - Authenticate using a public key
* [ssh2\_disconnect()](function.ssh2-disconnect) - Close a connection to a remote SSH server
| programming_docs |
php None Internal (built-in) functions
-----------------------------
PHP comes standard with many functions and constructs. There are also functions that require specific PHP extensions compiled in, otherwise fatal "undefined function" errors will appear. For example, to use [image](https://www.php.net/manual/en/ref.image.php) functions such as [imagecreatetruecolor()](function.imagecreatetruecolor), PHP must be compiled with GD support. Or, to use [mysqli\_connect()](function.mysqli-connect), PHP must be compiled with [MySQLi](https://www.php.net/manual/en/book.mysqli.php) support. There are many core functions that are included in every version of PHP, such as the [string](https://www.php.net/manual/en/ref.strings.php) and [variable](https://www.php.net/manual/en/ref.var.php) functions. A call to [phpinfo()](function.phpinfo) or [get\_loaded\_extensions()](function.get-loaded-extensions) will show which extensions are loaded into PHP. Also note that many extensions are enabled by default and that the PHP manual is split up by extension. See the [configuration](https://www.php.net/manual/en/configuration.php), [installation](https://www.php.net/manual/en/install.php), and individual extension chapters, for information on how to set up PHP.
Reading and understanding a function's prototype is explained within the manual section titled [how to read a function definition](https://www.php.net/manual/en/about.prototypes.php). It's important to realize what a function returns or if a function works directly on a passed in value. For example, [str\_replace()](function.str-replace) will return the modified string while [usort()](function.usort) works on the actual passed in variable itself. Each manual page also has specific information for each function like information on function parameters, behavior changes, return values for both success and failure, and availability information. Knowing these important (yet often subtle) differences is crucial for writing correct PHP code.
> **Note**: If the parameters given to a function are not what it expects, such as passing an array where a string is expected, the return value of the function is undefined. In this case it will likely return **`null`** but this is just a convention, and cannot be relied upon. As of PHP 8.0.0, a [TypeError](class.typeerror) exception is supposed to be thrown in this case.
>
>
>
> **Note**:
>
>
> Scalar types for built-in functions are nullable by default in coercive mode. As of PHP 8.1.0, passing **`null`** to an internal function parameter that is not declared nullable is discouraged and emits a deprecation notice in coercive mode to align with the behavior of user-defined functions, where scalar types need to be marked as nullable explicitly.
>
> For example, [strlen()](function.strlen) function expects the parameter `$string` to be a non-nullable string. For historical reasons, PHP allows passing **`null`** for this parameter in coercive mode, and the parameter is implicitly cast to string, resulting in a `""` value. In contrast, a [TypeError](class.typeerror) is emitted in strict mode.
>
>
> ```
> <?php
> var_dump(strlen(null));
> // "Deprecated: Passing null to parameter #1 ($string) of type string is deprecated" as of PHP 8.1.0
> // int(0)
>
> var_dump(str_contains("foobar", null));
> // "Deprecated: Passing null to parameter #2 ($needle) of type string is deprecated" as of PHP 8.1.0
> // bool(true)
> ?>
> ```
>
### See Also
* [function\_exists()](function.function-exists)
* [the function reference](https://www.php.net/manual/en/funcref.php)
* [get\_extension\_funcs()](function.get-extension-funcs)
* [dl()](function.dl)
php eio_npending eio\_npending
=============
(PECL eio >= 0.0.1dev)
eio\_npending — Returns number of finished, but unhandled requests
### Description
```
eio_npending(): int
```
**eio\_npending()** returns number of finished, but unhandled requests
### Parameters
This function has no parameters.
### Return Values
**eio\_npending()** returns number of finished, but unhandled requests.
### See Also
* [eio\_nreqs()](function.eio-nreqs) - Returns number of requests to be processed
* [eio\_nready()](function.eio-nready) - Returns number of not-yet handled requests
* [eio\_nthreads()](function.eio-nthreads) - Returns number of threads currently in use
php ImagickDraw::setGravity ImagickDraw::setGravity
=======================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setGravity — Sets the text placement gravity
### Description
```
public ImagickDraw::setGravity(int $gravity): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Sets the text placement gravity to use when annotating with text.
### Parameters
`gravity`
One of the [GRAVITY](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.gravity) constant (`imagick::GRAVITY_*`).
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::setGravity()** example**
```
<?php
function setGravity($fillColor, $strokeColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(1);
$draw->setFontSize(24);
$gravitySettings = array(
\Imagick::GRAVITY_NORTHWEST => 'NorthWest',
\Imagick::GRAVITY_NORTH => 'North',
\Imagick::GRAVITY_NORTHEAST => 'NorthEast',
\Imagick::GRAVITY_WEST => 'West',
\Imagick::GRAVITY_CENTER => 'Centre',
\Imagick::GRAVITY_SOUTHWEST => 'SouthWest',
\Imagick::GRAVITY_SOUTH => 'South',
\Imagick::GRAVITY_SOUTHEAST => 'SouthEast',
\Imagick::GRAVITY_EAST => 'East'
);
$draw->setFont("../fonts/Arial.ttf");
foreach ($gravitySettings as $type => $description) {
$draw->setGravity($type);
$draw->annotation(50, 50, '"' . $description . '"');
}
$imagick = new \Imagick();
$imagick->newImage(500, 500, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
php UConverter::getSourceEncoding UConverter::getSourceEncoding
=============================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
UConverter::getSourceEncoding — Get the source encoding
### Description
```
public UConverter::getSourceEncoding(): string|false|null
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php PDO::lastInsertId PDO::lastInsertId
=================
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0)
PDO::lastInsertId — Returns the ID of the last inserted row or sequence value
### Description
```
public PDO::lastInsertId(?string $name = null): string|false
```
Returns the ID of the last inserted row, or the last value from a sequence object, depending on the underlying driver. For example, [PDO\_PGSQL](https://www.php.net/manual/en/ref.pdo-pgsql.php) requires you to specify the name of a sequence object for the `name` parameter.
>
> **Note**:
>
>
> This method may not return a meaningful or consistent result across different PDO drivers, because the underlying database may not even support the notion of auto-increment fields or sequences.
>
>
### Parameters
`name`
Name of the sequence object from which the ID should be returned.
### Return Values
If a sequence name was not specified for the `name` parameter, **PDO::lastInsertId()** returns a string representing the row ID of the last row that was inserted into the database.
If a sequence name was specified for the `name` parameter, **PDO::lastInsertId()** returns a string representing the last value retrieved from the specified sequence object.
If the PDO driver does not support this capability, **PDO::lastInsertId()** triggers an `IM001` SQLSTATE.
php None switch
------
(PHP 4, PHP 5, PHP 7, PHP 8)
The `switch` statement is similar to a series of IF statements on the same expression. In many occasions, you may want to compare the same variable (or expression) with many different values, and execute a different piece of code depending on which value it equals to. This is exactly what the `switch` statement is for.
> **Note**: Note that unlike some other languages, the [continue](control-structures.continue) statement applies to `switch` and acts similar to `break`. If you have a `switch` inside a loop and wish to continue to the next iteration of the outer loop, use `continue 2`.
>
>
>
> **Note**:
>
>
> Note that switch/case does [loose comparison](https://www.php.net/manual/en/types.comparisons.php#types.comparisions-loose).
>
>
In the following example, each code block is equivalent. One uses a series of `if` and `elseif` statements, and the other a `switch` statement. In each case, the output is the same.
**Example #1 `switch` structure**
```
<?php
// This switch statement:
switch ($i) {
case 0:
echo "i equals 0";
break;
case 1:
echo "i equals 1";
break;
case 2:
echo "i equals 2";
break;
}
// Is equivalent to:
if ($i == 0) {
echo "i equals 0";
} elseif ($i == 1) {
echo "i equals 1";
} elseif ($i == 2) {
echo "i equals 2";
}
?>
```
It is important to understand how the `switch` statement is executed in order to avoid mistakes. The `switch` statement executes line by line (actually, statement by statement). In the beginning, no code is executed. Only when a `case` statement is found whose expression evaluates to a value that matches the value of the `switch` expression does PHP begin to execute the statements. PHP continues to execute the statements until the end of the `switch` block, or the first time it sees a `break` statement. If you don't write a `break` statement at the end of a case's statement list, PHP will go on executing the statements of the following case. For example:
```
<?php
switch ($i) {
case 0:
echo "i equals 0";
case 1:
echo "i equals 1";
case 2:
echo "i equals 2";
}
?>
```
Here, if $i is equal to 0, PHP would execute all of the echo statements! If $i is equal to 1, PHP would execute the last two echo statements. You would get the expected behavior ('i equals 2' would be displayed) only if $i is equal to 2. Thus, it is important not to forget `break` statements (even though you may want to avoid supplying them on purpose under certain circumstances).
In a `switch` statement, the condition is evaluated only once and the result is compared to each `case` statement. In an `elseif` statement, the condition is evaluated again. If your condition is more complicated than a simple compare and/or is in a tight loop, a `switch` may be faster.
The statement list for a case can also be empty, which simply passes control into the statement list for the next case.
```
<?php
switch ($i) {
case 0:
case 1:
case 2:
echo "i is less than 3 but not negative";
break;
case 3:
echo "i is 3";
}
?>
```
A special case is the `default` case. This case matches anything that wasn't matched by the other cases. For example:
```
<?php
switch ($i) {
case 0:
echo "i equals 0";
break;
case 1:
echo "i equals 1";
break;
case 2:
echo "i equals 2";
break;
default:
echo "i is not equal to 0, 1 or 2";
}
?>
```
> **Note**: Multiple default cases will raise a **`E_COMPILE_ERROR`** error.
>
>
> **Note**: Technically the `default` case may be listed in any order. It will only be used if no other case matches. However, by convention it is best to place it at the end as the last branch.
>
>
If no `case` branch matches, and there is no `default` branch, then no code will be executed, just as if no `if` statement was true.
A case value may be given as an expression. However, that expression will be evaluated on its own and then loosely compared with the switch value. That means it cannot be used for complex evaluations of the switch value. For example:
```
<?php
$target = 1;
$start = 3;
switch ($target) {
case $start - 1:
print "A";
break;
case $start - 2:
print "B";
break;
case $start - 3:
print "C";
break;
case $start - 4:
print "D";
break;
}
// Prints "B"
?>
```
For more complex comparisons, the value `true` may be used as the switch value. Or, alternatively, `if`-`else` blocks instead of `switch`.
```
<?php
$offset = 1;
$start = 3;
switch (true) {
case $start - $offset === 1:
print "A";
break;
case $start - $offset === 2:
print "B";
break;
case $start - $offset === 3:
print "C";
break;
case $start - $offset === 4:
print "D";
break;
}
// Prints "B"
?>
```
The alternative syntax for control structures is supported with switches. For more information, see [Alternative syntax for control structures](https://www.php.net/manual/en/control-structures.alternative-syntax.php).
```
<?php
switch ($i):
case 0:
echo "i equals 0";
break;
case 1:
echo "i equals 1";
break;
case 2:
echo "i equals 2";
break;
default:
echo "i is not equal to 0, 1 or 2";
endswitch;
?>
```
It's possible to use a semicolon instead of a colon after a case like:
```
<?php
switch($beer)
{
case 'tuborg';
case 'carlsberg';
case 'stella';
case 'heineken';
echo 'Good choice';
break;
default;
echo 'Please make a new selection...';
break;
}
?>
```
### See Also
* [match](control-structures.match)
php RecursiveIteratorIterator::rewind RecursiveIteratorIterator::rewind
=================================
(PHP 5, PHP 7, PHP 8)
RecursiveIteratorIterator::rewind — Rewind the iterator to the first element of the top level inner iterator
### Description
```
public RecursiveIteratorIterator::rewind(): void
```
**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 Parle\Parser::tokenId Parle\Parser::tokenId
=====================
(PECL parle >= 0.5.1)
Parle\Parser::tokenId — Get token id
### Description
```
public Parle\Parser::tokenId(string $tok): int
```
Retrieve the id of the named token.
### Parameters
`tok`
Name of the token as used in [Parle\Parser::token()](parle-parser.token).
### Return Values
Returns int representing the token id.
php dngettext dngettext
=========
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
dngettext — Plural version of dgettext
### Description
```
dngettext(
string $domain,
string $singular,
string $plural,
int $count
): string
```
The **dngettext()** function allows you to override the current `domain` for a single plural message lookup.
### Parameters
`domain`
The domain
`singular`
`plural`
`count`
### Return Values
A string on success.
### See Also
* [ngettext()](function.ngettext) - Plural version of gettext
php Componere\Patch::getClosure Componere\Patch::getClosure
===========================
(Componere 2 >= 2.1.0)
Componere\Patch::getClosure — Get Closure
### Description
```
public Componere\Patch::getClosure(string $name): Closure
```
Shall return a Closure for the method specified by name
### Parameters
`name`
The case insensitive name of the method
### Return Values
A Closure bound to the correct scope and object
### Exceptions
**Warning** Shall throw [RuntimeException](class.runtimeexception) if `name` could not be found
php mysqli_stmt::$field_count mysqli\_stmt::$field\_count
===========================
mysqli\_stmt\_field\_count
==========================
(PHP 5, PHP 7, PHP 8)
mysqli\_stmt::$field\_count -- mysqli\_stmt\_field\_count — Returns the number of columns in the given statement
### Description
Object-oriented style
int [$mysqli\_stmt->field\_count](mysqli-stmt.field-count); Procedural style
```
mysqli_stmt_field_count(mysqli_stmt $statement): int
```
Returns the number of columns 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 columns.
### Examples
**Example #1 Object-oriented style**
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
$code = 'FR';
$stmt = $mysqli->prepare("SELECT Name FROM Country WHERE Code=?");
$stmt->bind_param('s', $code);
$stmt->execute();
$row = $stmt->get_result()->fetch_row();
for ($i = 0; $i < $stmt->field_count; $i++) {
printf("Value of column number %d is %s", $i, $row[$i]);
}
```
**Example #2 Procedural style**
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = mysqli_connect("localhost", "my_user", "my_password", "world");
$code = 'FR';
$stmt = mysqli_prepare($mysqli, "SELECT Name FROM Country WHERE Code=?");
mysqli_stmt_bind_param($stmt, 's', $code);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$row = mysqli_fetch_row($result);
for ($i = 0; $i < mysqli_stmt_field_count($stmt); $i++) {
printf("Value of column number %d is %s", $i, $row[$i]);
}
```
The above examples will output something similar to:
```
Value of column number 0 is France
```
### See Also
* [mysqli\_stmt\_num\_rows()](mysqli-stmt.num-rows) - Returns the number of rows fetched from the server
php uopz_set_return uopz\_set\_return
=================
(PECL uopz 5, PECL uopz 6, PECL uopz 7)
uopz\_set\_return — Provide a return value for an existing function
### Description
```
uopz_set_return(string $function, mixed $value, bool $execute = false): bool
```
```
uopz_set_return(
string $class,
string $function,
mixed $value,
bool $execute = false
): bool
```
Sets the return value of the `function` to `value`. If `value` is a Closure and `execute` is set, the Closure will be executed in place of the original function. It is possible to call the original function from the Closure.
>
> **Note**:
>
>
> This function replaces [uopz\_rename()](function.uopz-rename).
>
>
### Parameters
`class`
The name of the class containing the function
`function`
The name of an existing function
`value`
The value the function should return. If a Closure is provided and the execute flag is set, the Closure will be executed in place of the original function.
`execute`
If true, and a Closure was provided as the value, the Closure will be executed in place of the original function.
### Return Values
True if succeeded, false otherwise.
### Examples
**Example #1 **uopz\_set\_return()** example**
```
<?php
uopz_set_return("strlen", 42);
echo strlen("Banana");
?>
```
The above example will output:
```
42
```
**Example #2 **uopz\_set\_return()** example**
```
<?php
uopz_set_return("strlen", function($str) { return strlen($str) * 2; }, true );
echo strlen("Banana");
?>
```
The above example will output:
```
12
```
**Example #3 **uopz\_set\_return()** class example**
```
<?php
class My {
public static function strlen($arg) {
return strlen($arg);
}
}
uopz_set_return(My::class, "strlen", function($str) { return strlen($str) * 2; }, true );
echo My::strlen("Banana");
?>
```
The above example will output:
```
12
```
| programming_docs |
php copy copy
====
(PHP 4, PHP 5, PHP 7, PHP 8)
copy — Copies file
### Description
```
copy(string $from, string $to, ?resource $context = null): bool
```
Makes a copy of the file `from` to `to`.
If you wish to move a file, use the [rename()](function.rename) function.
### Parameters
`from`
Path to the source file.
`to`
The destination path. If `to` is a URL, the copy operation may fail if the wrapper does not support overwriting of existing files.
**Warning** If the destination file already exists, it will be overwritten.
`context`
A valid context resource created with [stream\_context\_create()](function.stream-context-create).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **copy()** example**
```
<?php
$file = 'example.txt';
$newfile = 'example.txt.bak';
if (!copy($file, $newfile)) {
echo "failed to copy $file...\n";
}
?>
```
### See Also
* [move\_uploaded\_file()](function.move-uploaded-file) - Moves an uploaded file to a new location
* [rename()](function.rename) - Renames a file or directory
* The section of the manual about [handling file uploads](https://www.php.net/manual/en/features.file-upload.php)
php tidy::repairFile tidy::repairFile
================
tidy\_repair\_file
==================
(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.7.0)
tidy::repairFile -- tidy\_repair\_file — Repair a file and return it as a string
### Description
Object-oriented style
```
public static tidy::repairFile(
string $filename,
array|string|null $config = null,
?string $encoding = null,
bool $useIncludePath = false
): string|false
```
Procedural style
```
tidy_repair_file(
string $filename,
array|string|null $config = null,
?string $encoding = null,
bool $useIncludePath = false
): string|false
```
Repairs the given file and returns it as a string.
### Parameters
`filename`
The file to be repaired.
`config`
The config `config` can be passed either as an array or as a string. If a string is passed, it is interpreted as the name of the configuration file, otherwise, it is interpreted as the options themselves.
Check http://tidy.sourceforge.net/docs/quickref.html for an explanation about each option.
`encoding`
The `encoding` parameter sets the encoding for input/output documents. The possible values for encoding are: `ascii`, `latin0`, `latin1`, `raw`, `utf8`, `iso2022`, `mac`, `win1252`, `ibm858`, `utf16`, `utf16le`, `utf16be`, `big5`, and `shiftjis`.
`useIncludePath`
Search for the file in the [include\_path](https://www.php.net/manual/en/ini.core.php#ini.include-path).
### Return Values
Returns the repaired contents as a string, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | **tidy::repairFile()** is a static method now. |
| 8.0.0 | `config` and `encoding` are nullable now. |
### Examples
**Example #1 **tidy::repairFile()** example**
```
<?php
$file = 'file.html';
$tidy = new tidy();
$repaired = $tidy->repairfile($file);
rename($file, $file . '.bak');
file_put_contents($file, $repaired);
?>
```
### See Also
* [tidy::parseFile()](tidy.parsefile) - Parse markup in file or URI
* [tidy::parseString()](tidy.parsestring) - Parse a document stored in a string
* [tidy::repairString()](tidy.repairstring) - Repair a string using an optionally provided configuration file
php Directory::rewind Directory::rewind
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
Directory::rewind — Rewind directory handle
### Description
```
public Directory::rewind(): void
```
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | No parameter is accepted. Previously, a directory handle could be passed as argument. |
php Yaf_Registry::has Yaf\_Registry::has
==================
(Yaf >=1.0.0)
Yaf\_Registry::has — Check whether an item exists
### Description
```
public static Yaf_Registry::has(string $name): bool
```
Check whether an item exists
### Parameters
`name`
### Return Values
php lcfirst lcfirst
=======
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
lcfirst — Make a string's first character lowercase
### Description
```
lcfirst(string $string): string
```
Returns a string with the first character of `string` lowercased if that character is an ASCII character in the range `"A"` (0x41) to `"Z"` (0x5a).
### Parameters
`string`
The input string.
### Return Values
Returns the resulting 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 **lcfirst()** example**
```
<?php
$foo = 'HelloWorld';
$foo = lcfirst($foo); // helloWorld
$bar = 'HELLO WORLD!';
$bar = lcfirst($bar); // hELLO WORLD!
$bar = lcfirst(strtoupper($bar)); // hELLO WORLD!
?>
```
### See Also
* [ucfirst()](function.ucfirst) - Make a string's first character uppercase
* [strtolower()](function.strtolower) - Make a string lowercase
* [strtoupper()](function.strtoupper) - Make a string uppercase
* [ucwords()](function.ucwords) - Uppercase the first character of each word in a string
php IntlChar::getIntPropertyMinValue IntlChar::getIntPropertyMinValue
================================
(PHP 7, PHP 8)
IntlChar::getIntPropertyMinValue — Get the min value for a Unicode property
### Description
```
public static IntlChar::getIntPropertyMinValue(int $property): int
```
Gets the minimum value for an enumerated/integer/binary Unicode property.
### Parameters
`property`
The Unicode property to lookup (see the `IntlChar::PROPERTY_*` constants).
### Return Values
The minimum value returned by [IntlChar::getIntPropertyValue()](intlchar.getintpropertyvalue) for a Unicode property. `0` if the property selector is out of range.
### Examples
**Example #1 Testing different properties**
```
<?php
var_dump(IntlChar::getIntPropertyMinValue(IntlChar::PROPERTY_BIDI_CLASS));
var_dump(IntlChar::getIntPropertyMinValue(IntlChar::PROPERTY_SCRIPT));
var_dump(IntlChar::getIntPropertyMinValue(IntlChar::PROPERTY_IDEOGRAPHIC));
var_dump(IntlChar::getIntPropertyMinValue(999999999)); // Some made-up value
?>
```
The above example will output:
```
int(0)
int(0)
int(0)
int(0)
```
### See Also
* [IntlChar::hasBinaryProperty()](intlchar.hasbinaryproperty) - Check a binary Unicode property for a code point
* [IntlChar::getIntPropertyMaxValue()](intlchar.getintpropertymaxvalue) - Get the max value for a Unicode property
* [IntlChar::getIntPropertyValue()](intlchar.getintpropertyvalue) - Get the value for a Unicode property for a code point
* [IntlChar::getUnicodeVersion()](intlchar.getunicodeversion) - Get the Unicode version
php call_user_func call\_user\_func
================
(PHP 4, PHP 5, PHP 7, PHP 8)
call\_user\_func — Call the callback given by the first parameter
### Description
```
call_user_func(callable $callback, mixed ...$args): mixed
```
Calls the `callback` given by the first parameter and passes the remaining parameters as arguments.
### Parameters
`callback`
The [callable](language.types.callable) to be called.
`args`
Zero or more parameters to be passed to the callback.
>
> **Note**:
>
>
> Note that the parameters for **call\_user\_func()** are not passed by reference.
>
>
> **Example #1 **call\_user\_func()** example and references**
>
>
> ```
> <?php
> error_reporting(E_ALL);
> function increment(&$var)
> {
> $var++;
> }
>
> $a = 0;
> call_user_func('increment', $a);
> echo $a."\n";
>
> // it is possible to use this instead
> call_user_func_array('increment', array(&$a));
> echo $a."\n";
>
> // it is also possible to use a variable function
> $increment = 'increment';
> $increment($a);
> echo $a."\n";
> ?>
> ```
> The above example will output:
>
>
> ```
>
> Warning: Parameter 1 to increment() expected to be a reference, value given in …
> 0
> 1
> 2
>
> ```
>
### Return Values
Returns the return value of the callback.
### Examples
**Example #2 **call\_user\_func()** example**
```
<?php
function barber($type)
{
echo "You wanted a $type haircut, no problem\n";
}
call_user_func('barber', "mushroom");
call_user_func('barber', "shave");
?>
```
The above example will output:
```
You wanted a mushroom haircut, no problem
You wanted a shave haircut, no problem
```
**Example #3 **call\_user\_func()** using namespace name**
```
<?php
namespace Foobar;
class Foo {
static public function test() {
print "Hello world!\n";
}
}
call_user_func(__NAMESPACE__ .'\Foo::test');
call_user_func(array(__NAMESPACE__ .'\Foo', 'test'));
?>
```
The above example will output:
```
Hello world!
Hello world!
```
**Example #4 Using a class method with **call\_user\_func()****
```
<?php
class myclass {
static function say_hello()
{
echo "Hello!\n";
}
}
$classname = "myclass";
call_user_func(array($classname, 'say_hello'));
call_user_func($classname .'::say_hello');
$myobject = new myclass();
call_user_func(array($myobject, 'say_hello'));
?>
```
The above example will output:
```
Hello!
Hello!
Hello!
```
**Example #5 Using lambda function with **call\_user\_func()****
```
<?php
call_user_func(function($arg) { print "[$arg]\n"; }, 'test');
?>
```
The above example will output:
```
[test]
```
### Notes
>
> **Note**:
>
>
> Callbacks registered with functions such as **call\_user\_func()** and [call\_user\_func\_array()](function.call-user-func-array) will not be called if there is an uncaught exception thrown in a previous callback.
>
>
>
### See Also
* [call\_user\_func\_array()](function.call-user-func-array) - Call a callback with an array of parameters
* [is\_callable()](function.is-callable) - Verify that a value can be called as a function from the current scope.
* [Variable functions](functions.variable-functions)
* [ReflectionFunction::invoke()](reflectionfunction.invoke) - Invokes function
* [ReflectionMethod::invoke()](reflectionmethod.invoke) - Invoke
php pg_convert pg\_convert
===========
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
pg\_convert — Convert associative array values into forms suitable for SQL statements
### Description
```
pg_convert(
PgSql\Connection $connection,
string $table_name,
array $values,
int $flags = 0
): array|false
```
**pg\_convert()** checks and converts the values in `values` into suitable values for use in an SQL statement. Precondition for **pg\_convert()** is the existence of a table `table_name` which has at least as many columns as `values` has elements. The fieldnames in `table_name` must match the indices in `values` and the corresponding datatypes must be compatible. Returns an array with the converted values on success, **`false`** otherwise.
>
> **Note**:
>
>
> Boolean values are accepted and converted to PostgreSQL booleans. String representations of boolean values are also supported. **`null`** is converted to PostgreSQL NULL.
>
>
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance.
`table_name`
Name of the table against which to convert types.
`values`
Data to be converted.
`flags`
Any number of **`PGSQL_CONV_IGNORE_DEFAULT`**, **`PGSQL_CONV_FORCE_NULL`** or **`PGSQL_CONV_IGNORE_NOT_NULL`**, combined.
### Return Values
An array of converted values, 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\_convert()** example**
```
<?php
$dbconn = pg_connect('dbname=foo');
$tmp = array(
'author' => 'Joe Thackery',
'year' => 2005,
'title' => 'My Life, by Joe Thackery'
);
$vals = pg_convert($dbconn, 'authors', $tmp);
?>
```
### See Also
* [pg\_meta\_data()](function.pg-meta-data) - Get meta data for table
* [pg\_insert()](function.pg-insert) - Insert array into table
* [pg\_select()](function.pg-select) - Select records
* [pg\_update()](function.pg-update) - Update table
* [pg\_delete()](function.pg-delete) - Deletes records
php set_time_limit set\_time\_limit
================
(PHP 4, PHP 5, PHP 7, PHP 8)
set\_time\_limit — Limits the maximum execution time
### Description
```
set_time_limit(int $seconds): bool
```
Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal error. The default limit is 30 seconds or, if it exists, the `max_execution_time` value defined in the php.ini.
When called, **set\_time\_limit()** restarts the timeout counter from zero. In other words, if the timeout is the default 30 seconds, and 25 seconds into script execution a call such as `set_time_limit(20)` is made, the script will run for a total of 45 seconds before timing out.
### Parameters
`seconds`
The maximum execution time, in seconds. If set to zero, no time limit is imposed.
### Return Values
Returns **`true`** on success, or **`false`** on failure.
### Notes
>
> **Note**:
>
>
> The **set\_time\_limit()** function and the configuration directive [max\_execution\_time](https://www.php.net/manual/en/info.configuration.php#ini.max-execution-time) only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using [system()](function.system), stream operations, database queries, etc. is not included when determining the maximum time that the script has been running. This is not true on Windows where the measured time is real.
>
>
### See Also
* [max\_execution\_time](https://www.php.net/manual/en/info.configuration.php#ini.max-execution-time)
* [max\_input\_time](https://www.php.net/manual/en/info.configuration.php#ini.max-input-time)
php XSLTProcessor::transformToUri XSLTProcessor::transformToUri
=============================
(PHP 5, PHP 7, PHP 8)
XSLTProcessor::transformToUri — Transform to URI
### Description
```
public XSLTProcessor::transformToUri(DOMDocument $doc, string $uri): int
```
Transforms the source node to an URI applying the stylesheet given by the [XSLTProcessor::importStylesheet()](xsltprocessor.importstylesheet) method.
### Parameters
`doc`
The document to transform.
`uri`
The target URI for the transformation.
### Return Values
Returns the number of bytes written or **`false`** if an error occurred.
### Examples
**Example #1 Transforming to a HTML file**
```
<?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
$proc->transformToURI($xml, 'file:///tmp/out.html');
?>
```
### See Also
* [XSLTProcessor::transformToDoc()](xsltprocessor.transformtodoc) - Transform to a DOMDocument
* [XSLTProcessor::transformToXml()](xsltprocessor.transformtoxml) - Transform to XML
php var_dump var\_dump
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
var\_dump — Dumps information about a variable
### Description
```
var_dump(mixed $value, mixed ...$values): void
```
This function displays structured information about one or more expressions that includes its type and value. Arrays and objects are explored recursively with values indented to show structure.
All public, private and protected properties of objects will be returned in the output unless the object implements a [\_\_debugInfo()](language.oop5.magic#language.oop5.magic.debuginfo) method.
**Tip**As with anything that outputs its result directly to the browser, the [output-control functions](https://www.php.net/manual/en/book.outcontrol.php) can be used to capture the output of this function, and save it in a string (for example).
### Parameters
`value`
The expression to dump.
`values`
Further expressions to dump.
### Return Values
No value is returned.
### Examples
**Example #1 **var\_dump()** example**
```
<?php
$a = array(1, 2, array("a", "b", "c"));
var_dump($a);
?>
```
The above example will output:
```
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
array(3) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
}
}
```
```
<?php
$b = 3.1;
$c = true;
var_dump($b, $c);
?>
```
The above example will output:
```
float(3.1)
bool(true)
```
### See Also
* [print\_r()](function.print-r) - Prints human-readable information about a variable
* [debug\_zval\_dump()](function.debug-zval-dump) - Dumps a string representation of an internal zval structure to output
* [var\_export()](function.var-export) - Outputs or returns a parsable string representation of a variable
* [\_\_debugInfo()](language.oop5.magic#language.oop5.magic.debuginfo)
php Storing into an array (e.g. with iterator_to_array()) Generator syntax
----------------
A generator function looks just like a normal function, except that instead of returning a value, a generator [yield](language.generators.syntax#control-structures.yield)s as many values as it needs to. Any function containing [yield](language.generators.syntax#control-structures.yield) is a generator function.
When a generator function is called, it returns an object that can be iterated over. When you iterate over that object (for instance, via a [foreach](control-structures.foreach) loop), PHP will call the object's iteration methods each time it needs a value, then saves the state of the generator when the generator yields a value so that it can be resumed when the next value is required.
Once there are no more values to be yielded, then the generator can simply exit, and the calling code continues just as if an array has run out of values.
>
> **Note**:
>
>
> A generator can return values, which can be retrieved using [Generator::getReturn()](generator.getreturn).
>
>
###
**yield** keyword
The heart of a generator function is the **yield** keyword. In its simplest form, a yield statement looks much like a return statement, except that instead of stopping execution of the function and returning, yield instead provides a value to the code looping over the generator and pauses execution of the generator function.
**Example #1 A simple example of yielding values**
```
<?php
function gen_one_to_three() {
for ($i = 1; $i <= 3; $i++) {
// Note that $i is preserved between yields.
yield $i;
}
}
$generator = gen_one_to_three();
foreach ($generator as $value) {
echo "$value\n";
}
?>
```
The above example will output:
```
1
2
3
```
>
> **Note**:
>
>
> Internally, sequential integer keys will be paired with the yielded values, just as with a non-associative array.
>
>
**Caution** The value that will be assigned to $data is the value passed to [Generator::send()](generator.send), or **`null`** if [Generator::next()](generator.next) is called instead.
#### Yielding values with keys
PHP also supports associative arrays, and generators are no different. In addition to yielding simple values, as shown above, you can also yield a key at the same time.
The syntax for yielding a key/value pair is very similar to that used to define an associative array, as shown below.
**Example #2 Yielding a key/value pair**
```
<?php
/*
* The input is semi-colon separated fields, with the first
* field being an ID to use as a key.
*/
$input = <<<'EOF'
1;PHP;Likes dollar signs
2;Python;Likes whitespace
3;Ruby;Likes blocks
EOF;
function input_parser($input) {
foreach (explode("\n", $input) as $line) {
$fields = explode(';', $line);
$id = array_shift($fields);
yield $id => $fields;
}
}
foreach (input_parser($input) as $id => $fields) {
echo "$id:\n";
echo " $fields[0]\n";
echo " $fields[1]\n";
}
?>
```
The above example will output:
```
1:
PHP
Likes dollar signs
2:
Python
Likes whitespace
3:
Ruby
Likes blocks
```
**Caution** As with the simple value yields shown earlier, yielding a key/value pair in an expression context requires the yield statement to be parenthesised:
```
$data = (yield $key => $value);
```
#### Yielding null values
Yield can be called without an argument to yield a **`null`** value with an automatic key.
**Example #3 Yielding **`null`**s**
```
<?php
function gen_three_nulls() {
foreach (range(1, 3) as $i) {
yield;
}
}
var_dump(iterator_to_array(gen_three_nulls()));
?>
```
The above example will output:
```
array(3) {
[0]=>
NULL
[1]=>
NULL
[2]=>
NULL
}
```
#### Yielding by reference
Generator functions are able to yield values by reference as well as by value. This is done in the same way as [returning references from functions](functions.returning-values): by prepending an ampersand to the function name.
**Example #4 Yielding values by reference**
```
<?php
function &gen_reference() {
$value = 3;
while ($value > 0) {
yield $value;
}
}
/*
* Note that we can change $number within the loop, and
* because the generator is yielding references, $value
* within gen_reference() changes.
*/
foreach (gen_reference() as &$number) {
echo (--$number).'... ';
}
?>
```
The above example will output:
```
2... 1... 0...
```
#### Generator delegation via **yield from**
Generator delegation allows you to yield values from another generator, [Traversable](class.traversable) object, or array by using the **yield from** keyword. The outer generator will then yield all values from the inner generator, object, or array until that is no longer valid, after which execution will continue in the outer generator.
If a generator is used with **yield from**, the **yield from** expression will also return any value returned by the inner generator.
**Caution** Storing into an array (e.g. with iterator\_to\_array())
=======================================================
**yield from** does not reset the keys. It preserves the keys returned by the [Traversable](class.traversable) object, or array. Thus some values may share a common key with another **yield** or **yield from**, which, upon insertion into an array, will overwrite former values with that key.
A common case where this matters is [iterator\_to\_array()](function.iterator-to-array) returning a keyed array by default, leading to possibly unexpected results. [iterator\_to\_array()](function.iterator-to-array) has a second parameter `use_keys` which can be set to **`false`** to collect all the values while ignoring the keys returned by the [Generator](class.generator).
**Example #5 **yield from** with [iterator\_to\_array()](function.iterator-to-array)**
```
<?php
function inner() {
yield 1; // key 0
yield 2; // key 1
yield 3; // key 2
}
function gen() {
yield 0; // key 0
yield from inner(); // keys 0-2
yield 4; // key 1
}
// pass false as second parameter to get an array [0, 1, 2, 3, 4]
var_dump(iterator_to_array(gen()));
?>
```
The above example will output:
```
array(3) {
[0]=>
int(1)
[1]=>
int(4)
[2]=>
int(3)
}
```
**Example #6 Basic use of **yield from****
```
<?php
function count_to_ten() {
yield 1;
yield 2;
yield from [3, 4];
yield from new ArrayIterator([5, 6]);
yield from seven_eight();
yield 9;
yield 10;
}
function seven_eight() {
yield 7;
yield from eight();
}
function eight() {
yield 8;
}
foreach (count_to_ten() as $num) {
echo "$num ";
}
?>
```
The above example will output:
```
1 2 3 4 5 6 7 8 9 10
```
**Example #7 **yield from** and return values**
```
<?php
function count_to_ten() {
yield 1;
yield 2;
yield from [3, 4];
yield from new ArrayIterator([5, 6]);
yield from seven_eight();
return yield from nine_ten();
}
function seven_eight() {
yield 7;
yield from eight();
}
function eight() {
yield 8;
}
function nine_ten() {
yield 9;
return 10;
}
$gen = count_to_ten();
foreach ($gen as $num) {
echo "$num ";
}
echo $gen->getReturn();
?>
```
The above example will output:
```
1 2 3 4 5 6 7 8 9 10
```
| programming_docs |
php Yaf_Response_Abstract::appendBody Yaf\_Response\_Abstract::appendBody
===================================
(Yaf >=1.0.0)
Yaf\_Response\_Abstract::appendBody — Append to response body
### Description
```
public Yaf_Response_Abstract::appendBody(string $content, string $key = ?): bool
```
Append 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::appendBody()**example**
```
<?php
$response = new Yaf_Response_Http();
$response->setBody("Hello")->prependBody(" World");
echo $response;
?>
```
The above example will output something similar to:
```
Hello World
```
### See Also
* [Yaf\_Config\_Ini](class.yaf-config-ini)
* [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::prependBody()](yaf-response-abstract.prependbody) - The prependBody purpose
* [Yaf\_Response\_Abstract::clearBody()](yaf-response-abstract.clearbody) - Discard all exists response body
php hash_final hash\_final
===========
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL hash >= 1.1)
hash\_final — Finalize an incremental hash and return resulting digest
### Description
```
hash_final(HashContext $context, bool $binary = false): string
```
### Parameters
`context`
Hashing context returned by [hash\_init()](function.hash-init).
`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.
### Changelog
| Version | Description |
| --- | --- |
| 7.2.0 | Accept [HashContext](class.hashcontext) instead of resource. |
### Examples
**Example #1 **hash\_final()** example**
```
<?php
$ctx = hash_init('sha1');
hash_update($ctx, 'The quick brown fox jumped over the lazy dog.');
echo hash_final($ctx);
?>
```
The above example will output:
```
c0854fb9fb03c41cce3802cb0d220529e6eef94e
```
### 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\_update\_stream()](function.hash-update-stream) - Pump data into an active hashing context from an open stream
* [hash\_update\_file()](function.hash-update-file) - Pump data into an active hashing context from a file
php Ds\Set::intersect Ds\Set::intersect
=================
(PECL ds >= 1.0.0)
Ds\Set::intersect — Creates a new set by intersecting values with another set
### Description
```
public Ds\Set::intersect(Ds\Set $set): Ds\Set
```
Creates a new set using values common to both the current instance and another `set`. In other words, returns a copy of the current instance with all values removed that are not in the other `set`.
`A ∩ B = {x : x ∈ A ∧ x ∈ B}`
### Parameters
`set`
The other set.
### Return Values
The intersection of the current instance and another `set`.
### See Also
* [» Intersection](https://en.wikipedia.org/wiki/Intersection_(set_theory)) on Wikipedia
### Examples
**Example #1 **Ds\Set::intersect()** example**
```
<?php
$a = new \Ds\Set([1, 2, 3]);
$b = new \Ds\Set([3, 4, 5]);
var_dump($a->intersect($b));
?>
```
The above example will output something similar to:
```
object(Ds\Set)#3 (1) {
[0]=>
int(3)
}
```
php RarEntry::getPackedSize RarEntry::getPackedSize
=======================
(PECL rar >= 0.1)
RarEntry::getPackedSize — Get packed size of the entry
### Description
```
public RarEntry::getPackedSize(): int
```
Get packed size of the archive entry.
>
> **Note**:
>
>
> Note that on platforms with 32-bit longs (that includes Windows x64), the maximum size returned is capped at 2 GiB. Check the constant **`PHP_INT_MAX`**.
>
>
### Parameters
This function has no parameters.
### Return Values
Returns the packed size, or **`false`** on error.
### Changelog
| Version | Description |
| --- | --- |
| PECL rar 2.0.0 | This method now returns correct values of packed sizes bigger than 2 GiB on platforms with 64-bit ints and never returns negative values on other platforms. |
### Examples
**Example #1 **RarEntry::getPackedSize()** example**
```
<?php
$rar_file = rar_open('example.rar') or die("Failed to open Rar archive");
$entry = rar_entry_get($rar_file, 'Dir/file.txt') or die("Failed to find such entry");
echo "Packed size of " . $entry->getName() . " = " . $entry->getPackedSize() . " bytes";
?>
```
php RecursiveRegexIterator::hasChildren RecursiveRegexIterator::hasChildren
===================================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
RecursiveRegexIterator::hasChildren — Returns whether an iterator can be obtained for the current entry
### Description
```
public RecursiveRegexIterator::hasChildren(): bool
```
Returns whether an iterator can be obtained for the current entry. This iterator can be obtained via [RecursiveRegexIterator::getChildren()](recursiveregexiterator.getchildren).
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if an iterator can be obtained for the current entry, otherwise returns **`false`**.
### Examples
**Example #1 **RecursiveRegexIterator::hasChildren()** example**
```
<?php
$rArrayIterator = new RecursiveArrayIterator(array('test1', array('tet3', 'test4', 'test5')));
$rRegexIterator = new RecursiveRegexIterator($rArrayIterator, '/^test/',
RecursiveRegexIterator::ALL_MATCHES);
foreach ($rRegexIterator as $value) {
var_dump($rRegexIterator->hasChildren());
}
?>
```
The above example will output:
```
bool(false)
bool(true)
```
### See Also
* [RecursiveRegexIterator::getChildren()](recursiveregexiterator.getchildren) - Returns an iterator for the current entry
php gmp_pow gmp\_pow
========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_pow — Raise number into power
### Description
```
gmp_pow(GMP|int|string $num, int $exponent): GMP
```
Raise `num` into power `exponent`.
### Parameters
`num`
The base number.
A [GMP](class.gmp) object, an int or a numeric string.
`exponent`
The positive power to raise the `num`.
### Return Values
The new (raised) number, as a GMP number. The case of `0^0` yields 1.
### Examples
**Example #1 **gmp\_pow()** example**
```
<?php
$pow1 = gmp_pow("2", 31);
echo gmp_strval($pow1) . "\n";
$pow2 = gmp_pow("0", 0);
echo gmp_strval($pow2) . "\n";
$pow3 = gmp_pow("2", -1); // Negative exp, generates warning
echo gmp_strval($pow3) . "\n";
?>
```
The above example will output:
```
2147483648
1
```
php None Anonymous functions
-------------------
Anonymous functions, also known as `closures`, allow the creation of functions which have no specified name. They are most useful as the value of [callable](language.types.callable) parameters, but they have many other uses.
Anonymous functions are implemented using the [[Closure](class.closure)](class.closure) class.
**Example #1 Anonymous function example**
```
<?php
echo preg_replace_callback('~-([a-z])~', function ($match) {
return strtoupper($match[1]);
}, 'hello-world');
// outputs helloWorld
?>
```
Closures can also be used as the values of variables; PHP automatically converts such expressions into instances of the [Closure](class.closure) internal class. Assigning a closure to a variable uses the same syntax as any other assignment, including the trailing semicolon:
**Example #2 Anonymous function variable assignment example**
```
<?php
$greet = function($name) {
printf("Hello %s\r\n", $name);
};
$greet('World');
$greet('PHP');
?>
```
Closures may also inherit variables from the parent scope. Any such variables must be passed to the `use` language construct. As of PHP 7.1, these variables must not include [superglobals](language.variables.predefined), $this, or variables with the same name as a parameter. A return type declaration of the function has to be placed *after* the `use` clause.
**Example #3 Inheriting variables from the parent scope**
```
<?php
$message = 'hello';
// No "use"
$example = function () {
var_dump($message);
};
$example();
// Inherit $message
$example = function () use ($message) {
var_dump($message);
};
$example();
// Inherited variable's value is from when the function
// is defined, not when called
$message = 'world';
$example();
// Reset message
$message = 'hello';
// Inherit by-reference
$example = function () use (&$message) {
var_dump($message);
};
$example();
// The changed value in the parent scope
// is reflected inside the function call
$message = 'world';
$example();
// Closures can also accept regular arguments
$example = function ($arg) use ($message) {
var_dump($arg . ' ' . $message);
};
$example("hello");
// Return type declaration comes after the use clause
$example = function () use ($message): string {
return "hello $message";
};
var_dump($example());
?>
```
The above example will output something similar to:
```
Notice: Undefined variable: message in /example.php on line 6
NULL
string(5) "hello"
string(5) "hello"
string(5) "hello"
string(5) "world"
string(11) "hello world"
string(11) "hello world"
```
As of PHP 8.0.0, the list of scope-inherited variables may include a trailing comma, which will be ignored.
Inheriting variables from the parent scope is *not* the same as using global variables. Global variables exist in the global scope, which is the same no matter what function is executing. The parent scope of a closure is the function in which the closure was declared (not necessarily the function it was called from). See the following example:
**Example #4 Closures and scoping**
```
<?php
// A basic shopping cart which contains a list of added products
// and the quantity of each product. Includes a method which
// calculates the total price of the items in the cart using a
// closure as a callback.
class Cart
{
const PRICE_BUTTER = 1.00;
const PRICE_MILK = 3.00;
const PRICE_EGGS = 6.95;
protected $products = array();
public function add($product, $quantity)
{
$this->products[$product] = $quantity;
}
public function getQuantity($product)
{
return isset($this->products[$product]) ? $this->products[$product] :
FALSE;
}
public function getTotal($tax)
{
$total = 0.00;
$callback =
function ($quantity, $product) use ($tax, &$total)
{
$pricePerItem = constant(__CLASS__ . "::PRICE_" .
strtoupper($product));
$total += ($pricePerItem * $quantity) * ($tax + 1.0);
};
array_walk($this->products, $callback);
return round($total, 2);
}
}
$my_cart = new Cart;
// Add some items to the cart
$my_cart->add('butter', 1);
$my_cart->add('milk', 3);
$my_cart->add('eggs', 6);
// Print the total with a 5% sales tax.
print $my_cart->getTotal(0.05) . "\n";
// The result is 54.29
?>
```
**Example #5 Automatic binding of `$this`**
```
<?php
class Test
{
public function testing()
{
return function() {
var_dump($this);
};
}
}
$object = new Test;
$function = $object->testing();
$function();
?>
```
The above example will output:
```
object(Test)#1 (0) {
}
```
When declared in the context of a class, the current class is automatically bound to it, making `$this` available inside of the function's scope. If this automatic binding of the current class is not wanted, then [static anonymous functions](functions.anonymous#functions.anonymous-functions.static) may be used instead.
### Static anonymous functions
Anonymous functions may be declared statically. This prevents them from having the current class automatically bound to them. Objects may also not be bound to them at runtime.
**Example #6 Attempting to use `$this` inside a static anonymous function**
```
<?php
class Foo
{
function __construct()
{
$func = static function() {
var_dump($this);
};
$func();
}
};
new Foo();
?>
```
The above example will output:
```
Notice: Undefined variable: this in %s on line %d
NULL
```
**Example #7 Attempting to bind an object to a static anonymous function**
```
<?php
$func = static function() {
// function body
};
$func = $func->bindTo(new StdClass);
$func();
?>
```
The above example will output:
```
Warning: Cannot bind an instance to a static closure in %s on line %d
```
### Changelog
| Version | Description |
| --- | --- |
| 7.1.0 | Anonymous functions may not close over [superglobals](language.variables.predefined), $this, or any variable with the same name as a parameter. |
### 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 a closure.
>
>
php gnupg_setarmor gnupg\_setarmor
===============
(PECL gnupg >= 0.1)
gnupg\_setarmor — Toggle armored output
### Description
```
gnupg_setarmor(resource $identifier, int $armor): bool
```
Toggle the armored output.
### Parameters
`identifier`
The gnupg identifier, from a call to [gnupg\_init()](function.gnupg-init) or **gnupg**.
`armor`
Pass a non-zero integer-value to this function to enable armored-output (default). Pass 0 to disable armored output.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Procedural **gnupg\_setarmor()** example**
```
<?php
$res = gnupg_init();
gnupg_setarmor($res,1); // enable armored output;
gnupg_setarmor($res,0); // disable armored output;
?>
```
**Example #2 OO **gnupg\_setarmor()** example**
```
<?php
$gpg = new gnupg();
$gpg->setarmor(1); // enable armored output;
$gpg->setarmor(0); // disable armored output;
?>
```
php getopt getopt
======
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
getopt — Gets options from the command line argument list
### Description
```
getopt(string $short_options, array $long_options = [], int &$rest_index = null): array|false
```
Parses options passed to the script.
### Parameters
`short_options`
Each character in this string will be used as option characters and matched against options passed to the script starting with a single hyphen (`-`). For example, an option string `"x"` recognizes an option `-x`. Only a-z, A-Z and 0-9 are allowed. `long_options`
An array of options. Each element in this array will be used as option strings and matched against options passed to the script starting with two hyphens (`--`). For example, an longopts element `"opt"` recognizes an option `--opt`. `rest_index`
If the `rest_index` parameter is present, then the index where argument parsing stopped will be written to this variable. The `short_options` parameter may contain the following elements:
* Individual characters (do not accept values)
* Characters followed by a colon (parameter requires value)
* Characters followed by two colons (optional value)
Option values are the first argument after the string. If a value is required, it does not matter whether the value has leading white space or not. See note.
> **Note**: Optional values do not accept `" "` (space) as a separator.
>
>
The `long_options` array values may contain:
* String (parameter does not accept any value)
* String followed by a colon (parameter requires value)
* String followed by two colons (optional value)
>
> **Note**:
>
>
> The format for the `short_options` and `long_options` is almost the same, the only difference is that `long_options` takes an array of options (where each element is the option) whereas `short_options` takes a string (where each character is the option).
>
>
### Return Values
This function will return an array of option / argument pairs, or **`false`** on failure.
>
> **Note**:
>
>
> The parsing of options will end at the first non-option found, anything that follows is discarded.
>
>
### Changelog
| Version | Description |
| --- | --- |
| 7.1.0 | Added the `rest_index` parameter. |
### Examples
**Example #1 **getopt()** example: The basics**
```
<?php
// Script example.php
$options = getopt("f:hp:");
var_dump($options);
?>
```
```
shell> php example.php -fvalue -h
```
The above example will output:
```
array(2) {
["f"]=>
string(5) "value"
["h"]=>
bool(false)
}
```
**Example #2 **getopt()** example: Introducing long options**
```
<?php
// Script example.php
$shortopts = "";
$shortopts .= "f:"; // Required value
$shortopts .= "v::"; // Optional value
$shortopts .= "abc"; // These options do not accept values
$longopts = array(
"required:", // Required value
"optional::", // Optional value
"option", // No value
"opt", // No value
);
$options = getopt($shortopts, $longopts);
var_dump($options);
?>
```
```
shell> php example.php -f "value for f" -v -a --required value --optional="optional value" --option
```
The above example will output:
```
array(6) {
["f"]=>
string(11) "value for f"
["v"]=>
bool(false)
["a"]=>
bool(false)
["required"]=>
string(5) "value"
["optional"]=>
string(14) "optional value"
["option"]=>
bool(false)
}
```
**Example #3 **getopt()** example: Passing multiple options as one**
```
<?php
// Script example.php
$options = getopt("abc");
var_dump($options);
?>
```
```
shell> php example.php -aaac
```
The above example will output:
```
array(2) {
["a"]=>
array(3) {
[0]=>
bool(false)
[1]=>
bool(false)
[2]=>
bool(false)
}
["c"]=>
bool(false)
}
```
**Example #4 **getopt()** example: Using `rest_index`**
```
<?php
// Script example.php
$rest_index = null;
$opts = getopt('a:b:', [], $rest_index);
$pos_args = array_slice($argv, $rest_index);
var_dump($pos_args);
```
```
shell> php example.php -a 1 -b 2 -- test
```
The above example will output:
```
array(1) {
[0]=>
string(4) "test"
}
```
### See Also
* [[$argv](reserved.variables.argv)](reserved.variables.argv)
php imagecrop imagecrop
=========
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
imagecrop — Crop an image to the given rectangle
### Description
```
imagecrop(GdImage $image, array $rectangle): GdImage|false
```
Crops an image to the given rectangular area and returns the resulting image. The given `image` is not modified.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`rectangle`
The cropping rectangle as array with keys `x`, `y`, `width` and `height`.
### Return Values
Return cropped image object 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. |
| 8.0.0 | On success, this function returns a [GDImage](class.gdimage) instance now; previously, a resource was returned. |
### Examples
**Example #1 **imagecrop()** example**
This example shows how to crop an image to a square area.
```
<?php
$im = imagecreatefrompng('example.png');
$size = min(imagesx($im), imagesy($im));
$im2 = imagecrop($im, ['x' => 0, 'y' => 0, 'width' => $size, 'height' => $size]);
if ($im2 !== FALSE) {
imagepng($im2, 'example-cropped.png');
imagedestroy($im2);
}
imagedestroy($im);
?>
```
### See Also
* [imagecropauto()](function.imagecropauto) - Crop an image automatically using one of the available modes
| programming_docs |
php Imagick::getImagesBlob Imagick::getImagesBlob
======================
(PECL imagick 2, PECL imagick 3)
Imagick::getImagesBlob — Returns all image sequences as a blob
### Description
```
public Imagick::getImagesBlob(): string
```
Implements direct to memory image formats. It returns all image sequences 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 images. On failure, throws ImagickException.
php RegexIterator::accept RegexIterator::accept
=====================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
RegexIterator::accept — Get accept status
### Description
```
public RegexIterator::accept(): bool
```
Matches `(string)` **RegexIterator::current()** (or **RegexIterator::key()** if the [RegexIterator::USE\_KEY](class.regexiterator#regexiterator.constants.use-key) flag is set) against the regular expression.
### Parameters
This function has no parameters.
### Return Values
**`true`** if a match, **`false`** otherwise.
### Examples
**Example #1 **RegexIterator::accept()** example**
This example shows that only items matching the regular expression are accepted.
```
<?php
$names = new ArrayIterator(array('Ann', 'Bob', 'Charlie', 'David'));
$filter = new RegexIterator($names, '/^[B-D]/');
foreach ($filter as $name) {
echo $name . PHP_EOL;
}
?>
```
The above example will output:
```
Bob
Charlie
David
```
### See Also
* [RegexIterator constants](class.regexiterator#regexiterator.constants)
* [RegexIterator::setFlags()](regexiterator.setflags) - Sets the flags
php The GearmanClient class
The GearmanClient class
=======================
Introduction
------------
(PECL gearman >= 0.5.0)
Represents a class for connecting to a Gearman job server and making requests to perform some function on provided data. The function performed must be one registered by a Gearman worker and the data passed is opaque to the job server.
Class synopsis
--------------
class **GearmanClient** { /\* Methods \*/
```
public addOptions(int $options): bool
```
```
public addServer(string $host = 127.0.0.1, int $port = 4730): bool
```
```
public addServers(string $servers = 127.0.0.1:4730): bool
```
```
public addTask(
string $function_name,
string $workload,
mixed &$context = ?,
string $unique = ?
): GearmanTask
```
```
public addTaskBackground(
string $function_name,
string $workload,
mixed &$context = ?,
string $unique = ?
): GearmanTask
```
```
public addTaskHigh(
string $function_name,
string $workload,
mixed &$context = ?,
string $unique = ?
): GearmanTask
```
```
public addTaskHighBackground(
string $function_name,
string $workload,
mixed &$context = ?,
string $unique = ?
): GearmanTask
```
```
public addTaskLow(
string $function_name,
string $workload,
mixed &$context = ?,
string $unique = ?
): GearmanTask
```
```
public addTaskLowBackground(
string $function_name,
string $workload,
mixed &$context = ?,
string $unique = ?
): GearmanTask
```
```
public addTaskStatus(string $job_handle, string &$context = ?): GearmanTask
```
```
public clearCallbacks(): bool
```
```
public clone(): GearmanClient
```
```
public __construct()
```
```
public context(): string
```
```
public data(): string
```
```
public do(string $function_name, string $workload, string $unique = ?): string
```
```
public doBackground(string $function_name, string $workload, string $unique = ?): string
```
```
public doHigh(string $function_name, string $workload, string $unique = ?): string
```
```
public doHighBackground(string $function_name, string $workload, string $unique = ?): string
```
```
public doJobHandle(): string
```
```
public doLow(string $function_name, string $workload, string $unique = ?): string
```
```
public doLowBackground(string $function_name, string $workload, string $unique = ?): string
```
```
public doNormal(string $function_name, string $workload, string $unique = ?): string
```
```
public doStatus(): array
```
```
public echo(string $workload): bool
```
```
public error(): string
```
```
public getErrno(): int
```
```
public jobStatus(string $job_handle): array
```
```
public ping(string $workload): bool
```
```
public removeOptions(int $options): bool
```
```
public returnCode(): int
```
```
public runTasks(): bool
```
```
public setClientCallback(callable $callback): void
```
```
public setCompleteCallback(callable $callback): bool
```
```
public setContext(string $context): bool
```
```
public setCreatedCallback(string $callback): bool
```
```
public setData(string $data): bool
```
```
public setDataCallback(callable $callback): bool
```
```
public setExceptionCallback(callable $callback): bool
```
```
public setFailCallback(callable $callback): bool
```
```
public setOptions(int $options): bool
```
```
public setStatusCallback(callable $callback): bool
```
```
public setTimeout(int $timeout): bool
```
```
public setWarningCallback(callable $callback): bool
```
```
public setWorkloadCallback(callable $callback): bool
```
```
public timeout(): int
```
```
public wait(): bool
```
} Table of Contents
-----------------
* [GearmanClient::addOptions](gearmanclient.addoptions) — Add client options
* [GearmanClient::addServer](gearmanclient.addserver) — Add a job server to the client
* [GearmanClient::addServers](gearmanclient.addservers) — Add a list of job servers to the client
* [GearmanClient::addTask](gearmanclient.addtask) — Add a task to be run in parallel
* [GearmanClient::addTaskBackground](gearmanclient.addtaskbackground) — Add a background task to be run in parallel
* [GearmanClient::addTaskHigh](gearmanclient.addtaskhigh) — Add a high priority task to run in parallel
* [GearmanClient::addTaskHighBackground](gearmanclient.addtaskhighbackground) — Add a high priority background task to be run in parallel
* [GearmanClient::addTaskLow](gearmanclient.addtasklow) — Add a low priority task to run in parallel
* [GearmanClient::addTaskLowBackground](gearmanclient.addtasklowbackground) — Add a low priority background task to be run in parallel
* [GearmanClient::addTaskStatus](gearmanclient.addtaskstatus) — Add a task to get status
* [GearmanClient::clearCallbacks](gearmanclient.clearcallbacks) — Clear all task callback functions
* [GearmanClient::clone](gearmanclient.clone) — Create a copy of a GearmanClient object
* [GearmanClient::\_\_construct](gearmanclient.construct) — Create a GearmanClient instance
* [GearmanClient::context](gearmanclient.context) — Get the application context
* [GearmanClient::data](gearmanclient.data) — Get the application data (deprecated)
* [GearmanClient::do](gearmanclient.do) — Run a single task and return a result [deprecated]
* [GearmanClient::doBackground](gearmanclient.dobackground) — Run a task in the background
* [GearmanClient::doHigh](gearmanclient.dohigh) — Run a single high priority task
* [GearmanClient::doHighBackground](gearmanclient.dohighbackground) — Run a high priority task in the background
* [GearmanClient::doJobHandle](gearmanclient.dojobhandle) — Get the job handle for the running task
* [GearmanClient::doLow](gearmanclient.dolow) — Run a single low priority task
* [GearmanClient::doLowBackground](gearmanclient.dolowbackground) — Run a low priority task in the background
* [GearmanClient::doNormal](gearmanclient.donormal) — Run a single task and return a result
* [GearmanClient::doStatus](gearmanclient.dostatus) — Get the status for the running task
* [GearmanClient::echo](gearmanclient.echo) — Send data to all job servers to see if they echo it back [deprecated]
* [GearmanClient::error](gearmanclient.error) — Returns an error string for the last error encountered
* [GearmanClient::getErrno](gearmanclient.geterrno) — Get an errno value
* [GearmanClient::jobStatus](gearmanclient.jobstatus) — Get the status of a background job
* [GearmanClient::ping](gearmanclient.ping) — Send data to all job servers to see if they echo it back
* [GearmanClient::removeOptions](gearmanclient.removeoptions) — Remove client options
* [GearmanClient::returnCode](gearmanclient.returncode) — Get the last Gearman return code
* [GearmanClient::runTasks](gearmanclient.runtasks) — Run a list of tasks in parallel
* [GearmanClient::setClientCallback](gearmanclient.setclientcallback) — Callback function when there is a data packet for a task (deprecated)
* [GearmanClient::setCompleteCallback](gearmanclient.setcompletecallback) — Set a function to be called on task completion
* [GearmanClient::setContext](gearmanclient.setcontext) — Set application context
* [GearmanClient::setCreatedCallback](gearmanclient.setcreatedcallback) — Set a callback for when a task is queued
* [GearmanClient::setData](gearmanclient.setdata) — Set application data (deprecated)
* [GearmanClient::setDataCallback](gearmanclient.setdatacallback) — Callback function when there is a data packet for a task
* [GearmanClient::setExceptionCallback](gearmanclient.setexceptioncallback) — Set a callback for worker exceptions
* [GearmanClient::setFailCallback](gearmanclient.setfailcallback) — Set callback for job failure
* [GearmanClient::setOptions](gearmanclient.setoptions) — Set client options
* [GearmanClient::setStatusCallback](gearmanclient.setstatuscallback) — Set a callback for collecting task status
* [GearmanClient::setTimeout](gearmanclient.settimeout) — Set socket I/O activity timeout
* [GearmanClient::setWarningCallback](gearmanclient.setwarningcallback) — Set a callback for worker warnings
* [GearmanClient::setWorkloadCallback](gearmanclient.setworkloadcallback) — Set a callback for accepting incremental data updates
* [GearmanClient::timeout](gearmanclient.timeout) — Get current socket I/O activity timeout value
* [GearmanClient::wait](gearmanclient.wait) — Wait for I/O activity on all connections in a client
php Yaf_Response_Abstract::__destruct Yaf\_Response\_Abstract::\_\_destruct
=====================================
(Yaf >=1.0.0)
Yaf\_Response\_Abstract::\_\_destruct — The \_\_destruct purpose
### Description
public **Yaf\_Response\_Abstract::\_\_destruct**()
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php openal_buffer_loadwav openal\_buffer\_loadwav
=======================
(PECL openal >= 0.1.0)
openal\_buffer\_loadwav — Load a .wav file into a buffer
### Description
```
openal_buffer_loadwav(resource $buffer, string $wavfile): bool
```
### Parameters
`buffer`
An [Open AL(Buffer)](https://www.php.net/manual/en/openal.resources.php) resource (previously created by [openal\_buffer\_create()](function.openal-buffer-create)).
`wavfile`
Path to .wav file on *local* file system.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [openal\_buffer\_data()](function.openal-buffer-data) - Load a buffer with data
* [openal\_stream()](function.openal-stream) - Begin streaming on a source
php fdf_set_on_import_javascript fdf\_set\_on\_import\_javascript
================================
(PHP 4 >= 4.3.0, PHP 5 < 5.3.0, PECL fdf SVN)
fdf\_set\_on\_import\_javascript — Adds javascript code to be executed when Acrobat opens the FDF
### Description
```
fdf_set_on_import_javascript(resource $fdf_document, string $script, bool $before_data_import): bool
```
**Warning**This function is currently not documented; only its argument list is available.
### See Also
* [fdf\_add\_doc\_javascript()](function.fdf-add-doc-javascript) - Adds javascript code to the FDF document
* [fdf\_set\_javascript\_action()](function.fdf-set-javascript-action) - Sets an javascript action of a field
php unpack unpack
======
(PHP 4, PHP 5, PHP 7, PHP 8)
unpack — Unpack data from binary string
### Description
```
unpack(string $format, string $string, int $offset = 0): array|false
```
Unpacks from a binary string into an array according to the given `format`.
The unpacked data is stored in an associative array. To accomplish this you have to name the different format codes and separate them by a slash /. If a repeater argument is present, then each of the array keys will have a sequence number behind the given name.
Changes were made to bring this function into line with Perl:
* The "a" code now retains trailing NULL bytes.
* The "A" code now strips all trailing ASCII whitespace (spaces, tabs, newlines, carriage returns, and NULL bytes).
* The "Z" code was added for NULL-padded strings, and removes trailing NULL bytes.
### Parameters
`format`
See [pack()](function.pack) for an explanation of the format codes.
`string`
The packed data.
`offset`
The offset to begin unpacking from.
### Return Values
Returns an associative array containing unpacked elements of binary string, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 7.2.0 | float and double types supports both Big Endian and Little Endian. |
| 7.1.0 | The optional `offset` has been added. |
### Examples
**Example #1 **unpack()** example**
```
<?php
$binarydata = "\x04\x00\xa0\x00";
$array = unpack("cchars/nint", $binarydata);
print_r($array);
?>
```
The above example will output:
```
Array
(
[chars] => 4
[int] => 160
)
```
**Example #2 **unpack()** example with a repeater**
```
<?php
$binarydata = "\x04\x00\xa0\x00";
$array = unpack("c2chars/nint", $binarydata);
print_r($array);
?>
```
The above example will output:
```
Array
(
[chars1] => 4
[chars2] => 0
[int] => 40960
)
```
### Notes
**Caution** Note that PHP internally stores integral values as signed. If you unpack a large unsigned long and it is of the same size as PHP internally stored values the result will be a negative number even though unsigned unpacking was specified.
**Caution** If you do not name an element, numeric indices starting from `1` are used. Be aware that if you have more than one unnamed element, some data is overwritten because the numbering restarts from `1` for each element.
**Example #3 **unpack()** example with unnamed keys**
```
<?php
$binarydata = "\x32\x42\x00\xa0";
$array = unpack("c2/n", $binarydata);
var_dump($array);
?>
```
The above example will output:
```
array(2) {
[1]=>
int(160)
[2]=>
int(66)
}
```
Note that the first value from the `c` specifier is overwritten by the first value from the `n` specifier.
### See Also
* [pack()](function.pack) - Pack data into binary string
php fbird_maintain_db fbird\_maintain\_db
===================
(PHP 5, PHP 7 < 7.4.0)
fbird\_maintain\_db — Alias of [ibase\_maintain\_db()](function.ibase-maintain-db)
### Description
This function is an alias of: [ibase\_maintain\_db()](function.ibase-maintain-db).
php mhash_keygen_s2k mhash\_keygen\_s2k
==================
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
mhash\_keygen\_s2k — Generates a key
**Warning**This function has been *DEPRECATED* as of PHP 8.1.0. Relying on this function is highly discouraged.
### Description
```
mhash_keygen_s2k(
int $algo,
string $password,
string $salt,
int $length
): string|false
```
Generates a key according to the given `algo`, using an user provided `password`.
This is the Salted S2K algorithm as specified in the OpenPGP document ([» RFC 2440](http://www.faqs.org/rfcs/rfc2440)).
Keep in mind that user supplied passwords are not really suitable to be used as keys in cryptographic algorithms, since users normally choose keys they can write on keyboard. These passwords use only 6 to 7 bits per character (or less). It is highly recommended to use some kind of transformation (like this function) to the user supplied key.
### Parameters
`algo`
The hash ID used to create the key. One of the **`MHASH_hashname`** constants.
`password`
An user supplied password.
`salt`
Must be different and random enough for every key you generate in order to create different keys. Because `salt` must be known when you check the keys, it is a good idea to append the key to it. Salt has a fixed length of 8 bytes and will be padded with zeros if you supply less bytes.
`length`
The key length, in bytes.
### Return Values
Returns the generated key as a string, or **`false`** on error.
### 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. |
php usleep usleep
======
(PHP 4, PHP 5, PHP 7, PHP 8)
usleep — Delay execution in microseconds
### Description
```
usleep(int $microseconds): void
```
Delays program execution for the given number of microseconds.
### Parameters
`microseconds`
Halt time in microseconds. A microsecond is one millionth of a second.
> **Note**: Values larger than `1000000` (i.e. sleeping for more than a second) may not be supported by the operating system. Use [sleep()](function.sleep) instead.
>
>
> **Note**: The sleep may be lengthened slightly (i.e. may be longer than `microseconds`) by any system activity or by the time spent processing the call or by the granularity of system timers.
>
>
### Return Values
No value is returned.
### Examples
**Example #1 **usleep()** example**
```
<?php
// Current time
echo date('h:i:s') . "\n";
// wait for 2 seconds
usleep(2000000);
// back!
echo date('h:i:s') . "\n";
?>
```
The above example will output:
```
11:13:28
11:13:30
```
### See Also
* [sleep()](function.sleep) - Delay execution
* [time\_nanosleep()](function.time-nanosleep) - Delay for a number of seconds and nanoseconds
* [time\_sleep\_until()](function.time-sleep-until) - Make the script sleep until the specified time
* [set\_time\_limit()](function.set-time-limit) - Limits the maximum execution time
php stats_dens_logistic stats\_dens\_logistic
=====================
(PECL stats >= 1.0.0)
stats\_dens\_logistic — Probability density function of the logistic distribution
### Description
```
stats_dens_logistic(float $x, float $ave, float $stdev): float
```
Returns the probability density at `x`, where the random variable follows the logistic distribution of which the location parameter is `ave` and the scale parameter is `stdev`.
### Parameters
`x`
The value at which the probability density is calculated
`ave`
The location parameter of the distribution
`stdev`
The shape parameter of the distribution
### Return Values
The probability density at `x` or **`false`** for failure.
php Imagick::inverseFourierTransformImage Imagick::inverseFourierTransformImage
=====================================
(PECL imagick 3 >= 3.3.0)
Imagick::inverseFourierTransformImage — Description
### Description
```
public Imagick::inverseFourierTransformImage(Imagick $complement, bool $magnitude): bool
```
Implements the inverse discrete Fourier transform (DFT) of the image either as a magnitude / phase or real / imaginary image pair.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`complement`
The second image to combine with this one to form either the magnitude / phase or real / imaginary image pair.
`magnitude`
If true, combine as magnitude / phase pair otherwise a real / imaginary image pair.
### Return Values
Returns **`true`** on success.
php PharData::__construct PharData::\_\_construct
=======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
PharData::\_\_construct — Construct a non-executable tar or zip archive object
### Description
public **PharData::\_\_construct**(
string `$filename`,
int `$flags` = FilesystemIterator::SKIP\_DOTS | FilesystemIterator::UNIX\_PATHS,
?string `$alias` = **`null`**,
int `$format` = 0
) ### Parameters
`filename`
Path to an existing tar/zip archive or to-be-created archive
`flags`
Flags to pass to [Phar](class.phar) parent class [RecursiveDirectoryIterator](class.recursivedirectoryiterator).
`alias`
Alias with which this Phar archive should be referred to in calls to stream functionality.
`format`
One of the [file format constants](https://www.php.net/manual/en/phar.constants.php#phar.constants.fileformat) available within the [Phar](class.phar) class.
### Errors/Exceptions
Throws [BadMethodCallException](class.badmethodcallexception) if called twice; [UnexpectedValueException](class.unexpectedvalueexception) if the Phar archive can't be opened.
### Examples
**Example #1 A **PharData::\_\_construct()** example**
```
<?php
try {
$p = new PharData('/path/to/my.tar', Phar::CURRENT_AS_FILEINFO | Phar::KEY_AS_FILENAME);
} catch (UnexpectedValueException $e) {
die('Could not open my.tar');
} catch (BadMethodCallException $e) {
echo 'technically, this cannot happen';
}
echo file_get_contents('phar:///path/to/my.tar/example.txt');
?>
```
| programming_docs |
php SolrInputDocument::getBoost SolrInputDocument::getBoost
===========================
(PECL solr >= 0.9.2)
SolrInputDocument::getBoost — Retrieves the current boost value for the document
### Description
```
public SolrInputDocument::getBoost(): float
```
Retrieves the current boost value for the document.
### Parameters
This function has no parameters.
### Return Values
Returns the boost value on success and **`false`** on failure.
php Collator::asort Collator::asort
===============
collator\_asort
===============
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
Collator::asort -- collator\_asort — Sort array maintaining index association
### Description
Object-oriented style
```
public Collator::asort(array &$array, int $flags = Collator::SORT_REGULAR): bool
```
Procedural style
```
collator_asort(Collator $object, array &$array, int $flags = Collator::SORT_REGULAR): bool
```
This function sorts an array such that array indices maintain their correlation with the array elements they are associated with. This is used mainly when sorting associative arrays where the actual element order is significant. Array elements will have sort order according to current locale rules.
Equivalent to standard PHP [asort()](function.asort).
### Parameters
`object`
[Collator](class.collator) object.
`array`
Array of strings to sort.
`flags`
Optional sorting type, one of the following:
* **`Collator::SORT_REGULAR`** - compare items normally (don't change types)
* **`Collator::SORT_NUMERIC`** - compare items numerically
* **`Collator::SORT_STRING`** - compare items as strings
Default `flags` value is **`Collator::SORT_REGULAR`**. It is also used if an invalid `flags` value has been specified.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **collator\_asort()** example**
```
<?php
$coll = collator_create( 'en_US' );
$arr = array(
'a' => '100',
'b' => '50',
'c' => '7'
);
collator_asort( $coll, $arr, Collator::SORT_NUMERIC );
var_export( $arr );
collator_asort( $coll, $arr, Collator::SORT_STRING );
var_export( $arr );
?>
```
The above example will output:
```
array (
'c' => '7',
'b' => '50',
'a' => '100',
)array (
'a' => '100',
'b' => '50',
'c' => '7',
)
```
### See Also
* [[Collator](class.collator) constants](class.collator#intl.collator-constants)
* [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 Parle\Parser::build Parle\Parser::build
===================
(PECL parle >= 0.5.1)
Parle\Parser::build — Finalize the grammar rules
### Description
```
public Parle\Parser::build(): void
```
Any tokens and grammar rules previously added are finalized. The rule set becomes readonly and the parser is ready to start.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php UConverter::fromUCallback UConverter::fromUCallback
=========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
UConverter::fromUCallback — Default "from" callback function
### Description
```
public UConverter::fromUCallback(
int $reason,
array $source,
int $codePoint,
int &$error
): string|int|array|null
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`reason`
`source`
`codePoint`
`error`
### Return Values
php zip_entry_close zip\_entry\_close
=================
(PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.0.0)
zip\_entry\_close — Close 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_close(resource $zip_entry): bool
```
Closes the specified directory entry.
### Parameters
`zip_entry`
A directory entry previously opened [zip\_entry\_open()](function.zip-entry-open).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function is deprecated in favor of the Object API. |
### See Also
* [zip\_entry\_open()](function.zip-entry-open) - Open a directory entry for reading
* [zip\_entry\_read()](function.zip-entry-read) - Read from an open directory entry
php QuickHashIntStringHash::loadFromString QuickHashIntStringHash::loadFromString
======================================
(PECL quickhash >= Unknown)
QuickHashIntStringHash::loadFromString — This factory method creates a hash from a string
### Description
```
public static QuickHashIntStringHash::loadFromString(string $contents, int $size = 0, int $options = 0): QuickHashIntStringHash
```
This factory method creates a new hash from a definition in a string. The format is the same as the one used in "loadFromFile".
### Parameters
`contents`
The string containing a serialized format of the hash.
`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 hash, rounded up to the nearest power of two with a maximum limit of 4194304.
### Return Values
Returns a new QuickHashIntStringHash.
### Examples
**Example #1 **QuickHashIntStringHash::loadFromString()** example**
```
<?php
$contents = file_get_contents( dirname( __FILE__ ) . "/simple.hash" );
$hash = QuickHashIntStringHash::loadFromString(
$contents,
QuickHashIntStringHash::DO_NOT_USE_ZEND_ALLOC
);
foreach( range( 0, 0x0f ) as $key )
{
printf( "Key %3d (%2x) is %s\n",
$key, $key,
$hash->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 ErrorException::__construct ErrorException::\_\_construct
=============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
ErrorException::\_\_construct — Constructs the exception
### Description
public **ErrorException::\_\_construct**(
string `$message` = "",
int `$code` = 0,
int `$severity` = **`E_ERROR`**,
?string `$filename` = **`null`**,
?int `$line` = **`null`**,
?[Throwable](class.throwable) `$previous` = **`null`**
) Constructs the Exception.
### Parameters
`message`
The Exception message to throw.
`code`
The Exception code.
`severity`
The severity level of the exception.
>
> **Note**:
>
>
> While the severity can be any int value, it is intended that the [error constants](https://www.php.net/manual/en/errorfunc.constants.php) be used.
>
>
`filename`
The filename where the exception is thrown.
`line`
The line number where the exception is thrown.
`previous`
The previous exception used for the exception chaining.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `filename` and `line` are nullable now. Previously, their defaults were **`__FILE__`** and **`__LINE__`**, respectively. |
php $_GET $\_GET
======
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
$\_GET — HTTP GET variables
### Description
An associative array of variables passed to the current script via the URL parameters (aka. query string). Note that the array is not only populated for GET requests, but rather for all requests with a query string.
### Examples
**Example #1 $\_GET example**
```
<?php
echo 'Hello ' . htmlspecialchars($_GET["name"]) . '!';
?>
```
Assuming the user entered http://example.com/?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.
>
>
>
>
> **Note**:
>
>
> The GET variables are passed through [urldecode()](function.urldecode).
>
>
### See Also
* [Handling external variables](language.variables.external)
* [The filter extension](https://www.php.net/manual/en/book.filter.php)
php None Comments
--------
PHP supports 'C', 'C++' and Unix shell-style (Perl style) comments. For example:
```
<?php
echo 'This is a test'; // This is a one-line c++ style comment
/* This is a multi line comment
yet another line of comment */
echo 'This is yet another test';
echo 'One Final Test'; # This is a one-line shell-style comment
?>
```
The "one-line" comment styles only comment to the end of the line or the current block of PHP code, whichever comes first. This means that HTML code after `// ... ?>` or `# ... ?>` WILL be printed: ?> breaks out of PHP mode and returns to HTML mode, and `//` or `#` cannot influence that.
```
<h1>This is an <?php # echo 'simple';?> example</h1>
<p>The header above will say 'This is an example'.</p>
```
'C' style comments end at the first `*/` encountered. Make sure you don't nest 'C' style comments. It is easy to make this mistake if you are trying to comment out a large block of code.
```
<?php
/*
echo 'This is a test'; /* This comment will cause a problem */
*/
?>
```
php streamWrapper::rmdir streamWrapper::rmdir
====================
(PHP 5, PHP 7, PHP 8)
streamWrapper::rmdir — Removes a directory
### Description
```
public streamWrapper::rmdir(string $path, int $options): bool
```
This method is called in response to [rmdir()](function.rmdir).
>
> **Note**:
>
>
> In order for the appropriate error message to be returned this method should *not* be defined if the wrapper does not support removing directories.
>
>
### Parameters
`path`
The directory URL which should be removed.
`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
* [rmdir()](function.rmdir) - Removes directory
* [streamwrapper::mkdir()](streamwrapper.mkdir) - Create a directory
* [streamwrapper::unlink()](streamwrapper.unlink) - Delete a file
php The AppendIterator class
The AppendIterator class
========================
Introduction
------------
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
An Iterator that iterates over several iterators one after the other.
Class synopsis
--------------
class **AppendIterator** extends [IteratorIterator](class.iteratoriterator) { /\* Methods \*/ public [\_\_construct](appenditerator.construct)()
```
public append(Iterator $iterator): void
```
```
public current(): mixed
```
```
public getArrayIterator(): ArrayIterator
```
```
public getInnerIterator(): Iterator
```
```
public getIteratorIndex(): ?int
```
```
public key(): scalar
```
```
public next(): void
```
```
public rewind(): void
```
```
public valid(): bool
```
/\* 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
-----------------
* [AppendIterator::append](appenditerator.append) — Appends an iterator
* [AppendIterator::\_\_construct](appenditerator.construct) — Constructs an AppendIterator
* [AppendIterator::current](appenditerator.current) — Gets the current value
* [AppendIterator::getArrayIterator](appenditerator.getarrayiterator) — Gets the ArrayIterator
* [AppendIterator::getInnerIterator](appenditerator.getinneriterator) — Gets the inner iterator
* [AppendIterator::getIteratorIndex](appenditerator.getiteratorindex) — Gets an index of iterators
* [AppendIterator::key](appenditerator.key) — Gets the current key
* [AppendIterator::next](appenditerator.next) — Moves to the next element
* [AppendIterator::rewind](appenditerator.rewind) — Rewinds the Iterator
* [AppendIterator::valid](appenditerator.valid) — Checks validity of the current element
php Memcached::setMultiByKey Memcached::setMultiByKey
========================
(PECL memcached >= 0.1.0)
Memcached::setMultiByKey — Store multiple items on a specific server
### Description
```
public Memcached::setMultiByKey(string $server_key, array $items, int $expiration = ?): bool
```
**Memcached::setMultiByKey()** is functionally equivalent to [Memcached::setMulti()](memcached.setmulti), except that the free-form `server_key` can be used to map the keys from `items` 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.
`items`
An array of key/value pairs to store on the server.
`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.
### See Also
* [Memcached::setMulti()](memcached.setmulti) - Store multiple items
* [Memcached::set()](memcached.set) - Store an item
php sodium_crypto_generichash_final sodium\_crypto\_generichash\_final
==================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_generichash\_final — Complete the hash
### Description
```
sodium_crypto_generichash_final(string &$state, int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string
```
The finalization method for the streaming generichash API.
### Parameters
`state`
Hash state returned from [sodium\_crypto\_generichash\_init()](function.sodium-crypto-generichash-init)
`length`
Output length.
### Return Values
Cryptographic hash.
### Examples
**Example #1 **sodium\_crypto\_generichash\_final()** 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 ImagickDraw::pop ImagickDraw::pop
================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::pop — Destroys the current ImagickDraw in the stack, and returns to the previously pushed ImagickDraw
### Description
```
public ImagickDraw::pop(): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Destroys the current ImagickDraw in the stack, and returns to the previously pushed ImagickDraw. Multiple ImagickDraws may exist. It is an error to attempt to pop more ImagickDraws than have been pushed, and it is proper form to pop all ImagickDraws which have been pushed.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php odbc_procedurecolumns odbc\_procedurecolumns
======================
(PHP 4, PHP 5, PHP 7, PHP 8)
odbc\_procedurecolumns — Retrieve information about parameters to procedures
### Description
```
odbc_procedurecolumns(
resource $odbc,
?string $catalog = null,
?string $schema = null,
?string $procedure = null,
?string $column = null
): resource|false
```
Retrieve information about parameters to procedures.
### 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.
`procedure`
The proc. This parameter accepts the following search patterns: `%` to match zero or more characters, and `_` to match a single character.
`column`
The column. This parameter accepts the following search patterns: `%` to match zero or more characters, and `_` to match a single character.
### Return Values
Returns the list of input and output parameters, as well as the columns that make up the result set for the specified procedures. Returns an ODBC result identifier or **`false`** on failure.
The result set has the following columns:
* `PROCEDURE_CAT`
* `PROCEDURE_SCHEM`
* `PROCEDURE_NAME`
* `COLUMN_NAME`
* `COLUMN_TYPE`
* `DATA_TYPE`
* `TYPE_NAME`
* `COLUMN_SIZE`
* `BUFFER_LENGTH`
* `DECIMAL_DIGITS`
* `NUM_PREC_RADIX`
* `NULLABLE`
* `REMARKS`
* `COLUMN_DEF`
* `SQL_DATA_TYPE`
* `SQL_DATETIME_SUB`
* `CHAR_OCTET_LENGTH`
* `ORDINAL_POSITION`
* `IS_NULLABLE`
Drivers can report additional columns. The result set is ordered by `PROCEDURE_CAT`, `PROCEDURE_SCHEM`, `PROCEDURE_NAME` and `COLUMN_TYPE`.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Prior to this version, the function could only be called with either one or five arguments. |
### Examples
**Example #1 List Columns of a stored Procedure**
```
<?php
$conn = odbc_connect($dsn, $user, $pass);
$columns = odbc_procedurecolumns($conn, 'TutorialDB', 'dbo', 'GetEmployeeSalesYTD;1', '%');
while (($row = odbc_fetch_array($columns))) {
print_r($row);
break; // further rows omitted for brevity
}
?>
```
The above example will output something similar to:
```
Array
(
[PROCEDURE_CAT] => TutorialDB
[PROCEDURE_SCHEM] => dbo
[PROCEDURE_NAME] => GetEmployeeSalesYTD;1
[COLUMN_NAME] => @SalesPerson
[COLUMN_TYPE] => 1
[DATA_TYPE] => -9
[TYPE_NAME] => nvarchar
[COLUMN_SIZE] => 50
[BUFFER_LENGTH] => 100
[DECIMAL_DIGITS] =>
[NUM_PREC_RADIX] =>
[NULLABLE] => 1
[REMARKS] =>
[COLUMN_DEF] =>
[SQL_DATA_TYPE] => -9
[SQL_DATETIME_SUB] =>
[CHAR_OCTET_LENGTH] => 100
[ORDINAL_POSITION] => 1
[IS_NULLABLE] => YES
)
```
### See Also
* [odbc\_columns()](function.odbc-columns) - Lists the column names in specified tables
php dom_import_simplexml dom\_import\_simplexml
======================
(PHP 5, PHP 7, PHP 8)
dom\_import\_simplexml — Gets a [DOMElement](class.domelement) object from a [SimpleXMLElement](class.simplexmlelement) object
### Description
```
dom_import_simplexml(object $node): DOMElement
```
This function takes the node `node` of class [SimpleXML](https://www.php.net/manual/en/ref.simplexml.php) and makes it into a [DOMElement](class.domelement) node. This new object can then be used as a native [DOMElement](class.domelement) node.
### Parameters
`node`
The [SimpleXMLElement](class.simplexmlelement) node.
### Return Values
The [DOMElement](class.domelement) node added.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function no longer returns **`null`** on failure. |
### Examples
**Example #1 Import SimpleXML into DOM with **dom\_import\_simplexml()****
```
<?php
$sxe = simplexml_load_string('<books><book><title>blah</title></book></books>');
if ($sxe === false) {
echo 'Error while parsing the document';
exit;
}
$dom_sxe = dom_import_simplexml($sxe);
if (!$dom_sxe) {
echo 'Error while converting XML';
exit;
}
$dom = new DOMDocument('1.0');
$dom_sxe = $dom->importNode($dom_sxe, true);
$dom_sxe = $dom->appendChild($dom_sxe);
echo $dom->saveXML();
?>
```
### See Also
* [simplexml\_import\_dom()](function.simplexml-import-dom) - Get a SimpleXMLElement object from a DOM node
| programming_docs |
php eio_chmod eio\_chmod
==========
(PECL eio >= 0.0.1dev)
eio\_chmod — Change file/directory permissions
### Description
```
eio_chmod(
string $path,
int $mode,
int $pri = EIO_PRI_DEFAULT,
callable $callback = NULL,
mixed $data = NULL
): resource
```
**eio\_chmod()** changes file, or directory permissions. The new permissions are specified by `mode`.
### Parameters
`path`
Path to the target file or directory
**Warning**Avoid relative paths
`mode`
The new permissions. E.g. **`0644`**.
`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\_chmod()** returns request resource on success, or **`false`** on failure.
### See Also
* [eio\_chown()](function.eio-chown) - Change file/directory permissions
php array_count_values array\_count\_values
====================
(PHP 4, PHP 5, PHP 7, PHP 8)
array\_count\_values — Counts all the values of an array
### Description
```
array_count_values(array $array): array
```
**array\_count\_values()** returns an array using the values of `array` (which must be ints or strings) as keys and their frequency in `array` as values.
### Parameters
`array`
The array of values to count
### Return Values
Returns an associative array of values from `array` as keys and their count as value.
### Errors/Exceptions
Throws **`E_WARNING`** for every element which is not string or int.
### Examples
**Example #1 **array\_count\_values()** example**
```
<?php
$array = array(1, "hello", 1, "world", "hello");
print_r(array_count_values($array));
?>
```
The above example will output:
```
Array
(
[1] => 2
[hello] => 2
[world] => 1
)
```
### See Also
* [count()](function.count) - Counts all elements in an array or in a Countable object
* [array\_unique()](function.array-unique) - Removes duplicate values from an array
* [array\_values()](function.array-values) - Return all the values of an array
* [count\_chars()](function.count-chars) - Return information about characters used in a string
php Yar_Concurrent_Client::call Yar\_Concurrent\_Client::call
=============================
(PECL yar >= 1.0.0)
Yar\_Concurrent\_Client::call — Register a concurrent call
### Description
```
public static Yar_Concurrent_Client::call(
string $uri,
string $method,
array $parameters = ?,
callable $callback = ?,
callable $error_callback = ?,
array $options = ?
): int
```
Register a RPC call, but won't sent it immediately, it will be send while further call to [Yar\_Concurrent\_Client::loop()](yar-concurrent-client.loop)
### Parameters
`uri`
The RPC server URI(http, tcp)
`method`
Service name(aka the method name)
`parameters`
Parameters
`callback`
A function callback, which will be called while the response return.
### Return Values
An unique id, can be used to identified which call it is.
### Examples
**Example #1 **Yar\_Concurrent\_Client::call()** example**
```
<?php
function callback($retval, $callinfo) {
var_dump($retval);
}
function error_callback($type, $error, $callinfo) {
error_log($error);
}
Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters"), "callback");
Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters")); // if the callback is not specificed,
// callback in loop will be used
Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters"), "callback", NULL, array(YAR_OPT_PACKAGER => "json"));
//this server accept json packager
Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters"), "callback", NULL, array(YAR_OPT_TIMEOUT=>1));
//custom timeout
//The requests are not sent yet
?>
```
The above example will output something similar to:
### See Also
* [Yar\_Concurrent\_Client::loop()](yar-concurrent-client.loop) - Send all calls
* [Yar\_Concurrent\_Client::reset()](yar-concurrent-client.reset) - Clean all registered calls
* [Yar\_Server::\_\_construct()](yar-server.construct) - Register a server
* [Yar\_Server::handle()](yar-server.handle) - Start RPC Server
php GearmanClient::addTaskLow GearmanClient::addTaskLow
=========================
(PECL gearman >= 0.5.0)
GearmanClient::addTaskLow — Add a low priority task to run in parallel
### Description
```
public GearmanClient::addTaskLow(
string $function_name,
string $workload,
mixed &$context = ?,
string $unique = ?
): GearmanTask
```
Adds a low priority background task to be run in parallel with other tasks. Call this method for all the tasks to be run in parallel, then call [GearmanClient::runTasks()](gearmanclient.runtasks) to perform the work. Tasks with a low priority will be selected from the queue after 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 low priority task along with two normal tasks**
A low priority task is included among two other tasks. A single worker is available, so that tasks are run one at a time, with the low priority task run last.
```
<?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 low priority
$task= $gmc->addTask("reverse", "Hello World!", null, "1");
$task= $gmc->addTaskLow("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: 3, !dlroW olleH
COMPLETE: 1, !dlroW olleH
COMPLETE: 2, Hello World!
DONE
```
### See Also
* [GearmanClient::addTask()](gearmanclient.addtask) - Add a task to be run in parallel
* [GearmanClient::addTaskHigh()](gearmanclient.addtaskhigh) - Add a high 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
php openssl_spki_verify openssl\_spki\_verify
=====================
(PHP 5 >= 5.6.0, PHP 7, PHP 8)
openssl\_spki\_verify — Verifies a signed public key and challenge
### Description
```
openssl_spki_verify(string $spki): bool
```
Validates the supplied signed public key and challenge
### Parameters
`spki`
Expects a valid signed public key and challenge
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
Emits an **`E_WARNING`** level error if an invalid argument is passed via the `spki` parameter.
### Examples
**Example #1 **openssl\_spki\_verify()** example**
Validates an existing signed public key and challenge
```
<?php
$pkey = openssl_pkey_new('secret password');
$spkac = openssl_spki_new($pkey, 'challenge string');
if (openssl_spki_verify(preg_replace('/SPKAC=/', '', $spkac))) {
echo $spkac;
} else {
echo "SPKAC validation failed";
}
?>
```
**Example #2 **openssl\_spki\_verify()** example from <keygen>**
Validates an existing signed public key and challenge issued from the <keygen> element
```
<?php
if (openssl_spki_verify(preg_replace('/SPKAC=/', '', $_POST['spkac']))) {
echo $spkac;
} else {
echo "SPKAC validation failed";
}
?>
<keygen name="spkac" challenge="challenge string" keytype="RSA">
```
### See Also
* [openssl\_spki\_new()](function.openssl-spki-new) - Generate a new signed public key and challenge
* [openssl\_spki\_export\_challenge()](function.openssl-spki-export-challenge) - Exports the challenge associated with a signed public key and challenge
* [openssl\_spki\_export()](function.openssl-spki-export) - Exports a valid PEM formatted public key signed public key and challenge
* [openssl\_get\_md\_methods()](function.openssl-get-md-methods) - Gets available digest methods
* [openssl\_csr\_new()](function.openssl-csr-new) - Generates a CSR
* [openssl\_csr\_sign()](function.openssl-csr-sign) - Sign a CSR with another certificate (or itself) and generate a certificate
php ibase_blob_echo ibase\_blob\_echo
=================
(PHP 5, PHP 7 < 7.4.0)
ibase\_blob\_echo — Output blob contents to browser
### Description
```
ibase_blob_echo(string $blob_id): bool
```
```
ibase_blob_echo(resource $link_identifier, string $blob_id): bool
```
This function opens a BLOB for reading and sends its contents directly to standard output (the browser, in most cases).
### Parameters
`link_identifier`
An InterBase link identifier. If omitted, the last opened link is assumed.
`blob_id`
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [ibase\_blob\_open()](function.ibase-blob-open) - Open blob for retrieving data parts
* [ibase\_blob\_close()](function.ibase-blob-close) - Close blob
* [ibase\_blob\_get()](function.ibase-blob-get) - Get len bytes data from open blob
php EventHttpRequest::removeHeader EventHttpRequest::removeHeader
==============================
(PECL event >= 1.4.0-beta)
EventHttpRequest::removeHeader — Removes an HTTP header from the headers of the request
### Description
```
public EventHttpRequest::removeHeader( string $key , string $type ): void
```
Removes an HTTP header from the headers of the request.
### Parameters
`key` The header name.
`type` `type` is one of `EventHttpRequest::*_HEADER` constants.
### Return Values
Removes an HTTP header from the headers of the request.
### See Also
* [EventHttpRequest::addHeader()](eventhttprequest.addheader) - Adds an HTTP header to the headers of the request
php enchant_broker_free_dict enchant\_broker\_free\_dict
===========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant >= 0.1.0 )
enchant\_broker\_free\_dict — Free a dictionary resource
**Warning**This function has been *DEPRECATED* as of PHP 8.0.0. Relying on this function is highly discouraged.
### Description
```
enchant_broker_free_dict(EnchantDictionary $dictionary): bool
```
Free a dictionary. As of PHP 8.0.0, it is recommended to unset the object instead of calling this function.
### 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 a [EnchantDictionary](class.enchantdictionary) now; previoulsy, a [resource](language.types.resource) was expected. |
### See Also
* [enchant\_broker\_request\_dict()](function.enchant-broker-request-dict) - Create a new dictionary using a tag
* [enchant\_broker\_request\_pwl\_dict()](function.enchant-broker-request-pwl-dict) - Creates a dictionary using a PWL file
php Phar::getVersion Phar::getVersion
================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
Phar::getVersion — Return version info of Phar archive
### Description
```
public Phar::getVersion(): string
```
Returns the API version of an opened Phar archive.
### Parameters
### Return Values
The opened archive's API version. This is not to be confused with the API version that the loaded phar extension will use to create new phars. Each Phar archive has the API version hard-coded into its manifest. See [Phar file format](https://www.php.net/manual/en/phar.fileformat.php) documentation for more information.
### See Also
* [Phar::apiVersion()](phar.apiversion) - Returns the api version
php Imagick::normalizeImage Imagick::normalizeImage
=======================
(PECL imagick 2, PECL imagick 3)
Imagick::normalizeImage — Enhances the contrast of a color image
### Description
```
public Imagick::normalizeImage(int $channel = Imagick::CHANNEL_DEFAULT): bool
```
Enhances the contrast of a color image by adjusting the pixels color to span the entire range of colors available.
### 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 **`true`** on success.
### Examples
**Example #1 **Imagick::normalizeImage()****
```
<?php
function normalizeImage($imagePath, $channel) {
$imagick = new \Imagick(realpath($imagePath));
$original = clone $imagick;
$original->cropimage($original->getImageWidth() / 2, $original->getImageHeight(), 0, 0);
$imagick->normalizeImage($channel);
$imagick->compositeimage($original, \Imagick::COMPOSITE_ATOP, 0, 0);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php ltrim ltrim
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
ltrim — Strip whitespace (or other characters) from the beginning of a string
### Description
```
ltrim(string $string, string $characters = " \n\r\t\v\x00"): string
```
Strip whitespace (or other characters) from the beginning of a string.
### Parameters
`string`
The input string.
`characters`
You can also specify the characters you want to strip, by means of the `characters` parameter. Simply list all characters that you want to be stripped. With `..` you can specify a range of characters.
### Return Values
This function returns a string with whitespace stripped from the beginning of `string`. Without the second parameter, **ltrim()** 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.
### Examples
**Example #1 Usage example of **ltrim()****
```
<?php
$text = "\t\tThese are a few words :) ... ";
$binary = "\x09Example string\x0A";
$hello = "Hello World";
var_dump($text, $binary, $hello);
print "\n";
$trimmed = ltrim($text);
var_dump($trimmed);
$trimmed = ltrim($text, " \t.");
var_dump($trimmed);
$trimmed = ltrim($hello, "Hdle");
var_dump($trimmed);
// trim the ASCII control characters at the beginning of $binary
// (from 0 to 31 inclusive)
$clean = ltrim($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(30) "These are a few words :) ... "
string(30) "These are a few words :) ... "
string(7) "o World"
string(15) "Example string
"
```
### See Also
* [trim()](function.trim) - Strip whitespace (or other characters) from the beginning and end of a string
* [rtrim()](function.rtrim) - Strip whitespace (or other characters) from the end of a string
php ftok ftok
====
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
ftok — Convert a pathname and a project identifier to a System V IPC key
### Description
```
ftok(string $filename, string $project_id): int
```
The function converts the `filename` of an existing accessible file and a project identifier into an `integer` for use with for example [shmop\_open()](function.shmop-open) and other System V IPC keys.
### Parameters
`filename`
Path to an accessible file.
`project_id`
Project identifier. This must be a one character string.
### Return Values
On success the return value will be the created key value, otherwise `-1` is returned.
### See Also
* [shmop\_open()](function.shmop-open) - Create or open shared memory block
* [sem\_get()](function.sem-get) - Get a semaphore id
php gmp_legendre gmp\_legendre
=============
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_legendre — Legendre symbol
### Description
```
gmp_legendre(GMP|int|string $num1, GMP|int|string $num2): int
```
Compute the [» Legendre symbol](http://primes.utm.edu/glossary/page.php?sort=LegendreSymbol) of `num1` and `num2`. `num2` should be odd and must be positive.
### 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.
Should be odd and must be positive.
### Return Values
A [GMP](class.gmp) object.
### Examples
**Example #1 **gmp\_legendre()** example**
```
<?php
echo gmp_legendre("1", "3") . "\n";
echo gmp_legendre("2", "3") . "\n";
?>
```
The above example will output:
```
1
0
```
### See Also
* [gmp\_jacobi()](function.gmp-jacobi) - Jacobi symbol
* [gmp\_kronecker()](function.gmp-kronecker) - Kronecker symbol
php Gmagick::motionblurimage Gmagick::motionblurimage
========================
(PECL gmagick >= Unknown)
Gmagick::motionblurimage — Simulates motion blur
### Description
```
public Gmagick::motionblurimage(float $radius, float $sigma, float $angle): Gmagick
```
Simulates motion blur. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 and **Gmagick::motionblurimage()** selects a suitable radius for you. Angle gives the angle of the blurring motion.
### Parameters
`radius`
The radius of the Gaussian, in pixels, not counting the center pixel.
`sigma`
The standard deviation of the Gaussian, in pixels.
`angle`
Apply the effect along this angle.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php Memcached::quit Memcached::quit
===============
(PECL memcached >= 2.0.0)
Memcached::quit — Close any open connections
### Description
```
public Memcached::quit(): bool
```
**Memcached::quit()** closes any open connections to the memcache servers.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
| programming_docs |
php Memcached::getResultCode Memcached::getResultCode
========================
(PECL memcached >= 0.1.0)
Memcached::getResultCode — Return the result code of the last operation
### Description
```
public Memcached::getResultCode(): int
```
**Memcached::getResultCode()** returns one of the **`Memcached::RES_*`** constants that is the result of the last executed Memcached method.
### Parameters
This function has no parameters.
### Return Values
Result code of the last Memcached operation.
### Examples
**Example #1 **Memcached::getResultCode()** example**
```
<?php
$m = new Memcached();
$m->addServer('localhost', 11211);
$m->add('foo', 'bar');
if ($m->getResultCode() == Memcached::RES_NOTSTORED) {
/* ... */
}
?>
```
php ibase_gen_id ibase\_gen\_id
==============
(PHP 5, PHP 7 < 7.4.0)
ibase\_gen\_id — Increments the named generator and returns its new value
### Description
```
ibase_gen_id(string $generator, int $increment = 1, resource $link_identifier = null): mixed
```
**Warning**This function is currently not documented; only its argument list is available.
### Return Values
Returns new generator value as integer, or as string if the value is too big.
php sodium_increment sodium\_increment
=================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_increment — Increment large number
### Description
```
sodium_increment(string &$string): void
```
Treat the string as a little-endian unsigned integer, then increase it by 1. Constant-time.
### Parameters
`string`
String to increment.
### Return Values
No value is returned.
php bcpowmod bcpowmod
========
(PHP 5, PHP 7, PHP 8)
bcpowmod — Raise an arbitrary precision number to another, reduced by a specified modulus
### Description
```
bcpowmod(
string $num,
string $exponent,
string $modulus,
?int $scale = null
): string
```
Use the fast-exponentiation method to raise `num` to the power `exponent` with respect to the modulus `modulus`.
### Parameters
`num`
The base, as an integral string (i.e. the scale has to be zero).
`exponent`
The exponent, as an non-negative, integral string (i.e. the scale has to be zero).
`modulus`
The modulus, as an integral string (i.e. the scale has to be zero).
`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 as a string, or **`false`** if `modulus` is `0` or `exponent` is negative.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `scale` is now nullable. |
### Examples
The following two statements are functionally identical. The **bcpowmod()** version however, executes in less time and can accept larger parameters.
```
<?php
$a = bcpowmod($x, $y, $mod);
$b = bcmod(bcpow($x, $y), $mod);
// $a and $b are equal to each other.
?>
```
### Notes
>
> **Note**:
>
>
> Because this method uses the modulus operation, numbers which are not positive integers may give unexpected results.
>
>
### See Also
* [bcpow()](function.bcpow) - Raise an arbitrary precision number to another
* [bcmod()](function.bcmod) - Get modulus of an arbitrary precision number
php ZipArchive::setCommentIndex ZipArchive::setCommentIndex
===========================
(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.4.0)
ZipArchive::setCommentIndex — Set the comment of an entry defined by its index
### Description
```
public ZipArchive::setCommentIndex(int $index, string $comment): bool
```
Set the comment of an entry defined by its index.
### Parameters
`index`
Index of the entry.
`comment`
The contents of the comment.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Open an archive and set a comment for an entry**
```
<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip');
if ($res === TRUE) {
$zip->setCommentIndex(2, 'new entry comment');
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
```
php ldap_bind ldap\_bind
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
ldap\_bind — Bind to LDAP directory
### Description
```
ldap_bind(LDAP\Connection $ldap, ?string $dn = null, ?string $password = null): bool
```
Binds to the LDAP directory with specified RDN and password.
### Parameters
`ldap`
An [LDAP\Connection](class.ldap-connection) instance, returned by [ldap\_connect()](function.ldap-connect).
`dn`
`password`
If `password` is not specified or is empty, an anonymous bind is attempted. The `dn` can also be left empty for an anonymous bind. This is defined in https://tools.ietf.org/html/rfc2251#section-4.2.2
### 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. |
### Examples
**Example #1 Using LDAP Bind**
```
<?php
// using ldap bind
$ldaprdn = 'uname'; // ldap rdn or dn
$ldappass = 'password'; // associated password
// connect to ldap server
$ldapconn = ldap_connect("ldap://ldap.example.com")
or die("Could not connect to LDAP server.");
if ($ldapconn) {
// binding to ldap server
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
// verify binding
if ($ldapbind) {
echo "LDAP bind successful...";
} else {
echo "LDAP bind failed...";
}
}
?>
```
**Example #2 Using LDAP Bind Anonymously**
```
<?php
//using ldap bind anonymously
// connect to ldap server
$ldapconn = ldap_connect("ldap://ldap.example.com")
or die("Could not connect to LDAP server.");
if ($ldapconn) {
// binding anonymously
$ldapbind = ldap_bind($ldapconn);
if ($ldapbind) {
echo "LDAP bind anonymous successful...";
} else {
echo "LDAP bind anonymous failed...";
}
}
?>
```
### See Also
* [ldap\_bind\_ext()](function.ldap-bind-ext) - Bind to LDAP directory
* [ldap\_unbind()](function.ldap-unbind) - Unbind from LDAP directory
php DOMNode::appendChild DOMNode::appendChild
====================
(PHP 5, PHP 7, PHP 8)
DOMNode::appendChild — Adds new child at the end of the children
### Description
```
public DOMNode::appendChild(DOMNode $node): DOMNode|false
```
This function appends a child to an existing list of children or creates a new list of children. The child can be created with e.g. [DOMDocument::createElement()](domdocument.createelement), [DOMDocument::createTextNode()](domdocument.createtextnode) etc. or simply by using any other node.
When using an existing node it will be moved.
### Parameters
`node`
The appended child.
### Return Values
The node added.
### 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 append 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.
### Examples
The following example will add a new element node to a fresh document.
**Example #1 Adding a child**
```
<?php
$doc = new DOMDocument;
$node = $doc->createElement("para");
$newnode = $doc->appendChild($node);
echo $doc->saveXML();
?>
```
**Example #2 Nested children**
```
<?php
$doc = new DOMDocument;
$headNode = $doc->createElement("head");
$doc->appendChild($headNode);
$titleNode = $doc->createElement("title");
$headNode->appendChild($titleNode);
echo $doc->saveXML();
?>
```
### See Also
* [DOMChildNode::after()](domchildnode.after) - Adds nodes after the node
* [DOMNode::insertBefore()](domnode.insertbefore) - Adds a new child before a reference node
* [DOMNode::removeChild()](domnode.removechild) - Removes child from list of children
* [DOMNode::replaceChild()](domnode.replacechild) - Replaces a child
php Memcached::decrement Memcached::decrement
====================
(PECL memcached >= 0.1.0)
Memcached::decrement — Decrement numeric item's value
### Description
```
public Memcached::decrement(
string $key,
int $offset = 1,
int $initial_value = 0,
int $expiry = 0
): int|false
```
**Memcached::decrement()** 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::decrement()** will set the item to the `initial_value` parameter if the key doesn't exist.
### Parameters
`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.
### Examples
**Example #1 **Memcached::decrement()** example**
```
<?php
$m = new Memcached();
$m->addServer('localhost', 11211);
$m->set('counter', 5);
$n = $m->decrement('counter');
var_dump($n);
$n = $m->decrement('counter', 10);
var_dump($n);
var_dump($m->get('counter'));
$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(4)
int(0)
int(0)
bool(false)
```
### See Also
* [Memcached::increment()](memcached.increment) - Increment numeric item's value
* [Memcached::incrementByKey()](memcached.incrementbykey) - Increment numeric item's value, stored on a specific server
* [Memcached::decrementByKey()](memcached.decrementbykey) - Decrement numeric item's value, stored on a specific server
php timezone_identifiers_list timezone\_identifiers\_list
===========================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
timezone\_identifiers\_list — Alias of [DateTimeZone::listIdentifiers()](datetimezone.listidentifiers)
### Description
This function is an alias of: [DateTimeZone::listIdentifiers()](datetimezone.listidentifiers)
php mysqli::more_results mysqli::more\_results
=====================
mysqli\_more\_results
=====================
(PHP 5, PHP 7, PHP 8)
mysqli::more\_results -- mysqli\_more\_results — Check if there are any more query results from a multi query
### Description
Object-oriented style
```
public mysqli::more_results(): bool
```
Procedural style
```
mysqli_more_results(mysqli $mysql): bool
```
Indicates if one or more result sets are available from a previous call to [mysqli\_multi\_query()](mysqli.multi-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
Returns **`true`** if one or more result sets (including errors) are available from a previous call to [mysqli\_multi\_query()](mysqli.multi-query), otherwise **`false`**.
### Examples
See [mysqli\_multi\_query()](mysqli.multi-query).
### See Also
* [mysqli\_multi\_query()](mysqli.multi-query) - Performs one or more queries on the database
* [mysqli\_next\_result()](mysqli.next-result) - Prepare next result from multi\_query
* [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
php RecursiveDirectoryIterator::getSubPathname RecursiveDirectoryIterator::getSubPathname
==========================================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
RecursiveDirectoryIterator::getSubPathname — Get sub path and name
### Description
```
public RecursiveDirectoryIterator::getSubPathname(): string
```
Gets the sub path and filename.
### Parameters
This function has no parameters.
### Return Values
The sub path (sub directory) and filename.
### Examples
**Example #1 **getSubPathname()** example**
```
$directory = '/tmp';
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory));
foreach ($it as $file) {
echo 'SubPathName: ' . $it->getSubPathName() . "\n";
echo 'SubPath: ' . $it->getSubPath() . "\n\n";
}
```
The above example will output something similar to:
```
SubPathName: fruit/apple.xml
SubPath: fruit
SubPathName: stuff.xml
SubPath:
SubPathName: veggies/carrot.xml
SubPath: veggies
```
### See Also
* [RecursiveDirectoryIterator::getSubPath()](recursivedirectoryiterator.getsubpath) - Get sub path
* [RecursiveDirectoryIterator::key()](recursivedirectoryiterator.key) - Return path and filename of current dir entry
php GearmanClient::timeout GearmanClient::timeout
======================
(PECL gearman >= 0.6.0)
GearmanClient::timeout — Get current socket I/O activity timeout value
### Description
```
public GearmanClient::timeout(): int
```
Returns the timeout in milliseconds to wait for I/O activity.
### Parameters
This function has no parameters.
### Return Values
Timeout in milliseconds to wait for I/O activity. A negative value means an infinite timeout.
### See Also
* [GearmanClient::setTimeout()](gearmanclient.settimeout) - Set socket I/O activity timeout
php SolrInputDocument::reset SolrInputDocument::reset
========================
(PECL solr >= 0.9.2)
SolrInputDocument::reset — Alias of [SolrInputDocument::clear()](solrinputdocument.clear)
### Description
```
public SolrInputDocument::reset(): bool
```
This is an alias of SolrInputDocument::clear
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php stream_get_wrappers stream\_get\_wrappers
=====================
(PHP 5, PHP 7, PHP 8)
stream\_get\_wrappers — Retrieve list of registered streams
### Description
```
stream_get_wrappers(): array
```
Retrieve list of registered streams available on the running system.
### Parameters
This function has no parameters.
### Return Values
Returns an indexed array containing the name of all stream wrappers available on the running system.
### Examples
**Example #1 **stream\_get\_wrappers()** example**
```
<?php
print_r(stream_get_wrappers());
?>
```
The above example will output something similar to:
```
Array
(
[0] => php
[1] => file
[2] => http
[3] => ftp
[4] => compress.bzip2
[5] => compress.zlib
)
```
**Example #2 Checking for the existence of a stream wrapper**
```
<?php
// check for the existence of the bzip2 stream wrapper
if (in_array('compress.bzip2', stream_get_wrappers())) {
echo 'compress.bzip2:// support enabled.';
} else {
echo 'compress.bzip2:// support not enabled.';
}
?>
```
### See Also
* [stream\_wrapper\_register()](function.stream-wrapper-register) - Register a URL wrapper implemented as a PHP class
php CachingIterator::__toString CachingIterator::\_\_toString
=============================
(PHP 5, PHP 7, PHP 8)
CachingIterator::\_\_toString — Return the string representation of the current element
### Description
```
public CachingIterator::__toString(): string
```
**Warning**This function is currently not documented; only its argument list is available.
Get the string representation of the current element.
### Parameters
This function has no parameters.
### Return Values
The string representation of the current element.
php PDOStatement::fetchObject PDOStatement::fetchObject
=========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.2.4)
PDOStatement::fetchObject — Fetches the next row and returns it as an object
### Description
```
public PDOStatement::fetchObject(?string $class = "stdClass", array $constructorArgs = []): object|false
```
Fetches the next row and returns it as an object. This function is an alternative to [PDOStatement::fetch()](pdostatement.fetch) with **`PDO::FETCH_CLASS`** or **`PDO::FETCH_OBJ`** style.
When an object is fetched, its properties are assigned from respective column values, and afterwards its constructor is invoked.
### Parameters
`class`
Name of the created class.
`constructorArgs`
Elements of this array are passed to the constructor.
### Return Values
Returns an instance of the required class with property names that correspond to the column names or **`false`** on failure.
### See Also
* [PDOStatement::fetch()](pdostatement.fetch) - Fetches the next row from a result set
php QuickHashIntHash::get QuickHashIntHash::get
=====================
(PECL quickhash >= Unknown)
QuickHashIntHash::get — This method retrieves a value from the hash by its key
### Description
```
public QuickHashIntHash::get(int $key): int
```
This method retrieves a value from the hash by its key.
### Parameters
`key`
The key of the entry to retrieve.
### Return Values
The value if the key exists, or **`null`** if the key wasn't part of the hash.
### Examples
**Example #1 **QuickHashIntHash::get()** example**
```
<?php
$hash = new QuickHashIntHash( 8 );
var_dump( $hash->get( 1 ) );
var_dump( $hash->add( 2 ) );
var_dump( $hash->get( 2 ) );
var_dump( $hash->add( 3, 5 ) );
var_dump( $hash->get( 3 ) );
?>
```
The above example will output something similar to:
```
bool(false)
bool(true)
int(1)
bool(true)
int(5)
```
php spl_autoload_call spl\_autoload\_call
===================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
spl\_autoload\_call — Try all registered \_\_autoload() functions to load the requested class
### Description
```
spl_autoload_call(string $class): void
```
This function can be used to manually search for a class or interface using the registered \_\_autoload functions.
### Parameters
`class`
The class name being searched.
### Return Values
No value is returned.
php Phar::delMetadata Phar::delMetadata
=================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.2.0)
Phar::delMetadata — Deletes the global metadata of the phar
### Description
```
public Phar::delMetadata(): bool
```
>
> **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.
>
>
>
Deletes the global metadata of the phar
### Parameters
### Return Values
returns **`true`** on success, but it is better to check for thrown exception, and assume success if none is thrown.
### Errors/Exceptions
Throws [PharException](class.pharexception) if errors occur while flushing changes to disk.
### Examples
**Example #1 A **Phar::delMetaData()** example**
```
<?php
try {
$phar = new Phar('myphar.phar');
var_dump($phar->getMetadata());
$phar->setMetadata("hi there");
var_dump($phar->getMetadata());
$phar->delMetadata();
var_dump($phar->getMetadata());
} catch (Exception $e) {
// handle errors
}
?>
```
The above example will output:
```
NULL
string(8) "hi there"
NULL
```
### See Also
* [Phar::getMetadata()](phar.getmetadata) - Returns phar archive meta-data
* [Phar::setMetadata()](phar.setmetadata) - Sets phar archive meta-data
* [Phar::hasMetadata()](phar.hasmetadata) - Returns whether phar has global meta-data
| programming_docs |
php Imagick::drawImage Imagick::drawImage
==================
(PECL imagick 2, PECL imagick 3)
Imagick::drawImage — Renders the ImagickDraw object on the current image
### Description
```
public Imagick::drawImage(ImagickDraw $draw): bool
```
Renders the ImagickDraw object on the current image.
### Parameters
`draw`
The drawing operations to render on the image.
### Return Values
Returns **`true`** on success.
php phpdbg_break_method phpdbg\_break\_method
=====================
(PHP 5 >= 5.6.3, PHP 7, PHP 8)
phpdbg\_break\_method — Inserts a breakpoint at entry to a method
### Description
```
phpdbg_break_method(string $class, string $method): void
```
Insert a breakpoint at the entry to the given `method` of the given `class`.
### Parameters
`class`
The name of the class.
`method`
The name of the method.
### Return Values
No value is returned.
### See Also
* [phpdbg\_break\_file()](function.phpdbg-break-file) - Inserts a breakpoint at a line in a file
* [phpdbg\_break\_function()](function.phpdbg-break-function) - Inserts a breakpoint at entry to a function
* [phpdbg\_break\_next()](function.phpdbg-break-next) - Inserts a breakpoint at the next opcode
* [phpdbg\_clear()](function.phpdbg-clear) - Clears all breakpoints
php hypot hypot
=====
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
hypot — Calculate the length of the hypotenuse of a right-angle triangle
### Description
```
hypot(float $x, float $y): float
```
**hypot()** returns the length of the hypotenuse of a right-angle triangle with sides of length `x` and `y`, or the distance of the point (`x`, `y`) from the origin. This is equivalent to `sqrt(x*x + y*y)`.
### Parameters
`x`
Length of first side
`y`
Length of second side
### Return Values
Calculated length of the hypotenuse
php Imagick::setPointSize Imagick::setPointSize
=====================
(PECL imagick 2 >= 2.1.0, PECL imagick 3)
Imagick::setPointSize — Sets point size
### Description
```
public Imagick::setPointSize(float $point_size): bool
```
Sets object's point size property. This method can be used for example to set font size for caption: pseudo-format. This method is available if Imagick has been compiled against ImageMagick version 6.3.7 or newer.
### Parameters
`point_size`
Point size
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 A **Imagick::setPointSize()** example**
Example of using Imagick::setPointSize
```
<?php
/* Create new imagick object */
$im = new Imagick();
/* Set the font for the object */
$im->setFont("example.ttf");
/* Set the point size */
$im->setPointSize(12);
/* Create new caption */
$im->newPseudoImage(100, 100, "caption:Hello");
/* Do something with the image */
?>
```
### See Also
* [Imagick::getPointSize()](imagick.getpointsize) - Gets point size
php pg_version pg\_version
===========
(PHP 5, PHP 7, PHP 8)
pg\_version — Returns an array with client, protocol and server version (when available)
### Description
```
pg_version(?PgSql\Connection $connection = null): array
```
**pg\_version()** returns an array with the client, protocol and server version. Protocol and server versions are only available if PHP was compiled with PostgreSQL 7.4 or later.
For more detailed server information, use [pg\_parameter\_status()](function.pg-parameter-status).
### 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
Returns an array with `client`, `protocol` and `server` keys and values (if available).
### 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\_version()** example**
```
<?php
$dbconn = pg_connect("host=localhost port=5432 dbname=mary")
or die("Could not connect");
$v = pg_version($dbconn);
echo $v['client'];
?>
```
The above example will output:
```
7.4
```
### See Also
* [pg\_parameter\_status()](function.pg-parameter-status) - Looks up a current parameter setting of the server
php SplDoublyLinkedList::key SplDoublyLinkedList::key
========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplDoublyLinkedList::key — Return current node index
### Description
```
public SplDoublyLinkedList::key(): int
```
This function returns the current node index
### Parameters
This function has no parameters.
### Return Values
The current node index.
php The Yaf_Config_Abstract class
The Yaf\_Config\_Abstract class
===============================
Introduction
------------
(Yaf >=1.0.0)
Class synopsis
--------------
abstract class **Yaf\_Config\_Abstract** { /\* Properties \*/ protected [$\_config](class.yaf-config-abstract#yaf-config-abstract.props.config);
protected [$\_readonly](class.yaf-config-abstract#yaf-config-abstract.props.readonly); /\* Methods \*/
```
abstract public get(string $name, mixed $value): mixed
```
```
abstract public readonly(): bool
```
```
abstract public set(): Yaf_Config_Abstract
```
```
abstract public toArray(): array
```
} Properties
----------
\_config \_readonly Table of Contents
-----------------
* [Yaf\_Config\_Abstract::get](yaf-config-abstract.get) — Getter
* [Yaf\_Config\_Abstract::readonly](yaf-config-abstract.readonly) — Find a config whether readonly
* [Yaf\_Config\_Abstract::set](yaf-config-abstract.set) — Setter
* [Yaf\_Config\_Abstract::toArray](yaf-config-abstract.toarray) — Cast to array
php Parle\RLexer::getToken Parle\RLexer::getToken
======================
(PECL parle >= 0.5.1)
Parle\RLexer::getToken — Retrieve the current token
### Description
```
public Parle\RLexer::getToken(): Parle\Token
```
Retrive the current token.
### Parameters
This function has no parameters.
### Return Values
Returns an instance of [Parle\Token](class.parle-token).
php pspell_suggest pspell\_suggest
===============
(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)
pspell\_suggest — Suggest spellings of a word
### Description
```
pspell_suggest(PSpell\Dictionary $dictionary, string $word): array|false
```
**pspell\_suggest()** returns an array of possible spellings for the given word.
### Parameters
`dictionary`
An [PSpell\Dictionary](class.pspell-dictionary) instance.
`word`
The tested word.
### Return Values
Returns an array of possible spellings.
### 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\_suggest()** example**
```
<?php
$pspell = pspell_new("en");
if (!pspell_check($pspell, "testt")) {
$suggestions = pspell_suggest($pspell, "testt");
foreach ($suggestions as $suggestion) {
echo "Possible spelling: $suggestion<br />";
}
}
?>
```
php grapheme_strrpos grapheme\_strrpos
=================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
grapheme\_strrpos — Find position (in grapheme units) of last occurrence of a string
### Description
Procedural style
```
grapheme_strrpos(string $haystack, string $needle, int $offset = 0): int|false
```
Find position (in grapheme units) of last occurrence of a 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\_strrpos()** will return **`false`**.
### Examples
**Example #1 **grapheme\_strrpos()** 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 grapheme_strrpos( $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\_strripos()](function.grapheme-strripos) - Find position (in grapheme units) of last occurrence of a case-insensitive 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 DOMNodeList::item DOMNodeList::item
=================
(PHP 5, PHP 7, PHP 8)
DOMNodeList::item — Retrieves a node specified by index
### Description
```
public DOMNodeList::item(int $index): DOMNode|DOMNameSpaceNode|null
```
Retrieves a node specified by `index` within the [DOMNodeList](class.domnodelist) object.
**Tip** If you need to know the number of nodes in the collection, use the `length` property of the [DOMNodeList](class.domnodelist) object.
### Parameters
`index`
Index of the node into the collection.
### Return Values
The node at the `index`th position in the [DOMNodeList](class.domnodelist), or **`null`** if that is not a valid index.
### Examples
**Example #1 Traversing all the entries of the table**
```
<?php
$doc = new DOMDocument;
$doc->load('book.xml');
$items = $doc->getElementsByTagName('entry');
for ($i = 0; $i < $items->length; $i++) {
echo $items->item($i)->nodeValue . "\n";
}
?>
```
Alternatively, you can use [foreach](control-structures.foreach), which is a much more convenient way:
```
<?php
foreach ($items as $item) {
echo $item->nodeValue . "\n";
}
?>
```
The above example will output:
```
Title
Author
Language
ISBN
The Grapes of Wrath
John Steinbeck
en
0140186409
The Pearl
John Steinbeck
en
014017737X
Samarcande
Amine Maalouf
fr
2253051209
```
php QuickHashIntHash::saveToFile QuickHashIntHash::saveToFile
============================
(PECL quickhash >= Unknown)
QuickHashIntHash::saveToFile — This method stores an in-memory hash to disk
### Description
```
public QuickHashIntHash::saveToFile(string $filename): void
```
This method stores an existing hash to a file on disk, in the same format that [QuickHashIntHash::loadFromFile()](quickhashinthash.loadfromfile) can read.
### Parameters
`filename`
The filename of the file to store the hash in.
### Return Values
No value is returned.
### Examples
**Example #1 **QuickHashIntHash::saveToFile()** example**
```
<?php
$hash = new QuickHashIntHash( 1024 );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 4, 43 ) );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 4, 52 ) );
$hash->saveToFile( '/tmp/test.hash' );
?>
```
php Ds\Map::jsonSerialize Ds\Map::jsonSerialize
=====================
(PECL ds >= 1.0.0)
Ds\Map::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 EvLoop::nowUpdate EvLoop::nowUpdate
=================
(PECL ev >= 0.2.0)
EvLoop::nowUpdate — Establishes the current time by querying the kernel, updating the time returned by EvLoop::now in the progress
### Description
```
public EvLoop::nowUpdate(): void
```
Establishes the current time by querying the kernel, updating the time returned by [EvLoop::now()](evloop.now) in the progress. This is a costly operation and is usually done automatically within [EvLoop::run()](evloop.run) .
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### See Also
* [EvLoop::now()](evloop.now) - Returns the current "event loop time"
* [Ev::nowUpdate()](ev.nowupdate) - Establishes the current time by querying the kernel, updating the time returned by Ev::now in the progress
php EventBufferEvent::sslGetCipherVersion EventBufferEvent::sslGetCipherVersion
=====================================
(PECL event >= 1.10.0)
EventBufferEvent::sslGetCipherVersion — Returns version of cipher used by current SSL connection
### Description
```
public EventBufferEvent::sslGetCipherVersion(): string
```
Retrieves version of cipher used by 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 current cipher version of the SSL connection, or **`false`** on error.
php XSLTProcessor::setSecurityPrefs XSLTProcessor::setSecurityPrefs
===============================
(PHP >= 5.4.0, PHP 7, PHP 8)
XSLTProcessor::setSecurityPrefs — Set security preferences
### Description
```
public XSLTProcessor::setSecurityPrefs(int $preferences): int
```
Sets the security preferences.
### Parameters
`preferences`
The new security preferences. The following constants can be ORed: **`XSL_SECPREF_READ_FILE`**, **`XSL_SECPREF_WRITE_FILE`**, **`XSL_SECPREF_CREATE_DIRECTORY`**, **`XSL_SECPREF_READ_NETWORK`**, **`XSL_SECPREF_WRITE_NETWORK`**. Alternatively, **`XSL_SECPREF_NONE`** or **`XSL_SECPREF_DEFAULT`** can be passed.
### Return Values
Returns the old security preferences.
php strchr strchr
======
(PHP 4, PHP 5, PHP 7, PHP 8)
strchr — Alias of [strstr()](function.strstr)
### Description
This function is an alias of: [strstr()](function.strstr).
php HashContext::__serialize HashContext::\_\_serialize
==========================
(PHP 8)
HashContext::\_\_serialize — Serializes the HashContext object
### Description
```
public HashContext::__serialize(): array
```
**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 ssh2_auth_agent ssh2\_auth\_agent
=================
(PECL ssh2 >= 0.12)
ssh2\_auth\_agent — Authenticate over SSH using the ssh agent
### Description
```
ssh2_auth_agent(resource $session, string $username): bool
```
Authenticate over SSH using the ssh agent
> **Note**: The **ssh2\_auth\_agent()** function will only be available when the ssh2 extension is compiled with libssh >= 1.2.3.
>
>
### 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`** on success or **`false`** on failure.
### Examples
**Example #1 Authenticating with a ssh agent**
```
<?php
$connection = ssh2_connect('shell.example.com', 22);
if (ssh2_auth_agent($connection, 'username')) {
echo "Authentication Successful!\n";
} else {
die('Authentication Failed...');
}
?>
```
php mb_substitute_character mb\_substitute\_character
=========================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
mb\_substitute\_character — Set/Get substitution character
### Description
```
mb_substitute_character(string|int|null $substitute_character = null): string|int|bool
```
Specifies a substitution character when input character encoding is invalid or character code does not exist in output character encoding. Invalid characters may be substituted `"none"` (no output), string or int value (Unicode character code value).
This setting affects [mb\_convert\_encoding()](function.mb-convert-encoding), [mb\_convert\_variables()](function.mb-convert-variables), [mb\_output\_handler()](function.mb-output-handler), and [mb\_send\_mail()](function.mb-send-mail).
### Parameters
`substitute_character`
Specify the Unicode value as an int, or as one of the following strings:
* `"none"`: no output
* `"long"`: Output character code value (Example: `U+3000`, `JIS+7E7E`)
* `"entity"`: Output character entity (Example: `Ȁ`)
### Return Values
If `substitute_character` is set, it returns **`true`** for success, otherwise returns **`false`**. If `substitute_character` is not set, it returns the current setting.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Passing an empty string to `substitute_character` is no longer supported; `"none"` should be passed instead. |
| 8.0.0 | `encoding` is nullable now. |
### Examples
**Example #1 **mb\_substitute\_character()** example**
```
<?php
/* Set with Unicode U+3013 (GETA MARK) */
mb_substitute_character(0x3013);
/* Set hex format */
mb_substitute_character("long");
/* Display current setting */
echo mb_substitute_character();
?>
```
php imap_base64 imap\_base64
============
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_base64 — Decode BASE64 encoded text
### Description
```
imap_base64(string $string): string|false
```
Decodes the given BASE-64 encoded `string`.
### Parameters
`string`
The encoded text
### Return Values
Returns the decoded message as a string, or **`false`** on failure.
### See Also
* [imap\_binary()](function.imap-binary) - Convert an 8bit string to a base64 string
* [base64\_encode()](function.base64-encode) - Encodes data with MIME base64
* [base64\_decode()](function.base64-decode) - Decodes data encoded with MIME base64
* [» RFC2045](http://www.faqs.org/rfcs/rfc2045), Section 6.8
php die die
===
(PHP 4, PHP 5, PHP 7, PHP 8)
die — Equivalent to `exit`
### Description
This language construct is equivalent to [exit()](function.exit).
php cli_get_process_title cli\_get\_process\_title
========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
cli\_get\_process\_title — Returns the current process title
### Description
```
cli_get_process_title(): ?string
```
Returns the current process title, as set by [cli\_set\_process\_title()](function.cli-set-process-title). Note that this may not exactly match what is shown in **ps** or **top**, depending on your operating system.
This function is available only in [CLI](https://www.php.net/manual/en/features.commandline.php) mode.
### Parameters
This function has no parameters.
### Return Values
Return a string with the current process title or **`null`** on error.
### Errors/Exceptions
An **`E_WARNING`** will be generated if the operating system is unsupported.
### Examples
**Example #1 **cli\_get\_process\_title()** example**
```
<?php
echo "Process title: " . cli_get_process_title() . "\n";
?>
```
### See Also
* [cli\_set\_process\_title()](function.cli-set-process-title) - Sets the process title
| programming_docs |
php QuickHashIntSet::saveToFile QuickHashIntSet::saveToFile
===========================
(PECL quickhash >= Unknown)
QuickHashIntSet::saveToFile — This method stores an in-memory set to disk
### Description
```
public QuickHashIntSet::saveToFile(string $filename): void
```
This method stores an existing set to a file on disk, in the same format that [QuickHashIntSet::loadFromFile()](quickhashintset.loadfromfile) can read.
### Parameters
`filename`
The filename of the file to store the hash in.
### Return Values
No value is returned.
### Examples
**Example #1 **QuickHashIntSet::saveToFile()** example**
```
<?php
$set = new QuickHashIntSet( 1024 );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
$set->saveToFile( '/tmp/test.set' );
?>
```
php Ds\Vector::first Ds\Vector::first
================
(PECL ds >= 1.0.0)
Ds\Vector::first — Returns the first value in the vector
### Description
```
public Ds\Vector::first(): mixed
```
Returns the first value in the vector.
### Parameters
This function has no parameters.
### Return Values
The first value in the vector.
### Errors/Exceptions
[UnderflowException](class.underflowexception) if empty.
### Examples
**Example #1 **Ds\Vector::first()** example**
```
<?php
$vector = new \Ds\Vector([1, 2, 3]);
var_dump($vector->first());
?>
```
The above example will output something similar to:
```
int(1)
```
php ZipArchive::setCommentName ZipArchive::setCommentName
==========================
(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.4.0)
ZipArchive::setCommentName — Set the comment of an entry defined by its name
### Description
```
public ZipArchive::setCommentName(string $name, string $comment): bool
```
Set the comment of an entry defined by its name.
### Parameters
`name`
Name of the entry.
`comment`
The contents of the comment.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Open an archive and set a comment for an entry**
```
<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip');
if ($res === TRUE) {
$zip->setCommentName('entry1.txt', 'new entry comment');
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
```
php Imagick::contrastImage Imagick::contrastImage
======================
(PECL imagick 2, PECL imagick 3)
Imagick::contrastImage — Change the contrast of the image
### Description
```
public Imagick::contrastImage(bool $sharpen): bool
```
Enhances the intensity differences between the lighter and darker elements of the image. Set sharpen to a value other than 0 to increase the image contrast otherwise the contrast is reduced.
### Parameters
`sharpen`
The sharpen value
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::contrastImage()****
```
<?php
function contrastImage($imagePath, $contrastType) {
$imagick = new \Imagick(realpath($imagePath));
if ($contrastType != 2) {
$imagick->contrastImage($contrastType);
}
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php imap_utf7_decode imap\_utf7\_decode
==================
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_utf7\_decode — Decodes a modified UTF-7 encoded string
### Description
```
imap_utf7_decode(string $string): string|false
```
Decodes modified UTF-7 `string` into ISO-8859-1 string.
This function is needed to decode mailbox names that contain certain characters which are not in range of printable ASCII characters.
### Parameters
`string`
A modified UTF-7 encoding string, as defined in [» RFC 2060](http://www.faqs.org/rfcs/rfc2060), section 5.1.3.
### Return Values
Returns a string that is encoded in ISO-8859-1 and consists of the same sequence of characters in `string`, or **`false`** if `string` contains invalid modified UTF-7 sequence or `string` contains a character that is not part of ISO-8859-1 character set.
### See Also
* [imap\_utf7\_encode()](function.imap-utf7-encode) - Converts ISO-8859-1 string to modified UTF-7 text
php XMLWriter::endDtdEntity XMLWriter::endDtdEntity
=======================
xmlwriter\_end\_dtd\_entity
===========================
(PHP 5 >= 5.2.1, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::endDtdEntity -- xmlwriter\_end\_dtd\_entity — End current DTD Entity
### Description
Object-oriented style
```
public XMLWriter::endDtdEntity(): bool
```
Procedural style
```
xmlwriter_end_dtd_entity(XMLWriter $writer): bool
```
Ends the current DTD entity.
### 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::startDtdEntity()](xmlwriter.startdtdentity) - Create start DTD Entity
* [XMLWriter::writeDtdEntity()](xmlwriter.writedtdentity) - Write full DTD Entity tag
php None goto
----
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
Image courtesy of [» xkcd](http://xkcd.com/292) The `goto` operator can be used to jump to another section in the program. The target point is specified by a *case-sensitive* label followed by a colon, and the instruction is given as `goto` followed by the desired target label. This is not a full unrestricted `goto`. The target label must be within the same file and context, meaning that you cannot jump out of a function or method, nor can you jump into one. You also cannot jump into any sort of loop or switch structure. You may jump out of these, and a common use is to use a `goto` in place of a multi-level `break`.
**Example #1 `goto` example**
```
<?php
goto a;
echo 'Foo';
a:
echo 'Bar';
?>
```
The above example will output:
```
Bar
```
**Example #2 `goto` loop example**
```
<?php
for($i=0,$j=50; $i<100; $i++) {
while($j--) {
if($j==17) goto end;
}
}
echo "i = $i";
end:
echo 'j hit 17';
?>
```
The above example will output:
```
j hit 17
```
**Example #3 This will not work**
```
<?php
goto loop;
for($i=0,$j=50; $i<100; $i++) {
while($j--) {
loop:
}
}
echo "$i = $i";
?>
```
The above example will output:
```
Fatal error: 'goto' into loop or switch statement is disallowed in
script on line 2
```
php ldap_list ldap\_list
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
ldap\_list — Single-level search
### Description
```
ldap_list(
LDAP\Connection|array $ldap,
array|string $base,
array|string $filter,
array $attributes = [],
int $attributes_only = 0,
int $sizelimit = -1,
int $timelimit = -1,
int $deref = LDAP_DEREF_NEVER,
?array $controls = null
): LDAP\Result|array|false
```
Performs the search for a specified `filter` on the directory with the scope **`LDAP_SCOPE_ONELEVEL`**.
**`LDAP_SCOPE_ONELEVEL`** means that the search should only return information that is at the level immediately below the `base` given in the call. (Equivalent to typing "**ls**" and getting a list of files and folders in the current working directory.)
It is also possible to perform parallel searches. In this case, the first argument should be an array of [LDAP\Connection](class.ldap-connection) instances, rather than a single one. If the searches should not all use the same base DN and filter, an array of base DNs and/or an array of filters can be passed as arguments instead. These arrays must be of the same size as the [LDAP\Connection](class.ldap-connection) instances array, since the first entries of the arrays are used for one search, the second entries are used for another, and so on. When doing parallel searches an array of [LDAP\Result](class.ldap-result) instances is returned, except in case of error, when the return value will be **`false`**.
### Parameters
`ldap`
An [LDAP\Connection](class.ldap-connection) instance, returned by [ldap\_connect()](function.ldap-connect).
`base`
The base DN for the directory.
`filter`
`attributes`
An array of the required attributes, e.g. array("mail", "sn", "cn"). Note that the "dn" is always returned irrespective of which attributes types are requested.
Using this parameter is much more efficient than the default action (which is to return all attributes and their associated values). The use of this parameter should therefore be considered good practice.
`attributes_only`
Should be set to 1 if only attribute types are wanted. If set to 0 both attributes types and attribute values are fetched which is the default behaviour.
`sizelimit`
Enables you to limit the count of entries fetched. Setting this to 0 means no limit.
>
> **Note**:
>
>
> This parameter can NOT override server-side preset sizelimit. You can set it lower though.
>
> Some directory server hosts will be configured to return no more than a preset number of entries. If this occurs, the server will indicate that it has only returned a partial results set. This also occurs if you use this parameter to limit the count of fetched entries.
>
>
`timelimit`
Sets the number of seconds how long is spend on the search. Setting this to 0 means no limit.
>
> **Note**:
>
>
> This parameter can NOT override server-side preset timelimit. You can set it lower though.
>
>
`deref`
Specifies how aliases should be handled during the search. It can be one of the following:
* **`LDAP_DEREF_NEVER`** - (default) aliases are never dereferenced.
* **`LDAP_DEREF_SEARCHING`** - aliases should be dereferenced during the search but not when locating the base object of the search.
* **`LDAP_DEREF_FINDING`** - aliases should be dereferenced when locating the base object but not during the search.
* **`LDAP_DEREF_ALWAYS`** - aliases should be dereferenced always.
`controls`
Array of [LDAP Controls](https://www.php.net/manual/en/ldap.controls.php) to send with the request.
### Return Values
Returns an [LDAP\Result](class.ldap-result) instance, an array of [LDAP\Result](class.ldap-result) instances, 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 | Returns an [LDAP\Result](class.ldap-result) instance now; previously, a [resource](language.types.resource) was returned. |
| 8.0.0 | `controls` is nullable now; previously, it defaulted to `[]`. |
| 7.3.0 | Support for `controls` added |
### Examples
**Example #1 Produce a list of all organizational units of an organization**
```
<?php
// $ds is a valid LDAP\Connection instance for a directory server
$basedn = "o=My Company, c=US";
$justthese = array("ou");
$sr = ldap_list($ds, $basedn, "ou=*", $justthese);
$info = ldap_get_entries($ds, $sr);
for ($i=0; $i < $info["count"]; $i++) {
echo $info[$i]["ou"][0];
}
?>
```
### See Also
* [ldap\_search()](function.ldap-search) - Search LDAP tree
php Imagick::whiteThresholdImage Imagick::whiteThresholdImage
============================
(PECL imagick 2, PECL imagick 3)
Imagick::whiteThresholdImage — Force all pixels above the threshold into white
### Description
```
public Imagick::whiteThresholdImage(mixed $threshold): bool
```
Is like Imagick::ThresholdImage() but force all pixels above the threshold into white while leaving all pixels below the threshold unchanged.
### Parameters
`threshold`
### 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. |
### Examples
**Example #1 **Imagick::whiteThresholdImage()****
```
<?php
function whiteThresholdImage($imagePath, $color) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->whiteThresholdImage($color);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php ReflectionFiber::__construct ReflectionFiber::\_\_construct
==============================
(PHP 8 >= 8.1.0)
ReflectionFiber::\_\_construct — Constructs a ReflectionFiber object
### Description
public **ReflectionFiber::\_\_construct**([Fiber](class.fiber) `$fiber`) Constructs a [ReflectionFiber](class.reflectionfiber) object.
### Parameters
`fiber`
The [Fiber](class.fiber) to reflect.
php pg_connect pg\_connect
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
pg\_connect — Open a PostgreSQL connection
### Description
```
pg_connect(string $connection_string, int $flags = 0): PgSql\Connection|false
```
**pg\_connect()** opens a connection to a PostgreSQL database specified by the `connection_string`.
If a second call is made to **pg\_connect()** with the same `connection_string` as an existing connection, the existing connection will be returned unless you pass **`PGSQL_CONNECT_FORCE_NEW`** as `flags`.
The old syntax with multiple parameters **$conn = pg\_connect("host", "port", "options", "tty", "dbname")** has been deprecated.
### 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` (defaults to value of `user`), `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.
The `options` parameter can be used to set command line parameters to be invoked by the server.
`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.
If **`PGSQL_CONNECT_ASYNC`** is given, then the connection is established asynchronously. The state of the connection can then be checked via [pg\_connect\_poll()](function.pg-connect-poll) or [pg\_connection\_status()](function.pg-connection-status).
### 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\_connect()****
```
<?php
$dbconn = pg_connect("dbname=mary");
//connect to a database named "mary"
$dbconn2 = pg_connect("host=localhost port=5432 dbname=mary");
// connect to a database named "mary" on "localhost" at port "5432"
$dbconn3 = pg_connect("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_connect($conn_string);
//connect to a database named "test" on the host "sheep" with a username and password
$dbconn5 = pg_connect("host=localhost options='--client_encoding=UTF8'");
//connect to a database on "localhost" and set the command line parameter which tells the encoding is in UTF-8
?>
```
### See Also
* [pg\_pconnect()](function.pg-pconnect) - Open a persistent PostgreSQL connection
* [pg\_close()](function.pg-close) - Closes a PostgreSQL connection
* [pg\_host()](function.pg-host) - Returns the host name associated with the connection
* [pg\_port()](function.pg-port) - Return the port number associated with the connection
* [pg\_tty()](function.pg-tty) - Return the TTY name associated with the connection
* [pg\_options()](function.pg-options) - Get the options associated with the connection
* [pg\_dbname()](function.pg-dbname) - Get the database name
php openal_device_open openal\_device\_open
====================
(PECL openal >= 0.1.0)
openal\_device\_open — Initialize the OpenAL audio layer
### Description
```
openal_device_open(string $device_desc = ?): resource
```
### Parameters
`device_desc`
Open an audio device optionally specified by `device_desc`. If `device_desc` is not specified the first available audio device will be used.
### Return Values
Returns an [Open AL(Device)](https://www.php.net/manual/en/openal.resources.php) resource on success or **`false`** on failure.
### See Also
* [openal\_device\_close()](function.openal-device-close) - Close an OpenAL device
* [openal\_context\_create()](function.openal-context-create) - Create an audio processing context
php fdf_set_file fdf\_set\_file
==============
(PHP 4, PHP 5 < 5.3.0, PECL fdf SVN)
fdf\_set\_file — Set PDF document to display FDF data in
### Description
```
fdf_set_file(resource $fdf_document, string $url, string $target_frame = ?): bool
```
Selects a different PDF document to display the form results in then the form it originated from.
### 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).
`url`
Should be given as an absolute URL.
`target_frame`
Use this parameter to specify the frame in which the document will be displayed. You can also set the default value for this parameter using [fdf\_set\_target\_frame()](function.fdf-set-target-frame).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Passing FDF data to a second form**
```
<?php
/* set content type for Adobe FDF */
fdf_header();
/* start new fdf */
$fdf = fdf_create();
/* set field "foo" to value "bar" */
fdf_set_value($fdf, "foo", "bar");
/* tell client to display FDF data using "fdf_form.pdf" */
fdf_set_file($fdf, "http://www.example.com/fdf_form.pdf");
/* output fdf */
fdf_save($fdf);
/* clean up */
fdf_close($fdf);
?>
```
### See Also
* [fdf\_get\_file()](function.fdf-get-file) - Get the value of the /F key
* [fdf\_set\_target\_frame()](function.fdf-set-target-frame) - Set target frame for form display
php ReflectionFunctionAbstract::getExtensionName ReflectionFunctionAbstract::getExtensionName
============================================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
ReflectionFunctionAbstract::getExtensionName — Gets extension name
### Description
```
public ReflectionFunctionAbstract::getExtensionName(): string|false
```
Get the extensions name.
### Parameters
This function has no parameters.
### Return Values
The name of the extension which defined the function, or **`false`** for user-defined functions.
### See Also
* [ReflectionFunctionAbstract::getExtension()](reflectionfunctionabstract.getextension) - Gets extension info
| programming_docs |
php IntlBreakIterator::getErrorMessage IntlBreakIterator::getErrorMessage
==================================
intl\_get\_error\_message
=========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlBreakIterator::getErrorMessage -- intl\_get\_error\_message — Get last error message on the object
### Description
Object-oriented style (method):
```
public IntlBreakIterator::getErrorMessage(): string
```
Procedural style:
```
intl_get_error_message(): string
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php odbc_connection_string_should_quote odbc\_connection\_string\_should\_quote
=======================================
(PHP 8 >= 8.2.0)
odbc\_connection\_string\_should\_quote — Determines if an ODBC connection string value should be quoted
### Description
```
odbc_connection_string_should_quote(string $str): bool
```
Determines if a string needs to be quoted for an ODBC connection string value; that is, if it contains special characters.
Note that this does not check if the string is already quoted; an already quoted string will contain characters that will make this function return true. You should call [odbc\_connection\_string\_is\_quoted()](function.odbc-connection-string-is-quoted) to check.
### Parameters
`str`
The string to check for.
### Return Values
**`true`** if the string should be quoted; **`false`** otherwise.
### See Also
* [odbc\_connection\_string\_quote()](function.odbc-connection-string-quote) - Quotes an ODBC connection string value
* [odbc\_connection\_string\_is\_quoted()](function.odbc-connection-string-is-quoted) - Determines if an ODBC connection string value is quoted
php OAuth::setSSLChecks OAuth::setSSLChecks
===================
(No version information available, might only be in Git)
OAuth::setSSLChecks — Tweak specific SSL checks for requests
### Description
```
public OAuth::setSSLChecks(int $sslcheck): bool
```
Tweak specific SSL checks for requests.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`sslcheck`
### Return Values
Returns **`true`** on success or **`false`** on failure.
php EvWatcher::__construct EvWatcher::\_\_construct
========================
(PECL ev >= 0.2.0)
EvWatcher::\_\_construct — Abstract constructor of a watcher object
### Description
abstract public **EvWatcher::\_\_construct**() **EvWatcher::\_\_construct()** is an abstract constructor of a watcher object implemented in the derived classes.
### Parameters
This function has no parameters.
php stream_socket_client stream\_socket\_client
======================
(PHP 5, PHP 7, PHP 8)
stream\_socket\_client — Open Internet or Unix domain socket connection
### Description
```
stream_socket_client(
string $address,
int &$error_code = null,
string &$error_message = null,
?float $timeout = null,
int $flags = STREAM_CLIENT_CONNECT,
?resource $context = null
): resource|false
```
Initiates a stream or datagram connection to the destination specified by `address`. The type of socket created is determined by the transport specified using standard URL formatting: `transport://target`. For Internet Domain sockets (AF\_INET) such as TCP and UDP, the `target` portion of the `address` parameter should consist of a hostname or IP address followed by a colon and a port number. For Unix domain sockets, the `target` portion should point to the socket file on the filesystem.
>
> **Note**:
>
>
> The stream will by default be opened in blocking mode. You can switch it to non-blocking mode by using [stream\_set\_blocking()](function.stream-set-blocking).
>
>
### Parameters
`address`
Address to the socket to connect to.
`error_code`
Will be set to the system level error number if connection fails.
`error_message`
Will be set to the system level error message if the connection fails.
`timeout`
Number of seconds until the `connect()` system call should timeout. By default, [default\_socket\_timeout](https://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout) is used.
> **Note**: This parameter only applies when not making asynchronous connection attempts.
>
>
>
> **Note**:
>
>
> To set a timeout for reading/writing data over the socket, use the [stream\_set\_timeout()](function.stream-set-timeout), as the `timeout` only applies while making connecting the socket.
>
>
`flags`
Bitmask field which may be set to any combination of connection flags. Currently the select of connection flags is limited to **`STREAM_CLIENT_CONNECT`** (default), **`STREAM_CLIENT_ASYNC_CONNECT`** and **`STREAM_CLIENT_PERSISTENT`**.
`context`
A valid context resource created with [stream\_context\_create()](function.stream-context-create).
### Return Values
On success a stream resource is returned which may be used together with the other file functions (such as [fgets()](function.fgets), [fgetss()](function.fgetss), [fwrite()](function.fwrite), [fclose()](function.fclose), and [feof()](function.feof)), **`false`** on failure.
### Errors/Exceptions
On failure the `error_code` and `error_message` arguments will be populated with the actual system level error that occurred in the system-level `connect()` call. If the value returned in `error_code` is `0` and the function returned **`false`**, it is an indication that the error occurred before the `connect()` call. This is most likely due to a problem initializing the socket. Note that the `error_code` and `error_message` arguments will always be passed by reference.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `timeout` and `context` are now nullable. |
### Examples
**Example #1 **stream\_socket\_client()** example**
```
<?php
$fp = stream_socket_client("tcp://www.example.com:80", $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
fwrite($fp, "GET / HTTP/1.0\r\nHost: www.example.com\r\nAccept: */*\r\n\r\n");
while (!feof($fp)) {
echo fgets($fp, 1024);
}
fclose($fp);
}
?>
```
**Example #2 Using UDP connection**
Retrieving the day and time from the UDP service "daytime" (port 13) on localhost.
```
<?php
$fp = stream_socket_client("udp://127.0.0.1:13", $errno, $errstr);
if (!$fp) {
echo "ERROR: $errno - $errstr<br />\n";
} else {
fwrite($fp, "\n");
echo fread($fp, 26);
fclose($fp);
}
?>
```
### Notes
**Warning** UDP sockets will sometimes appear to have opened without an error, even if the remote host is unreachable. The error will only become apparent when you read or write data to/from the socket. The reason for this is because UDP is a "connectionless" protocol, which means that the operating system does not try to establish a link for the socket until it actually needs to send or receive data.
> **Note**: When specifying a numerical IPv6 address (e.g. `fe80::1`), you must enclose the IP in square brackets—for example, `tcp://[fe80::1]:80`.
>
>
>
> **Note**:
>
>
> Depending on the environment, the Unix domain or the optional connect timeout may not be available. A list of available transports can be retrieved using [stream\_get\_transports()](function.stream-get-transports). See [List of Supported Socket Transports](https://www.php.net/manual/en/transports.php) for a list of built in transports.
>
>
### See Also
* [stream\_socket\_server()](function.stream-socket-server) - Create an Internet or Unix domain server socket
* [stream\_set\_blocking()](function.stream-set-blocking) - Set blocking/non-blocking mode on a stream
* [stream\_set\_timeout()](function.stream-set-timeout) - Set timeout period on a stream
* [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
* [fgets()](function.fgets) - Gets line from file pointer
* [fgetss()](function.fgetss) - Gets line from file pointer and strip HTML tags
* [fwrite()](function.fwrite) - Binary-safe file write
* [fclose()](function.fclose) - Closes an open file pointer
* [feof()](function.feof) - Tests for end-of-file on a file pointer
* [cURL Functions](https://www.php.net/manual/en/ref.curl.php)
php Imagick::blueShiftImage Imagick::blueShiftImage
=======================
(PECL imagick 3 >= 3.3.0)
Imagick::blueShiftImage — Description
### Description
```
public Imagick::blueShiftImage(float $factor = 1.5): bool
```
Mutes the colors of the image to simulate a scene at nighttime in the moonlight.
### Parameters
`factor`
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::blueShiftImage()****
```
<?php
function blueShiftImage($imagePath, $blueShift) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->blueShiftImage($blueShift);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php Yaf_Route_Rewrite::route Yaf\_Route\_Rewrite::route
==========================
(Yaf >=1.0.0)
Yaf\_Route\_Rewrite::route — The route purpose
### Description
```
public Yaf_Route_Rewrite::route(Yaf_Request_Abstract $request): bool
```
### Parameters
`request`
### Return Values
php mb_ereg_search mb\_ereg\_search
================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
mb\_ereg\_search — Multibyte regular expression match for predefined multibyte string
### Description
```
mb_ereg_search(?string $pattern = null, ?string $options = null): bool
```
Performs a multibyte regular expression match for a predefined multibyte string.
### Parameters
`pattern`
The search pattern.
`options`
The search option. See [mb\_regex\_set\_options()](function.mb-regex-set-options) for explanation.
### Return Values
**mb\_ereg\_search()** returns **`true`** if the multibyte string matches with the regular expression, or **`false`** otherwise. The string for matching is set by [mb\_ereg\_search\_init()](function.mb-ereg-search-init). If `pattern` is not specified, the previous one is used.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `pattern` and `options` are 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\_search\_init()](function.mb-ereg-search-init) - Setup string and regular expression for a multibyte regular expression match
php runkit7_superglobals runkit7\_superglobals
=====================
(PECL runkit7 >= Unknown)
runkit7\_superglobals — Return numerically indexed array of registered superglobals
### Description
```
runkit7_superglobals(): array
```
### Parameters
This function has no parameters.
### Return Values
Returns a numerically indexed array of the currently registered superglobals. i.e. \_GET, \_POST, \_REQUEST, \_COOKIE, \_SESSION, \_SERVER, \_ENV, \_FILES
### See Also
* [Variable Scope](language.variables.scope)
php get_declared_classes get\_declared\_classes
======================
(PHP 4, PHP 5, PHP 7, PHP 8)
get\_declared\_classes — Returns an array with the name of the defined classes
### Description
```
get_declared_classes(): array
```
Gets the declared classes.
### Parameters
This function has no parameters.
### Return Values
Returns an array of the names of the declared classes in the current script.
>
> **Note**:
>
>
> Note that depending on what extensions you have compiled or loaded into PHP, additional classes could be present. This means that you will not be able to define your own classes using these names. There is a list of predefined classes in the [Predefined Classes](https://www.php.net/manual/en/reserved.classes.php) section of the appendices.
>
>
### Changelog
| Version | Description |
| --- | --- |
| 7.4.0 | Previously **get\_declared\_classes()** always returned parent classes before child classes. This is no longer the case. No particular order is guaranteed for the **get\_declared\_classes()** return value. |
### Examples
**Example #1 **get\_declared\_classes()** example**
```
<?php
print_r(get_declared_classes());
?>
```
The above example will output something similar to:
```
Array
(
[0] => stdClass
[1] => __PHP_Incomplete_Class
[2] => Directory
)
```
### See Also
* [class\_exists()](function.class-exists) - Checks if the class has been defined
* [get\_declared\_interfaces()](function.get-declared-interfaces) - Returns an array of all declared interfaces
* [get\_defined\_functions()](function.get-defined-functions) - Returns an array of all defined functions
php Imagick::getImageOrientation Imagick::getImageOrientation
============================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageOrientation — Gets the image orientation
### Description
```
public Imagick::getImageOrientation(): int
```
Gets the image orientation. The return value is one of the [orientation constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.orientation).
### Parameters
This function has no parameters.
### Return Values
Returns an int on success.
### Errors/Exceptions
Throws ImagickException on error.
php runkit7_function_copy runkit7\_function\_copy
=======================
(PECL runkit7 >= Unknown)
runkit7\_function\_copy — Copy a function to a new function name
### Description
```
runkit7_function_copy(string $source_name, string $target_name): bool
```
### Parameters
`source_name`
Name of the existing function
`target_name`
Name of the new function to copy the definition to
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 A **runkit7\_function\_copy()** example**
```
<?php
function original() {
echo "In a function\n";
}
runkit7_function_copy('original','duplicate');
original();
duplicate();
?>
```
The above example will output:
```
In a function
In a function
```
### See Also
* [runkit7\_function\_add()](function.runkit7-function-add) - Add a new function, similar to create\_function
* [runkit7\_function\_redefine()](function.runkit7-function-redefine) - Replace a function definition with a new implementation
* [runkit7\_function\_rename()](function.runkit7-function-rename) - Change a function's name
* [runkit7\_function\_remove()](function.runkit7-function-remove) - Remove a function definition
php svn_revert svn\_revert
===========
(PECL svn >= 0.3.0)
svn\_revert — Revert changes to the working copy
### Description
```
svn_revert(string $path, bool $recursive = false): bool
```
Revert any local changes to the path in a working copy.
### Parameters
`path`
The path to the working repository.
`recursive`
Optionally make recursive changes.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [svn\_delete()](function.svn-delete) - Delete items from a working copy or repository
* [svn\_export()](function.svn-export) - Export the contents of a SVN directory
php array_replace_recursive array\_replace\_recursive
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
array\_replace\_recursive — Replaces elements from passed arrays into the first array recursively
### Description
```
array_replace_recursive(array $array, array ...$replacements): array
```
**array\_replace\_recursive()** replaces the values of `array` with the same values from all 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 array overwriting the previous values.
**array\_replace\_recursive()** is recursive : it will recurse into arrays and apply the same process to the inner value.
When the value in the first array is scalar, it will be replaced by the value in the second array, may it be scalar or array. When the value in the first array and the second array are both arrays, **array\_replace\_recursive()** will replace their respective value recursively.
### Parameters
`array`
The array in which elements are replaced.
`replacements`
Arrays from which elements will be extracted.
### Return Values
Returns an array.
### Examples
**Example #1 **array\_replace\_recursive()** example**
```
<?php
$base = array('citrus' => array( "orange") , 'berries' => array("blackberry", "raspberry"), );
$replacements = array('citrus' => array('pineapple'), 'berries' => array('blueberry'));
$basket = array_replace_recursive($base, $replacements);
print_r($basket);
$basket = array_replace($base, $replacements);
print_r($basket);
?>
```
The above example will output:
```
Array
(
[citrus] => Array
(
[0] => pineapple
)
[berries] => Array
(
[0] => blueberry
[1] => raspberry
)
)
Array
(
[citrus] => Array
(
[0] => pineapple
)
[berries] => Array
(
[0] => blueberry
)
)
```
**Example #2 **array\_replace\_recursive()** and recursive behavior**
```
<?php
$base = array('citrus' => array("orange") , 'berries' => array("blackberry", "raspberry"), 'others' => 'banana' );
$replacements = array('citrus' => 'pineapple', 'berries' => array('blueberry'), 'others' => array('litchis'));
$replacements2 = array('citrus' => array('pineapple'), 'berries' => array('blueberry'), 'others' => 'litchis');
$basket = array_replace_recursive($base, $replacements, $replacements2);
print_r($basket);
?>
```
The above example will output:
```
Array
(
[citrus] => Array
(
[0] => pineapple
)
[berries] => Array
(
[0] => blueberry
[1] => raspberry
)
[others] => litchis
)
```
### See Also
* [array\_replace()](function.array-replace) - Replaces elements from passed arrays into the first array
* [array\_merge\_recursive()](function.array-merge-recursive) - Merge one or more arrays recursively
php Memcached::getMultiByKey Memcached::getMultiByKey
========================
(PECL memcached >= 0.1.0)
Memcached::getMultiByKey — Retrieve multiple items from a specific server
### Description
```
public Memcached::getMultiByKey(string $server_key, array $keys, int $flags = ?): array|false
```
**Memcached::getMultiByKey()** is functionally equivalent to [Memcached::getMulti()](memcached.getmulti), except that the free-form `server_key` can be used to map the `keys` to a specific 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.
`keys`
Array of keys to retrieve.
`flags`
The flags for the get operation.
### Return Values
Returns the array of found items or **`false`** on failure. Use [Memcached::getResultCode()](memcached.getresultcode) if necessary.
### Changelog
| Version | Description |
| --- | --- |
| PECL memcached 3.0.0 | The `&cas_tokens` parameter was removed. The **`Memcached::GET_EXTENDED`** was added and when passed as a flag it ensures the CAS tokens to be fetched. |
### See Also
* [Memcached::getMulti()](memcached.getmulti) - Retrieve multiple items
* [Memcached::get()](memcached.get) - Retrieve an item
* [Memcached::getDelayed()](memcached.getdelayed) - Request multiple items
| programming_docs |
php xml_set_element_handler xml\_set\_element\_handler
==========================
(PHP 4, PHP 5, PHP 7, PHP 8)
xml\_set\_element\_handler — Set up start and end element handlers
### Description
```
xml_set_element_handler(XMLParser $parser, callable $start_handler, callable $end_handler): bool
```
Sets the element handler functions for the XML `parser`. `start_handler` and `end_handler` are strings containing the names of functions that must exist when [xml\_parse()](function.xml-parse) is called for `parser`.
### Parameters
`parser`
A reference to the XML parser to set up start and end element handler functions.
`start_handler`
The function named by `start_handler` must accept three parameters:
```
start_element_handler(XMLParser $parser, string $name, array $attribs)
```
`parser`
The first parameter, parser, is a reference to the XML parser calling the handler. `name`
The second parameter, `name`, contains the name of the element for which this handler is called.If [case-folding](https://www.php.net/manual/en/xml.case-folding.php) is in effect for this parser, the element name will be in uppercase letters. `attribs`
The third parameter, `attribs`, contains an associative array with the element's attributes (if any).The keys of this array are the attribute names, the values are the attribute values.Attribute names are [case-folded](https://www.php.net/manual/en/xml.case-folding.php) on the same criteria as element names.Attribute values are *not* case-folded. The original order of the attributes can be retrieved by walking through `attribs` the normal way, using [each()](function.each).The first key in the array was the first attribute, and so on.
> **Note**: Instead of a function name, an array containing an object reference and a method name can also be supplied.
>
>
`end_handler`
The function named by `end_handler` must accept two parameters:
```
end_element_handler(XMLParser $parser, string $name)
```
`parser`
The first parameter, parser, is a reference to the XML parser calling the handler. `name`
The second parameter, `name`, contains the name of the element for which this handler is called.If [case-folding](https://www.php.net/manual/en/xml.case-folding.php) is in effect for this parser, the element name will be in uppercase letters. If a handler function is set to an empty string, or **`false`**, the handler in question is disabled.
### 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 imap_mail_copy imap\_mail\_copy
================
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_mail\_copy — Copy specified messages to a mailbox
### Description
```
imap_mail_copy(
IMAP\Connection $imap,
string $message_nums,
string $mailbox,
int $flags = 0
): bool
```
Copies mail messages specified by `message_nums` to specified mailbox.
### Parameters
`imap`
An [IMAP\Connection](class.imap-connection) instance.
`message_nums`
`message_nums` is a range not just message numbers (as described in [» RFC2060](http://www.faqs.org/rfcs/rfc2060)).
`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.
`flags`
`flags` is a bitmask of one or more of
* **`CP_UID`** - the sequence numbers contain UIDS
* **`CP_MOVE`** - Delete the messages from the current mailbox after copying. If this flag is set, the function behaves identically to [imap\_mail\_move()](function.imap-mail-move).
### 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. |
### See Also
* [imap\_mail\_move()](function.imap-mail-move) - Move specified messages to a mailbox
php SolrQuery::getMltMaxNumQueryTerms SolrQuery::getMltMaxNumQueryTerms
=================================
(PECL solr >= 0.9.2)
SolrQuery::getMltMaxNumQueryTerms — Returns the maximum number of query terms that will be included in any generated query
### Description
```
public SolrQuery::getMltMaxNumQueryTerms(): int
```
Returns the maximum number of query terms that will be included in any generated query
### Parameters
This function has no parameters.
### Return Values
Returns an integer on success and **`null`** if not set.
php Ds\Map::reverse Ds\Map::reverse
===============
(PECL ds >= 1.0.0)
Ds\Map::reverse — Reverses the map in-place
### Description
```
public Ds\Map::reverse(): void
```
Reverses the map in-place.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Map::reverse()** example**
```
<?php
$map = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]);
$map->reverse();
print_r($map);
?>
```
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 SolrQuery::setGroupFormat SolrQuery::setGroupFormat
=========================
(PECL solr >= 2.2.0)
SolrQuery::setGroupFormat — Sets the group format, result structure (group.format parameter)
### Description
```
public SolrQuery::setGroupFormat(string $value): SolrQuery
```
Sets the group.format parameter. If this parameter is set to simple, the grouped documents are presented in a single flat list, and the start and rows parameters affect the numbers of documents instead of groups. Accepts: grouped/simple
### 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::setGroupTruncate()](solrquery.setgrouptruncate) - If true, facet counts are based on the most relevant document of each group matching the query
* [SolrQuery::setGroupCachePercent()](solrquery.setgroupcachepercent) - Enables caching for result grouping
php The ReflectionExtension class
The ReflectionExtension class
=============================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
The **ReflectionExtension** class reports information about an extension.
Class synopsis
--------------
class **ReflectionExtension** implements [Reflector](class.reflector) { /\* Properties \*/ public string [$name](class.reflectionextension#reflectionextension.props.name); /\* Methods \*/ public [\_\_construct](reflectionextension.construct)(string `$name`)
```
private __clone(): void
```
```
public static export(string $name, string $return = false): string
```
```
public getClasses(): array
```
```
public getClassNames(): array
```
```
public getConstants(): array
```
```
public getDependencies(): array
```
```
public getFunctions(): array
```
```
public getINIEntries(): array
```
```
public getName(): string
```
```
public getVersion(): ?string
```
```
public info(): void
```
```
public isPersistent(): bool
```
```
public isTemporary(): bool
```
```
public __toString(): string
```
} Properties
----------
name Name of the extension, same as calling the [ReflectionExtension::getName()](reflectionextension.getname) method.
Table of Contents
-----------------
* [ReflectionExtension::\_\_clone](reflectionextension.clone) — Clones
* [ReflectionExtension::\_\_construct](reflectionextension.construct) — Constructs a ReflectionExtension
* [ReflectionExtension::export](reflectionextension.export) — Export
* [ReflectionExtension::getClasses](reflectionextension.getclasses) — Gets classes
* [ReflectionExtension::getClassNames](reflectionextension.getclassnames) — Gets class names
* [ReflectionExtension::getConstants](reflectionextension.getconstants) — Gets constants
* [ReflectionExtension::getDependencies](reflectionextension.getdependencies) — Gets dependencies
* [ReflectionExtension::getFunctions](reflectionextension.getfunctions) — Gets extension functions
* [ReflectionExtension::getINIEntries](reflectionextension.getinientries) — Gets extension ini entries
* [ReflectionExtension::getName](reflectionextension.getname) — Gets extension name
* [ReflectionExtension::getVersion](reflectionextension.getversion) — Gets extension version
* [ReflectionExtension::info](reflectionextension.info) — Print extension info
* [ReflectionExtension::isPersistent](reflectionextension.ispersistent) — Returns whether this extension is persistent
* [ReflectionExtension::isTemporary](reflectionextension.istemporary) — Returns whether this extension is temporary
* [ReflectionExtension::\_\_toString](reflectionextension.tostring) — To string
php ibase_rollback ibase\_rollback
===============
(PHP 5, PHP 7 < 7.4.0)
ibase\_rollback — Roll back a transaction
### Description
```
ibase_rollback(resource $link_or_trans_identifier = null): bool
```
Rolls back a transaction.
### Parameters
`link_or_trans_identifier`
If called without an argument, this function rolls back the default transaction of the default link. If the argument is a connection identifier, the default transaction of the corresponding connection will be rolled back. If the argument is a transaction identifier, the corresponding transaction will be rolled back.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php gmp_jacobi gmp\_jacobi
===========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_jacobi — Jacobi symbol
### Description
```
gmp_jacobi(GMP|int|string $num1, GMP|int|string $num2): int
```
Computes [» Jacobi symbol](http://primes.utm.edu/glossary/page.php?sort=JacobiSymbol) of `num1` and `num2`. `num2` should be odd and must be positive.
### 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.
Should be odd and must be positive.
### Return Values
A [GMP](class.gmp) object.
### Examples
**Example #1 **gmp\_jacobi()** example**
```
<?php
echo gmp_jacobi("1", "3") . "\n";
echo gmp_jacobi("2", "3") . "\n";
?>
```
The above example will output:
```
1
0
```
### See Also
* [gmp\_kronecker()](function.gmp-kronecker) - Kronecker symbol
* [gmp\_legendre()](function.gmp-legendre) - Legendre symbol
php sodium_memcmp sodium\_memcmp
==============
(PHP 7 >= 7.2.0, PHP 8)
sodium\_memcmp — Test for equality in constant-time
### Description
```
sodium_memcmp(string $string1, string $string2): int
```
Compare two strings in constant-time.
In practice, you almost always want to use [hash\_equals()](function.hash-equals) instead, since it provides the same logic but returns a bool instead of an int. However, if you're using the return value of a comparison in a calculation that's timing-sensitive, and worried about timing leaks with bool-to-int conversions, **sodium\_memcmp()** is an ideal replacement.
### Parameters
`string1`
String to compare
`string2`
Other string to compare
### Return Values
Returns `0` if both strings are equal; `-1` otherwise.
php snmp_get_quick_print snmp\_get\_quick\_print
=======================
(PHP 4, PHP 5, PHP 7, PHP 8)
snmp\_get\_quick\_print — Fetches the current value of the NET-SNMP library's quick\_print setting
### Description
```
snmp_get_quick_print(): bool
```
Returns the current value stored in the NET-SNMP Library for quick\_print. quick\_print is off by default.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if quick\_print is on, **`false`** otherwise.
### Examples
**Example #1 **snmp\_get\_quick\_print()** example**
```
<?php
$quickprint = snmp_get_quick_print();
?>
```
### See Also
* [snmp\_set\_quick\_print()](function.snmp-set-quick-print) - Set the value of enable within the NET-SNMP library for a full description of what quick\_print does.
php Ds\PriorityQueue::peek Ds\PriorityQueue::peek
======================
(PECL ds >= 1.0.0)
Ds\PriorityQueue::peek — Returns the value at the front of the queue
### Description
```
public Ds\PriorityQueue::peek(): mixed
```
Returns the value at the front of the queue, but does not remove it.
### Parameters
This function has no parameters.
### Return Values
The value at the front of the queue.
### Errors/Exceptions
[UnderflowException](class.underflowexception) if empty.
### Examples
**Example #1 **Ds\PriorityQueue::peek()** example**
```
<?php
$queue = new \Ds\PriorityQueue();
$queue->push("a", 5);
$queue->push("b", 15);
$queue->push("c", 10);
var_dump($queue->peek());
?>
```
The above example will output something similar to:
```
string(1) "b"
```
php SQLite3::openBlob SQLite3::openBlob
=================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3::openBlob — Opens a stream resource to read a BLOB
### Description
```
public SQLite3::openBlob(
string $table,
string $column,
int $rowid,
string $database = "main",
int $flags = SQLITE3_OPEN_READONLY
): resource|false
```
Opens a stream resource to read or write a BLOB, which would be selected by:
SELECT `column` FROM `database`.`table` WHERE rowid = `rowid`
> **Note**: It is not possible to change the size of a BLOB by writing to the stream. Instead, an UPDATE statement has to be executed, possibly using SQLite's zeroblob() function to set the desired BLOB size.
>
>
### Parameters
`table`
The table name.
`column`
The column name.
`rowid`
The row ID.
`database`
The symbolic name of the DB
`flags`
Either **`SQLITE3_OPEN_READONLY`** or **`SQLITE3_OPEN_READWRITE`** to open the stream for reading only, or for reading and writing, respectively.
### Return Values
Returns a stream resource, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 7.2.0 | The `flags` parameter has been added, allowing to write BLOBs; formerly only reading was supported. |
### Examples
**Example #1 **SQLite3::openBlob()** example**
```
<?php
$conn = new SQLite3(':memory:');
$conn->exec('CREATE TABLE test (text text)');
$conn->exec("INSERT INTO test VALUES ('Lorem ipsum')");
$stream = $conn->openBlob('test', 'text', 1);
echo stream_get_contents($stream);
fclose($stream); // mandatory, otherwise the next line would fail
$conn->close();
?>
```
The above example will output:
```
Lorem ipsum
```
**Example #2 Incrementally writing a BLOB**
```
<?php
$conn = new SQLite3(':memory:');
$conn->exec('CREATE TABLE test (text text)');
$conn->exec("INSERT INTO test VALUES (zeroblob(36))");
$stream = $conn->openBlob('test', 'text', 1, 'main', SQLITE3_OPEN_READWRITE);
for ($i = 0; $i < 3; $i++) {
fwrite($stream, "Lorem ipsum\n");
}
fclose($stream);
echo $conn->querySingle("SELECT text FROM test");
$conn->close();
?>
```
The above example will output:
```
Lorem ipsum
Lorem ipsum
Lorem ipsum
```
php DOMDocument::importNode DOMDocument::importNode
=======================
(PHP 5, PHP 7, PHP 8)
DOMDocument::importNode — Import node into current document
### Description
```
public DOMDocument::importNode(DOMNode $node, bool $deep = false): DOMNode|false
```
This function returns a copy of the node to import and associates it with the current document.
### Parameters
`node`
The node to import.
`deep`
If set to **`true`**, this method will recursively import the subtree under the `node`.
>
> **Note**:
>
>
> To copy the nodes attributes `deep` needs to be set to **`true`**
>
>
### Return Values
The copied node or **`false`**, if it cannot be copied.
### Errors/Exceptions
[DOMException](class.domexception) is thrown if node cannot be imported.
### Examples
**Example #1 **DOMDocument::importNode()** example**
Copying nodes between documents.
```
<?php
$orgdoc = new DOMDocument;
$orgdoc->loadXML("<root><element><child>text in child</child></element></root>");
// The node we want to import to a new document
$node = $orgdoc->getElementsByTagName("element")->item(0);
// Create a new document
$newdoc = new DOMDocument;
$newdoc->formatOutput = true;
// Add some markup
$newdoc->loadXML("<root><someelement>text in some element</someelement></root>");
echo "The 'new document' before copying nodes into it:\n";
echo $newdoc->saveXML();
// Import the node, and all its children, to the document
$node = $newdoc->importNode($node, true);
// And then append it to the "<root>" node
$newdoc->documentElement->appendChild($node);
echo "\nThe 'new document' after copying the nodes into it:\n";
echo $newdoc->saveXML();
?>
```
The above example will output:
```
The 'new document' before copying nodes into it:
<?xml version="1.0"?>
<root>
<someelement>text in some element</someelement>
</root>
The 'new document' after copying the nodes into it:
<?xml version="1.0"?>
<root>
<someelement>text in some element</someelement>
<element>
<child>text in child</child>
</element>
</root>
```
php Yaf_Router::getRoutes Yaf\_Router::getRoutes
======================
(Yaf >=1.0.0)
Yaf\_Router::getRoutes — Retrieve registered routes
### Description
```
public Yaf_Router::getRoutes(): mixed
```
Retrieve registered routes
### Parameters
This function has no parameters.
### Return Values
php mysqli::dump_debug_info mysqli::dump\_debug\_info
=========================
mysqli\_dump\_debug\_info
=========================
(PHP 5, PHP 7, PHP 8)
mysqli::dump\_debug\_info -- mysqli\_dump\_debug\_info — Dump debugging information into the log
### Description
Object-oriented style
```
public mysqli::dump_debug_info(): bool
```
Procedural style
```
mysqli_dump_debug_info(mysqli $mysql): bool
```
This function is designed to be executed by an user with the SUPER privilege and is used to dump debugging information into the log for the MySQL Server relating to the connection.
### 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.
### See Also
* [mysqli\_debug()](mysqli.debug) - Performs debugging operations
| programming_docs |
php ReflectionClass::isAbstract ReflectionClass::isAbstract
===========================
(PHP 5, PHP 7, PHP 8)
ReflectionClass::isAbstract — Checks if class is abstract
### Description
```
public ReflectionClass::isAbstract(): bool
```
Checks if the class is abstract.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **ReflectionClass::isAbstract()** example**
```
<?php
class TestClass { }
abstract class TestAbstractClass { }
$testClass = new ReflectionClass('TestClass');
$abstractClass = new ReflectionClass('TestAbstractClass');
var_dump($testClass->isAbstract());
var_dump($abstractClass->isAbstract());
?>
```
The above example will output:
```
bool(false)
bool(true)
```
### See Also
* [ReflectionClass::isInterface()](reflectionclass.isinterface) - Checks if the class is an interface
* [Class Abstraction](language.oop5.abstract)
php SplQueue::setIteratorMode SplQueue::setIteratorMode
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplQueue::setIteratorMode — Sets the mode of iteration
### Description
```
public SplQueue::setIteratorMode(int $mode): void
```
### Parameters
`mode`
There is only one iteration parameter you can modify.
* The behavior of the iterator (either one or the other):
+ **`SplDoublyLinkedList::IT_MODE_DELETE`** (Elements are deleted by the iterator)
+ **`SplDoublyLinkedList::IT_MODE_KEEP`** (Elements are traversed by the iterator)
The default mode is: **`SplDoublyLinkedList::IT_MODE_FIFO`** | **`SplDoublyLinkedList::IT_MODE_KEEP`**
**Warning** The direction of iteration can not be changed for SplQueues, it is always **`SplDoublyLinkedList::IT_MODE_FIFO`**.
### Return Values
No value is returned.
### Errors/Exceptions
Throws a [RuntimeException](class.runtimeexception) on trying to change the direction of iteration by using **`SplDoublyLinkedList::IT_MODE_LIFO`**.
php XSLTProcessor::transformToXml XSLTProcessor::transformToXml
=============================
(PHP 5, PHP 7, PHP 8)
XSLTProcessor::transformToXml — Transform to XML
### Description
```
public XSLTProcessor::transformToXml(object $document): string|null|false
```
Transforms the source node to a string applying the stylesheet given by the [xsltprocessor::importStylesheet()](xsltprocessor.importstylesheet) method.
### Parameters
`document`
The [DOMDocument](class.domdocument) or [SimpleXMLElement](class.simplexmlelement) object to be transformed.
### Return Values
The result of the transformation as a string or **`false`** on error.
### Examples
**Example #1 Transforming to a string**
```
<?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 $proc->transformToXML($xml);
?>
```
The above example will output:
```
Hey! Welcome to Nicolas Eliaszewicz's sweet CD collection!
<h1>Fight for your mind</h1><h2>by Ben Harper - 1995</h2><hr>
<h1>Electric Ladyland</h1><h2>by Jimi Hendrix - 1997</h2><hr>
```
### See Also
* [XSLTProcessor::transformToDoc()](xsltprocessor.transformtodoc) - Transform to a DOMDocument
* [XSLTProcessor::transformToUri()](xsltprocessor.transformtouri) - Transform to URI
php stats_rand_gen_t stats\_rand\_gen\_t
===================
(PECL stats >= 1.0.0)
stats\_rand\_gen\_t — Generates a single random deviate from a t-distribution
### Description
```
stats_rand_gen_t(float $df): float
```
Returns a random deviate from the t-distribution with the degrees of freedom, `df`.
### Parameters
`df`
The degrees of freedom
### Return Values
A random deviate
php SplObserver::update SplObserver::update
===================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplObserver::update — Receive update from subject
### Description
```
public SplObserver::update(SplSubject $subject): void
```
This method is called when any [SplSubject](class.splsubject) to which the observer is attached calls [SplSubject::notify()](splsubject.notify).
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`subject`
The [SplSubject](class.splsubject) notifying the observer of an update.
### Return Values
No value is returned.
php PharFileInfo::isCompressed PharFileInfo::isCompressed
==========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
PharFileInfo::isCompressed — Returns whether the entry is compressed
### Description
```
public PharFileInfo::isCompressed(?int $compression = null): bool
```
This returns whether a file is compressed within a Phar archive with either Gzip or Bzip2 compression.
### Parameters
`compression`
One of **`Phar::GZ`** or **`Phar::BZ2`**, defaults to any compression.
### Return Values
**`true`** if the file is compressed within the Phar archive, **`false`** if not.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `compression` is now nullable. |
### Examples
**Example #1 A **PharFileInfo::isCompressed()** example**
```
<?php
try {
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
$p['myfile.txt'] = 'hi';
$p['myfile2.txt'] = 'hi';
$p['myfile2.txt']->setCompressedGZ();
$file = $p['myfile.txt'];
$file2 = $p['myfile2.txt'];
var_dump($file->isCompressed());
var_dump($file2->isCompressed());
} catch (Exception $e) {
echo 'Create/modify on phar my.phar failed: ', $e;
}
?>
```
The above example will output:
```
bool(false)
bool(true)
```
### See Also
* [PharFileInfo::getCompressedSize()](pharfileinfo.getcompressedsize) - Returns the actual size of the file (with compression) inside the Phar archive
* [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::isCompressed()](phar.iscompressed) - Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)
* [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 system system
======
(PHP 4, PHP 5, PHP 7, PHP 8)
system — Execute an external program and display the output
### Description
```
system(string $command, int &$result_code = null): string|false
```
**system()** is just like the C version of the function in that it executes the given `command` and outputs the result.
The **system()** call also tries to automatically flush the web server's output buffer after each line of output if PHP is running as a server module.
If you need to execute a command and have all the data from the command passed directly back without any interference, use the [passthru()](function.passthru) function.
### Parameters
`command`
The command that will be executed.
`result_code`
If the `result_code` argument is present, then the return status of the executed command will be written to this variable.
### Return Values
Returns the last line of the command output on success, and **`false`** on failure.
### Examples
**Example #1 **system()** example**
```
<?php
echo '<pre>';
// Outputs all the result of shellcommand "ls", and returns
// the last output line into $last_line. Stores the return value
// of the shell command in $retval.
$last_line = system('ls', $retval);
// Printing additional info
echo '
</pre>
<hr />Last line of the output: ' . $last_line . '
<hr />Return value: ' . $retval;
?>
```
### Notes
**Warning**When allowing user-supplied data to be passed to this function, use [escapeshellarg()](function.escapeshellarg) or [escapeshellcmd()](function.escapeshellcmd) to ensure that users cannot trick the system into executing arbitrary commands.
>
> **Note**:
>
>
> If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends.
>
>
>
### See Also
* [exec()](function.exec) - Execute an external program
* [passthru()](function.passthru) - Execute an external program and display raw output
* [popen()](function.popen) - Opens process file pointer
* [escapeshellcmd()](function.escapeshellcmd) - Escape shell metacharacters
* [pcntl\_exec()](function.pcntl-exec) - Executes specified program in current process space
* [backtick operator](language.operators.execution)
php IntlBreakIterator::createCharacterInstance IntlBreakIterator::createCharacterInstance
==========================================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlBreakIterator::createCharacterInstance — Create break iterator for boundaries of combining character sequences
### Description
```
public static IntlBreakIterator::createCharacterInstance(?string $locale = null): ?IntlBreakIterator
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`locale`
### Return Values
php Locale::getKeywords Locale::getKeywords
===================
locale\_get\_keywords
=====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
Locale::getKeywords -- locale\_get\_keywords — Gets the keywords for the input locale
### Description
Object-oriented style
```
public static Locale::getKeywords(string $locale): array|false|null
```
Procedural style
```
locale_get_keywords(string $locale): array|false|null
```
Gets the keywords for the input locale.
### Parameters
`locale`
The locale to extract the keywords from
### Return Values
Associative array containing the keyword-value pairs for this locale
Returns **`null`** when the length of `locale` exceeds **`INTL_MAX_LOCALE_LEN`**.
### Examples
**Example #1 **locale\_get\_keywords()** example**
```
<?php
$keywords_arr = locale_get_keywords('de_DE@currency=EUR;collation=PHONEBOOK');
if ($keywords_arr) {
foreach ($keywords_arr as $key => $value) {
echo "$key = $value\n";
}
}
?>
```
**Example #2 OO example**
```
<?php
$keywords_arr = Locale::getKeywords('de_DE@currency=EUR;collation=PHONEBOOK');
if ($keywords_arr) {
foreach ($keywords_arr as $key => $value) {
echo "$key = $value\n";
}
}
?>
```
The above example will output:
```
collation = PHONEBOOK
currency = EUR
```
### See Also
* [locale\_get\_all\_variants()](locale.getallvariants) - Gets the variants for the input locale
php mb_convert_kana mb\_convert\_kana
=================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
mb\_convert\_kana — Convert "kana" one from another ("zen-kaku", "han-kaku" and more)
### Description
```
mb_convert_kana(string $string, string $mode = "KV", ?string $encoding = null): string
```
Performs a "han-kaku" - "zen-kaku" conversion for string `string`. This function is only useful for Japanese.
### Parameters
`string`
The string being converted.
`mode`
The conversion option.
Specify with a combination of following options.
**Applicable Conversion Options**| Option | Meaning |
| --- | --- |
| `r` | Convert "zen-kaku" alphabets to "han-kaku" |
| `R` | Convert "han-kaku" alphabets to "zen-kaku" |
| `n` | Convert "zen-kaku" numbers to "han-kaku" |
| `N` | Convert "han-kaku" numbers to "zen-kaku" |
| `a` | Convert "zen-kaku" alphabets and numbers to "han-kaku" |
| `A` | Convert "han-kaku" alphabets and numbers to "zen-kaku" (Characters included in "a", "A" options are U+0021 - U+007E excluding U+0022, U+0027, U+005C, U+007E) |
| `s` | Convert "zen-kaku" space to "han-kaku" (U+3000 -> U+0020) |
| `S` | Convert "han-kaku" space to "zen-kaku" (U+0020 -> U+3000) |
| `k` | Convert "zen-kaku kata-kana" to "han-kaku kata-kana" |
| `K` | Convert "han-kaku kata-kana" to "zen-kaku kata-kana" |
| `h` | Convert "zen-kaku hira-gana" to "han-kaku kata-kana" |
| `H` | Convert "han-kaku kata-kana" to "zen-kaku hira-gana" |
| `c` | Convert "zen-kaku kata-kana" to "zen-kaku hira-gana" |
| `C` | Convert "zen-kaku hira-gana" to "zen-kaku kata-kana" |
| `V` | Collapse voiced sound notation and convert them into a character. Use with "K","H" |
`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 converted string.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `encoding` is nullable now. |
### Examples
**Example #1 **mb\_convert\_kana()** example**
```
<?php
/* Convert all "kana" to "zen-kaku" "kata-kana" */
$str = mb_convert_kana($str, "KVC");
/* Convert "han-kaku" "kata-kana" to "zen-kaku" "kata-kana"
and "zen-kaku" alphanumeric to "han-kaku" */
$str = mb_convert_kana($str, "KVa");
?>
```
php DOMAttr::isId DOMAttr::isId
=============
(PHP 5, PHP 7, PHP 8)
DOMAttr::isId — Checks if attribute is a defined ID
### Description
```
public DOMAttr::isId(): bool
```
This function checks if the attribute is a defined ID.
According to the DOM standard this requires a DTD which defines the attribute ID to be of type ID. You need to validate your document with [DOMDocument::validate](domdocument.validate) or `DOMDocument::validateOnParse` before using this function.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 DOMAttr::isId() Example**
```
<?php
$doc = new DomDocument;
// We need to validate our document before referring to the id
$doc->validateOnParse = true;
$doc->Load('book.xml');
// We retrieve the attribute named id of the chapter element
$attr = $doc->getElementsByTagName('chapter')->item(0)->getAttributeNode('id');
var_dump($attr->isId()); // bool(true)
?>
```
php None Using namespaces: Aliasing/Importing
------------------------------------
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
The ability to refer to an external fully qualified name with an alias, or importing, is an important feature of namespaces. This is similar to the ability of unix-based filesystems to create symbolic links to a file or to a directory.
PHP can alias(/import) constants, functions, classes, interfaces, traits, enums and namespaces.
Aliasing is accomplished with the `use` operator. Here is an example showing all 5 kinds of importing:
**Example #1 importing/aliasing with the use operator**
```
<?php
namespace foo;
use My\Full\Classname as Another;
// this is the same as use My\Full\NSname as NSname
use My\Full\NSname;
// importing a global class
use ArrayObject;
// importing a function
use function My\Full\functionName;
// aliasing a function
use function My\Full\functionName as func;
// importing a constant
use const My\Full\CONSTANT;
$obj = new namespace\Another; // instantiates object of class foo\Another
$obj = new Another; // instantiates object of class My\Full\Classname
NSname\subns\func(); // calls function My\Full\NSname\subns\func
$a = new ArrayObject(array(1)); // instantiates object of class ArrayObject
// without the "use ArrayObject" we would instantiate an object of class foo\ArrayObject
func(); // calls function My\Full\functionName
echo CONSTANT; // echoes the value of My\Full\CONSTANT
?>
```
Note that for namespaced names (fully qualified namespace names containing namespace separator, such as `Foo\Bar` as opposed to global names that do not, such as `FooBar`), the leading backslash is unnecessary and not recommended, as import names must be fully qualified, and are not processed relative to the current namespace. PHP additionally supports a convenience shortcut to place multiple use statements on the same line
**Example #2 importing/aliasing with the use operator, multiple use statements combined**
```
<?php
use My\Full\Classname as Another, My\Full\NSname;
$obj = new Another; // instantiates object of class My\Full\Classname
NSname\subns\func(); // calls function My\Full\NSname\subns\func
?>
```
Importing is performed at compile-time, and so does not affect dynamic class, function or constant names.
**Example #3 Importing and dynamic names**
```
<?php
use My\Full\Classname as Another, My\Full\NSname;
$obj = new Another; // instantiates object of class My\Full\Classname
$a = 'Another';
$obj = new $a; // instantiates object of class Another
?>
```
In addition, importing only affects unqualified and qualified names. Fully qualified names are absolute, and unaffected by imports.
**Example #4 Importing and fully qualified names**
```
<?php
use My\Full\Classname as Another, My\Full\NSname;
$obj = new Another; // instantiates object of class My\Full\Classname
$obj = new \Another; // instantiates object of class Another
$obj = new Another\thing; // instantiates object of class My\Full\Classname\thing
$obj = new \Another\thing; // instantiates object of class Another\thing
?>
```
### Scoping rules for importing
The `use` keyword must be declared in the outermost scope of a file (the global scope) or inside namespace declarations. This is because the importing is done at compile time and not runtime, so it cannot be block scoped. The following example will show an illegal use of the `use` keyword:
**Example #5 Illegal importing rule**
```
<?php
namespace Languages;
function toGreenlandic()
{
use Languages\Danish;
// ...
}
?>
```
>
> **Note**:
>
>
> Importing rules are per file basis, meaning included files will *NOT* inherit the parent file's importing rules.
>
>
### Group `use` declarations
Classes, functions and constants being imported from the same [`namespace`](language.namespaces.definition) can be grouped together in a single [`use`](language.namespaces.importing) statement.
```
<?php
use some\namespace\ClassA;
use some\namespace\ClassB;
use some\namespace\ClassC as C;
use function some\namespace\fn_a;
use function some\namespace\fn_b;
use function some\namespace\fn_c;
use const some\namespace\ConstA;
use const some\namespace\ConstB;
use const some\namespace\ConstC;
// is equivalent to the following groupped use declaration
use some\namespace\{ClassA, ClassB, ClassC as C};
use function some\namespace\{fn_a, fn_b, fn_c};
use const some\namespace\{ConstA, ConstB, ConstC};
```
php get_class_methods get\_class\_methods
===================
(PHP 4, PHP 5, PHP 7, PHP 8)
get\_class\_methods — Gets the class methods' names
### Description
```
get_class_methods(object|string $object_or_class): array
```
Gets the class methods names.
### Parameters
`object_or_class`
The class name or an object instance
### Return Values
Returns an array of method names defined for the class specified by `object_or_class`.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | The `object_or_class` parameter now only accepts objects or valid class names. |
### Examples
**Example #1 **get\_class\_methods()** example**
```
<?php
class myclass {
// constructor
function __construct()
{
return(true);
}
// method 1
function myfunc1()
{
return(true);
}
// method 2
function myfunc2()
{
return(true);
}
}
$class_methods = get_class_methods('myclass');
// or
$class_methods = get_class_methods(new myclass());
foreach ($class_methods as $method_name) {
echo "$method_name\n";
}
?>
```
The above example will output:
```
__construct
myfunc1
myfunc2
```
### See Also
* [get\_class()](function.get-class) - Returns the name of the class of an object
* [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
| programming_docs |
php ReflectionClass::isIterable ReflectionClass::isIterable
===========================
(PHP 7 >= 7.2.0, PHP 8)
ReflectionClass::isIterable — Check whether this class is iterable
### Description
```
public ReflectionClass::isIterable(): bool
```
Check whether this class is iterable (i.e. can be used inside [foreach](control-structures.foreach)).
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Basic **ReflectionClass::isIterable()** Usage**
```
<?php
class IteratorClass implements Iterator {
public function __construct() { }
public function key() { }
public function current() { }
function next() { }
function valid() { }
function rewind() { }
}
class DerivedClass extends IteratorClass { }
class NonIterator { }
function dump_iterable($class) {
$reflection = new ReflectionClass($class);
var_dump($reflection->isIterable());
}
$classes = array("ArrayObject", "IteratorClass", "DerivedClass", "NonIterator");
foreach ($classes as $class) {
echo "Is $class iterable? ";
dump_iterable($class);
}
?>
```
The above example will output:
```
Is ArrayObject iterable? bool(true)
Is IteratorClass iterable? bool(true)
Is DerivedClass iterable? bool(true)
Is NonIterator iterable? bool(false)
```
### See Also
* [ReflectionClass::\_\_construct()](reflectionclass.construct) - Constructs a ReflectionClass
php DOMElement::removeAttributeNS DOMElement::removeAttributeNS
=============================
(PHP 5, PHP 7, PHP 8)
DOMElement::removeAttributeNS — Removes attribute
### Description
```
public DOMElement::removeAttributeNS(?string $namespace, string $localName): void
```
Removes attribute `localName` in namespace `namespace` from the element.
### Parameters
`namespace`
The namespace URI.
`localName`
The local name.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### 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::getAttributeNS()](domelement.getattributens) - Returns value of attribute
* [DOMElement::setAttributeNS()](domelement.setattributens) - Adds new attribute
php pspell_config_save_repl pspell\_config\_save\_repl
==========================
(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)
pspell\_config\_save\_repl — Determine whether to save a replacement pairs list along with the wordlist
### Description
```
pspell_config_save_repl(PSpell\Config $config, bool $save): bool
```
**pspell\_config\_save\_repl()** determines whether [pspell\_save\_wordlist()](function.pspell-save-wordlist) will save the replacement pairs along with the wordlist. Usually there is no need to use this function because if [pspell\_config\_repl()](function.pspell-config-repl) is used, the replacement pairs will be saved by [pspell\_save\_wordlist()](function.pspell-save-wordlist) anyway, and if it is not, the replacement pairs will not be saved.
**pspell\_config\_save\_repl()** should be used on a config before calling [pspell\_new\_config()](function.pspell-new-config).
### Parameters
`config`
An [PSpell\Config](class.pspell-config) instance.
`save`
**`true`** if replacement pairs should be saved, **`false`** otherwise.
### 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. |
### Notes
>
> **Note**:
>
>
> This function will not work unless you have pspell .11.2 and aspell .32.5 or later.
>
>
php IntlDateFormatter::setCalendar IntlDateFormatter::setCalendar
==============================
datefmt\_set\_calendar
======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
IntlDateFormatter::setCalendar -- datefmt\_set\_calendar — Sets the calendar type used by the formatter
### Description
Object-oriented style
```
public IntlDateFormatter::setCalendar(IntlCalendar|int|null $calendar): bool
```
Procedural style
```
datefmt_set_calendar(IntlDateFormatter $formatter, IntlCalendar|int|null $calendar): bool
```
Sets the calendar or calendar type used by the formatter.
### Parameters
`formatter`
The formatter resource.
`calendar`
This can either be: the [calendar type](class.intldateformatter#intl.intldateformatter-constants.calendartypes) to use (default is **`IntlDateFormatter::GREGORIAN`**, which is also used if **`null`** is specified) or an [IntlCalendar](class.intlcalendar) object.
Any [IntlCalendar](class.intlcalendar) object passed in will be cloned; no modifications will be made to the argument object.
The timezone of the formatter will only be kept if an [IntlCalendar](class.intlcalendar) object is not passed, otherwise the new timezone will be that of the passed object.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 5.5.0/PECL 3.0.0 | It became possible to pass an [IntlCalendar](class.intlcalendar) object. |
### Examples
**Example #1 **datefmt\_set\_calendar()** example**
```
<?php
$fmt = datefmt_create(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'calendar of the formatter is : ' . datefmt_get_calendar($fmt);
datefmt_set_calendar($fmt, IntlDateFormatter::TRADITIONAL);
echo 'Now calendar of the formatter is : ' . datefmt_get_calendar($fmt);
?>
```
**Example #2 OO example**
```
<?php
$fmt = new IntlDateFormatter(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'calendar of the formatter is : ' . $fmt->getCalendar();
$fmt->setCalendar(IntlDateFormatter::TRADITIONAL);
echo 'Now calendar of the formatter is : ' . $fmt->getCalendar();
?>
```
The above example will output:
```
calendar of the formatter is : 1
Now calendar of the formatter is : 0
```
**Example #3 Example with [IntlCalendar](class.intlcalendar) argument**
```
<?php
$time = strtotime("2013-03-03 00:00:00 UTC");
$formatter = IntlDateFormatter::create("en_US", NULL, NULL, "Europe/Amsterdam");
echo "before: ", $formatter->format($time), "\n";
/* note that the calendar's locale is not used! */
$formatter->setCalendar(IntlCalendar::createInstance(
"America/New_York", "pt_PT@calendar=islamic"));
echo "after: ", $formatter->format($time), "\n";
```
The above example will output:
```
before: Sunday, March 3, 2013 at 1:00:00 AM Central European Standard Time
after: Saturday, Rabiʻ II 20, 1434 at 7:00:00 PM Eastern Standard Time
```
### See Also
* [datefmt\_get\_calendar()](intldateformatter.getcalendar) - Get the calendar type used for the IntlDateFormatter
* [datefmt\_get\_calendar\_object()](intldateformatter.getcalendarobject) - Get copy of formatterʼs calendar object
* [datefmt\_create()](intldateformatter.create) - Create a date formatter
php ftp_rawlist ftp\_rawlist
============
(PHP 4, PHP 5, PHP 7, PHP 8)
ftp\_rawlist — Returns a detailed list of files in the given directory
### Description
```
ftp_rawlist(FTP\Connection $ftp, string $directory, bool $recursive = false): array|false
```
**ftp\_rawlist()** executes the FTP **LIST** command, and returns the result as an array.
### Parameters
`ftp`
An [FTP\Connection](class.ftp-connection) instance.
`directory`
The directory path. May include arguments for the **LIST** command.
`recursive`
If set to **`true`**, the issued command will be **LIST -R**.
### Return Values
Returns an array where each element corresponds to one line of text. Returns **`false`** when passed `directory` is invalid.
The output is not parsed in any way. The system type identifier returned by [ftp\_systype()](function.ftp-systype) can be used to determine how the results should be interpreted.
### 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\_rawlist()** 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 the file list for /
$buff = ftp_rawlist($ftp, '/');
// close the connection
ftp_close($ftp);
// output the buffer
var_dump($buff);
?>
```
The above example will output something similar to:
```
array(3) {
[0]=>
string(65) "drwxr-x--- 3 vincent vincent 4096 Jul 12 12:16 public_ftp"
[1]=>
string(66) "drwxr-x--- 15 vincent vincent 4096 Nov 3 21:31 public_html"
[2]=>
string(73) "lrwxrwxrwx 1 vincent vincent 11 Jul 12 12:16 www -> public_html"
}
```
### See Also
* [ftp\_nlist()](function.ftp-nlist) - Returns a list of files in the given directory
* [ftp\_mlsd()](function.ftp-mlsd) - Returns a list of files in the given directory
php mysqli_result::fetch_array mysqli\_result::fetch\_array
============================
mysqli\_fetch\_array
====================
(PHP 5, PHP 7, PHP 8)
mysqli\_result::fetch\_array -- mysqli\_fetch\_array — Fetch the next row of a result set as an associative, a numeric array, or both
### Description
Object-oriented style
```
public mysqli_result::fetch_array(int $mode = MYSQLI_BOTH): array|null|false
```
Procedural style
```
mysqli_fetch_array(mysqli_result $result, int $mode = MYSQLI_BOTH): array|null|false
```
Fetches one row of data from the result set and returns it as an array. Each subsequent call to this function will return the next row within the result set, or **`null`** if there are no more rows.
In addition to storing the data in the numeric indices of the result array, this function can also store the data in associative indices by using the field names of the result set as keys.
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, the numerically indexed version of the row must be used.
> **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).
`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`**.
By using the **`MYSQLI_ASSOC`** constant this function will behave identically to the [mysqli\_fetch\_assoc()](mysqli-result.fetch-assoc), while **`MYSQLI_NUM`** will behave identically to the [mysqli\_fetch\_row()](mysqli-result.fetch-row) function. The final option **`MYSQLI_BOTH`** will create a single array with the attributes of both.
### Return Values
Returns an array representing the fetched row, **`null`** if there are no more rows in the result set, or **`false`** on failure.
### Examples
**Example #1 **mysqli\_result::fetch\_array()** 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 LIMIT 3";
$result = $mysqli->query($query);
/* numeric array */
$row = $result->fetch_array(MYSQLI_NUM);
printf("%s (%s)\n", $row[0], $row[1]);
/* associative array */
$row = $result->fetch_array(MYSQLI_ASSOC);
printf("%s (%s)\n", $row["Name"], $row["CountryCode"]);
/* associative and numeric array */
$row = $result->fetch_array(MYSQLI_BOTH);
printf("%s (%s)\n", $row[0], $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 LIMIT 3";
$result = mysqli_query($mysqli, $query);
/* numeric array */
$row = mysqli_fetch_array($result, MYSQLI_NUM);
printf("%s (%s)\n", $row[0], $row[1]);
/* associative array */
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
printf("%s (%s)\n", $row["Name"], $row["CountryCode"]);
/* associative and numeric array */
$row = mysqli_fetch_array($result, MYSQLI_BOTH);
printf("%s (%s)\n", $row[0], $row["CountryCode"]);
```
The above examples will output something similar to:
```
Kabul (AFG)
Qandahar (AFG)
Herat (AFG)
```
### See Also
* [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\_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 imap_get_quota imap\_get\_quota
================
(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)
imap\_get\_quota — Retrieve the quota level settings, and usage statics per mailbox
### Description
```
imap_get_quota(IMAP\Connection $imap, string $quota_root): array|false
```
Retrieve the quota level settings, and usage statics per mailbox.
For a non-admin user version of this function, please see the [imap\_get\_quotaroot()](function.imap-get-quotaroot) function of PHP.
### Parameters
`imap`
An [IMAP\Connection](class.imap-connection) instance.
`quota_root`
`quota_root` should normally be in the form of `user.name` where name is the mailbox you wish to retrieve information about.
### Return Values
Returns an array with integer values limit and usage for the given mailbox. The value of limit represents the total amount of space allowed for this mailbox. The usage value represents the mailboxes current level of capacity. Will return **`false`** in the case of failure.
As of PHP 4.3, the function more properly reflects the functionality as dictated by the [» RFC2087](http://www.faqs.org/rfcs/rfc2087). The array return value has changed to support an unlimited number of returned resources (i.e. messages, or sub-folders) with each named resource receiving an individual array key. Each key value then contains an another array with the usage and limit values within it.
For backwards compatibility reasons, the original access methods are still available for use, although it is suggested to update.
### 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\_get\_quota()** example**
```
<?php
$mbox = imap_open("{imap.example.org}", "mailadmin", "password", OP_HALFOPEN)
or die("can't connect: " . imap_last_error());
$quota_value = imap_get_quota($mbox, "user.kalowsky");
if (is_array($quota_value)) {
echo "Usage level is: " . $quota_value['usage'];
echo "Limit level is: " . $quota_value['limit'];
}
imap_close($mbox);
?>
```
**Example #2 **imap\_get\_quota()** 4.3 or greater example**
```
<?php
$mbox = imap_open("{imap.example.org}", "mailadmin", "password", OP_HALFOPEN)
or die("can't connect: " . imap_last_error());
$quota_values = imap_get_quota($mbox, "user.kalowsky");
if (is_array($quota_values)) {
$storage = $quota_values['STORAGE'];
echo "STORAGE usage level is: " . $storage['usage'];
echo "STORAGE limit level is: " . $storage['limit'];
$message = $quota_values['MESSAGE'];
echo "MESSAGE usage level is: " . $message['usage'];
echo "MESSAGE limit is: " . $message['limit'];
/* ... */
}
imap_close($mbox);
?>
```
### Notes
This function is currently only available to users of the c-client2000 or greater library.
The given `imap` must be opened as the mail administrator, otherwise this function will fail.
### See Also
* [imap\_open()](function.imap-open) - Open an IMAP stream to a mailbox
* [imap\_set\_quota()](function.imap-set-quota) - Sets a quota for a given mailbox
* [imap\_get\_quotaroot()](function.imap-get-quotaroot) - Retrieve the quota settings per user
php is_integer is\_integer
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
is\_integer — Alias of [is\_int()](function.is-int)
### Description
This function is an alias of: [is\_int()](function.is-int).
php EventHttpConnection::setLocalPort EventHttpConnection::setLocalPort
=================================
(PECL event >= 1.2.6-beta)
EventHttpConnection::setLocalPort — Sets the local port from which connections are made
### Description
```
public EventHttpConnection::setLocalPort( int $port ): void
```
Sets the local port from which connections are made.
### Parameters
`port` The port number.
### Return Values
### See Also
* [EventHttpConnection::setLocalAddress()](eventhttpconnection.setlocaladdress) - Sets the IP address from which HTTP connections are made
php svn_update svn\_update
===========
(PECL svn >= 0.1.0)
svn\_update — Update working copy
### Description
```
svn_update(string $path, int $revno = SVN_REVISION_HEAD, bool $recurse = true): int
```
Update working copy at `path` to revision `revno`. If `recurse` is true, directories will be recursively updated.
### Parameters
`path`
Path to local working copy.
> **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\_\_).
>
>
`revno`
Revision number to update to, default is **`SVN_REVISION_HEAD`**.
`recurse`
Whether or not to recursively update directories.
### Return Values
Returns new revision number on success, returns **`false`** on failure.
### Examples
**Example #1 Basic example**
This example demonstrates basic usage of this function:
```
<?php
echo svn_update(realpath('working-copy'));
?>
```
The above example will output something similar to:
```
234
```
### 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\_checkout()](function.svn-checkout) - Checks out a working copy from the repository
* [svn\_commit()](function.svn-commit) - Sends changes from the local working copy to the repository
* [» SVN documentation for svn update](http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.update.html)
php The InflateContext class
The InflateContext class
========================
Introduction
------------
(PHP 8)
A fully opaque class which replaces `zlib.inflate` resources as of PHP 8.0.0.
Class synopsis
--------------
final class **InflateContext** { /\* Methods \*/ public [\_\_construct](inflatecontext.construct)() } Table of Contents
-----------------
* [InflateContext::\_\_construct](inflatecontext.construct) — Construct a new InflateContext instance
| programming_docs |
php EventBase::__construct EventBase::\_\_construct
========================
(PECL event >= 1.2.6-beta)
EventBase::\_\_construct — Constructs EventBase object
### Description
```
public EventBase::__construct( EventConfig $cfg = ?)
```
Constructs EventBase object
### Parameters
`cfg` Optional [EventConfig](class.eventconfig) object.
### Return Values
Returns EventBase object.
### See Also
* [EventConfig](class.eventconfig)
php Thread::isJoined Thread::isJoined
================
(PECL pthreads >= 2.0.0)
Thread::isJoined — State Detection
### Description
```
public Thread::isJoined(): bool
```
Tell if the referenced Thread has been joined
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Detect the state of the referenced Thread**
```
<?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->isJoined());
$my->synchronized(function($thread){
$thread->done = true;
$thread->notify();
}, $my);
?>
```
The above example will output:
```
bool(false)
```
php imap_get_quotaroot imap\_get\_quotaroot
====================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
imap\_get\_quotaroot — Retrieve the quota settings per user
### Description
```
imap_get_quotaroot(IMAP\Connection $imap, string $mailbox): array|false
```
Retrieve the quota settings per user. The limit value represents the total amount of space allowed for this user's total mailbox usage. The usage value represents the user's current total mailbox capacity.
### Parameters
`imap`
An [IMAP\Connection](class.imap-connection) instance.
`mailbox`
`mailbox` should normally be in the form of which mailbox (i.e. INBOX).
### Return Values
Returns an array of integer values pertaining to the specified user mailbox. All values contain a key based upon the resource name, and a corresponding array with the usage and limit values within.
This function will return **`false`** in the case of call failure, and an array of information about the connection upon an un-parsable response from the server.
### 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\_get\_quotaroot()** example**
```
<?php
$mbox = imap_open("{imap.example.org}", "kalowsky", "password", OP_HALFOPEN)
or die("can't connect: " . imap_last_error());
$quota = imap_get_quotaroot($mbox, "INBOX");
if (is_array($quota)) {
$storage = $quota['STORAGE'];
echo "STORAGE usage level is: " . $storage['usage'];
echo "STORAGE limit level is: " . $storage['limit'];
$message = $quota['MESSAGE'];
echo "MESSAGE usage level is: " . $message['usage'];
echo "MESSAGE limit level is: " . $message['limit'];
/* ... */
}
imap_close($mbox);
?>
```
### Notes
This function is currently only available to users of the c-client2000 or greater library.
The `imap` should be opened as the user whose mailbox you wish to check.
### See Also
* [imap\_open()](function.imap-open) - Open an IMAP stream to a mailbox
* [imap\_set\_quota()](function.imap-set-quota) - Sets a quota for a given mailbox
* [imap\_get\_quota()](function.imap-get-quota) - Retrieve the quota level settings, and usage statics per mailbox
php DOMNode::getNodePath DOMNode::getNodePath
====================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
DOMNode::getNodePath — Get an XPath for a node
### Description
```
public DOMNode::getNodePath(): ?string
```
Gets an XPath location path for the node.
### Parameters
This function has no parameters.
### Return Values
Returns a string containing the XPath, or **`null`** in case of an error.
### Examples
**Example #1 **DOMNode::getNodePath()** example**
```
<?php
// Create a new DOMDocument instance
$dom = new DOMDocument;
// Load the XML
$dom->loadXML('
<fruits>
<apples>
<apple>braeburn</apple>
<apple>granny smith</apple>
</apples>
<pears>
<pear>conference</pear>
</pears>
</fruits>
');
// Print XPath for each element
foreach ($dom->getElementsByTagName('*') as $node) {
echo $node->getNodePath() . "\n";
}
?>
```
The above example will output:
```
/fruits
/fruits/apples
/fruits/apples/apple[1]
/fruits/apples/apple[2]
/fruits/pears
/fruits/pears/pear
```
### See Also
* [DOMXPath](class.domxpath)
php PharData::extractTo PharData::extractTo
===================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
PharData::extractTo — Extract the contents of a tar/zip archive to a directory
### Description
```
public PharData::extractTo(string $directory, array|string|null $files = null, bool $overwrite = false): bool
```
Extract all files within a tar/zip archive to disk. Extracted files and directories preserve permissions as stored in the archive. The optional parameters allow optional control over which files are extracted, and whether existing files on disk can be overwritten. The second parameter `files` can be either the name of a file or directory to extract, or an array of names of files and directories to extract. By default, this method will not overwrite existing files, the third parameter can be set to true to enable overwriting of files. This method is similar to [ZipArchive::extractTo()](ziparchive.extractto).
### Parameters
`directory`
Path to extract the given `files` to
`files`
The name of a file or directory to extract, or an array of files/directories to extract
`overwrite`
Set to **`true`** to enable overwriting existing files
### Return Values
returns **`true`** on success, but it is better to check for thrown exception, and assume success if none is thrown.
### Errors/Exceptions
Throws [PharException](class.pharexception) if errors occur while flushing changes to disk.
### Examples
**Example #1 A **PharData::extractTo()** example**
```
<?php
try {
$phar = new PharData('myphar.tar');
$phar->extractTo('/full/path'); // extract all files
$phar->extractTo('/another/path', 'file.txt'); // extract only file.txt
$phar->extractTo('/this/path',
array('file1.txt', 'file2.txt')); // extract 2 files only
$phar->extractTo('/third/path', null, true); // extract all files, and overwrite
} catch (Exception $e) {
// handle errors
}
?>
```
### Notes
>
> **Note**:
>
>
> Windows NTFS file systems do not support some characters in filenames, namely `<|>*?":`. Filenames with a trailing dot are not supported either. Contrary to some extraction tools, this method does not replace these characters with an underscore, but instead fails to extract such files.
>
>
>
### See Also
* [Phar::extractTo()](phar.extractto) - Extract the contents of a phar archive to a directory
php ReflectionExtension::getDependencies ReflectionExtension::getDependencies
====================================
(PHP 5 >= 5.1.3, PHP 7, PHP 8)
ReflectionExtension::getDependencies — Gets dependencies
### Description
```
public ReflectionExtension::getDependencies(): array
```
Gets dependencies, by listing both required and conflicting dependencies.
### Parameters
This function has no parameters.
### Return Values
An associative array with dependencies as keys and either `Required`, `Optional` or `Conflicts` as the values.
### Examples
**Example #1 **ReflectionExtension::getDependencies()** example**
```
<?php
$dom = new ReflectionExtension('dom');
print_r($dom->getDependencies());
?>
```
The above example will output something similar to:
```
Array
(
[libxml] => Required
[domxml] => Conflicts
)
```
### See Also
* **ReflectionClass::getVersion()**
php ImagickDraw::pathCurveToQuadraticBezierSmoothRelative ImagickDraw::pathCurveToQuadraticBezierSmoothRelative
=====================================================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::pathCurveToQuadraticBezierSmoothRelative — Draws a quadratic Bezier curve
### Description
```
public ImagickDraw::pathCurveToQuadraticBezierSmoothRelative(float $x, float $y): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Draws a quadratic Bezier curve (using relative coordinates) from the current point to (x, y). The control point is assumed to be the reflection of the control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not a DrawPathCurveToQuadraticBezierAbsolute, DrawPathCurveToQuadraticBezierRelative, DrawPathCurveToQuadraticBezierSmoothAbsolut or DrawPathCurveToQuadraticBezierSmoothRelative, assume the control point is coincident with the current point). At the end of the command, the new current point becomes the final (x, y) coordinate pair used in the polybezier.
This function cannot be used to continue a cubic Bezier curve smoothly. It can only continue from a quadratic curve smoothly.
### Parameters
`x`
ending x coordinate
`y`
ending y coordinate
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::pathCurveToQuadraticBezierSmoothRelative()** example**
```
<?php
$draw = new \ImagickDraw();
$draw->setStrokeOpacity(1);
$draw->setStrokeColor("black");
$draw->setFillColor("blue");
$draw->setStrokeWidth(2);
$draw->setFontSize(72);
$draw->pathStart();
$draw->pathMoveToAbsolute(50,250);
// This specifies a quadratic bezier curve with the current position as the start
// point, the control point is the first two params, and the end point is the last two params.
$draw->pathCurveToQuadraticBezierAbsolute(
150,50,
250,250
);
// This specifies a quadratic bezier curve with the current position as the start
// point, the control point is mirrored from the previous curves control point
// and the end point is defined by the x, y values.
$draw->pathCurveToQuadraticBezierSmoothAbsolute(
450,250
);
// This specifies a quadratic bezier curve with the current position as the start
// point, the control point is mirrored from the previous curves control point
// and the end point is defined relative from the current position by the x, y values.
$draw->pathCurveToQuadraticBezierSmoothRelative(
200,-100
);
$draw->pathFinish();
$imagick = new \Imagick();
$imagick->newImage(700, 500, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
?>
```
php gmp_gcd gmp\_gcd
========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_gcd — Calculate GCD
### Description
```
gmp_gcd(GMP|int|string $num1, GMP|int|string $num2): GMP
```
Calculate greatest common divisor of `num1` and `num2`. The result is always positive even if either of, or both, input operands are negative.
### 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
A positive GMP number that divides into both `num1` and `num2`.
### Examples
**Example #1 **gmp\_gcd()** example**
```
<?php
$gcd = gmp_gcd("12", "21");
echo gmp_strval($gcd) . "\n";
?>
```
The above example will output:
```
3
```
### See Also
* [gmp\_lcm()](function.gmp-lcm) - Calculate LCM
php openssl_x509_check_private_key openssl\_x509\_check\_private\_key
==================================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
openssl\_x509\_check\_private\_key — Checks if a private key corresponds to a certificate
### Description
```
openssl_x509_check_private_key(OpenSSLCertificate|string $certificate, OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key): bool
```
Checks whether the given `private_key` is the private key that corresponds to `certificate`.
**Warning** The function does not check if `private_key` is indeed a private key or not. It merely compares the public materials (e.g. exponent and modulus of an RSA key) and/or key parameters (e.g. EC params of an EC key) of a key pair.
This means, for example, that a public key could be given for `private_key` and the function may return **`true`**.
### Parameters
`certificate`
The certificate.
`private_key`
The private key.
### Return Values
Returns **`true`** if `private_key` is the private key that corresponds to `certificate`, or **`false`** otherwise.
### 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. |
| 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. |
php mcrypt_enc_is_block_algorithm mcrypt\_enc\_is\_block\_algorithm
=================================
(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mcrypt\_enc\_is\_block\_algorithm — Checks whether the algorithm of the opened mode is a block 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_is_block_algorithm(resource $td): bool
```
Tells whether the algorithm of the opened mode is a block algorithm.
### Parameters
`td`
The encryption descriptor.
### Return Values
Returns **`true`** if the algorithm is a block algorithm or **`false`** if it is a stream one.
php Parle\Parser::reset Parle\Parser::reset
===================
(PECL parle >= 0.7.1)
Parle\Parser::reset — Reset parser state
### Description
```
public Parle\Parser::reset(int $tokenId = ?): void
```
Reset parser state using the given token id.
### Parameters
`tokenId`
Token id.
### Return Values
No value is returned.
php DateTime::setTimestamp DateTime::setTimestamp
======================
date\_timestamp\_set
====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
DateTime::setTimestamp -- date\_timestamp\_set — Sets the date and time based on an Unix timestamp
### Description
Object-oriented style
```
public DateTime::setTimestamp(int $timestamp): DateTime
```
Procedural style
```
date_timestamp_set(DateTime $object, int $timestamp): DateTime
```
Sets the date and time based on an Unix timestamp.
Like [DateTimeImmutable::setTimestamp()](datetimeimmutable.settimestamp) 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.
`timestamp`
Unix timestamp representing the date. Setting timestamps outside the range of int is possible by using [DateTimeImmutable::modify()](datetimeimmutable.modify) with the `@` format.
### Return Values
Returns the modified [DateTime](class.datetime) object for method chaining.
### See Also
* [DateTimeImmutable::setTimestamp()](datetimeimmutable.settimestamp) - Sets the date and time based on a Unix timestamp
php Componere\Abstract\Definition::addMethod Componere\Abstract\Definition::addMethod
========================================
(Componere 2 >= 2.1.0)
Componere\Abstract\Definition::addMethod — Add Method
### Description
```
public Componere\Abstract\Definition::addMethod(string $name, Componere\Method $method): Definition
```
Shall create or override a method on the current definition.
### Parameters
`name`
The case insensitive name for method
`method`
[Componere\Method](class.componere-method) not previously added to another Definition
### Return Values
The current Definition
### Exceptions
**Warning** Shall throw [RuntimeException](class.runtimeexception) if Definition was registered
**Warning** Shall throw [RuntimeException](class.runtimeexception) if Method was added to another Definition
php DOMDocument::createDocumentFragment DOMDocument::createDocumentFragment
===================================
(PHP 5, PHP 7, PHP 8)
DOMDocument::createDocumentFragment — Create new document fragment
### Description
```
public DOMDocument::createDocumentFragment(): DOMDocumentFragment
```
This function creates a new instance of class [DOMDocumentFragment](class.domdocumentfragment). This node will not show up in the document unless it is inserted with (e.g.) [DOMNode::appendChild()](domnode.appendchild).
### Parameters
This function has no parameters.
### Return Values
The new [DOMDocumentFragment](class.domdocumentfragment).
### 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::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
* [DOMDocument::createTextNode()](domdocument.createtextnode) - Create new text node
php IntlTimeZone::getRegion IntlTimeZone::getRegion
=======================
intltz\_get\_region
===================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlTimeZone::getRegion -- intltz\_get\_region — Get the region code associated with the given system time zone ID
### Description
Object-oriented style (method):
```
public static IntlTimeZone::getRegion(string $timezoneId): string|false
```
Procedural style:
```
intltz_get_region(string $timezoneId): string|false
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`timezoneId`
### Return Values
Return region or **`false`** on failure.
php GmagickDraw::roundrectangle GmagickDraw::roundrectangle
===========================
(PECL gmagick >= Unknown)
GmagickDraw::roundrectangle — Draws a rounded rectangle
### Description
```
public GmagickDraw::roundrectangle(
float $x1,
float $y1,
float $x2,
float $y2,
float $rx,
float $ry
): GmagickDraw
```
Draws a rounded rectangle given two coordinates, x and y corner radiuses and using the current stroke, stroke width, and fill settings.
### Parameters
`x1`
x ordinate of first coordinate
`y1`
y ordinate of first coordinate
`x2`
x ordinate of second coordinate
`y2`
y ordinate of second coordinate
`rx`
radius of corner in horizontal direction
`ry`
radius of corner in vertical direction
### Return Values
The [GmagickDraw](class.gmagickdraw) object.
| programming_docs |
php ldap_exop ldap\_exop
==========
(PHP 7 >= 7.2.0, PHP 8)
ldap\_exop — Performs an extended operation
### Description
```
ldap_exop(
LDAP\Connection $ldap,
string $request_oid,
string $request_data = null,
array $controls = null,
string &$response_data = ?,
string &$response_oid = ?
): mixed
```
Performs an extended operation on the specified `ldap` with `request_oid` the OID of the operation and `request_data` the data.
### Parameters
`ldap`
An [LDAP\Connection](class.ldap-connection) instance, returned by [ldap\_connect()](function.ldap-connect).
`request_oid`
The extended operation request OID. You may use one of **`LDAP_EXOP_START_TLS`**, **`LDAP_EXOP_MODIFY_PASSWD`**, **`LDAP_EXOP_REFRESH`**, **`LDAP_EXOP_WHO_AM_I`**, **`LDAP_EXOP_TURN`**, or a string with the OID of the operation you want to send.
`request_data`
The extended operation request data. May be NULL for some operations like **`LDAP_EXOP_WHO_AM_I`**, may also need to be BER encoded.
`controls`
Array of [LDAP Controls](https://www.php.net/manual/en/ldap.controls.php) to send with the request.
`response_data`
Will be filled with the extended operation response data if provided. If not provided you may use ldap\_parse\_exop on the result object later to get this data.
`response_oid`
Will be filled with the response OID if provided, usually equal to the request OID.
### Return Values
When used with `response_data`, returns **`true`** on success or **`false`** on error. When used without `response_data`, returns a result identifier or **`false`** on error.
### 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. |
| 7.3.0 | Support for `serverctrls` added |
### Examples
**Example #1 Whoami extended operation**
```
<?php
$ds = ldap_connect("localhost"); // assuming the LDAP server is on this host
if ($ds) {
// bind with appropriate dn to give update access
$bind = ldap_bind($ds, "cn=root, o=My Company, c=US", "secret");
if (!$bind) {
echo "Unable to bind to LDAP server";
exit;
}
// Call WHOAMI EXOP
$r = ldap_exop($ds, LDAP_EXOP_WHO_AM_I);
// Parse the result object
ldap_parse_exop($ds, $r, $retdata);
// Output: string(31) "dn:cn=root, o=My Company, c=US"
var_dump($retdata);
// Same thing using $response_data parameter
$success = ldap_exop($ds, LDAP_EXOP_WHO_AM_I, NULL, NULL, $retdata, $retoid);
if ($success) {
var_dump($retdata);
}
ldap_close($ds);
} else {
echo "Unable to connect to LDAP server";
}
?>
```
### See Also
* [ldap\_parse\_result()](function.ldap-parse-result) - Extract information from result
* [ldap\_parse\_exop()](function.ldap-parse-exop) - Parse result object from an LDAP extended operation
* [ldap\_exop\_whoami()](function.ldap-exop-whoami) - WHOAMI extended operation helper
* [ldap\_exop\_refresh()](function.ldap-exop-refresh) - Refresh extended operation helper
* [ldap\_exop\_passwd()](function.ldap-exop-passwd) - PASSWD extended operation helper
php IteratorIterator::next IteratorIterator::next
======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
IteratorIterator::next — Forward to the next element
### Description
```
public IteratorIterator::next(): void
```
Forward to the next element.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### See Also
* [IteratorIterator::rewind()](iteratoriterator.rewind) - Rewind to the first element
* [IteratorIterator::valid()](iteratoriterator.valid) - Checks if the iterator is valid
php ReflectionEnum::getCases ReflectionEnum::getCases
========================
(PHP 8 >= 8.1.0)
ReflectionEnum::getCases — Returns a list of all cases on an Enum
### Description
```
public ReflectionEnum::getCases(): array
```
An Enum may contain zero or more cases. This method retrieves all defined cases, in lexical order (that is, the order they appear in the source code).
### Parameters
This function has no parameters.
### Return Values
An array of Enum reflection objects, one for each case in the Enum. For a Unit Enum, they will all be instances of [ReflectionEnumUnitCase](class.reflectionenumunitcase). For a Backed Enum, they will all be instances of [ReflectionEnumBackedCase](class.reflectionenumbackedcase).
### Examples
**Example #1 **ReflectionEnum::getCases()** example**
```
<?php
enum Suit
{
case Hearts;
case Diamonds;
case Clubs;
case Spades;
}
$rEnum = new ReflectionEnum(Suit::class);
$cases = $rEnum->getCases();
foreach ($cases as $rCase) {
var_dump($rCase->getValue());
}
?>
```
The above example will output:
```
enum(Suit::Hearts)
enum(Suit::Diamonds)
enum(Suit::Clubs)
enum(Suit::Spades)
```
### See Also
* [Enumerations](https://www.php.net/manual/en/language.enumerations.php)
* [ReflectionEnum::getCase()](reflectionenum.getcase) - Returns a specific case of an Enum
* [ReflectionEnum::isBacked()](reflectionenum.isbacked) - Determines if an Enum is a Backed Enum
php doubleval doubleval
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
doubleval — Alias of [floatval()](function.floatval)
### Description
This function is an alias of: [floatval()](function.floatval).
php tidyNode::__construct tidyNode::\_\_construct
=======================
(PHP 5, PHP 7, PHP 8)
tidyNode::\_\_construct — Private constructor to disallow direct instantiation
### Description
private **tidyNode::\_\_construct**() ### Parameters
This function has no parameters.
php stream_context_set_option stream\_context\_set\_option
============================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
stream\_context\_set\_option — Sets an option for a stream/wrapper/context
### Description
```
stream_context_set_option(
resource $stream_or_context,
string $wrapper,
string $option,
mixed $value
): bool
```
```
stream_context_set_option(resource $stream_or_context, array $options): bool
```
Sets an option on the specified context. `value` is set to `option` for `wrapper`
### Parameters
`stream_or_context`
The stream or context resource to apply the options to.
`wrapper`
The name of the wrapper (which may be different than the protocol). Refer to [context options and parameters](https://www.php.net/manual/en/context.php) for a listing of stream options.
`option`
The name of the option.
`value`
The value of the option.
`options`
The options to set for `stream_or_context`.
>
> **Note**:
>
>
> `options` must be an associative array of associative arrays in the format `$arr['wrapper']['option'] = $value`.
>
> Refer to [context options and parameters](https://www.php.net/manual/en/context.php) for a listing of stream options.
>
>
### Return Values
Returns **`true`** on success or **`false`** on failure.
php eio_fchown eio\_fchown
===========
(PECL eio >= 0.0.1dev)
eio\_fchown — Change file ownership
### Description
```
eio_fchown(
mixed $fd,
int $uid,
int $gid = -1,
int $pri = EIO_PRI_DEFAULT,
callable $callback = NULL,
mixed $data = NULL
): resource
```
**eio\_fchown()** changes ownership of the file specified by `fd` file descriptor.
### Parameters
`fd`
Stream, Socket resource, or numeric file descriptor.
`uid`
User ID. Is ignored when equal to -1.
`gid`
Group ID. Is ignored when equal to -1.
`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\_chmod()](function.eio-chmod) returns request resource on success, or **`false`** on failure.
### See Also
* [eio\_fchmod()](function.eio-fchmod) - Change file permissions
php SolrQuery::getGroupFields SolrQuery::getGroupFields
=========================
(PECL solr >= 2.2.0)
SolrQuery::getGroupFields — Returns group fields (group.field parameter values)
### Description
```
public SolrQuery::getGroupFields(): array
```
Returns group fields (group.field parameter values)
### Parameters
This function has no parameters.
### Return Values
### See Also
* [SolrQuery::addGroupField()](solrquery.addgroupfield) - Add a field to be used to group results
php stream_socket_shutdown stream\_socket\_shutdown
========================
(PHP 5 >= 5.2.1, PHP 7, PHP 8)
stream\_socket\_shutdown — Shutdown a full-duplex connection
### Description
```
stream_socket_shutdown(resource $stream, int $mode): bool
```
Shutdowns (partially or not) a full-duplex connection.
>
> **Note**:
>
>
> The associated buffer, or buffers, may or may not be emptied.
>
>
### Parameters
`stream`
An open stream (opened with [stream\_socket\_client()](function.stream-socket-client), for example)
`mode`
One of the following constants: **`STREAM_SHUT_RD`** (disable further receptions), **`STREAM_SHUT_WR`** (disable further transmissions) or **`STREAM_SHUT_RDWR`** (disable further receptions and transmissions).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 A **stream\_socket\_shutdown()** example**
```
<?php
$server = stream_socket_server('tcp://127.0.0.1:1337');
$client = stream_socket_client('tcp://127.0.0.1:1337');
var_dump(fputs($client, "hello"));
stream_socket_shutdown($client, STREAM_SHUT_WR);
var_dump(fputs($client, "hello")); // doesn't work now
?>
```
The above example will output something similar to:
```
int(5)
Notice: fputs(): send of 5 bytes failed with errno=32 Broken pipe in test.php on line 9
int(0)
```
### See Also
* [fclose()](function.fclose) - Closes an open file pointer
php fbird_blob_close fbird\_blob\_close
==================
(PHP 5, PHP 7 < 7.4.0)
fbird\_blob\_close — Alias of [ibase\_blob\_close()](function.ibase-blob-close)
### Description
This function is an alias of: [ibase\_blob\_close()](function.ibase-blob-close).
### See Also
* [fbird\_blob\_create()](function.fbird-blob-create) - Alias of ibase\_blob\_create
* [fbird\_blob\_cancel()](function.fbird-blob-cancel) - Cancel creating blob
* [fbird\_blob\_open()](function.fbird-blob-open) - Alias of ibase\_blob\_open
* [fbird\_blob\_import()](function.fbird-blob-import) - Alias of ibase\_blob\_import
php openssl_spki_new openssl\_spki\_new
==================
(PHP 5 >= 5.6.0, PHP 7, PHP 8)
openssl\_spki\_new — Generate a new signed public key and challenge
### Description
```
openssl_spki_new(OpenSSLAsymmetricKey $private_key, string $challenge, int $digest_algo = OPENSSL_ALGO_MD5): string|false
```
Generates a signed public key and challenge using specified hashing algorithm
### Parameters
`private_key`
`private_key` should be set to a private key that was previously generated by [openssl\_pkey\_new()](function.openssl-pkey-new) (or otherwise obtained from the other openssl\_pkey family of functions). The corresponding public portion of the key will be used to sign the CSR.
`challenge`
The challenge associated to associate with the SPKAC
`digest_algo`
The digest algorithm. See openssl\_get\_md\_method().
### Return Values
Returns a signed public key and challenge string or **`false`** on failure.
### Errors/Exceptions
Emits an **`E_WARNING`** level error if an unknown signature algorithm is passed via the `digest_algo` parameter.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `private_key` accepts an [OpenSSLAsymmetricKey](class.opensslasymmetrickey) instance now; previously, a [resource](language.types.resource) of type `OpenSSL key` was accepted. |
### Examples
**Example #1 **openssl\_spki\_new()** example**
Generate a new SPKAC with the default digest (MD5)
```
<?php
$pkey = openssl_pkey_new('secret password');
$spkac = openssl_spki_new($pkey, 'testing');
if ($spkac !== NULL) {
echo $spkac;
} else {
echo "SPKAC generation failed";
}
?>
```
The above example will output something similar to:
```
MIICRzCCAS8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDM3V3sS4o4
mB9dczziRnjGAmSp+JwPrHoYMAFGvDNmZGyiWfU586X4BKs++BAj7e/FsAfno0Hd
hN9FwpCNFSox30L03nQvLYJE7f/WqigwBeMRT7Op/xvFks4sT70xP2HRYv4KqP9a
WRcKU6cFH8VxhFhqM2txEIxZKdFLaL28yT7bEDmcglf4JLDdgNMb9rET1dkgtKE6
dOaJHPGjf1uvnOH4YwkQr7n4sLUR3Kdbh0ZJAFuQVDZulo+LLzxBBkqJJcB6FhF+
oXCdHTKZnqAhpWDz+NXYytAmevab6IYm5TWPWsJUv1YKJA5lg2mXbbloIZlN9Mgc
i9fi03bdw+crAgMBAAEWB3Rlc3RpbmcwDQYJKoZIhvcNAQEEBQADggEBALyUvP/o
pPSoWBlorFyZ2RnGwKf9qMpE0q2IJP7G3oDR4LyK/m933DUiZ+YnqThrH/CWb4Ek
y5I3OCyl3S4wCuU1ibZZwDVwYShr5ELp0J9PEf7qMQZOhNsizoC7k+Czb2xB6hYW
sKfsfTKm3cXBtH3fdgc/Z1Z7VSWnAzYo38snqm72NTf5yFRnrQdphNNXi+kn1zHA
lxXRyFDXHOcYsOnwAWfyXFA4QDHQ0ezz0UoCY8gJXovcZb4GRYqOLUAsF2HcNboy
29WN8VqE29sL9QxVZFlwMcqyoLcNnyw38GvNvAGqSvzzbnEFP2MAQXJVe0H0hdp/
MML5G2iNVgNozAo=
```
### See Also
* [openssl\_spki\_verify()](function.openssl-spki-verify) - Verifies a signed public key and challenge
* [openssl\_spki\_export\_challenge()](function.openssl-spki-export-challenge) - Exports the challenge associated with a signed public key and challenge
* [openssl\_spki\_export()](function.openssl-spki-export) - Exports a valid PEM formatted public key signed public key and challenge
* [openssl\_get\_md\_methods()](function.openssl-get-md-methods) - Gets available digest methods
* [openssl\_csr\_new()](function.openssl-csr-new) - Generates a CSR
* [openssl\_csr\_sign()](function.openssl-csr-sign) - Sign a CSR with another certificate (or itself) and generate a certificate
php Ds\Vector::set Ds\Vector::set
==============
(PECL ds >= 1.0.0)
Ds\Vector::set — Updates a value at a given index
### Description
```
public Ds\Vector::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\Vector::set()** example**
```
<?php
$vector = new \Ds\Vector(["a", "b", "c"]);
$vector->set(1, "_");
print_r($vector);
?>
```
The above example will output something similar to:
```
Ds\Vector Object
(
[0] => a
[1] => _
[2] => c
)
```
**Example #2 **Ds\Vector::set()** example using array syntax**
```
<?php
$vector = new \Ds\Vector(["a", "b", "c"]);
$vector[1] = "_";
print_r($vector);
?>
```
The above example will output something similar to:
```
Ds\Vector Object
(
[0] => a
[1] => _
[2] => c
)
```
php Imagick::haldClutImage Imagick::haldClutImage
======================
(PECL imagick 3)
Imagick::haldClutImage — Replaces colors in the image
### Description
```
public Imagick::haldClutImage(Imagick $clut, int $channel = Imagick::CHANNEL_DEFAULT): bool
```
Replaces colors in the image using a Hald lookup table. Hald images can be created using HALD color coder.
### Parameters
`clut`
Imagick object containing the Hald lookup image.
`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.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::haldClutImage()****
```
<?php
function haldClutImage($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imagickPalette = new \Imagick(realpath("images/hald/hald_8.png"));
$imagickPalette->sepiatoneImage(55);
$imagick->haldClutImage($imagickPalette);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php pg_field_type_oid pg\_field\_type\_oid
====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
pg\_field\_type\_oid — Returns the type ID (OID) for the corresponding field number
### Description
```
pg_field_type_oid(PgSql\Result $result, int $field): string|int
```
**pg\_field\_type\_oid()** returns an integer containing the OID of the base type of the given `field` in the given `result` instance.
You can get more information about the field type by querying PostgreSQL's `pg_type` system table using the OID obtained with this function. The PostgreSQL **format\_type()** function will convert a type OID into an SQL standard type name.
>
> **Note**:
>
>
> If the field uses a PostgreSQL domain (rather than a basic type), it is the OID of the domain's underlying type that is returned, rather than the OID of the domain itself.
>
>
### 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).
`field`
Field number, starting from 0.
### Return Values
The OID of the field's base type.
### 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 Getting information about fields**
```
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
// Assume 'title' is a varchar type
$res = pg_query($dbconn, "select title from authors where author = 'Orwell'");
echo "Title field type OID: ", pg_field_type_oid($res, 0);
?>
```
The above example will output:
```
Title field type OID: 1043
```
### See Also
* [pg\_field\_type()](function.pg-field-type) - Returns the type name for the corresponding field number
* [pg\_field\_prtlen()](function.pg-field-prtlen) - Returns the printed length
* [pg\_field\_name()](function.pg-field-name) - Returns the name of a field
php xdiff_string_diff_binary xdiff\_string\_diff\_binary
===========================
(PECL xdiff >= 0.2.0)
xdiff\_string\_diff\_binary — Alias of [xdiff\_string\_bdiff()](function.xdiff-string-bdiff)
### Description
```
xdiff_string_bdiff(string $old_data, string $new_data): string
```
Makes a binary diff of two strings and returns the result. 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).
Starting with version 1.5.0 this function is an alias of [xdiff\_string\_bdiff()](function.xdiff-string-bdiff).
### 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 result or **`false`** if an internal error happened.
### See Also
* [xdiff\_string\_bdiff()](function.xdiff-string-bdiff) - Make binary diff of two strings
* [xdiff\_string\_bpatch()](function.xdiff-string-bpatch) - Patch a string with a binary diff
| programming_docs |
php gmp_perfect_power gmp\_perfect\_power
===================
(PHP 7 >= 7.3.0, PHP 8)
gmp\_perfect\_power — Perfect power check
### Description
```
gmp_perfect_power(GMP|int|string $num): bool
```
Checks whether `num` is a perfect power.
### Parameters
`num`
A [GMP](class.gmp) object, an int or a numeric string.
### Return Values
Returns **`true`** if `num` is a perfect power, **`false`** otherwise.
### See Also
* [gmp\_perfect\_square()](function.gmp-perfect-square) - Perfect square check
php Yaf_Dispatcher::getRequest Yaf\_Dispatcher::getRequest
===========================
(Yaf >=1.0.0)
Yaf\_Dispatcher::getRequest — Retrive the request instance
### Description
```
public Yaf_Dispatcher::getRequest(): Yaf_Request_Abstract
```
### Parameters
This function has no parameters.
### Return Values
php MultipleIterator::setFlags MultipleIterator::setFlags
==========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
MultipleIterator::setFlags — Sets flags
### Description
```
public MultipleIterator::setFlags(int $flags): void
```
Sets flags.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`flags`
The flags to set, according to the [Flag Constants](class.multipleiterator#multipleiterator.constants)
### Return Values
No value is returned.
### See Also
* [Flag Constants](class.multipleiterator#multipleiterator.constants)
* [MultipleIterator::\_\_construct()](multipleiterator.construct) - Constructs a new MultipleIterator
* [MultipleIterator::getFlags()](multipleiterator.getflags) - Gets the flag information
php Imagick::writeImagesFile Imagick::writeImagesFile
========================
(PECL imagick 2 >= 2.3.0, PECL imagick 3)
Imagick::writeImagesFile — Writes frames to a filehandle
### Description
```
public Imagick::writeImagesFile(resource $filehandle, string $format = ?): bool
```
Writes all image frames into an open filehandle. This method can be used to write animated gifs or other multiframe images into open filehandle. This method is available if Imagick has been compiled against ImageMagick version 6.3.6 or newer.
### Parameters
`filehandle`
Filehandle where to write the images.
`format`
The image format. The list of valid format specifiers depends on the compiled feature set of ImageMagick, and can be queried at runtime via [Imagick::queryFormats()](imagick.queryformats).
### Return Values
Returns **`true`** on success.
### See Also
* [Imagick::queryFormats()](imagick.queryformats) - Returns formats supported by Imagick
php None Autoloading Classes
-------------------
Many developers writing object-oriented applications create one PHP source file per class definition. One of the biggest annoyances is having to write a long list of needed includes at the beginning of each script (one for each class).
The [spl\_autoload\_register()](function.spl-autoload-register) function registers any number of autoloaders, enabling for classes and interfaces to be automatically loaded if they are currently not defined. By registering autoloaders, PHP is given a last chance to load the class or interface before it fails with an error.
Any class-like construct may be autoloaded the same way. That includes classes, interfaces, traits, and enumerations.
**Caution** Prior to PHP 8.0.0, it was possible to use [\_\_autoload()](function.autoload) to autoload classes and interfaces. However, it is a less flexible alternative to [spl\_autoload\_register()](function.spl-autoload-register) and [\_\_autoload()](function.autoload) is deprecated as of PHP 7.2.0, and removed as of PHP 8.0.0.
>
> **Note**:
>
>
> [spl\_autoload\_register()](function.spl-autoload-register) may be called multiple times in order to register multiple autoloaders. Throwing an exception from an autoload function, however, will interrupt that process and not allow further autoload functions to run. For that reason, throwing exceptions from an autoload function is strongly discouraged.
>
>
**Example #1 Autoload example**
This example attempts to load the classes `MyClass1` and `MyClass2` from the files MyClass1.php and MyClass2.php respectively.
```
<?php
spl_autoload_register(function ($class_name) {
include $class_name . '.php';
});
$obj = new MyClass1();
$obj2 = new MyClass2();
?>
```
**Example #2 Autoload other example**
This example attempts to load the interface `ITest`.
```
<?php
spl_autoload_register(function ($name) {
var_dump($name);
});
class Foo implements ITest {
}
/*
string(5) "ITest"
Fatal error: Interface 'ITest' not found in ...
*/
?>
```
### See Also
* [unserialize()](function.unserialize)
* [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)
* [spl\_autoload\_register()](function.spl-autoload-register)
* [spl\_autoload()](function.spl-autoload)
* [\_\_autoload()](function.autoload)
php uopz_function uopz\_function
==============
(PECL uopz 1, PECL uopz 2)
uopz\_function — Creates a function at runtime
**Warning**This function has been *REMOVED* in PECL uopz 5.0.0.
### Description
```
uopz_function(string $function, Closure $handler, int $modifiers = ?): void
```
```
uopz_function(
string $class,
string $function,
Closure $handler,
int $modifiers = ?
): void
```
Creates a function at runtime
### Parameters
`class`
The name of the class to receive the new function
`function`
The name of the function
`handler`
The Closure for the function
`modifiers`
The modifiers for the function, by default copied or ZEND\_ACC\_PUBLIC
### Return Values
### Examples
**Example #1 **uopz\_function()** example**
```
<?php
uopz_function("my_strlen", function($arg) {
return strlen($arg);
});
echo my_strlen("Hello World");
?>
```
The above example will output:
```
11
```
**Example #2 **uopz\_function()** class example**
```
<?php
class My {}
uopz_function(My::class, "strlen", function($arg) {
return strlen($arg);
}, ZEND_ACC_STATIC);
echo My::strlen("Hello World");
?>
```
The above example will output:
```
11
```
php DateTime::setDate DateTime::setDate
=================
date\_date\_set
===============
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
DateTime::setDate -- date\_date\_set — Sets the date
### Description
Object-oriented style
```
public DateTime::setDate(int $year, int $month, int $day): DateTime
```
Procedural style
```
date_date_set(
DateTime $object,
int $year,
int $month,
int $day
): DateTime
```
Resets the current date of the DateTime object to a different date.
Like [DateTimeImmutable::setDate()](datetimeimmutable.setdate) but works with [DateTime](class.datetime), and changes the existing object.
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.
`year`
Year of the date.
`month`
Month of the date.
`day`
Day of the date.
### Return Values
Returns the modified [DateTime](class.datetime) object for method chaining.
### See Also
* [DateTimeImmutable::setDate()](datetimeimmutable.setdate) - Sets the date
php ob_iconv_handler ob\_iconv\_handler
==================
(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)
ob\_iconv\_handler — Convert character encoding as output buffer handler
### Description
```
ob_iconv_handler(string $contents, int $status): string
```
Converts the string encoded in `internal_encoding` to `output_encoding`.
`internal_encoding` and `output_encoding` should be defined in the php.ini file or in [iconv\_set\_encoding()](function.iconv-set-encoding).
### Parameters
See [ob\_start()](function.ob-start) for information about this handler parameters.
### Return Values
See [ob\_start()](function.ob-start) for information about this handler return values.
### Examples
**Example #1 **ob\_iconv\_handler()** example:**
```
<?php
iconv_set_encoding("internal_encoding", "UTF-8");
iconv_set_encoding("output_encoding", "ISO-8859-1");
ob_start("ob_iconv_handler"); // start output buffering
?>
```
### See Also
* [iconv\_get\_encoding()](function.iconv-get-encoding) - Retrieve internal configuration variables of iconv extension
* [iconv\_set\_encoding()](function.iconv-set-encoding) - Set current setting for character encoding conversion
* [output-control functions](https://www.php.net/manual/en/ref.outcontrol.php)
php ibase_commit ibase\_commit
=============
(PHP 5, PHP 7 < 7.4.0)
ibase\_commit — Commit a transaction
### Description
```
ibase_commit(resource $link_or_trans_identifier = null): bool
```
Commits a transaction.
### 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.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php PharFileInfo::compress PharFileInfo::compress
======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
PharFileInfo::compress — Compresses the current Phar entry with either zlib or bzip2 compression
### Description
```
public PharFileInfo::compress(int $compression): bool
```
This method compresses the file inside the Phar archive using either bzip2 compression or zlib compression. The [bzip2](https://www.php.net/manual/en/ref.bzip2.php) or [zlib](https://www.php.net/manual/en/ref.zlib.php) extension must be enabled to take advantage of this feature. In addition, if the file is already compressed, the respective extension must be enabled in order to decompress the file. 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
`compression`
Compression must be **`Phar::GZ`** or **`Phar::BZ2`**.
### 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::compress()** example**
```
<?php
try {
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
$p['myfile.txt'] = 'hi';
$file = $p['myfile.txt'];
var_dump($file->isCompressed(Phar::BZ2));
$p['myfile.txt']->compress(Phar::BZ2);
var_dump($file->isCompressed(Phar::BZ2));
} catch (Exception $e) {
echo 'Create/modify operations on my.phar failed: ', $e;
}
?>
```
The above example will output:
```
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
* [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 EventHttpRequest::sendReplyEnd EventHttpRequest::sendReplyEnd
==============================
(PECL event >= 1.4.0-beta)
EventHttpRequest::sendReplyEnd — Complete a chunked reply, freeing the request as appropriate
### Description
```
public EventHttpRequest::sendReplyEnd(): void
```
Complete a chunked reply, freeing the request as appropriate.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### See Also
* [EventHttpRequest::sendReplyStart()](eventhttprequest.sendreplystart) - Initiate a chunked reply
* [EventHttpRequest::sendReplyChunk()](eventhttprequest.sendreplychunk) - Send another data chunk as part of an ongoing chunked reply
php openssl_public_decrypt openssl\_public\_decrypt
========================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
openssl\_public\_decrypt — Decrypts data with public key
### Description
```
openssl_public_decrypt(
string $data,
string &$decrypted_data,
OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $public_key,
int $padding = OPENSSL_PKCS1_PADDING
): bool
```
**openssl\_public\_decrypt()** decrypts `data` that was previous encrypted via [openssl\_private\_encrypt()](function.openssl-private-encrypt) and stores the result into `decrypted_data`.
You can use this function e.g. to check if the message was written by the owner of the private key.
### Parameters
`data`
`decrypted_data`
`public_key`
`public_key` must be the public key corresponding that was used to encrypt the data.
`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 | `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 ReflectionParameter::isDefaultValueAvailable ReflectionParameter::isDefaultValueAvailable
============================================
(PHP 5 >= 5.0.3, PHP 7, PHP 8)
ReflectionParameter::isDefaultValueAvailable — Checks if a default value is available
### Description
```
public ReflectionParameter::isDefaultValueAvailable(): bool
```
Checks if a default value for the parameter is available.
### Parameters
This function has no parameters.
### Return Values
**`true`** if a default value is available, otherwise **`false`**
### See Also
* [ReflectionParameter::getDefaultValue()](reflectionparameter.getdefaultvalue) - Gets default parameter value
* [ReflectionParameter::isDefaultValueConstant()](reflectionparameter.isdefaultvalueconstant) - Returns whether the default value of this parameter is a constant
* [ReflectionParameter::getName()](reflectionparameter.getname) - Gets parameter name
php radius_get_attr radius\_get\_attr
=================
(PECL radius >= 1.1.0)
radius\_get\_attr — Extracts an attribute
### Description
```
radius_get_attr(resource $radius_handle): mixed
```
Like Radius requests, each response may contain zero or more attributes. After a response has been received successfully by [radius\_send\_request()](function.radius-send-request), its attributes can be extracted one by one using **radius\_get\_attr()**. Each time **radius\_get\_attr()** is called, it gets the next attribute from the current response.
### Parameters
`radius_handle`
The RADIUS resource.
### Return Values
Returns an associative array containing the attribute-type and the data, or error number <= 0.
### Examples
**Example #1 **radius\_get\_attr()** 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'];
printf("Got Attr:%d %d Bytes %s\n", $attr, strlen($data), bin2hex($data));
}
?>
```
### See Also
* [radius\_put\_attr()](function.radius-put-attr) - Attaches a binary attribute
* [radius\_get\_vendor\_attr()](function.radius-get-vendor-attr) - Extracts a vendor specific attribute
* [radius\_put\_vendor\_attr()](function.radius-put-vendor-attr) - Attaches a vendor specific binary attribute
* [radius\_send\_request()](function.radius-send-request) - Sends the request and waits for a reply
php SQLite3::query SQLite3::query
==============
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3::query — Executes an SQL query
### Description
```
public SQLite3::query(string $query): SQLite3Result|false
```
Executes an SQL query, returning an [SQLite3Result](class.sqlite3result) object. If the query does not yield a result (such as DML statements) the returned [SQLite3Result](class.sqlite3result) object is not really usable. Use [SQLite3::exec()](sqlite3.exec) for such queries instead.
### Parameters
`query`
The SQL query to execute.
### Return Values
Returns an [SQLite3Result](class.sqlite3result) object, or **`false`** on failure.
### Examples
**Example #1 **SQLite3::query()** example**
```
<?php
$db = new SQLite3('mysqlitedb.db');
$results = $db->query('SELECT bar FROM foo');
while ($row = $results->fetchArray()) {
var_dump($row);
}
?>
```
php NoRewindIterator::next NoRewindIterator::next
======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
NoRewindIterator::next — Forward to the next element
### Description
```
public NoRewindIterator::next(): void
```
Forwards 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.
### See Also
* [NoRewindIterator::rewind()](norewinditerator.rewind) - Prevents the rewind operation on the inner iterator
php geoip_record_by_name geoip\_record\_by\_name
=======================
(PECL geoip >= 0.2.0)
geoip\_record\_by\_name — Returns the detailed City information found in the GeoIP Database
### Description
```
geoip_record_by_name(string $hostname): array
```
The **geoip\_record\_by\_name()** function will return the record information corresponding to a hostname or an IP address.
This function is available for both GeoLite City Edition and commercial GeoIP City Edition. A warning will be issued if the proper database cannot be located.
The names of the different keys of the returning associative array are as follows:
* "continent\_code" -- Two letter continent code (as of version 1.0.4 with libgeoip 1.4.3 or newer)
* "country\_code" -- Two letter country code (see [geoip\_country\_code\_by\_name()](function.geoip-country-code-by-name))
* "country\_code3" -- Three letter country code (see [geoip\_country\_code3\_by\_name()](function.geoip-country-code3-by-name))
* "country\_name" -- The country name (see [geoip\_country\_name\_by\_name()](function.geoip-country-name-by-name))
* "region" -- The region code (ex: CA for California)
* "city" -- The city.
* "postal\_code" -- The Postal Code, FSA or Zip Code.
* "latitude" -- The Latitude as signed float.
* "longitude" -- The Longitude as signed float.
* "dma\_code" -- Designated Market Area code (USA and Canada only)
* "area\_code" -- The PSTN area code (ex: 212)
### Parameters
`hostname`
The hostname or IP address whose record is to be looked-up.
### Return Values
Returns the associative array on success, or **`false`** if the address cannot be found in the database.
### Changelog
| Version | Description |
| --- | --- |
| PECL geoip 1.0.4 | Adding the continent\_code with GeoIP Library 1.4.3 or newer only |
| PECL geoip 1.0.3 | Adding country\_code3 and country\_name |
### Examples
**Example #1 A **geoip\_record\_by\_name()** example**
This will print the array containing the record of host example.com.
```
<?php
$record = geoip_record_by_name('www.example.com');
if ($record) {
print_r($record);
}
?>
```
The above example will output:
```
Array
(
[continent_code] => NA
[country_code] => US
[country_code3] => USA
[country_name] => United States
[region] => CA
[city] => Marina Del Rey
[postal_code] =>
[latitude] => 33.9776992798
[longitude] => -118.435096741
[dma_code] => 803
[area_code] => 310
)
```
| programming_docs |
php Stomp::commit Stomp::commit
=============
stomp\_commit
=============
(PECL stomp >= 0.1.0)
Stomp::commit -- stomp\_commit — Commits a transaction in progress
### Description
Object-oriented style (method):
```
public Stomp::commit(string $transaction_id, array $headers = ?): bool
```
Procedural style:
```
stomp_commit(resource $link, string $transaction_id, array $headers = ?): bool
```
Commits a transaction in progress.
### Parameters
`link`
Procedural style only: The stomp link identifier returned by [stomp\_connect()](stomp.construct).
`transaction_id`
The transaction id.
`headers`
Associative array containing the additional headers (example: receipt).
### Return Values
Returns **`true`** 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());
}
/* begin a transaction */
$stomp->begin('t1');
/* send a message to the queue */
$stomp->send('/queue/foo', 'bar', array('transaction' => 't1'));
/* commit */
$stomp->commit('t1');
/* close connection */
unset($stomp);
?>
```
**Example #2 Procedural style**
```
<?php
/* connection */
$link = stomp_connect('tcp://localhost:61613');
/* check connection */
if (!$link) {
die('Connection failed: ' . stomp_connect_error());
}
/* begin a transaction */
stomp_begin($link, 't1');
/* send a message to the queue 'foo' */
stomp_send($link, '/queue/foo', 'bar', array('transaction' => 't1'));
/* commit */
stomp_commit($link, 't1');
/* close connection */
stomp_close($link);
?>
```
### Notes
**Tip**Stomp is inherently asynchronous. Synchronous communication can be implemented adding a receipt header. This will cause methods to not return anything until the server has acknowledged receipt of the message or until read timeout was reached.
php None Instruction separation
----------------------
As in C or Perl, PHP requires instructions to be terminated with a semicolon at the end of each statement. The closing tag of a block of PHP code automatically implies a semicolon; you do not need to have a semicolon terminating the last line of a PHP block. The closing tag for the block will include the immediately trailing newline if one is present.
**Example #1 Example showing the closing tag encompassing the trailing newline**
```
<?php echo "Some text"; ?>
No newline
<?= "But newline now" ?>
```
The above example will output:
```
Some textNo newline
But newline now
```
Examples of entering and exiting the PHP parser:
```
<?php
echo 'This is a test';
?>
<?php echo 'This is a test' ?>
<?php echo 'We omitted the last closing tag';
```
>
> **Note**:
>
>
> The closing tag of a PHP block at the end of a file is optional, and in some cases omitting it is helpful when using [include](function.include) or [require](function.require), so unwanted whitespace will not occur at the end of files, and you will still be able to add headers to the response later. It is also handy if you use output buffering, and would not like to see added unwanted whitespace at the end of the parts generated by the included files.
>
>
php tidy_access_count tidy\_access\_count
===================
(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.5.2)
tidy\_access\_count — Returns the Number of Tidy accessibility warnings encountered for specified document
### Description
```
tidy_access_count(tidy $tidy): int
```
**tidy\_access\_count()** returns the number of accessibility warnings found for the specified document.
### Parameters
`tidy`
The [Tidy](class.tidy) object.
### Return Values
Returns the number of warnings.
### Examples
**Example #1 **tidy\_access\_count()** example**
```
<?php
$html ='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>Title</title></head>
<body>
<p><img src="img.png"></p>
</body></html>';
// select the accessibility check level: 1, 2 or 3
$config = array('accessibility-check' => 3);
$tidy = new tidy();
$tidy->parseString($html, $config);
$tidy->cleanRepair();
/* Never forget to call this! */
$tidy->diagnose();
echo tidy_access_count($tidy); //5
?>
```
### Notes
>
> **Note**:
>
>
> Due to the design of the TidyLib, you must call [tidy\_diagnose()](tidy.diagnose) before **tidy\_access\_count()** or it will return always `0`. You must also need to enable the `accessibility-check` option.
>
>
### See Also
* [tidy\_error\_count()](function.tidy-error-count) - Returns the Number of Tidy errors encountered for specified document
* [tidy\_warning\_count()](function.tidy-warning-count) - Returns the Number of Tidy warnings encountered for specified document
php gnupg_decrypt gnupg\_decrypt
==============
(PECL gnupg >= 0.1)
gnupg\_decrypt — Decrypts a given text
### Description
```
gnupg_decrypt(resource $identifier, string $text): string
```
Decrypts the given text with the keys, which were set with [gnupg\_adddecryptkey](function.gnupg-adddecryptkey) before.
### Parameters
`identifier`
The gnupg identifier, from a call to [gnupg\_init()](function.gnupg-init) or **gnupg**.
`text`
The text being decrypted.
### Return Values
On success, this function returns the decrypted text. On failure, this function returns **`false`**.
### Examples
**Example #1 Procedural **gnupg\_decrypt()** example**
```
<?php
$res = gnupg_init();
gnupg_adddecryptkey($res,"8660281B6051D071D94B5B230549F9DC851566DC","test");
$plain = gnupg_decrypt($res,$encrypted_text);
echo $plain;
?>
```
**Example #2 OO **gnupg\_decrypt()** example**
```
<?php
$gpg = new gnupg();
$gpg->adddecryptkey("8660281B6051D071D94B5B230549F9DC851566DC","test");
$plain = $gpg->decrypt($encrypted_text);
echo $plain;
?>
```
php CachingIterator::setFlags CachingIterator::setFlags
=========================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
CachingIterator::setFlags — The setFlags purpose
### Description
```
public CachingIterator::setFlags(int $flags): void
```
**Warning**This function is currently not documented; only its argument list is available.
Set the flags for the CachingIterator object.
### Parameters
`flags`
Bitmask of the flags to set.
### Return Values
No value is returned.
php SplObjectStorage::contains SplObjectStorage::contains
==========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplObjectStorage::contains — Checks if the storage contains a specific object
### Description
```
public SplObjectStorage::contains(object $object): bool
```
Checks if the storage contains the object provided.
### Parameters
`object`
The object to look for.
### Return Values
Returns **`true`** if the object is in the storage, **`false`** otherwise.
### Examples
**Example #1 **SplObjectStorage::contains()** example**
```
<?php
$o1 = new StdClass;
$o2 = new StdClass;
$s = new SplObjectStorage();
$s[$o1] = "hello";
var_dump($s->contains($o1));
var_dump($s->contains($o2));
?>
```
The above example will output something similar to:
```
bool(true)
bool(false)
```
### See Also
* [SplObjectStorage::offsetExists()](splobjectstorage.offsetexists) - Checks whether an object exists in the storage
php Fiber::isStarted Fiber::isStarted
================
(PHP 8 >= 8.1.0)
Fiber::isStarted — Determines if the fiber has started
### Description
```
public Fiber::isStarted(): bool
```
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** only after the fiber has been started; otherwise **`false`** is returned.
php exec exec
====
(PHP 4, PHP 5, PHP 7, PHP 8)
exec — Execute an external program
### Description
```
exec(string $command, array &$output = null, int &$result_code = null): string|false
```
**exec()** executes the given `command`.
### Parameters
`command`
The command that will be executed.
`output`
If the `output` argument is present, then the specified array will be filled with every line of output from the command. Trailing whitespace, such as `\n`, is not included in this array. Note that if the array already contains some elements, **exec()** will append to the end of the array. If you do not want the function to append elements, call [unset()](function.unset) on the array before passing it to **exec()**.
`result_code`
If the `result_code` argument is present along with the `output` argument, then the return status of the executed command will be written to this variable.
### Return Values
The last line from the result of the command. If you need to execute a command and have all the data from the command passed directly back without any interference, use the [passthru()](function.passthru) function.
Returns **`false`** on failure.
To get the output of the executed command, be sure to set and use the `output` parameter.
### Errors/Exceptions
Emits an **`E_WARNING`** if **exec()** is unable to execute the `command`.
Throws a [ValueError](class.valueerror) if `command` is empty or contains null bytes.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | If `command` is empty or contains null bytes, **exec()** now throws a [ValueError](class.valueerror). Previously it emitted an **`E_WARNING`** and returned **`false`**. |
### Examples
**Example #1 An **exec()** example**
```
<?php
// outputs the username that owns the running php/httpd process
// (on a system with the "whoami" executable in the path)
$output=null;
$retval=null;
exec('whoami', $output, $retval);
echo "Returned with status $retval and output:\n";
print_r($output);
?>
```
The above example will output something similar to:
```
Returned with status 0 and output:
Array
(
[0] => cmb
)
```
### Notes
**Warning**When allowing user-supplied data to be passed to this function, use [escapeshellarg()](function.escapeshellarg) or [escapeshellcmd()](function.escapeshellcmd) to ensure that users cannot trick the system into executing arbitrary commands.
>
> **Note**:
>
>
> If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends.
>
>
>
>
> **Note**:
>
>
> On Windows **exec()** will first start cmd.exe to launch the command. If you want to start an external program without starting cmd.exe use [proc\_open()](function.proc-open) with the `bypass_shell` option set.
>
>
>
### See Also
* [system()](function.system) - Execute an external program and display the output
* [passthru()](function.passthru) - Execute an external program and display raw output
* [escapeshellcmd()](function.escapeshellcmd) - Escape shell metacharacters
* [pcntl\_exec()](function.pcntl-exec) - Executes specified program in current process space
* [backtick operator](language.operators.execution)
php imap_subscribe imap\_subscribe
===============
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_subscribe — Subscribe to a mailbox
### Description
```
imap_subscribe(IMAP\Connection $imap, string $mailbox): bool
```
Subscribe to a new 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.
### 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. |
### See Also
* [imap\_unsubscribe()](function.imap-unsubscribe) - Unsubscribe from a mailbox
php ssh2_sftp_rmdir ssh2\_sftp\_rmdir
=================
(PECL ssh2 >= 0.9.0)
ssh2\_sftp\_rmdir — Remove a directory
### Description
```
ssh2_sftp_rmdir(resource $sftp, string $dirname): bool
```
Removes a directory from the remote file server.
This function is similar to using [rmdir()](function.rmdir) 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`
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Removing 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_rmdir($sftp, '/home/username/deltodel');
/* Or: rmdir("ssh2.sftp://$sftp/home/username/dirtodel"); */
?>
```
### See Also
* [rmdir()](function.rmdir) - Removes directory
* [ssh2\_sftp\_mkdir()](function.ssh2-sftp-mkdir) - Create a directory
php Gmagick::getquantumdepth Gmagick::getquantumdepth
========================
(PECL gmagick >= Unknown)
Gmagick::getquantumdepth — Returns the Gmagick quantum depth as a string
### Description
```
public Gmagick::getquantumdepth(): array
```
Returns the [Gmagick](class.gmagick) quantum depth as a string.
### Parameters
This function has no parameters.
### Return Values
Returns the [Gmagick](class.gmagick) quantum depth as a string.
### Errors/Exceptions
Throws an **GmagickException** on error.
php Ds\Vector::capacity Ds\Vector::capacity
===================
(PECL ds >= 1.0.0)
Ds\Vector::capacity — Returns the current capacity
### Description
```
public Ds\Vector::capacity(): int
```
Returns the current capacity.
### Parameters
This function has no parameters.
### Return Values
The current capacity.
### Examples
**Example #1 **Ds\Vector::capacity()** example**
```
<?php
$vector = new \Ds\Vector();
var_dump($vector->capacity());
$vector->push(...range(1, 50));
var_dump($vector->capacity());
$vector[] = "a";
var_dump($vector->capacity());
?>
```
The above example will output something similar to:
```
int(10)
int(50)
int(75)
```
php SolrDocument::toArray SolrDocument::toArray
=====================
(PECL solr >= 0.9.2)
SolrDocument::toArray — Returns an array representation of the document
### Description
```
public SolrDocument::toArray(): array
```
Returns an array representation of the document.
### Parameters
This function has no parameters.
### Return Values
Returns an array representation of the document.
### Examples
**Example #1 **SolrDocument::toArray()** example**
```
<?php
$doc = new SolrDocument();
$doc->addField('id', 1123);
$doc->features = "PHP Client Side";
$doc->features = "Fast development cycles";
$doc['cat'] = 'Software';
$doc['cat'] = 'Custom Search';
$doc->cat = 'Information Technology';
print_r($doc->toArray());
?>
```
The above example will output something similar to:
```
Array
(
[document_boost] => 0
[field_count] => 3
[fields] => Array
(
[0] => SolrDocumentField Object
(
[name] => id
[boost] => 0
[values] => Array
(
[0] => 1123
)
)
[1] => SolrDocumentField Object
(
[name] => features
[boost] => 0
[values] => Array
(
[0] => PHP Client Side
[1] => Fast development cycles
)
)
[2] => SolrDocumentField Object
(
[name] => cat
[boost] => 0
[values] => Array
(
[0] => Software
[1] => Custom Search
[2] => Information Technology
)
)
)
)
```
php zlib_get_coding_type zlib\_get\_coding\_type
=======================
(PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8)
zlib\_get\_coding\_type — Returns the coding type used for output compression
### Description
```
zlib_get_coding_type(): string|false
```
Returns the coding type used for output compression.
### Parameters
This function has no parameters.
### Return Values
Possible return values are `gzip`, `deflate`, or **`false`**.
### See Also
* The [zlib.output\_compression](https://www.php.net/manual/en/zlib.configuration.php#ini.zlib.output-compression) directive
php mb_strstr mb\_strstr
==========
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
mb\_strstr — Finds first occurrence of a string within another
### Description
```
mb_strstr(
string $haystack,
string $needle,
bool $before_needle = false,
?string $encoding = null
): string|false
```
**mb\_strstr()** finds the first occurrence of `needle` in `haystack` and returns the portion of `haystack`. If `needle` is not found, it returns **`false`**.
### Parameters
`haystack`
The string from which to get the first occurrence of `needle`
`needle`
The string to find in `haystack`
`before_needle`
Determines which portion of `haystack` this function returns. If set to **`true`**, it returns all of `haystack` from the beginning to the first occurrence of `needle` (excluding needle). If set to **`false`**, it returns all of `haystack` from the first occurrence of `needle` to the end (including needle).
`encoding`
Character encoding name to use. If it is omitted, internal character encoding is used.
### Return Values
Returns the portion of `haystack`, or **`false`** if `needle` is not found.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `needle` now accepts an empty string. |
| 8.0.0 | `encoding` is nullable now. |
### See Also
* [stristr()](function.stristr) - Case-insensitive strstr
* [strstr()](function.strstr) - Find the first occurrence of a string
* [mb\_stristr()](function.mb-stristr) - Finds first occurrence of a string within another, case insensitive
php get_declared_traits get\_declared\_traits
=====================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
get\_declared\_traits — Returns an array of all declared traits
### Description
```
get_declared_traits(): array
```
### Parameters
This function has no parameters.
### Return Values
Returns an array with names of all declared traits in values. Returns **`null`** in case of a failure.
### See Also
* [class\_uses()](function.class-uses) - Return the traits used by the given class
* [trait\_exists()](function.trait-exists) - Checks if the trait exists
php Gmagick::setimagetype Gmagick::setimagetype
=====================
(PECL gmagick >= Unknown)
Gmagick::setimagetype — Sets the image type
### Description
```
public Gmagick::setimagetype(int $imgType): Gmagick
```
Sets the image type.
### Parameters
`imgType`
One of the [Image type](https://www.php.net/manual/en/gmagick.constants.php#gmagick.constants.imagetype) constant (`Gmagick::IMGTYPE_*`).
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
| programming_docs |
php SolrQuery::getFacetDateFields SolrQuery::getFacetDateFields
=============================
(PECL solr >= 0.9.2)
SolrQuery::getFacetDateFields — Returns all the facet.date fields
### Description
```
public SolrQuery::getFacetDateFields(): array
```
Returns all the facet.date fields
### Parameters
This function has no parameters.
### Return Values
Returns all the facet.date fields as an array or **`null`** if none was set
php Imagick::morphImages Imagick::morphImages
====================
(PECL imagick 2, PECL imagick 3)
Imagick::morphImages — Method morphs a set of images
### Description
```
public Imagick::morphImages(int $number_frames): Imagick
```
Method morphs a set of images. Both the image pixels and size are linearly interpolated to give the appearance of a meta-morphosis from one image to the next.
### Parameters
`number_frames`
The number of in-between images to generate.
### Return Values
This method returns a new Imagick object on success. Throw an **ImagickException** on error.
php is_countable is\_countable
=============
(PHP 7 >= 7.3.0, PHP 8)
is\_countable — Verify that the contents of a variable is a countable value
### Description
```
is_countable(mixed $value): bool
```
Verify that the contents of a variable is an array or an object implementing [Countable](class.countable)
### Parameters
`value`
The value to check
### Return Values
Returns **`true`** if `value` is countable, **`false`** otherwise.
### Changelog
| Version | Description |
| --- | --- |
| 7.3.0 | **is\_countable()** has been added. |
### Examples
**Example #1 **is\_countable()** examples**
```
<?php
var_dump(is_countable([1, 2, 3])); // bool(true)
var_dump(is_countable(new ArrayIterator(['foo', 'bar', 'baz']))); // bool(true)
var_dump(is_countable(new ArrayIterator())); // bool(true)
var_dump(is_countable(new stdClass())); // bool(false)
```
### See Also
* [is\_array()](function.is-array) - Finds whether a variable is an array
* [is\_object()](function.is-object) - Finds whether a variable is an object
* [is\_iterable()](function.is-iterable) - Verify that the contents of a variable is an iterable value
* [is\_bool()](function.is-bool) - Finds out whether a variable is a boolean
php Yaf_Dispatcher::throwException Yaf\_Dispatcher::throwException
===============================
(Yaf >=1.0.0)
Yaf\_Dispatcher::throwException — Switch on/off exception throwing
### Description
```
public Yaf_Dispatcher::throwException(bool $flag = ?): Yaf_Dispatcher
```
Switch on/off exception throwing while unexpected error occurring. When this is on, Yaf will throwing exceptions instead of triggering catchable errors.
You can also use [application.dispatcher.throwException](https://www.php.net/manual/en/yaf.appconfig.php#configuration.yaf.dispatcher.throwexception) to achieve the same purpose.
### Parameters
`flag`
bool
### Return Values
### Examples
**Example #1 **Yaf\_Dispatcher::throwexception()** example**
```
<?php
$config = array(
'application' => array(
'directory' => dirname(__FILE__),
),
);
$app = new Yaf_Application($config);
$app->getDispatcher()->throwException(true);
try {
$app->run();
} catch (Yaf_Exception $e) {
var_dump($e->getMessage());
}
?>
```
The above example will output something similar to:
```
string(59) "Could not find controller script /tmp/controllers/Index.php"
```
**Example #2 **Yaf\_Dispatcher::throwexception()**example**
```
<?php
$config = array(
'application' => array(
'directory' => dirname(__FILE__),
),
);
$app = new Yaf_Application($config);
$app->getDispatcher()->throwException(false);
$app->run();
?>
```
The above example will output something similar to:
```
PHP Catchable fatal error: Yaf_Application::run(): Could not find controller script /tmp/controllers/Index.php in /tmp/1.php on line 12
```
### See Also
* [Yaf\_Dispatcher::catchException()](yaf-dispatcher.catchexception) - Switch on/off exception catching
* [Yaf\_Exception](class.yaf-exception)
php PharData::delMetadata PharData::delMetadata
=====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
PharData::delMetadata — Deletes the global metadata of a zip archive
### Description
```
public PharData::delMetadata(): bool
```
>
> **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.
>
>
>
Deletes the global metadata of the zip archive
### Parameters
### Return Values
returns **`true`** on success, but it is better to check for thrown exception, and assume success if none is thrown.
### Errors/Exceptions
Throws [PharException](class.pharexception) if errors occur while flushing changes to disk.
### Examples
**Example #1 A **PharData::delMetaData()** example**
```
<?php
try {
$phar = new PharData('myphar.zip');
var_dump($phar->getMetadata());
$phar->setMetadata("hi there");
var_dump($phar->getMetadata());
$phar->delMetadata();
var_dump($phar->getMetadata());
} catch (Exception $e) {
// handle errors
}
?>
```
The above example will output:
```
NULL
string(8) "hi there"
NULL
```
### See Also
* [Phar::delMetadata()](phar.delmetadata) - Deletes the global metadata of the phar
php The Serializable interface
The Serializable interface
==========================
Introduction
------------
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
Interface for customized serializing.
Classes that implement this interface no longer support [\_\_sleep()](language.oop5.magic#object.sleep) and [\_\_wakeup()](language.oop5.magic#object.wakeup). The method serialize is called whenever an instance needs to be serialized. This does not invoke \_\_destruct() or have any other side effect unless programmed inside the method. When the data is unserialized the class is known and the appropriate unserialize() method is called as a constructor instead of calling \_\_construct(). If you need to execute the standard constructor you may do so in the method.
**Warning** As of PHP 8.1.0, a class which implements **Serializable** without also implementing [\_\_serialize()](language.oop5.magic#object.serialize) and [\_\_unserialize()](language.oop5.magic#object.unserialize) will generate a deprecation warning.
Interface synopsis
------------------
interface **Serializable** { /\* Methods \*/
```
public serialize(): ?string
```
```
public unserialize(string $data): void
```
} **Example #1 Basic usage**
```
<?php
class obj implements Serializable {
private $data;
public function __construct() {
$this->data = "My private data";
}
public function serialize() {
return serialize($this->data);
}
public function unserialize($data) {
$this->data = unserialize($data);
}
public function getData() {
return $this->data;
}
}
$obj = new obj;
$ser = serialize($obj);
var_dump($ser);
$newobj = unserialize($ser);
var_dump($newobj->getData());
?>
```
The above example will output something similar to:
```
string(38) "C:3:"obj":23:{s:15:"My private data";}"
string(15) "My private data"
```
Table of Contents
-----------------
* [Serializable::serialize](serializable.serialize) — String representation of object
* [Serializable::unserialize](serializable.unserialize) — Constructs the object
php None Arithmetic Operators
--------------------
Remember basic arithmetic from school? These work just like those.
**Arithmetic Operators**| Example | Name | Result |
| --- | --- | --- |
| +$a | Identity | Conversion of $a to int or float as appropriate. |
| -$a | Negation | Opposite of $a. |
| $a + $b | Addition | Sum of $a and $b. |
| $a - $b | Subtraction | Difference of $a and $b. |
| $a \* $b | Multiplication | Product of $a and $b. |
| $a / $b | Division | Quotient of $a and $b. |
| $a % $b | Modulo | Remainder of $a divided by $b. |
| $a \*\* $b | Exponentiation | Result of raising $a to the $b'th power. |
The division operator ("/") returns a float value unless the two operands are integers (or strings that get converted to integers) and the numbers are evenly divisible, in which case an integer value will be returned. For integer division, see [intdiv()](function.intdiv).
Operands of modulo are converted to int before processing. For floating-point modulo, see [fmod()](function.fmod).
The result of the modulo operator `%` has the same sign as the dividend — that is, the result of `$a % $b` will have the same sign as $a. For example:
```
<?php
echo (5 % 3)."\n"; // prints 2
echo (5 % -3)."\n"; // prints 2
echo (-5 % 3)."\n"; // prints -2
echo (-5 % -3)."\n"; // prints -2
?>
```
### See Also
* [Math functions](https://www.php.net/manual/en/ref.math.php)
php IntlBreakIterator::previous IntlBreakIterator::previous
===========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlBreakIterator::previous — Set the iterator position to the boundary immediately before the current
### Description
```
public IntlBreakIterator::previous(): int
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php mysqli::$sqlstate mysqli::$sqlstate
=================
mysqli\_sqlstate
================
(PHP 5, PHP 7, PHP 8)
mysqli::$sqlstate -- mysqli\_sqlstate — Returns the SQLSTATE error from previous MySQL operation
### Description
Object-oriented style
string [$mysqli->sqlstate](mysqli.sqlstate); Procedural style
```
mysqli_sqlstate(mysqli $mysql): string
```
Returns a string containing the SQLSTATE error code for the last error. 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).
>
> **Note**:
>
>
> Note that not all MySQL errors are yet mapped to SQLSTATE's. The value `HY000` (general error) is used for unmapped errors.
>
>
### 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 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 $mysqli->sqlstate 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();
}
/* Table City already exists, so we should get an error */
if (!$mysqli->query("CREATE TABLE City (ID INT, Name VARCHAR(30))")) {
printf("Error - SQLSTATE %s.\n", $mysqli->sqlstate);
}
$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();
}
/* Table City already exists, so we should get an error */
if (!mysqli_query($link, "CREATE TABLE City (ID INT, Name VARCHAR(30))")) {
printf("Error - SQLSTATE %s.\n", mysqli_sqlstate($link));
}
mysqli_close($link);
?>
```
The above examples will output:
```
Error - SQLSTATE 42S01.
```
### 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
php SolrQuery::getGroupQueries SolrQuery::getGroupQueries
==========================
(PECL solr >= 2.2.0)
SolrQuery::getGroupQueries — Returns all the group.query parameter values
### Description
```
public SolrQuery::getGroupQueries(): array
```
Returns all the group.query parameter values
### Parameters
This function has no parameters.
### Return Values
array
### See Also
* [SolrQuery::addGroupQuery()](solrquery.addgroupquery) - Allows grouping of documents that match the given query
php inotify_rm_watch inotify\_rm\_watch
==================
(PECL inotify >= 0.1.2)
inotify\_rm\_watch — Remove an existing watch from an inotify instance
### Description
```
inotify_rm_watch(resource $inotify_instance, int $watch_descriptor): bool
```
**inotify\_rm\_watch()** removes the watch `watch_descriptor` from the inotify instance `inotify_instance`.
### Parameters
`inotify_instance`
Resource returned by [inotify\_init()](function.inotify-init)
`watch_descriptor`
Watch to remove from the instance
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [inotify\_init()](function.inotify-init) - Initialize an inotify instance
php ftp_pasv ftp\_pasv
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
ftp\_pasv — Turns passive mode on or off
### Description
```
ftp_pasv(FTP\Connection $ftp, bool $enable): bool
```
**ftp\_pasv()** turns on or off passive mode. In passive mode, data connections are initiated by the client, rather than by the server. It may be needed if the client is behind firewall.
Please note that **ftp\_pasv()** can only be called after a successful login or otherwise it will fail.
### Parameters
`ftp`
An [FTP\Connection](class.ftp-connection) instance.
`enable`
If **`true`**, the passive mode is turned on, else it's turned off.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### 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\_pasv()** example**
```
<?php
$file = 'somefile.txt';
$remote_file = 'readme.txt';
// 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);
// turn passive mode on
ftp_pasv($ftp, true);
// upload a file
if (ftp_put($ftp, $remote_file, $file, FTP_ASCII)) {
echo "successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}
// close the connection
ftp_close($ftp);
?>
```
php cal_from_jd cal\_from\_jd
=============
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
cal\_from\_jd — Converts from Julian Day Count to a supported calendar
### Description
```
cal_from_jd(int $julian_day, int $calendar): array
```
**cal\_from\_jd()** converts the Julian day given in `julian_day` into a date of the specified `calendar`. Supported `calendar` values are **`CAL_GREGORIAN`**, **`CAL_JULIAN`**, **`CAL_JEWISH`** and **`CAL_FRENCH`**.
### Parameters
`julian_day`
Julian day as integer
`calendar`
Calendar to convert to
### Return Values
Returns an array containing calendar information like month, day, year, day of week (`dow`), abbreviated and full names of weekday and month and the date in string form "month/day/year". The day of week ranges from `0` (Sunday) to `6` (Saturday).
### Examples
**Example #1 **cal\_from\_jd()** example**
```
<?php
$today = unixtojd(mktime(0, 0, 0, 8, 16, 2003));
print_r(cal_from_jd($today, CAL_GREGORIAN));
?>
```
The above example will output:
```
Array
(
[date] => 8/16/2003
[month] => 8
[day] => 16
[year] => 2003
[dow] => 6
[abbrevdayname] => Sat
[dayname] => Saturday
[abbrevmonth] => Aug
[monthname] => August
)
```
### See Also
* [cal\_to\_jd()](function.cal-to-jd) - Converts from a supported calendar to Julian Day Count
* [jdtofrench()](function.jdtofrench) - Converts a Julian Day Count to the French Republican Calendar
* [jdtogregorian()](function.jdtogregorian) - Converts Julian Day Count to Gregorian date
* [jdtojewish()](function.jdtojewish) - Converts a Julian day count to a Jewish calendar date
* [jdtojulian()](function.jdtojulian) - Converts a Julian Day Count to a Julian Calendar Date
* [jdtounix()](function.jdtounix) - Convert Julian Day to Unix timestamp
php GmagickDraw::settextencoding GmagickDraw::settextencoding
============================
(PECL gmagick >= Unknown)
GmagickDraw::settextencoding — Specifies the text code set
### Description
```
public GmagickDraw::settextencoding(string $encoding): GmagickDraw
```
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`
Character string specifying text encoding
### Return Values
The [GmagickDraw](class.gmagickdraw) object.
php DateTime::createFromInterface DateTime::createFromInterface
=============================
(PHP 8)
DateTime::createFromInterface — Returns new DateTime object encapsulating the given DateTimeInterface object
### Description
```
public static DateTime::createFromInterface(DateTimeInterface $object): DateTime
```
### Parameters
`object`
The [DateTimeInterface](class.datetimeinterface) object that needs to be converted to a mutable version. This object is not modified, but instead a new [DateTime](class.datetime) object is created containing the same date, time, and timezone information.
### Return Values
Returns a new [DateTime](class.datetime) instance.
### Examples
**Example #1 Creating a mutable date time object**
```
<?php
$date = new DateTimeImmutable("2014-06-20 11:45 Europe/London");
$mutable = DateTime::createFromInterface($date);
$date = new DateTime("2014-06-20 11:45 Europe/London");
$also_mutable = DateTime::createFromInterface($date);
?>
```
php Imagick::getInterlaceScheme Imagick::getInterlaceScheme
===========================
(PECL imagick 2, PECL imagick 3)
Imagick::getInterlaceScheme — Gets the object interlace scheme
### Description
```
public Imagick::getInterlaceScheme(): int
```
Gets the object interlace scheme.
### Parameters
This function has no parameters.
### Return Values
Gets the wand [interlace scheme](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.interlace).
### Errors/Exceptions
Throws ImagickException on error.
php uopz_backup uopz\_backup
============
(PECL uopz 1 >= 1.0.3, PECL uopz 2)
uopz\_backup — Backup a function
**Warning**This function has been *REMOVED* in PECL uopz 5.0.0.
### Description
```
uopz_backup(string $function): void
```
```
uopz_backup(string $class, string $function): void
```
Backup a function at runtime, to be restored on shutdown
### Parameters
`class`
The name of the class containing the function to backup
`function`
The name of the function
### Return Values
### Examples
**Example #1 **uopz\_backup()** example**
```
<?php
uopz_backup("fgets");
uopz_function("fgets", function(){
return true;
});
var_dump(fgets());
?>
```
The above example will output:
```
bool(true)
```
php SolrQuery::getTermsMinCount SolrQuery::getTermsMinCount
===========================
(PECL solr >= 0.9.2)
SolrQuery::getTermsMinCount — Returns the minimum document frequency to return in order to be included
### Description
```
public SolrQuery::getTermsMinCount(): int
```
Returns the minimum document frequency to return in order to be included
### Parameters
This function has no parameters.
### Return Values
Returns an integer on success and **`null`** if not set.
| programming_docs |
php implode implode
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
implode — Join array elements with a string
### Description
```
implode(string $separator, array $array): string
```
Alternative signature (not supported with named arguments):
```
implode(array $array): string
```
Legacy signature (deprecated as of PHP 7.4.0, removed as of PHP 8.0.0):
```
implode(array $array, string $separator): string
```
Join array elements with a `separator` string.
### Parameters
`separator`
Optional. Defaults to an empty string.
`array`
The array of strings to implode.
### Return Values
Returns a string containing a string representation of all the array elements in the same order, with the separator string between each element.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | Passing the `separator` after the `array` is no longer supported. |
| 7.4.0 | Passing the `separator` after the `array` (i.e. using the legacy signature) has been deprecated. |
### Examples
**Example #1 **implode()** example**
```
<?php
$array = ['lastname', 'email', 'phone'];
var_dump(implode(",", $array)); // string(20) "lastname,email,phone"
// Empty string when using an empty array:
var_dump(implode('hello', [])); // string(0) ""
// The separator is optional:
var_dump(implode(['a', 'b', 'c'])); // string(3) "abc"
?>
```
### Notes
> **Note**: This function is binary-safe.
>
>
### See Also
* [explode()](function.explode) - Split a string by a string
* [preg\_split()](function.preg-split) - Split string by a regular expression
* [http\_build\_query()](function.http-build-query) - Generate URL-encoded query string
php PDO::errorCode PDO::errorCode
==============
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0)
PDO::errorCode — Fetch the SQLSTATE associated with the last operation on the database handle
### Description
```
public PDO::errorCode(): ?string
```
### Parameters
This function has no parameters.
### Return Values
Returns an SQLSTATE, a five characters alphanumeric identifier defined in the ANSI SQL-92 standard. Briefly, an SQLSTATE consists of a two characters class value followed by a three characters subclass value. A class value of 01 indicates a warning and is accompanied by a return code of SQL\_SUCCESS\_WITH\_INFO. Class values other than '01', except for the class 'IM', indicate an error. The class 'IM' is specific to warnings and errors that derive from the implementation of PDO (or perhaps ODBC, if you're using the ODBC driver) itself. The subclass value '000' in any class indicates that there is no subclass for that SQLSTATE.
**PDO::errorCode()** only retrieves error codes 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::errorCode()** will not reflect that error. You must call [PDOStatement::errorCode()](pdostatement.errorcode) to return the error code for an operation performed on a particular statement handle.
Returns **`null`** if no operation has been run on the database handle.
### Examples
**Example #1 Retrieving an SQLSTATE code**
```
<?php
/* Provoke an error -- the BONES table does not exist */
$dbh->exec("INSERT INTO bones(skull) VALUES ('lucy')");
echo "\nPDO::errorCode(): ", $dbh->errorCode();
?>
```
The above example will output:
```
PDO::errorCode(): 42S02
```
### See Also
* [PDO::errorInfo()](pdo.errorinfo) - Fetch extended error information 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 ReflectionClass::isInternal ReflectionClass::isInternal
===========================
(PHP 5, PHP 7, PHP 8)
ReflectionClass::isInternal — Checks if class is defined internally by an extension, or the core
### Description
```
public ReflectionClass::isInternal(): bool
```
Checks if the class is defined internally by an extension, or the core, as opposed to user-defined.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Basic usage of **ReflectionClass::isInternal()****
```
<?php
$internalclass = new ReflectionClass('ReflectionClass');
class Apple {}
$userclass = new ReflectionClass('Apple');
var_dump($internalclass->isInternal());
var_dump($userclass->isInternal());
?>
```
The above example will output:
```
bool(true)
bool(false)
```
### See Also
* [ReflectionClass::isUserDefined()](reflectionclass.isuserdefined) - Checks if user defined
php apache_response_headers apache\_response\_headers
=========================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
apache\_response\_headers — Fetch all HTTP response headers
### Description
```
apache_response_headers(): array|false
```
Fetch all HTTP response headers. Works in the Apache, FastCGI, CLI, and FPM webservers.
### Parameters
This function has no parameters.
### Return Values
An array of all Apache response headers on success or **`false`** on failure.
### Examples
**Example #1 **apache\_response\_headers()** example**
```
<?php
print_r(apache_response_headers());
?>
```
The above example will output something similar to:
```
Array
(
[Accept-Ranges] => bytes
[X-Powered-By] => PHP/4.3.8
)
```
### See Also
* [apache\_request\_headers()](function.apache-request-headers) - Fetch all HTTP request headers
* [headers\_sent()](function.headers-sent) - Checks if or where headers have been sent
* [headers\_list()](function.headers-list) - Returns a list of response headers sent (or ready to send)
php SolrCollapseFunction::setMin SolrCollapseFunction::setMin
============================
(PECL solr >= 2.2.0)
SolrCollapseFunction::setMin — Sets the initial size of the collapse data structures when collapsing on a numeric field only
### Description
```
public SolrCollapseFunction::setMin(string $min): SolrCollapseFunction
```
Sets the initial size of the collapse data structures when collapsing on a numeric field only
### Parameters
`min`
### Return Values
[SolrCollapseFunction](class.solrcollapsefunction)
php RarArchive::getComment RarArchive::getComment
======================
rar\_comment\_get
=================
(PECL rar >= 2.0.0)
RarArchive::getComment -- rar\_comment\_get — Get comment text from the RAR archive
### Description
Object-oriented style (method):
```
public RarArchive::getComment(): string
```
Procedural style:
```
rar_comment_get(RarArchive $rarfile): string
```
Get the (global) comment stored in the RAR archive. It may be up to 64 KiB long.
>
> **Note**:
>
>
> This extension does not support comments at the entry level.
>
>
### Parameters
`rarfile`
A [RarArchive](class.rararchive) object, opened with [rar\_open()](rararchive.open).
### Return Values
Returns the comment or **`null`** if there is none.
>
> **Note**:
>
>
> RAR has currently no support for unicode comments. The encoding of the result of this function is not specified, but it will probably be Windows-1252.
>
>
### Examples
**Example #1 Object-oriented style**
```
<?php
$rar_arch = RarArchive::open('commented.rar');
echo $rar_arch->getComment();
?>
```
The above example will output something similar to:
```
This is the comment of the file commented.rar.
```
**Example #2 Procedural style**
```
<?php
$rar_arch = rar_open('commented.rar');
echo rar_comment_get($rar_arch);
?>
```
php VarnishAdmin::auth VarnishAdmin::auth
==================
(PECL varnish >= 0.3)
VarnishAdmin::auth — Authenticate on a varnish instance
### Description
```
public VarnishAdmin::auth(): bool
```
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php APCUIterator::valid APCUIterator::valid
===================
(PECL apcu >= 5.0.0)
APCUIterator::valid — Checks if current position is valid
### Description
```
public APCUIterator::valid(): bool
```
Checks if the current iterator position is valid.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the current iterator position is valid, otherwise **`false`**.
### See Also
* [APCUIterator::current()](apcuiterator.current) - Get current item
* [Iterator::valid()](iterator.valid) - Checks if current position is valid
php Imagick::addNoiseImage Imagick::addNoiseImage
======================
(PECL imagick 2, PECL imagick 3)
Imagick::addNoiseImage — Adds random noise to the image
### Description
```
public Imagick::addNoiseImage(int $noise_type, int $channel = Imagick::CHANNEL_DEFAULT): bool
```
Adds random noise to the image.
### Parameters
`noise_type`
The type of the noise. Refer to this list of [noise constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.noise).
`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::addNoiseImage()****
```
<?php
function addNoiseImage($noiseType, $imagePath, $channel) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->addNoiseImage($noiseType, $channel);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php SolrQuery::getFacetMinCount SolrQuery::getFacetMinCount
===========================
(PECL solr >= 0.9.2)
SolrQuery::getFacetMinCount — Returns the minimum counts for facet fields should be included in the response
### Description
```
public SolrQuery::getFacetMinCount(string $field_override = ?): int
```
Returns the minimum counts for facet fields should be included in the response. It accepts an optional field override
### Parameters
`field_override`
The name of the field
### Return Values
Returns an integer on success and **`null`** if not set
php is_writable is\_writable
============
(PHP 4, PHP 5, PHP 7, PHP 8)
is\_writable — Tells whether the filename is writable
### Description
```
is_writable(string $filename): bool
```
Returns **`true`** if the `filename` exists and is writable. The filename argument may be a directory name allowing you to check if a directory is writable.
Keep in mind that PHP may be accessing the file as the user id that the web server runs as (often 'nobody'). Safe mode limitations are not taken into account.
### Parameters
`filename`
The filename being checked.
### Return Values
Returns **`true`** if the `filename` exists and is writable.
### Errors/Exceptions
Upon failure, an **`E_WARNING`** is emitted.
### Examples
**Example #1 **is\_writable()** example**
```
<?php
$filename = 'test.txt';
if (is_writable($filename)) {
echo 'The file is writable';
} else {
echo 'The file is not writable';
}
?>
```
### Notes
> **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.
### See Also
* [is\_readable()](function.is-readable) - Tells whether a file exists and is readable
* [file\_exists()](function.file-exists) - Checks whether a file or directory exists
* [fwrite()](function.fwrite) - Binary-safe file write
php Yaf_Loader::__construct Yaf\_Loader::\_\_construct
==========================
(Yaf >=1.0.0)
Yaf\_Loader::\_\_construct — The \_\_construct purpose
### Description
private **Yaf\_Loader::\_\_construct**()
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php GmagickPixel::getcolorcount GmagickPixel::getcolorcount
===========================
(PECL gmagick >= Unknown)
GmagickPixel::getcolorcount — Returns the color count associated with this color
### Description
```
public GmagickPixel::getcolorcount(): int
```
Returns the color count associated with this color.
### Parameters
This function has no parameters.
### Return Values
Returns the color count as an integer on success, throws **GmagickPixelException** on failure.
php GearmanJob::status GearmanJob::status
==================
(PECL gearman <= 0.5.0)
GearmanJob::status — Send status (deprecated)
### Description
```
public GearmanJob::status(int $numerator, int $denominator): bool
```
Sends status information to the job server and any listening clients. Use this to specify what percentage of the job has been completed.
>
> **Note**:
>
>
> This method has been replaced by [GearmanJob::sendStatus()](gearmanjob.sendstatus) in the 0.6.0 release of the Gearman extenstion.
>
>
### Parameters
`numerator`
The numerator of the precentage completed expressed as a fraction.
`denominator`
The denominator of the precentage completed expressed as a fraction.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [GearmanClient::jobStatus()](gearmanclient.jobstatus) - Get the status of a background job
* [GearmanTask::taskDenominator()](gearmantask.taskdenominator) - Get completion percentage denominator
* [GearmanTask::taskNumerator()](gearmantask.tasknumerator) - Get completion percentage numerator
php ImagickDraw::setTextUnderColor ImagickDraw::setTextUnderColor
==============================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setTextUnderColor — Specifies the color of a background rectangle
### Description
```
public ImagickDraw::setTextUnderColor(ImagickPixel $under_color): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Specifies the color of a background rectangle to place under text annotations.
### Parameters
`under_color`
the under color
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::setTextUnderColor()** example**
```
<?php
function setTextUnderColor($strokeColor, $fillColor, $backgroundColor, $textUnderColor) {
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFontSize(72);
$draw->annotation(50, 75, "Lorem Ipsum!");
$draw->setTextUnderColor($textUnderColor);
$draw->annotation(50, 175, "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 Imagick::blurImage Imagick::blurImage
==================
(PECL imagick 2, PECL imagick 3)
Imagick::blurImage — Adds blur filter to image
### Description
```
public Imagick::blurImage(float $radius, float $sigma, int $channel = ?): bool
```
Adds blur filter to image. Optional third parameter to blur a specific channel.
### Parameters
`radius`
Blur radius
`sigma`
Standard deviation
`channel`
The [Channeltype](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel) constant. When not supplied, all channels are blurred.
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 Using **Imagick::blurImage()**:**
Blur an image, then display to the browser.
```
<?php
header('Content-type: image/jpeg');
$image = new Imagick('test.jpg');
$image->blurImage(5,3);
echo $image;
?>
```
### See Also
* [Imagick::adaptiveBlurImage()](imagick.adaptiveblurimage) - Adds adaptive blur filter to image
* [Imagick::motionBlurImage()](imagick.motionblurimage) - Simulates motion blur
* [Imagick::radialBlurImage()](imagick.radialblurimage) - Radial blurs an image
php ImagickDraw::matte ImagickDraw::matte
==================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::matte — Paints on the image's opacity channel
### Description
```
public ImagickDraw::matte(float $x, float $y, int $paintMethod): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Paints on the image's opacity channel in order to set effected pixels to transparent, to influence the opacity of pixels.
### Parameters
`x`
x coordinate of the matte
`y`
y coordinate of the matte
`paintMethod`
One of the [PAINT](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.paint) constant (`imagick::PAINT_*`).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **ImagickDraw::matte()** example**
```
<?php
function matte($strokeColor, $fillColor, $backgroundColor, $paintType) {
$draw = new \ImagickDraw();
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFontSize(72);
$draw->matte(120, 120, $paintType);
$draw->rectangle(100, 100, 300, 200);
$imagick = new \Imagick();
$imagick->newImage(500, 500, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
php pg_fetch_object pg\_fetch\_object
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
pg\_fetch\_object — Fetch a row as an object
### Description
```
pg_fetch_object(
PgSql\Result $result,
?int $row = null,
string $class = "stdClass",
array $constructor_args = []
): object|false
```
**pg\_fetch\_object()** returns an object with properties that correspond to the fetched row's field names. It can optionally instantiate an object of a specific class, and pass parameters to that class's constructor.
> **Note**: This function sets NULL fields to the PHP **`null`** value.
>
>
Speed-wise, the function is identical to [pg\_fetch\_array()](function.pg-fetch-array), and almost as fast as [pg\_fetch\_row()](function.pg-fetch-row) (the difference is insignificant).
### 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.
`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
An object with one attribute for each field name in the result. 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\_object()** example**
```
<?php
$database = "store";
$db_conn = pg_connect("host=localhost port=5432 dbname=$database");
if (!$db_conn) {
echo "Failed connecting to postgres database $database\n";
exit;
}
$qu = pg_query($db_conn, "SELECT * FROM books ORDER BY author");
while ($data = pg_fetch_object($qu)) {
echo $data->author . " (";
echo $data->year . "): ";
echo $data->title . "<br />";
}
pg_free_result($qu);
pg_close($db_conn);
?>
```
### 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\_assoc()](function.pg-fetch-assoc) - Fetch a row as an associative array
* [pg\_fetch\_row()](function.pg-fetch-row) - Get a row as an enumerated array
* [pg\_fetch\_result()](function.pg-fetch-result) - Returns values from a result instance
| programming_docs |
php sodium_crypto_secretbox sodium\_crypto\_secretbox
=========================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_secretbox — Authenticated shared-key encryption
### Description
```
sodium_crypto_secretbox(string $message, string $nonce, string $key): string
```
Encrypt a message with a symmetric (shared) key.
### Parameters
`message`
The plaintext message to encrypt.
`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
Returns the encrypted string.
### 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.
* Throws a [SodiumException](class.sodiumexception) on failure.
### Examples
**Example #1 **sodium\_crypto\_secretbox()** example**
```
<?php
// The $key must be kept confidential
$key = sodium_crypto_secretbox_keygen();
// Do not reuse $nonce with the same key
$nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
$plaintext = "message to be encrypted";
$ciphertext = sodium_crypto_secretbox($plaintext, $nonce, $key);
var_dump(bin2hex($ciphertext));
// The same nouce and key are required to decrypt the $ciphertext
var_dump(sodium_crypto_secretbox_open($ciphertext, $nonce, $key));
?>
```
The above example will output something similar to:
```
string(78) "3a1fa3e9f7b72ef8be51d40abf8e296c6899c185d07b18b4c93e7f26aa776d24c50852cd6b1076"
string(23) "message to be encrypted"
```
### See Also
* [sodium\_crypto\_secretbox\_open()](function.sodium-crypto-secretbox-open) - Authenticated shared-key decryption
* [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 Imagick::clutImage Imagick::clutImage
==================
(PECL imagick 2, PECL imagick 3)
Imagick::clutImage — Replaces colors in the image
### Description
```
public Imagick::clutImage(Imagick $lookup_table, int $channel = Imagick::CHANNEL_DEFAULT): bool
```
Replaces colors in the image from a color lookup table. Optional second parameter to replace colors in a specific channel. This method is available if Imagick has been compiled against ImageMagick version 6.3.6 or newer.
### Parameters
`lookup_table`
Imagick object containing the color lookup table
`channel`
The [Channeltype](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.channel) constant. When not supplied, default channels are replaced.
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 Using **Imagick::clutImage()**:**
Replace colors in the image from a color lookup table.
```
<?php
$image = new Imagick('test.jpg');
$clut = new Imagick();
$clut->newImage(1, 1, new ImagickPixel('black'));
$image->clutImage($clut);
$image->writeImage('test_out.jpg');
?>
```
### See Also
* [Imagick::adaptiveBlurImage()](imagick.adaptiveblurimage) - Adds adaptive blur filter to image
* [Imagick::motionBlurImage()](imagick.motionblurimage) - Simulates motion blur
* [Imagick::radialBlurImage()](imagick.radialblurimage) - Radial blurs an image
php ImagickDraw::__construct ImagickDraw::\_\_construct
==========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::\_\_construct — The ImagickDraw constructor
### Description
```
public ImagickDraw::__construct()
```
**Warning**This function is currently not documented; only its argument list is available.
The [ImagickDraw](class.imagickdraw) constructor.
### Return Values
No value is returned.
php mb_chr mb\_chr
=======
(PHP 7 >= 7.2.0, PHP 8)
mb\_chr — Return character by Unicode code point value
### Description
```
mb_chr(int $codepoint, ?string $encoding = null): string|false
```
Returns a string containing the character specified by the Unicode code point value, encoded in the specified encoding.
This function complements [mb\_ord()](function.mb-ord).
### Parameters
`codepoint`
A Unicode codepoint value, e.g. `128024` for *U+1F418 ELEPHANT*
`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 string containing the requested character, if it can be represented in the specified encoding or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `encoding` is nullable now. |
### Examples
**Example #1 Testing different code points**
```
<?php
$values = [65, 63, 0x20AC, 128024];
foreach ($values as $value) {
var_dump(mb_chr($value, 'UTF-8'));
var_dump(mb_chr($value, 'ISO-8859-1'));
}
?>
```
The above example will output:
```
string(1) "A"
string(1) "A"
string(1) "?"
string(1) "?"
string(3) "€"
bool(false)
string(4) "🐘"
bool(false)
```
### See Also
* [mb\_internal\_encoding()](function.mb-internal-encoding) - Set/Get internal character encoding
* [mb\_ord()](function.mb-ord) - Get Unicode code point of character
* [IntlChar::ord()](intlchar.ord) - Return Unicode code point value of character
* [chr()](function.chr) - Generate a single-byte string from a number
php Ev::now Ev::now
=======
(PECL ev >= 0.2.0)
Ev::now — Returns the time when the last iteration of the default event loop has started
### Description
```
final public static Ev::now(): float
```
Returns the time when the last iteration of the default event loop has started. This is the time that timers( [EvTimer](class.evtimer) and [EvPeriodic](class.evperiodic) ) are based on, and referring to it is usually faster then calling [Ev::time()](ev.time) .
### Parameters
This function has no parameters.
### Return Values
Returns number of seconds(fractional) representing the time when the last iteration of the default event loop has started.
### See Also
* [Ev::nowUpdate()](ev.nowupdate) - Establishes the current time by querying the kernel, updating the time returned by Ev::now in the progress
php xmlrpc_decode xmlrpc\_decode
==============
(PHP 4 >= 4.1.0, PHP 5, PHP 7)
xmlrpc\_decode — Decodes XML into native PHP types
### Description
```
xmlrpc_decode(string $xml, string $encoding = "iso-8859-1"): mixed
```
**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
`xml`
XML response returned by XMLRPC method.
`encoding`
Input encoding supported by iconv.
### Return Values
Returns either an array, or an integer, or a string, or a boolean according to the response returned by the XMLRPC method.
### Examples
See example by [xmlrpc\_encode\_request()](function.xmlrpc-encode-request).
### See Also
* [xmlrpc\_encode\_request()](function.xmlrpc-encode-request) - Generates XML for a method request
* [xmlrpc\_is\_fault()](function.xmlrpc-is-fault) - Determines if an array value represents an XMLRPC fault
php Yaf_Request_Simple::getQuery Yaf\_Request\_Simple::getQuery
==============================
(Yaf >=1.0.0)
Yaf\_Request\_Simple::getQuery — The getQuery purpose
### Description
```
public Yaf_Request_Simple::getQuery(): 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_encrypt sodium\_crypto\_aead\_aes256gcm\_encrypt
========================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_aead\_aes256gcm\_encrypt — Encrypt then authenticate with AES-256-GCM
### Description
```
sodium_crypto_aead_aes256gcm_encrypt(
string $message,
string $additional_data,
string $nonce,
string $key
): string
```
Encrypt then authenticate with AES-256-GCM. Only available if [sodium\_crypto\_aead\_aes256gcm\_is\_available()](function.sodium-crypto-aead-aes256gcm-is-available) returns **`true`**.
### Parameters
`message`
The plaintext message to encrypt.
`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 ciphertext and authentication tag as a string of raw binary bytes. (Format: ciphertext, then tag.)
php RecursiveRegexIterator::__construct RecursiveRegexIterator::\_\_construct
=====================================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
RecursiveRegexIterator::\_\_construct — Creates a new RecursiveRegexIterator
### Description
public **RecursiveRegexIterator::\_\_construct**(
[RecursiveIterator](class.recursiveiterator) `$iterator`,
string `$pattern`,
int `$mode` = RecursiveRegexIterator::MATCH,
int `$flags` = 0,
int `$pregFlags` = 0
) Creates a new regular expression iterator.
### Parameters
`iterator`
The recursive iterator to apply this regex filter to.
`pattern`
The regular expression to match.
`mode`
Operation mode, see [RegexIterator::setMode()](regexiterator.setmode) for a list of modes.
`flags`
Special flags, see [RegexIterator::setFlags()](regexiterator.setflags) for a list of available flags.
`pregFlags`
The regular expression flags. These flags depend on the operation mode parameter:
**[RegexIterator](class.regexiterator) preg\_flags**| operation mode | available flags |
| --- | --- |
| RecursiveRegexIterator::ALL\_MATCHES | See [preg\_match\_all()](function.preg-match-all). |
| RecursiveRegexIterator::GET\_MATCH | See [preg\_match()](function.preg-match). |
| RecursiveRegexIterator::MATCH | See [preg\_match()](function.preg-match). |
| RecursiveRegexIterator::REPLACE | none. |
| RecursiveRegexIterator::SPLIT | See [preg\_split()](function.preg-split). |
### Examples
**Example #1 **RecursiveRegexIterator::\_\_construct()** example**
Creates a new RegexIterator that filters all strings that start with 'test'.
```
<?php
$rArrayIterator = new RecursiveArrayIterator(array('test1', array('tet3', 'test4', 'test5')));
$rRegexIterator = new RecursiveRegexIterator($rArrayIterator, '/^test/',
RecursiveRegexIterator::ALL_MATCHES);
foreach ($rRegexIterator as $key1 => $value1) {
if ($rRegexIterator->hasChildren()) {
// print all children
echo "Children: ";
foreach ($rRegexIterator->getChildren() as $key => $value) {
echo $value . " ";
}
echo "\n";
} else {
echo "No children\n";
}
}
?>
```
The above example will output something similar to:
```
No children
Children: test4 test5
```
### See Also
* [preg\_match()](function.preg-match) - Perform a regular expression match
* [preg\_match\_all()](function.preg-match-all) - Perform a global regular expression match
* [preg\_replace()](function.preg-replace) - Perform a regular expression search and replace
* [preg\_split()](function.preg-split) - Split string by a regular expression
php mysqli::$info mysqli::$info
=============
mysqli\_info
============
(PHP 5, PHP 7, PHP 8)
mysqli::$info -- mysqli\_info — Retrieves information about the most recently executed query
### Description
Object-oriented style
?string [$mysqli->info](mysqli.info); Procedural style
```
mysqli_info(mysqli $mysql): ?string
```
The **mysqli\_info()** function returns a string providing information about the last query executed. The nature of this string is provided below:
**Possible mysqli\_info return values**| Query type | Example result string |
| --- | --- |
| INSERT INTO...SELECT... | Records: 100 Duplicates: 0 Warnings: 0 |
| INSERT INTO...VALUES (...),(...),(...) | Records: 3 Duplicates: 0 Warnings: 0 |
| LOAD DATA INFILE ... | Records: 1 Deleted: 0 Skipped: 0 Warnings: 0 |
| ALTER TABLE ... | Records: 3 Duplicates: 0 Warnings: 0 |
| UPDATE ... | Rows matched: 40 Changed: 40 Warnings: 0 |
>
> **Note**:
>
>
> Queries which do not fall into one of the preceding formats are not supported. In these situations, **mysqli\_info()** will return an empty string.
>
>
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
### Return Values
A character string representing additional information about the most recently executed query.
### Examples
**Example #1 $mysqli->info 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 TEMPORARY TABLE t1 LIKE City");
/* INSERT INTO ... SELECT */
$mysqli->query("INSERT INTO t1 SELECT * FROM City ORDER BY ID LIMIT 150");
printf("%s\n", $mysqli->info);
/* 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 TEMPORARY TABLE t1 LIKE City");
/* INSERT INTO ... SELECT */
mysqli_query($link, "INSERT INTO t1 SELECT * FROM City ORDER BY ID LIMIT 150");
printf("%s\n", mysqli_info($link));
/* close connection */
mysqli_close($link);
?>
```
The above examples will output:
```
Records: 150 Duplicates: 0 Warnings: 0
```
### See Also
* [mysqli\_affected\_rows()](mysqli.affected-rows) - Gets the number of affected rows in a previous MySQL operation
* [mysqli\_warning\_count()](mysqli.warning-count) - Returns the number of warnings from the last query for the given link
* [mysqli\_num\_rows()](mysqli-result.num-rows) - Gets the number of rows in the result set
php apcu_sma_info apcu\_sma\_info
===============
(PECL apcu >= 4.0.0)
apcu\_sma\_info — Retrieves APCu Shared Memory Allocation information
### Description
```
apcu_sma_info(bool $limited = false): array|false
```
Retrieves APCu Shared Memory Allocation information.
### Parameters
`limited`
When set to **`false`** (default) **apcu\_sma\_info()** will return a detailed information about each segment.
### Return Values
Array of Shared Memory Allocation data; **`false`** on failure.
### Examples
**Example #1 A **apcu\_sma\_info()** example**
```
<?php
print_r(apcu_sma_info());
?>
```
The above example will output something similar to:
```
Array
(
[num_seg] => 1
[seg_size] => 31457280
[avail_mem] => 31448408
[block_lists] => Array
(
[0] => Array
(
[0] => Array
(
[size] => 31448408
[offset] => 8864
)
)
)
)
```
### See Also
* [APCu configuration directives](https://www.php.net/manual/en/apcu.configuration.php)
php ksort ksort
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
ksort — Sort an array by key in ascending order
### Description
```
ksort(array &$array, int $flags = SORT_REGULAR): bool
```
Sorts `array` in place by keys in ascending order.
>
> **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.
`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 **ksort()** example**
```
<?php
$fruits = array("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
ksort($fruits);
foreach ($fruits as $key => $val) {
echo "$key = $val\n";
}
?>
```
The above example will output:
```
a = orange
b = banana
c = apple
d = lemon
```
**Example #2 **ksort()** with int keys**
```
<?php
$a = [0 => 'First', 2 => 'Last', 1 => 'Middle'];
var_dump($a);
ksort($a);
var_dump($a);
?>
```
The above example will output:
```
array(3) {
[0]=>
string(5) "First"
[2]=>
string(4) "Last"
[1]=>
string(6) "Middle"
}
array(3) {
[0]=>
string(5) "First"
[1]=>
string(6) "Middle"
[2]=>
string(4) "Last"
}
```
### See Also
* [sort()](function.sort) - Sort an array in ascending order
* [krsort()](function.krsort) - Sort an array by key in descending order
* The [comparison of array sorting functions](https://www.php.net/manual/en/array.sorting.php)
php Parle\Lexer::push Parle\Lexer::push
=================
(PECL parle >= 0.5.1)
Parle\Lexer::push — Add a lexer rule
### Description
```
public Parle\Lexer::push(string $regex, int $id): void
```
Push a pattern for lexeme recognition.
### Parameters
`regex`
Regular expression used for token matching.
`id`
Token id. If the lexer instance is meant to be used standalone, this can be an arbitrary number. If the lexer instance is going to be passed to the parser, it has to be an id returned by [Parle\Parser::tokenid()](parle-parser.tokenid).
### Return Values
No value is returned.
php pspell_config_dict_dir pspell\_config\_dict\_dir
=========================
(PHP 5, PHP 7, PHP 8)
pspell\_config\_dict\_dir — Location of the main word list
### Description
```
pspell_config_dict_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_open fdf\_open
=========
(PHP 4, PHP 5 < 5.3.0, PECL fdf SVN)
fdf\_open — Open a FDF document
### Description
```
fdf_open(string $filename): resource
```
Opens a file with form data.
You can also use [fdf\_open\_string()](function.fdf-open-string) to process the results of a PDF form POST request.
### Parameters
`filename`
Path to the FDF file. This file must contain the data as returned from a PDF form or created using [fdf\_create()](function.fdf-create) and [fdf\_save()](function.fdf-save).
### Return Values
Returns a FDF document handle, or **`false`** on error.
### Examples
**Example #1 Accessing the form data**
```
<?php
// Save the FDF data into a temp file
$fdffp = fopen("test.fdf", "w");
fwrite($fdffp, $HTTP_FDF_DATA, strlen($HTTP_FDF_DATA));
fclose($fdffp);
// Open temp file and evaluate data
$fdf = fdf_open("test.fdf");
/* ... */
fdf_close($fdf);
?>
```
### See Also
* [fdf\_open\_string()](function.fdf-open-string) - Read a FDF document from a string
* [fdf\_close()](function.fdf-close) - Close an FDF document
* [fdf\_create()](function.fdf-create) - Create a new FDF document
* [fdf\_save()](function.fdf-save) - Save a FDF document
| programming_docs |
php mysqli_stmt::attr_set mysqli\_stmt::attr\_set
=======================
mysqli\_stmt\_attr\_set
=======================
(PHP 5, PHP 7, PHP 8)
mysqli\_stmt::attr\_set -- mysqli\_stmt\_attr\_set — Used to modify the behavior of a prepared statement
### Description
Object-oriented style
```
public mysqli_stmt::attr_set(int $attribute, int $value): bool
```
Procedural style
```
mysqli_stmt_attr_set(mysqli_stmt $statement, int $attribute, int $value): bool
```
Used to modify the behavior of a prepared statement. This function may be called multiple times to set several attributes.
### Parameters
`statement`
Procedural style only: A [mysqli\_stmt](class.mysqli-stmt) object returned by [mysqli\_stmt\_init()](mysqli.stmt-init).
`attribute`
The attribute that you want to set. It can have one of the following values:
**Attribute values**| Character | Description |
| --- | --- |
| MYSQLI\_STMT\_ATTR\_UPDATE\_MAX\_LENGTH | Setting to **`true`** causes [mysqli\_stmt\_store\_result()](mysqli-stmt.store-result) to update the metadata `MYSQL_FIELD->max_length` value. |
| MYSQLI\_STMT\_ATTR\_CURSOR\_TYPE | Type of cursor to open for statement when [mysqli\_stmt\_execute()](mysqli-stmt.execute) is invoked. `value` can be `MYSQLI_CURSOR_TYPE_NO_CURSOR` (the default) or `MYSQLI_CURSOR_TYPE_READ_ONLY`. |
| MYSQLI\_STMT\_ATTR\_PREFETCH\_ROWS | Number of rows to fetch from server at a time when using a cursor. `value` can be in the range from 1 to the maximum value of unsigned long. The default is 1. |
If you use the `MYSQLI_STMT_ATTR_CURSOR_TYPE` option with `MYSQLI_CURSOR_TYPE_READ_ONLY`, a cursor is opened for the statement when you invoke [mysqli\_stmt\_execute()](mysqli-stmt.execute). If there is already an open cursor from a previous [mysqli\_stmt\_execute()](mysqli-stmt.execute) call, it closes the cursor before opening a new one. [mysqli\_stmt\_reset()](mysqli-stmt.reset) also closes any open cursor before preparing the statement for re-execution. [mysqli\_stmt\_free\_result()](mysqli-stmt.free-result) closes any open cursor.
If you open a cursor for a prepared statement, [mysqli\_stmt\_store\_result()](mysqli-stmt.store-result) is unnecessary.
`value`
The value to assign to the attribute.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [» Connector/MySQL mysql\_stmt\_attr\_set()](http://dev.mysql.com/doc/en/mysql-stmt-attr-set.html)
php sodium_crypto_sign_publickey_from_secretkey sodium\_crypto\_sign\_publickey\_from\_secretkey
================================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_sign\_publickey\_from\_secretkey — Extract the Ed25519 public key from the secret key
### Description
```
sodium_crypto_sign_publickey_from_secretkey(string $secret_key): string
```
Extract the Ed25519 public key from the secret key
### Parameters
`secret_key`
Ed25519 secret key
### Return Values
Ed25519 public key
php DateTimeZone::__construct DateTimeZone::\_\_construct
===========================
timezone\_open
==============
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
DateTimeZone::\_\_construct -- timezone\_open — Creates new DateTimeZone object
### Description
Object-oriented style
public **DateTimeZone::\_\_construct**(string `$timezone`) Procedural style
```
timezone_open(string $timezone): DateTimeZone|false
```
Creates a new DateTimeZone object.
A DateTimeZone object provides access to three different types of timezone rules: UTC offset (type `1`), timezone abbreviation (type `2`), and [timezone identifiers](https://www.php.net/manual/en/timezones.php) as published in the IANA timezone database (type `3`).
The DateTimeZone object can be attached to [DateTime](class.datetime) and [DateTimeImmutable](class.datetimeimmutable) objects to be able to render the timezone encapsulated by these objects in a local timezone.
### Parameters
`timezone`
One of the supported [timezone names](https://www.php.net/manual/en/timezones.php), an offset value (+0200), or a timezone abbreviation (BST).
### Return Values
Returns [DateTimeZone](class.datetimezone) on success. Procedural style returns **`false`** on failure.
### Errors/Exceptions
This method throws [Exception](class.exception) if the timezone supplied is not recognised as a valid timezone.
### Examples
**Example #1 Creating and attaching DateTimeZone to a DateTimeImmutable**
```
<?php
$d = new DateTimeImmutable("2022-06-02 15:44:48 UTC");
$timezones = [ 'Europe/London', 'GMT+04:45', '-06:00', 'CEST' ];
foreach ($timezones as $tz) {
$tzo = new DateTimeZone($tz);
$local = $d->setTimezone($tzo);
echo $local->format(DateTimeInterface::RFC2822 . ' — e'), "\n";
}
?>
```
The above example will output:
Thu, 02 Jun 2022 16:44:48 +0100 — Europe/London
Thu, 02 Jun 2022 20:29:48 +0445 — +04:45
Thu, 02 Jun 2022 09:44:48 -0600 — -06:00
Thu, 02 Jun 2022 17:44:48 +0200 — CEST
**Example #2 Catching errors when instantiating [DateTimeZone](class.datetimezone)**
```
<?php
// Error handling by catching exceptions
$timezones = array('Europe/London', 'Mars/Phobos', 'Jupiter/Europa');
foreach ($timezones as $tz) {
try {
$mars = new DateTimeZone($tz);
} catch(Exception $e) {
echo $e->getMessage() . '<br />';
}
}
?>
```
The above example will output:
```
DateTimeZone::__construct() [datetimezone.--construct]: Unknown or bad timezone (Mars/Phobos)
DateTimeZone::__construct() [datetimezone.--construct]: Unknown or bad timezone (Jupiter/Europa)
```
php acosh acosh
=====
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
acosh — Inverse hyperbolic cosine
### Description
```
acosh(float $num): float
```
Returns the inverse hyperbolic cosine of `num`, i.e. the value whose hyperbolic cosine is `num`.
### Parameters
`num`
The value to process
### Return Values
The inverse hyperbolic cosine of `num`
### See Also
* [cosh()](function.cosh) - Hyperbolic cosine
* [acos()](function.acos) - Arc cosine
* [asinh()](function.asinh) - Inverse hyperbolic sine
* [atanh()](function.atanh) - Inverse hyperbolic tangent
php cos cos
===
(PHP 4, PHP 5, PHP 7, PHP 8)
cos — Cosine
### Description
```
cos(float $num): float
```
**cos()** returns the cosine of the `num` parameter. The `num` parameter is in radians.
### Parameters
`num`
An angle in radians
### Return Values
The cosine of `num`
### Examples
**Example #1 **cos()** example**
```
<?php
echo cos(M_PI); // -1
?>
```
### See Also
* [acos()](function.acos) - Arc cosine
* [sin()](function.sin) - Sine
* [tan()](function.tan) - Tangent
* [deg2rad()](function.deg2rad) - Converts the number in degrees to the radian equivalent
php imagecolorexactalpha imagecolorexactalpha
====================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
imagecolorexactalpha — Get the index of the specified color + alpha
### Description
```
imagecolorexactalpha(
GdImage $image,
int $red,
int $green,
int $blue,
int $alpha
): int
```
Returns the index of the specified color+alpha in the palette of the image.
### 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 the index of the specified color+alpha in the palette of the image, or -1 if the color does not exist in the image's palette.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 Get colors from the GD logo**
```
<?php
// Setup an image
$im = imagecreatefrompng('./gdlogo.png');
$colors = Array();
$colors[] = imagecolorexactalpha($im, 255, 0, 0, 0);
$colors[] = imagecolorexactalpha($im, 0, 0, 0, 127);
$colors[] = imagecolorexactalpha($im, 255, 255, 255, 55);
$colors[] = imagecolorexactalpha($im, 100, 255, 52, 20);
print_r($colors);
// Free from memory
imagedestroy($im);
?>
```
The above example will output something similar to:
```
Array
(
[0] => 16711680
[1] => 2130706432
[2] => 939524095
[3] => 342163252
)
```
### See Also
* [imagecolorclosestalpha()](function.imagecolorclosestalpha) - Get the index of the closest color to the specified color + alpha
php in_array in\_array
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
in\_array — Checks if a value exists in an array
### Description
```
in_array(mixed $needle, array $haystack, bool $strict = false): bool
```
Searches for `needle` in `haystack` using loose comparison unless `strict` is set.
### Parameters
`needle`
The searched value.
>
> **Note**:
>
>
> If `needle` is a string, the comparison is done in a case-sensitive manner.
>
>
`haystack`
The array.
`strict`
If the third parameter `strict` is set to **`true`** then the **in\_array()** function will also check the [types](https://www.php.net/manual/en/language.types.php) of the `needle` in the `haystack`.
>
> **Note**:
>
>
> Prior to PHP 8.0.0, a `string` `needle` will match an array value of `0` in non-strict mode, and vice versa. That may lead to undesireable results. Similar edge cases exist for other types, as well. If not absolutely certain of the types of values involved, always use the `strict` flag to avoid unexpected behavior.
>
>
### Return Values
Returns **`true`** if `needle` is found in the array, **`false`** otherwise.
### Examples
**Example #1 **in\_array()** example**
```
<?php
$os = array("Mac", "NT", "Irix", "Linux");
if (in_array("Irix", $os)) {
echo "Got Irix";
}
if (in_array("mac", $os)) {
echo "Got mac";
}
?>
```
The second condition fails because **in\_array()** is case-sensitive, so the program above will display:
```
Got Irix
```
**Example #2 **in\_array()** with strict example**
```
<?php
$a = array('1.10', 12.4, 1.13);
if (in_array('12.4', $a, true)) {
echo "'12.4' found with strict check\n";
}
if (in_array(1.13, $a, true)) {
echo "1.13 found with strict check\n";
}
?>
```
The above example will output:
```
1.13 found with strict check
```
**Example #3 **in\_array()** with an array as needle**
```
<?php
$a = array(array('p', 'h'), array('p', 'r'), 'o');
if (in_array(array('p', 'h'), $a)) {
echo "'ph' was found\n";
}
if (in_array(array('f', 'i'), $a)) {
echo "'fi' was found\n";
}
if (in_array('o', $a)) {
echo "'o' was found\n";
}
?>
```
The above example will output:
```
'ph' was found
'o' was found
```
### See Also
* [array\_search()](function.array-search) - Searches the array for a given value and returns the first corresponding key if successful
* [isset()](function.isset) - Determine if a variable is declared and is different than null
* [array\_key\_exists()](function.array-key-exists) - Checks if the given key or index exists in the array
php None Escape sequences
----------------
The backslash character has several uses. Firstly, if it is followed by a non-alphanumeric character, it takes away any special meaning that character may have. This use of backslash as an escape character applies both inside and outside character classes.
For example, if you want to match a "\*" character, you write "\\*" in the pattern. This applies whether or not the following character would otherwise be interpreted as a meta-character, so it is always safe to precede a non-alphanumeric with "\" to specify that it stands for itself. In particular, if you want to match a backslash, you write "\\".
>
> **Note**:
>
>
> Single and double quoted PHP [strings](language.types.string#language.types.string.syntax) have special meaning of backslash. Thus if \ has to be matched with a regular expression \\, then "\\\\" or '\\\\' must be used in PHP code.
>
>
If a pattern is compiled with the [PCRE\_EXTENDED](reference.pcre.pattern.modifiers) option, whitespace in the pattern (other than in a character class) and characters between a "#" outside a character class and the next newline character are ignored. An escaping backslash can be used to include a whitespace or "#" character as part of the pattern.
A second use of backslash provides a way of encoding non-printing characters in patterns in a visible manner. There is no restriction on the appearance of non-printing characters, apart from the binary zero that terminates a pattern, but when a pattern is being prepared by text editing, it is usually easier to use one of the following escape sequences than the binary character it represents:
*\a*
alarm, that is, the BEL character (hex 07) *\cx*
"control-x", where x is any character *\e*
escape (hex 1B) *\f*
formfeed (hex 0C) *\n*
newline (hex 0A) *\p{xx}*
a character with the xx property, see [unicode properties](regexp.reference.unicode) for more info *\P{xx}*
a character without the xx property, see [unicode properties](regexp.reference.unicode) for more info *\r*
carriage return (hex 0D) *\R*
line break: matches \n, \r and \r\n *\t*
tab (hex 09) *\xhh*
character with hex code hh *\ddd*
character with octal code ddd, or backreference The precise effect of "`\cx`" is as follows: if "`x`" is a lower case letter, it is converted to upper case. Then bit 6 of the character (hex 40) is inverted. Thus "`\cz`" becomes hex 1A, but "`\c{`" becomes hex 3B, while "`\c;`" becomes hex 7B.
After "`\x`", up to two hexadecimal digits are read (letters can be in upper or lower case). In *UTF-8 mode*, "`\x{...}`" is allowed, where the contents of the braces is a string of hexadecimal digits. It is interpreted as a UTF-8 character whose code number is the given hexadecimal number. The original hexadecimal escape sequence, `\xhh`, matches a two-byte UTF-8 character if the value is greater than 127.
After "`\0`" up to two further octal digits are read. In both cases, if there are fewer than two digits, just those that are present are used. Thus the sequence "`\0\x\07`" specifies two binary zeros followed by a BEL character. Make sure you supply two digits after the initial zero if the character that follows is itself an octal digit.
The handling of a backslash followed by a digit other than 0 is complicated. Outside a character class, PCRE reads it and any following digits as a decimal number. If the number is less than 10, or if there have been at least that many previous capturing left parentheses in the expression, the entire sequence is taken as a *back reference*. A description of how this works is given later, following the discussion of parenthesized subpatterns.
Inside a character class, or if the decimal number is greater than 9 and there have not been that many capturing subpatterns, PCRE re-reads up to three octal digits following the backslash, and generates a single byte from the least significant 8 bits of the value. Any subsequent digits stand for themselves. For example:
*\040*
is another way of writing a space
*\40*
is the same, provided there are fewer than 40 previous capturing subpatterns *\7*
is always a back reference
*\11*
might be a back reference, or another way of writing a tab *\011*
is always a tab
*\0113*
is a tab followed by the character "3"
*\113*
is the character with octal code 113 (since there can be no more than 99 back references) *\377*
is a byte consisting entirely of 1 bits
*\81*
is either a back reference, or a binary zero followed by the two characters "8" and "1" Note that octal values of 100 or greater must not be introduced by a leading zero, because no more than three octal digits are ever read.
All the sequences that define a single byte value can be used both inside and outside character classes. In addition, inside a character class, the sequence "`\b`" is interpreted as the backspace character (hex 08). Outside a character class it has a different meaning (see below).
The third use of backslash is for specifying generic character types:
*\d*
any decimal digit
*\D*
any character that is not a decimal digit
*\h*
any horizontal whitespace character
*\H*
any character that is not a horizontal whitespace character
*\s*
any whitespace character
*\S*
any character that is not a whitespace character
*\v*
any vertical whitespace character
*\V*
any character that is not a vertical whitespace character
*\w*
any "word" character
*\W*
any "non-word" character
Each pair of escape sequences partitions the complete set of characters into two disjoint sets. Any given character matches one, and only one, of each pair.
The "whitespace" characters are HT (9), LF (10), FF (12), CR (13), and space (32). However, if locale-specific matching is happening, characters with code points in the range 128-255 may also be considered as whitespace characters, for instance, NBSP (A0).
A "word" character is any letter or digit or the underscore character, that is, any character which can be part of a Perl "*word*". The definition of letters and digits is controlled by PCRE's character tables, and may vary if locale-specific matching is taking place. For example, in the "fr" (French) locale, some character codes greater than 128 are used for accented letters, and these are matched by `\w`.
These character type sequences can appear both inside and outside character classes. They each match one character of the appropriate type. If the current matching point is at the end of the subject string, all of them fail, since there is no character to match.
The fourth use of backslash is for certain simple assertions. An assertion specifies a condition that has to be met at a particular point in a match, without consuming any characters from the subject string. The use of subpatterns for more complicated assertions is described below. The backslashed assertions are
*\b*
word boundary
*\B*
not a word boundary
*\A*
start of subject (independent of multiline mode)
*\Z*
end of subject or newline at end (independent of multiline mode) *\z*
end of subject (independent of multiline mode)
*\G*
first matching position in subject
These assertions may not appear in character classes (but note that "`\b`" has a different meaning, namely the backspace character, inside a character class).
A word boundary is a position in the subject string where the current character and the previous character do not both match `\w` or `\W` (i.e. one matches `\w` and the other matches `\W`), or the start or end of the string if the first or last character matches `\w`, respectively.
The `\A`, `\Z`, and `\z` assertions differ from the traditional circumflex and dollar (described in [anchors](regexp.reference.anchors) ) in that they only ever match at the very start and end of the subject string, whatever options are set. They are not affected by the [PCRE\_MULTILINE](reference.pcre.pattern.modifiers) or [PCRE\_DOLLAR\_ENDONLY](reference.pcre.pattern.modifiers) options. The difference between `\Z` and `\z` is that `\Z` matches before a newline that is the last character of the string as well as at the end of the string, whereas `\z` matches only at the end.
The `\G` assertion is true only when the current matching position is at the start point of the match, as specified by the `offset` argument of [preg\_match()](function.preg-match). It differs from `\A` when the value of `offset` is non-zero.
`\Q` and `\E` can be used to ignore regexp metacharacters in the pattern. For example: `\w+\Q.$.\E$` will match one or more word characters, followed by literals `.$.` and anchored at the end of the string. Note that this does not change the behavior of delimiters; for instance the pattern `#\Q#\E#$` is not valid, because the second `#` marks the end of the pattern, and the `\E#` is interpreted as invalid modifiers.
`\K` can be used to reset the match start. For example, the pattern `foo\Kbar` matches "foobar", but reports that it has matched "bar". The use of `\K` does not interfere with the setting of captured substrings. For example, when the pattern `(foo)\Kbar` matches "foobar", the first substring is still set to "foo".
| programming_docs |
php header_remove header\_remove
==============
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
header\_remove — Remove previously set headers
### Description
```
header_remove(?string $name = null): void
```
Removes an HTTP header previously set using [header()](function.header).
### Parameters
`name`
The header name to be removed. When **`null`**, all previously set headers are removed.
> **Note**: This parameter is case-insensitive.
>
>
### Return Values
No value is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `name` is nullable now. |
### Examples
**Example #1 Unsetting specific header.**
```
<?php
header("X-Foo: Bar");
header("X-Bar: Baz");
header_remove("X-Foo");
?>
```
The above example will output something similar to:
```
X-Bar: Baz
```
**Example #2 Unsetting all previously set headers.**
```
<?php
header("X-Foo: Bar");
header("X-Bar: Baz");
header_remove();
?>
```
The above example will output something similar to:
### Notes
**Caution** This function will remove *all* headers set by PHP, including cookies, session and the `X-Powered-By` headers.
>
> **Note**:
>
>
> Headers will only be accessible and output when a SAPI that supports them is in use.
>
>
### See Also
* [header()](function.header) - Send a raw HTTP header
* [headers\_sent()](function.headers-sent) - Checks if or where headers have been sent
php constant constant
========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
constant — Returns the value of a constant
### Description
```
constant(string $name): mixed
```
Return the value of the constant indicated by `name`.
**constant()** is useful if you need to retrieve the value of a constant, but do not know its name. I.e. it is stored in a variable or returned by a function.
This function works also with [class constants](language.oop5.constants).
### Parameters
`name`
The constant name.
### Return Values
Returns the value of the constant.
### Errors/Exceptions
If the constant is not defined, an [Error](class.error) exception is thrown. Prior to PHP 8.0.0, an **`E_WARNING`** level error was generated in that case.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | If the constant is not defined, **constant()** now throws an [Error](class.error) exception; previously an **`E_WARNING`** was generated, and **`null`** was returned. |
### Examples
**Example #1 **constant()** example**
```
<?php
define("MAXSIZE", 100);
echo MAXSIZE;
echo constant("MAXSIZE"); // same thing as the previous line
interface bar {
const test = 'foobar!';
}
class foo {
const test = 'foobar!';
}
$const = 'test';
var_dump(constant('bar::'. $const)); // string(7) "foobar!"
var_dump(constant('foo::'. $const)); // string(7) "foobar!"
?>
```
### See Also
* [define()](function.define) - Defines a named constant
* [defined()](function.defined) - Checks whether a given named constant exists
* [get\_defined\_constants()](function.get-defined-constants) - Returns an associative array with the names of all the constants and their values
* The section on [Constants](language.constants)
php ssh2_sftp_readlink ssh2\_sftp\_readlink
====================
(PECL ssh2 >= 0.9.0)
ssh2\_sftp\_readlink — Return the target of a symbolic link
### Description
```
ssh2_sftp_readlink(resource $sftp, string $link): string
```
Returns the target of a symbolic link.
### Parameters
`sftp`
An SSH2 SFTP resource opened by [ssh2\_sftp()](function.ssh2-sftp).
`link`
Path of the symbolic link.
### Return Values
Returns the target of the symbolic `link`.
### Examples
**Example #1 Reading a symbolic link**
```
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$sftp = ssh2_sftp($connection);
$target = ssh2_sftp_readlink($sftp, '/tmp/mysql.sock');
/* $target is now (e.g.): '/var/run/mysql.sock' */
?>
```
### See Also
* [readlink()](function.readlink) - Returns the target of a symbolic link
* [ssh2\_sftp\_symlink()](function.ssh2-sftp-symlink) - Create a symlink
php mysqli_stmt::reset mysqli\_stmt::reset
===================
mysqli\_stmt\_reset
===================
(PHP 5, PHP 7, PHP 8)
mysqli\_stmt::reset -- mysqli\_stmt\_reset — Resets a prepared statement
### Description
Object-oriented style
```
public mysqli_stmt::reset(): bool
```
Procedural style
```
mysqli_stmt_reset(mysqli_stmt $statement): bool
```
Resets a prepared statement on client and server to state after prepare.
It resets the statement on the server, data sent using [mysqli\_stmt\_send\_long\_data()](mysqli-stmt.send-long-data), unbuffered result sets and current errors. It does not clear bindings or stored result sets. Stored result sets will be cleared when executing the prepared statement (or closing it).
To prepare a statement with another query use function [mysqli\_stmt\_prepare()](mysqli-stmt.prepare).
### 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 Ds\Sequence::remove Ds\Sequence::remove
===================
(PECL ds >= 1.0.0)
Ds\Sequence::remove — Removes and returns a value by index
### Description
```
abstract public Ds\Sequence::remove(int $index): mixed
```
Removes and returns a value by index.
### Parameters
`index`
The index of the value to remove.
### Return Values
The value that was removed.
### Errors/Exceptions
[OutOfRangeException](class.outofrangeexception) if the index is not valid.
### Examples
**Example #1 **Ds\Sequence::remove()** example**
```
<?php
$sequence = new \Ds\Vector(["a", "b", "c"]);
var_dump($sequence->remove(1));
var_dump($sequence->remove(0));
var_dump($sequence->remove(0));
?>
```
The above example will output something similar to:
```
string(1) "b"
string(1) "a"
string(1) "c"
```
php fdf_set_encoding fdf\_set\_encoding
==================
(PHP 4 >= 4.0.7, PHP 5 < 5.3.0, PECL fdf SVN)
fdf\_set\_encoding — Sets FDF character encoding
### Description
```
fdf_set_encoding(resource $fdf_document, string $encoding): bool
```
Sets the character encoding for the FDF document.
### 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).
`encoding`
The encoding name. The following values are supported: "`Shift-JIS`", "`UHC`", "`GBK`" and "`BigFive`".
An empty string resets the encoding to the default `PDFDocEncoding/Unicode` scheme.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php xdiff_string_diff xdiff\_string\_diff
===================
(PECL xdiff >= 0.2.0)
xdiff\_string\_diff — Make unified diff of two strings
### Description
```
xdiff_string_diff(
string $old_data,
string $new_data,
int $context = 3,
bool $minimal = false
): string
```
Makes an unified diff containing differences between `old_data` string and `new_data` string and returns it. The resulting diff is human-readable. An optional `context` parameter specifies how many lines of context should be added around each change. Setting `minimal` parameter to true will result in outputting the shortest patch file possible (can take a long time).
### Parameters
`old_data`
First string with data. It acts as "old" data.
`new_data`
Second string with data. It acts as "new" data.
`context`
Indicates how many lines of context you want to include in the diff result.
`minimal`
Set this parameter to **`true`** if you want to minimalize the size of the result (can take a long time).
### Return Values
Returns string with resulting diff or **`false`** if an internal error happened.
### Examples
**Example #1 **xdiff\_string\_diff()** example**
The following code makes unified diff of two articles.
```
<?php
$old_article = file_get_contents('./old_article.txt');
$new_article = $_REQUEST['article']; /* Let's say that someone pasted a new article to html form */
$diff = xdiff_string_diff($old_article, $new_article, 1);
if (is_string($diff)) {
echo "Differences between two articles:\n";
echo $diff;
}
?>
```
### Notes
>
> **Note**:
>
>
> This function doesn't work well with binary strings. To make diff of binary strings use [xdiff\_string\_bdiff()](function.xdiff-string-bdiff)/[xdiff\_string\_rabdiff()](function.xdiff-string-rabdiff).
>
>
### See Also
* [xdiff\_string\_patch()](function.xdiff-string-patch) - Patch a string with an unified diff
php openssl_get_md_methods openssl\_get\_md\_methods
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
openssl\_get\_md\_methods — Gets available digest methods
### Description
```
openssl_get_md_methods(bool $aliases = false): array
```
Gets a list of available digest methods.
### Parameters
`aliases`
Set to **`true`** if digest aliases should be included within the returned array.
### Return Values
An array of available digest methods.
### Examples
**Example #1 **openssl\_get\_md\_methods()** example**
Shows how the available digests might look, and also which aliases might be available.
```
<?php
$digests = openssl_get_md_methods();
$digests_and_aliases = openssl_get_md_methods(true);
$digest_aliases = array_diff($digests_and_aliases, $digests);
print_r($digests);
print_r($digest_aliases);
?>
```
The above example will output something similar to:
```
Array
(
[0] => DSA
[1] => DSA-SHA
[2] => MD2
[3] => MD4
[4] => MD5
[5] => RIPEMD160
[6] => SHA
[7] => SHA1
[8] => SHA224
[9] => SHA256
[10] => SHA384
[11] => SHA512
[12] => dsaEncryption
[13] => dsaWithSHA
[14] => ecdsa-with-SHA1
[15] => md2
[16] => md4
[17] => md5
[18] => ripemd160
[19] => sha
[20] => sha1
[21] => sha224
[22] => sha256
[23] => sha384
[24] => sha512
)
Array
(
[2] => DSA-SHA1
[3] => DSA-SHA1-old
[4] => DSS1
[9] => RSA-MD2
[10] => RSA-MD4
[11] => RSA-MD5
[12] => RSA-RIPEMD160
[13] => RSA-SHA
[14] => RSA-SHA1
[15] => RSA-SHA1-2
[16] => RSA-SHA224
[17] => RSA-SHA256
[18] => RSA-SHA384
[19] => RSA-SHA512
[28] => dsaWithSHA1
[29] => dss1
[32] => md2WithRSAEncryption
[34] => md4WithRSAEncryption
[36] => md5WithRSAEncryption
[37] => ripemd
[39] => ripemd160WithRSA
[40] => rmd160
[43] => sha1WithRSAEncryption
[45] => sha224WithRSAEncryption
[47] => sha256WithRSAEncryption
[49] => sha384WithRSAEncryption
[51] => sha512WithRSAEncryption
[52] => shaWithRSAEncryption
[53] => ssl2-md5
[54] => ssl3-md5
[55] => ssl3-sha1
)
```
### See Also
* [openssl\_digest()](function.openssl-digest) - Computes a digest
* [openssl\_get\_cipher\_methods()](function.openssl-get-cipher-methods) - Gets available cipher methods
php XMLWriter::startDtd XMLWriter::startDtd
===================
xmlwriter\_start\_dtd
=====================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::startDtd -- xmlwriter\_start\_dtd — Create start DTD tag
### Description
Object-oriented style
```
public XMLWriter::startDtd(string $qualifiedName, ?string $publicId = null, ?string $systemId = null): bool
```
Procedural style
```
xmlwriter_start_dtd(
XMLWriter $writer,
string $qualifiedName,
?string $publicId = null,
?string $systemId = null
): bool
```
Starts a DTD.
### 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).
`qualifiedName`
The qualified name of the document type to create.
`publicId`
The external subset public identifier.
`systemId`
The external subset system identifier.
### 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::endDtd()](xmlwriter.enddtd) - End current DTD
* [XMLWriter::writeDtd()](xmlwriter.writedtd) - Write full DTD tag
php ReflectionParameter::hasType ReflectionParameter::hasType
============================
(PHP 7, PHP 8)
ReflectionParameter::hasType — Checks if parameter has a type
### Description
```
public ReflectionParameter::hasType(): bool
```
Checks if the parameter has a type associated with it.
### Parameters
This function has no parameters.
### Return Values
**`true`** if a type is specified, **`false`** otherwise.
### Examples
**Example #1 **ReflectionParameter::hasType()** example**
```
<?php
function someFunction(string $param, $param2 = null) {}
$reflectionFunc = new ReflectionFunction('someFunction');
$reflectionParams = $reflectionFunc->getParameters();
var_dump($reflectionParams[0]->hasType());
var_dump($reflectionParams[1]->hasType());
```
The above example will output something similar to:
```
bool(true)
bool(false)
```
### See Also
* [ReflectionParameter::getType()](reflectionparameter.gettype) - Gets a parameter's type
php gmp_import gmp\_import
===========
(PHP 5 >= 5.6.1, PHP 7, PHP 8)
gmp\_import — Import from a binary string
### Description
```
gmp_import(string $data, int $word_size = 1, int $flags = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): GMP
```
Import a GMP number from a binary string
### Parameters
`data`
The binary string being imported
`word_size`
Default value is 1. The number of bytes in each chunk of binary data. This is mainly used in conjunction with the options parameter.
`flags`
Default value is **`GMP_MSW_FIRST`** | **`GMP_NATIVE_ENDIAN`**.
### Return Values
Returns a GMP number.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function no longer returns **`false`** on failure. |
### Examples
**Example #1 **gmp\_import()** example**
```
<?php
$number = gmp_import("\0");
echo gmp_strval($number) . "\n";
$number = gmp_import("\0\1\2");
echo gmp_strval($number) . "\n";
?>
```
The above example will output:
```
0
258
```
### See Also
* [gmp\_export()](function.gmp-export) - Export to a binary string
php ZipArchive::setPassword ZipArchive::setPassword
=======================
(PHP 5 >= 5.6.0, PHP 7, PHP 8, PECL zip >= 1.12.4)
ZipArchive::setPassword — Set the password for the active archive
### Description
```
public ZipArchive::setPassword(string $password): bool
```
Sets the password for the active archive.
### Parameters
`password`
The password to be used for the archive.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Notes
>
> **Note**:
>
>
> As of PHP 7.2.0 and libzip 1.2.0 the password is used to decompress the archive, and is also the default password for [ZipArchive::setEncryptionName()](ziparchive.setencryptionname) and [ZipArchive::setEncryptionIndex()](ziparchive.setencryptionindex). Formerly, this function only set the password to be used to decompress the archive; it did not turn a non-password-protected [ZipArchive](class.ziparchive) into a password-protected [ZipArchive](class.ziparchive).
>
>
### See Also
* [ZipArchive::setEncryptionIndex()](ziparchive.setencryptionindex) - Set the encryption method of an entry defined by its index
* [ZipArchive::setEncryptionName()](ziparchive.setencryptionname) - Set the encryption method of an entry defined by its name
php Ds\Vector::sort Ds\Vector::sort
===============
(PECL ds >= 1.0.0)
Ds\Vector::sort — Sorts the vector in-place
### Description
```
public Ds\Vector::sort(callable $comparator = ?): void
```
Sorts the vector 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\Vector::sort()** example**
```
<?php
$vector = new \Ds\Vector([4, 5, 1, 3, 2]);
$vector->sort();
print_r($vector);
?>
```
The above example will output something similar to:
```
Ds\Vector Object
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
)
```
**Example #2 **Ds\Vector::sort()** example using a comparator**
```
<?php
$vector = new \Ds\Vector([4, 5, 1, 3, 2]);
$vector->sort(function($a, $b) {
return $b <=> $a;
});
print_r($vector);
?>
```
The above example will output something similar to:
```
Ds\Vector Object
(
[0] => 5
[1] => 4
[2] => 3
[3] => 2
[4] => 1
)
```
php Locale::getDisplayScript Locale::getDisplayScript
========================
locale\_get\_display\_script
============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
Locale::getDisplayScript -- locale\_get\_display\_script — Returns an appropriately localized display name for script of the input locale
### Description
Object-oriented style
```
public static Locale::getDisplayScript(string $locale, ?string $displayLocale = null): string|false
```
Procedural style
```
locale_get_display_script(string $locale, ?string $displayLocale = null): string|false
```
Returns an appropriately localized display name for script of the input locale. If is **`null`** then the default locale is used.
### Parameters
`locale`
The locale to return a display script for
`displayLocale`
Optional format locale to use to display the script name
### Return Values
Display name of the script for the `locale` in the format appropriate for `displayLocale`, or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `displayLocale` is nullable now. |
### Examples
**Example #1 **locale\_get\_display\_script()** example**
```
<?php
echo locale_get_display_script('sl-Latn-IT-nedis', 'en');
echo ";\n";
echo locale_get_display_script('sl-Latn-IT-nedis', 'fr');
echo ";\n";
echo locale_get_display_script('sl-Latn-IT-nedis', 'de');
?>
```
**Example #2 OO example**
```
<?php
echo Locale::getDisplayScript('sl-Latn-IT-nedis', 'en');
echo ";\n";
echo Locale::getDisplayScript('sl-Latn-IT-nedis', 'fr');
echo ";\n";
echo Locale::getDisplayScript('sl-Latn-IT-nedis', 'de');
?>
```
The above example will output:
```
Latin;
latin;
Lateinisch
```
### See Also
* [locale\_get\_display\_name()](locale.getdisplayname) - Returns an appropriately localized display name for the input locale
* [locale\_get\_display\_language()](locale.getdisplaylanguage) - Returns an appropriately localized display name for language of the inputlocale
* [locale\_get\_display\_region()](locale.getdisplayregion) - Returns an appropriately localized display name for region of the input locale
* [locale\_get\_display\_variant()](locale.getdisplayvariant) - Returns an appropriately localized display name for variants of the input locale
| programming_docs |
php SolrInputDocument::__destruct SolrInputDocument::\_\_destruct
===============================
(PECL solr >= 0.9.2)
SolrInputDocument::\_\_destruct — Destructor
### Description
public **SolrInputDocument::\_\_destruct**() Destructor
### Parameters
This function has no parameters.
### Return Values
None.
php The Yaf_Dispatcher class
The Yaf\_Dispatcher class
=========================
Introduction
------------
(Yaf >=1.0.0)
**Yaf\_Dispatcher** purpose is to initialize the request environment, route the incoming request, and then dispatch any discovered actions; it aggregates any responses and returns them when the process is complete.
**Yaf\_Dispatcher** also implements the Singleton pattern, meaning only a single instance of it may be available at any given time. This allows it to also act as a registry on which the other objects in the dispatch process may draw.
Class synopsis
--------------
final class **Yaf\_Dispatcher** { /\* Properties \*/ protected [$\_router](class.yaf-dispatcher#yaf-dispatcher.props.router);
protected [$\_view](class.yaf-dispatcher#yaf-dispatcher.props.view);
protected [$\_request](class.yaf-dispatcher#yaf-dispatcher.props.request);
protected [$\_plugins](class.yaf-dispatcher#yaf-dispatcher.props.plugins);
protected static [$\_instance](class.yaf-dispatcher#yaf-dispatcher.props.instance);
protected [$\_auto\_render](class.yaf-dispatcher#yaf-dispatcher.props.auto-render);
protected [$\_return\_response](class.yaf-dispatcher#yaf-dispatcher.props.return-response);
protected [$\_instantly\_flush](class.yaf-dispatcher#yaf-dispatcher.props.instantly-flush);
protected [$\_default\_module](class.yaf-dispatcher#yaf-dispatcher.props.default-module);
protected [$\_default\_controller](class.yaf-dispatcher#yaf-dispatcher.props.default-controller);
protected [$\_default\_action](class.yaf-dispatcher#yaf-dispatcher.props.default-action); /\* Methods \*/ public [\_\_construct](yaf-dispatcher.construct)()
```
public autoRender(bool $flag = ?): Yaf_Dispatcher
```
```
public catchException(bool $flag = ?): Yaf_Dispatcher
```
```
public disableView(): bool
```
```
public dispatch(Yaf_Request_Abstract $request): Yaf_Response_Abstract
```
```
public enableView(): Yaf_Dispatcher
```
```
public flushInstantly(bool $flag = ?): Yaf_Dispatcher
```
```
public getApplication(): Yaf_Application
```
```
public getDefaultAction(): string
```
```
public getDefaultController(): string
```
```
public getDefaultModule(): string
```
```
public static getInstance(): Yaf_Dispatcher
```
```
public getRequest(): Yaf_Request_Abstract
```
```
public getRouter(): Yaf_Router
```
```
public initView(string $templates_dir, array $options = ?): Yaf_View_Interface
```
```
public registerPlugin(Yaf_Plugin_Abstract $plugin): Yaf_Dispatcher
```
```
public returnResponse(bool $flag): Yaf_Dispatcher
```
```
public setDefaultAction(string $action): Yaf_Dispatcher
```
```
public setDefaultController(string $controller): Yaf_Dispatcher
```
```
public setDefaultModule(string $module): Yaf_Dispatcher
```
```
public setErrorHandler(call $callback, int $error_types): Yaf_Dispatcher
```
```
public setRequest(Yaf_Request_Abstract $request): Yaf_Dispatcher
```
```
public setView(Yaf_View_Interface $view): Yaf_Dispatcher
```
```
public throwException(bool $flag = ?): Yaf_Dispatcher
```
} Properties
----------
\_router \_view \_request \_plugins \_instance \_auto\_render \_return\_response \_instantly\_flush \_default\_module \_default\_controller \_default\_action Table of Contents
-----------------
* [Yaf\_Dispatcher::autoRender](yaf-dispatcher.autorender) — Switch on/off autorendering
* [Yaf\_Dispatcher::catchException](yaf-dispatcher.catchexception) — Switch on/off exception catching
* [Yaf\_Dispatcher::\_\_construct](yaf-dispatcher.construct) — Yaf\_Dispatcher constructor
* [Yaf\_Dispatcher::disableView](yaf-dispatcher.disableview) — Disable view rendering
* [Yaf\_Dispatcher::dispatch](yaf-dispatcher.dispatch) — Dispatch a request
* [Yaf\_Dispatcher::enableView](yaf-dispatcher.enableview) — Enable view rendering
* [Yaf\_Dispatcher::flushInstantly](yaf-dispatcher.flushinstantly) — Switch on/off the instant flushing
* [Yaf\_Dispatcher::getApplication](yaf-dispatcher.getapplication) — Retrieve the application
* [Yaf\_Dispatcher::getDefaultAction](yaf-dispatcher.getdefaultaction) — Retrive the default action name
* [Yaf\_Dispatcher::getDefaultController](yaf-dispatcher.getdefaultcontroller) — Retrive the default controller name
* [Yaf\_Dispatcher::getDefaultModule](yaf-dispatcher.getdefaultmodule) — Retrive the default module name
* [Yaf\_Dispatcher::getInstance](yaf-dispatcher.getinstance) — Retrive the dispatcher instance
* [Yaf\_Dispatcher::getRequest](yaf-dispatcher.getrequest) — Retrive the request instance
* [Yaf\_Dispatcher::getRouter](yaf-dispatcher.getrouter) — Retrive router instance
* [Yaf\_Dispatcher::initView](yaf-dispatcher.initview) — Initialize view and return it
* [Yaf\_Dispatcher::registerPlugin](yaf-dispatcher.registerplugin) — Register a plugin
* [Yaf\_Dispatcher::returnResponse](yaf-dispatcher.returnresponse) — The returnResponse purpose
* [Yaf\_Dispatcher::setDefaultAction](yaf-dispatcher.setdefaultaction) — Change default action name
* [Yaf\_Dispatcher::setDefaultController](yaf-dispatcher.setdefaultcontroller) — Change default controller name
* [Yaf\_Dispatcher::setDefaultModule](yaf-dispatcher.setdefaultmodule) — Change default module name
* [Yaf\_Dispatcher::setErrorHandler](yaf-dispatcher.seterrorhandler) — Set error handler
* [Yaf\_Dispatcher::setRequest](yaf-dispatcher.setrequest) — The setRequest purpose
* [Yaf\_Dispatcher::setView](yaf-dispatcher.setview) — Set a custom view engine
* [Yaf\_Dispatcher::throwException](yaf-dispatcher.throwexception) — Switch on/off exception throwing
php socket_export_stream socket\_export\_stream
======================
(PHP 7 >= 7.0.7, PHP 8)
socket\_export\_stream — Export a socket into a stream that encapsulates a socket
### Description
```
socket_export_stream(Socket $socket): resource|false
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`socket`
### Return Values
Return resource or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `socket` is a [Socket](class.socket) instance now; previously, it was a resource. |
php IntlDateFormatter::isLenient IntlDateFormatter::isLenient
============================
datefmt\_is\_lenient
====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
IntlDateFormatter::isLenient -- datefmt\_is\_lenient — Get the lenient used for the IntlDateFormatter
### Description
Object-oriented style
```
public IntlDateFormatter::isLenient(): bool
```
Procedural style
```
datefmt_is_lenient(IntlDateFormatter $formatter): bool
```
Check if the parser is strict or lenient in interpreting inputs that do not match the pattern exactly.
### Parameters
`formatter`
The formatter resource.
### Return Values
**`true`** if parser is lenient, **`false`** if parser is strict. By default the parser is lenient.
### Examples
**Example #1 **datefmt\_is\_lenient()** example**
```
<?php
$fmt = datefmt_create(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN,
'dd/mm/yyyy'
);
echo 'lenient of the formatter is : ';
if ($fmt->isLenient()) {
echo 'TRUE';
} else {
echo 'FALSE';
}
datefmt_parse($fmt, '35/13/1971');
echo "\n Trying to do parse('35/13/1971').\nResult is : " . datefmt_parse($fmt, '35/13/1971');
if (intl_get_error_code() != 0) {
echo "\nError_msg is : " . intl_get_error_message();
echo "\nError_code is : " . intl_get_error_code();
}
datefmt_set_lenient($fmt,false);
echo 'Now lenient of the formatter is : ';
if ($fmt->isLenient()) {
echo 'TRUE';
} else {
echo 'FALSE';
}
datefmt_parse($fmt, '35/13/1971');
echo "\n Trying to do parse('35/13/1971').Result is : " . datefmt_parse($fmt, '35/13/1971');
if (intl_get_error_code() != 0) {
echo "\nError_msg is : " . intl_get_error_message();
echo "\nError_code is : " . intl_get_error_code();
}
?>
```
**Example #2 OO example**
```
<?php
$fmt = new IntlDateFormatter(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN,
"dd/mm/yyyy"
);
echo "lenient of the formatter is : ";
if ($fmt->isLenient()) {
echo 'TRUE';
} else {
echo 'FALSE';
}
$fmt->parse('35/13/1971');
echo "\n Trying to do parse('35/13/1971').\nResult is : " . $fmt->parse('35/13/1971');
if (intl_get_error_code() != 0){
echo "\nError_msg is : " . intl_get_error_message();
echo "\nError_code is : " . intl_get_error_code();
}
$fmt->setLenient(FALSE);
echo 'Now lenient of the formatter is : ';
if ($fmt->isLenient()) {
echo 'TRUE';
} else {
echo 'FALSE';
}
$fmt->parse('35/13/1971');
echo "\n Trying to do parse('35/13/1971').\nResult is : " . $fmt->parse('35/13/1971');
if (intl_get_error_code() != 0) {
echo "\nError_msg is : " . intl_get_error_message();
echo "\nError_code is : " . intl_get_error_code();
}
?>
```
The above example will output:
```
lenient of the formatter is : TRUE
Trying to do parse('35/13/1971').
Result is : -2147483
Now lenient of the formatter is : FALSE
Trying to do parse('35/13/1971').
Result is :
Error_msg is : Date parsing failed: U_PARSE_ERROR
Error_code is : 9
```
### See Also
* [datefmt\_set\_lenient()](intldateformatter.setlenient) - Set the leniency of the parser
* [datefmt\_create()](intldateformatter.create) - Create a date formatter
php IntlChar::getFC_NFKC_Closure IntlChar::getFC\_NFKC\_Closure
==============================
(PHP 7, PHP 8)
IntlChar::getFC\_NFKC\_Closure — Get the FC\_NFKC\_Closure property for a code point
### Description
```
public static IntlChar::getFC_NFKC_Closure(int|string $codepoint): string|false|null
```
Gets the FC\_NFKC\_Closure property string for a character.
### 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 the FC\_NFKC\_Closure property string for the `codepoint`, or an empty string if there is none. Returns **`null`** or **`false`** on failure.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::getFC_NFKC_Closure("\u{2121}"));
var_dump(IntlChar::getFC_NFKC_Closure("\u{1D2D}"));
?>
```
The above example will output:
```
string(3) "tel"
string(2) "æ"
```
php The EvEmbed class
The EvEmbed class
=================
Introduction
------------
(PECL ev >= 0.2.0)
Used to embed one event loop into another.
Class synopsis
--------------
class **EvEmbed** extends [EvWatcher](class.evwatcher) { /\* Properties \*/ public [$embed](class.evembed#evembed.props.embed); /\* Methods \*/ public [\_\_construct](evembed.construct)(
object `$other` ,
[callable](language.types.callable) `$callback` = ?,
[mixed](language.types.declarations#language.types.declarations.mixed) `$data` = ?,
int `$priority` = ?
)
```
final public static createStopped(
object $other ,
callable $callback = ?,
mixed $data = ?,
int $priority = ?
): void
```
```
public set( object $other ): void
```
```
public sweep(): void
```
/\* 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
```
} Properties
----------
is\_active data is\_pending priority embed Table of Contents
-----------------
* [EvEmbed::\_\_construct](evembed.construct) — Constructs the EvEmbed object
* [EvEmbed::createStopped](evembed.createstopped) — Create stopped EvEmbed watcher object
* [EvEmbed::set](evembed.set) — Configures the watcher
* [EvEmbed::sweep](evembed.sweep) — Make a single, non-blocking sweep over the embedded loop
php The ZookeeperAuthenticationException class
The ZookeeperAuthenticationException class
==========================================
Introduction
------------
(PECL zookeeper >= 0.3.0)
The ZooKeeper authentication exception handling class.
Class synopsis
--------------
class **ZookeeperAuthenticationException** 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 Anonymous classes
-----------------
Anonymous classes are useful when simple, one-off objects need to be created.
```
<?php
// Using an explicit class
class Logger
{
public function log($msg)
{
echo $msg;
}
}
$util->setLogger(new Logger());
// Using an anonymous class
$util->setLogger(new class {
public function log($msg)
{
echo $msg;
}
});
```
They can pass arguments through to their constructors, extend other classes, implement interfaces, and use traits just like a normal class can:
```
<?php
class SomeClass {}
interface SomeInterface {}
trait SomeTrait {}
var_dump(new class(10) extends SomeClass implements SomeInterface {
private $num;
public function __construct($num)
{
$this->num = $num;
}
use SomeTrait;
});
```
The above example will output:
```
object(class@anonymous)#1 (1) {
["Command line code0x104c5b612":"class@anonymous":private]=>
int(10)
}
```
Nesting an anonymous class within another class does not give it access to any private or protected methods or properties of that outer class. In order to use the outer class' protected properties or methods, the anonymous class can extend the outer class. To use the private properties of the outer class in the anonymous class, they must be passed through its constructor:
```
<?php
class Outer
{
private $prop = 1;
protected $prop2 = 2;
protected function func1()
{
return 3;
}
public function func2()
{
return new class($this->prop) extends Outer {
private $prop3;
public function __construct($prop)
{
$this->prop3 = $prop;
}
public function func3()
{
return $this->prop2 + $this->prop3 + $this->func1();
}
};
}
}
echo (new Outer)->func2()->func3();
```
The above example will output:
```
6
```
All objects created by the same anonymous class declaration are instances of that very class.
```
<?php
function anonymous_class()
{
return new class {};
}
if (get_class(anonymous_class()) === get_class(anonymous_class())) {
echo 'same class';
} else {
echo 'different class';
}
```
The above example will output:
```
same class
```
>
> **Note**:
>
>
> Note that anonymous classes are assigned a name by the engine, as demonstrated in the following example. This name has to be regarded an implementation detail, which should not be relied upon.
>
>
> ```
> <?php
> echo get_class(new class {});
> ```
> The above example will output something similar to:
>
>
> ```
>
> class@anonymous/in/oNi1A0x7f8636ad2021
>
> ```
>
php SoapServer::addFunction SoapServer::addFunction
=======================
(PHP 5, PHP 7, PHP 8)
SoapServer::addFunction — Adds one or more functions to handle SOAP requests
### Description
```
public SoapServer::addFunction(array|string|int $functions): void
```
Exports one or more functions for remote clients
### Parameters
`functions`
To export one function, pass the function name into this parameter as a string.
To export several functions, pass an array of function names.
To export all the functions, pass a special constant **`SOAP_FUNCTIONS_ALL`**.
>
> **Note**:
>
>
> `functions` must receive all input arguments in the same order as defined in the WSDL file (They should not receive any output parameters as arguments) and return one or more values. To return several values they must return an array with named output parameters.
>
>
### Return Values
No value is returned.
### Examples
**Example #1 **SoapServer::addFunction()** example**
```
<?php
function echoString($inputString)
{
return $inputString;
}
$server->addFunction("echoString");
function echoTwoStrings($inputString1, $inputString2)
{
return array("outputString1" => $inputString1,
"outputString2" => $inputString2);
}
$server->addFunction(array("echoString", "echoTwoStrings"));
$server->addFunction(SOAP_FUNCTIONS_ALL);
?>
```
### See Also
* [SoapServer::\_\_construct()](soapserver.construct) - SoapServer constructor
* [SoapServer::setClass()](soapserver.setclass) - Sets the class which handles SOAP requests
php acos acos
====
(PHP 4, PHP 5, PHP 7, PHP 8)
acos — Arc cosine
### Description
```
acos(float $num): float
```
Returns the arc cosine of `num` in radians. **acos()** is the inverse function of [cos()](function.cos), which means that `a==cos(acos(a))` for every value of a that is within **acos()**' range.
### Parameters
`num`
The argument to process
### Return Values
The arc cosine of `num` in radians.
### See Also
* [cos()](function.cos) - Cosine
* [acosh()](function.acosh) - Inverse hyperbolic cosine
* [asin()](function.asin) - Arc sine
* [atan()](function.atan) - Arc tangent
php ImagickDraw::setTextAntialias ImagickDraw::setTextAntialias
=============================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setTextAntialias — Controls whether text is antialiased
### Description
```
public ImagickDraw::setTextAntialias(bool $antiAlias): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Controls whether text is antialiased. Text is antialiased by default.
### Parameters
`antiAlias`
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::setTextAntialias()** example**
```
<?php
function setTextAntialias($fillColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeColor('none');
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(1);
$draw->setFontSize(32);
$draw->setTextAntialias(false);
$draw->annotation(5, 30, "Lorem Ipsum!");
$draw->setTextAntialias(true);
$draw->annotation(5, 65, "Lorem Ipsum!");
$imagick = new \Imagick();
$imagick->newImage(220, 80, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
//Scale the image so that people can see the aliasing.
$imagick->scaleImage(220 * 6, 80 * 6);
$imagick->cropImage(640, 480, 0, 0);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
| programming_docs |
php get_called_class get\_called\_class
==================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
get\_called\_class — The "Late Static Binding" class name
### Description
```
get_called_class(): string
```
Gets the name of the class the static method is called in.
### Parameters
This function has no parameters.
### Return Values
Returns the class name. Returns **`false`** if called from outside a class.
### Examples
**Example #1 Using **get\_called\_class()****
```
<?php
class foo {
static public function test() {
var_dump(get_called_class());
}
}
class bar extends foo {
}
foo::test();
bar::test();
?>
```
The above example will output:
```
string(3) "foo"
string(3) "bar"
```
### See Also
* [get\_parent\_class()](function.get-parent-class) - Retrieves the parent class name for object or class
* [get\_class()](function.get-class) - Returns the name of the class of an object
* [is\_subclass\_of()](function.is-subclass-of) - Checks if the object has this class as one of its parents or implements it
php Imagick::getImageColormapColor Imagick::getImageColormapColor
==============================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageColormapColor — Returns the color of the specified colormap index
### Description
```
public Imagick::getImageColormapColor(int $index): ImagickPixel
```
Returns the color of the specified colormap index.
### Parameters
`index`
The offset into the image colormap.
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
php Generator::next Generator::next
===============
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
Generator::next — Resume execution of the generator
### Description
```
public Generator::next(): void
```
Calling **Generator::next()** has the same effect as calling [Generator::send()](generator.send) with **`null`** as argument.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php SolrObject::__construct SolrObject::\_\_construct
=========================
(PECL solr >= 0.9.2)
SolrObject::\_\_construct — Creates Solr object
### Description
public **SolrObject::\_\_construct**() Creates Solr object.
### Parameters
This function has no parameters.
### Return Values
None
### Examples
**Example #1 **SolrObject::\_\_construct()** example**
```
<?php
/* ... */
?>
```
The above example will output something similar to:
```
...
```
php EventBufferEvent::sslRenegotiate EventBufferEvent::sslRenegotiate
================================
(PECL event >= 1.2.6-beta)
EventBufferEvent::sslRenegotiate — Tells a bufferevent to begin SSL renegotiation
### Description
```
public EventBufferEvent::sslRenegotiate(): void
```
Tells a bufferevent to begin SSL renegotiation.
**Warning** Calling this function tells the SSL to renegotiate, and the buffer event to invoke appropriate callbacks. This is an advanced topic; this should be generally avoided unless one really knows what he/she does, especially since many SSL versions have had known security issues related to renegotiation.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php posix_getpwuid posix\_getpwuid
===============
(PHP 4, PHP 5, PHP 7, PHP 8)
posix\_getpwuid — Return info about a user by user id
### Description
```
posix_getpwuid(int $user_id): array|false
```
Returns an array of information about the user referenced by the given user ID.
### Parameters
`user_id`
The user identifier.
### Return Values
Returns an associative array with the following elements:
**The user information array**| Element | Description |
| --- | --- |
| name | The name element contains the username of the user. This is a short, usually less than 16 character "handle" of the user, not the real, full name. |
| passwd | The passwd element contains the user's password in an encrypted format. Often, for example on a system employing "shadow" passwords, an asterisk is returned instead. |
| uid | User ID, should be the same as the `user_id` parameter used when calling the function, and hence redundant. |
| gid | The group ID of the user. Use the function [posix\_getgrgid()](function.posix-getgrgid) to resolve the group name and a list of its members. |
| gecos | GECOS is an obsolete term that refers to the finger information field on a Honeywell batch processing system. The field, however, lives on, and its contents have been formalized by POSIX. The field contains a comma separated list containing the user's full name, office phone, office number, and home phone number. On most systems, only the user's full name is available. |
| dir | This element contains the absolute path to the home directory of the user. |
| shell | The shell element contains the absolute path to the executable of the user's default shell. |
The function returns **`false`** on failure. ### Examples
**Example #1 Example use of **posix\_getpwuid()****
```
<?php
$userinfo = posix_getpwuid(10000);
print_r($userinfo);
?>
```
The above example will output something similar to:
```
Array
(
[name] => tom
[passwd] => x
[uid] => 10000
[gid] => 42
[gecos] => "tom,,,"
[dir] => "/home/tom"
[shell] => "/bin/bash"
)
```
### See Also
* [posix\_getpwnam()](function.posix-getpwnam) - Return info about a user by username
* POSIX man page GETPWNAM(3)
php Yaf_Config_Ini::key Yaf\_Config\_Ini::key
=====================
(Yaf >=1.0.0)
Yaf\_Config\_Ini::key — Fetch current element's key
### Description
```
public Yaf_Config_Ini::key(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php mcrypt_list_algorithms mcrypt\_list\_algorithms
========================
(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mcrypt\_list\_algorithms — Gets an array of all supported ciphers
**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_list_algorithms(string $lib_dir = ini_get("mcrypt.algorithms_dir")): array
```
Gets the list of all supported algorithms in the `lib_dir` parameter.
### Parameters
`lib_dir`
Specifies the directory where all algorithms are located. If not specified, the value of the `mcrypt.algorithms_dir` php.ini directive is used.
### Return Values
Returns an array with all the supported algorithms.
### Examples
**Example #1 **mcrypt\_list\_algorithms()** Example**
```
<?php
$algorithms = mcrypt_list_algorithms();
print_r($algorithms);
?>
```
The above example will output something similar to:
```
Array
(
[0] => cast-128
[1] => gost
[2] => rijndael-128
[3] => twofish
[4] => arcfour
[5] => cast-256
[6] => loki97
[7] => rijndael-192
[8] => saferplus
[9] => wake
[10] => blowfish-compat
[11] => des
[12] => rijndael-256
[13] => serpent
[14] => xtea
[15] => blowfish
[16] => enigma
[17] => rc2
[18] => tripledes
)
```
php PDOStatement::getColumnMeta PDOStatement::getColumnMeta
===========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.2.0)
PDOStatement::getColumnMeta — Returns metadata for a column in a result set
### Description
```
public PDOStatement::getColumnMeta(int $column): array|false
```
Retrieves the metadata for a 0-indexed column in a result set as an associative array.
**Warning** Some drivers may not implement **PDOStatement::getColumnMeta()**, as it is optional. However, all [PDO drivers](https://www.php.net/manual/en/pdo.drivers.php) documented in the manual implement this function.
### Parameters
`column`
The 0-indexed column in the result set.
### Return Values
Returns an associative array containing the following values representing the metadata for a single column:
**Column metadata** | Name | Value |
| --- | --- |
| `native_type` | The PHP native type used to represent the column value. |
| `driver:decl_type` | The SQL type used to represent the column value in the database. If the column in the result set is the result of a function, this value is not returned by **PDOStatement::getColumnMeta()**. |
| `flags` | Any flags set for this column. |
| `name` | The name of this column as returned by the database. |
| `table` | The name of this column's table as returned by the database. |
| `len` | The length of this column. Normally `-1` for types other than floating point decimals. |
| `precision` | The numeric precision of this column. Normally `0` for types other than floating point decimals. |
| `pdo_type` | The type of this column as represented by the [`PDO::PARAM_*` constants](https://www.php.net/manual/en/pdo.constants.php). |
Returns **`false`** if the requested column does not exist in the result set, or if no result set exists.
### Examples
**Example #1 Retrieving column metadata**
The following example shows the results of retrieving the metadata for a single column generated by a function (COUNT) in a PDO\_SQLITE driver.
```
<?php
$select = $DB->query('SELECT COUNT(*) FROM fruit');
$meta = $select->getColumnMeta(0);
var_dump($meta);
?>
```
The above example will output:
```
array(6) {
["native_type"]=>
string(7) "integer"
["flags"]=>
array(0) {
}
["name"]=>
string(8) "COUNT(*)"
["len"]=>
int(-1)
["precision"]=>
int(0)
["pdo_type"]=>
int(2)
}
```
### See Also
* [PDOStatement::columnCount()](pdostatement.columncount) - Returns the number of columns in the result set
* [PDOStatement::rowCount()](pdostatement.rowcount) - Returns the number of rows affected by the last SQL statement
php is_a is\_a
=====
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
is\_a — Checks if the object is of this object type or has this object type as one of its parents
### Description
```
is_a(mixed $object_or_class, string $class, bool $allow_string = false): bool
```
Checks if the given `object_or_class` is of this object type or has this class as one of its parents.
### Parameters
`object_or_class`
A class name or an object instance.
`class`
The class name
`allow_string`
If this parameter set to **`false`**, string class name as `object_or_class` is not allowed. This also prevents from calling autoloader if the class doesn't exist.
### Return Values
Returns **`true`** if the object is of this class or has this class as one of its parents, **`false`** otherwise.
### Examples
**Example #1 **is\_a()** example**
```
<?php
// define a class
class WidgetFactory
{
var $oink = 'moo';
}
// create a new object
$WF = new WidgetFactory();
if (is_a($WF, 'WidgetFactory')) {
echo "yes, \$WF is still a WidgetFactory\n";
}
?>
```
**Example #2 Using the *instanceof* operator**
```
<?php
if ($WF instanceof WidgetFactory) {
echo 'Yes, $WF is a WidgetFactory';
}
?>
```
### See Also
* [get\_class()](function.get-class) - Returns the name of the class of an object
* [get\_parent\_class()](function.get-parent-class) - Retrieves the parent class name for object or class
* [is\_subclass\_of()](function.is-subclass-of) - Checks if the object has this class as one of its parents or implements it
php svn_fs_apply_text svn\_fs\_apply\_text
====================
(PECL svn >= 0.2.0)
svn\_fs\_apply\_text — Creates and returns a stream that will be used to replace
### Description
```
svn_fs_apply_text(resource $root, string $path): resource
```
**Warning**This function is currently not documented; only its argument list is available.
Creates and returns a stream that will be used to replace
### 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 openal_buffer_destroy openal\_buffer\_destroy
=======================
(PECL openal >= 0.1.0)
openal\_buffer\_destroy — Destroys an OpenAL buffer
### Description
```
openal_buffer_destroy(resource $buffer): bool
```
### Parameters
`buffer`
An [Open AL(Buffer)](https://www.php.net/manual/en/openal.resources.php) resource (previously created by [openal\_buffer\_create()](function.openal-buffer-create)).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [openal\_buffer\_create()](function.openal-buffer-create) - Generate OpenAL buffer
php IntlRuleBasedBreakIterator::getBinaryRules IntlRuleBasedBreakIterator::getBinaryRules
==========================================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlRuleBasedBreakIterator::getBinaryRules — Get the binary form of compiled rules
### Description
```
public IntlRuleBasedBreakIterator::getBinaryRules(): string|false
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php gzfile gzfile
======
(PHP 4, PHP 5, PHP 7, PHP 8)
gzfile — Read entire gz-file into an array
### Description
```
gzfile(string $filename, int $use_include_path = 0): array|false
```
This function is identical to [readgzfile()](function.readgzfile), except that it returns the file in an array.
### Parameters
`filename`
The file name.
`use_include_path`
You can set this optional parameter to `1`, 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.
### Return Values
An array containing the file, one line per cell, empty lines included, and with newlines still attached, or **`false`** on failure.
### Examples
**Example #1 **gzfile()** example**
```
<?php
$lines = gzfile('somefile.gz');
foreach ($lines as $line) {
echo $line;
}
?>
```
### See Also
* [readgzfile()](function.readgzfile) - Output a gz-file
* [gzopen()](function.gzopen) - Open gz-file
php QuickHashIntSet::loadFromString QuickHashIntSet::loadFromString
===============================
(PECL quickhash >= Unknown)
QuickHashIntSet::loadFromString — This factory method creates a set from a string
### Description
```
public static QuickHashIntSet::loadFromString(string $contents, int $size = ?, int $options = ?): QuickHashIntSet
```
This factory method creates a new set from a definition in a string. The file format consists of 32 bit signed integers packed together in the Endianness that the system that the code runs on uses.
### Parameters
`contents`
The string containing a serialized format of the set.
`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 automatically limited from `64` to `4194304`.
### Return Values
Returns a new [QuickHashIntSet](class.quickhashintset).
### Examples
**Example #1 **QuickHashIntSet::loadFromString()** example**
```
<?php
$contents = file_get_contents( dirname( __FILE__ ) . "/simple.set" );
$set = QuickHashIntSet::loadFromString(
$contents,
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 SolrDocument::deleteField SolrDocument::deleteField
=========================
(PECL solr >= 0.9.2)
SolrDocument::deleteField — Removes a field from the document
### Description
```
public SolrDocument::deleteField(string $fieldName): bool
```
Removes a field from the document.
### Parameters
`fieldName`
Name of the field
### Return Values
Returns **`true`** on success or **`false`** on failure.
php Imagick::flipImage Imagick::flipImage
==================
(PECL imagick 2, PECL imagick 3)
Imagick::flipImage — Creates a vertical mirror image
### Description
```
public Imagick::flipImage(): bool
```
Creates a vertical mirror image by reflecting the pixels around the central x-axis.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::flipImage()****
```
<?php
function flipImage($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->flipImage();
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
### See Also
* [Imagick::flopimage()](imagick.flopimage) - Creates a horizontal mirror image
php Yaf_Config_Simple::readonly Yaf\_Config\_Simple::readonly
=============================
(Yaf >=1.0.0)
Yaf\_Config\_Simple::readonly — The readonly purpose
### Description
```
public Yaf_Config_Simple::readonly(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php session_reset session\_reset
==============
(PHP 5 >= 5.6.0, PHP 7, PHP 8)
session\_reset — Re-initialize session array with original values
### Description
```
session_reset(): bool
```
**session\_reset()** reinitializes a session with original values stored in session storage. This function requires an active session and discards changes in $\_SESSION.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 7.2.0 | The return type of this function is bool now. Formerly, it has been void. |
### See Also
* [$\_SESSION](reserved.variables.session)
* The [session.auto\_start](https://www.php.net/manual/en/session.configuration.php#ini.session.auto-start) configuration directive
* [session\_start()](function.session-start) - Start new or resume existing session
* [session\_abort()](function.session-abort) - Discard session array changes and finish session
* [session\_commit()](function.session-commit) - Alias of session\_write\_close
php curl_multi_errno curl\_multi\_errno
==================
(PHP 7 >= 7.1.0, PHP 8)
curl\_multi\_errno — Return the last multi curl error number
### Description
```
curl_multi_errno(CurlMultiHandle $multi_handle): int
```
Return an integer containing the last multi curl error number.
### Parameters
`multi_handle` A cURL multi handle returned by [curl\_multi\_init()](function.curl-multi-init).
### Return Values
Return an integer containing the last multi curl error number.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | The function no longer returns **`false`** on failure. |
| 8.0.0 | `multi_handle` expects a [CurlMultiHandle](class.curlmultihandle) instance now; previously, a resource was expected. |
### See Also
* [curl\_errno()](function.curl-errno) - Return the last error number
| programming_docs |
php The Deque class
The Deque class
===============
Introduction
------------
(No version information available, might only be in Git)
A Deque (pronounced “deck”) is a sequence of values in a contiguous buffer that grows and shrinks automatically. The name is a common abbreviation of “double-ended queue” and is used internally by **Ds\Queue**.
Two pointers are used to keep track of a head and a tail. The pointers can “wrap around” the end of the buffer, which avoids the need to move other values around to make room. This makes shift and unshift very fast — something a **Ds\Vector** can’t compete with.
Accessing a value by index requires a translation between the index and its corresponding position in the buffer: `((head + position) % capacity)`.
Strengths
---------
* Supports array syntax (square brackets).
* Uses less overall memory than an array for the same number of values.
* Automatically frees allocated memory when its size drops low enough.
* **get()**, **set()**, **push()**, **pop()**, **shift()**, and **unshift()** are all O(1).
Weaknesses
----------
* Capacity must be a power of 2.
* **insert()** and **remove()** are O(n).
Class synopsis
--------------
class **Ds\Deque** implements **Ds\Sequence**, [ArrayAccess](class.arrayaccess) { /\* Constants \*/ const int [MIN\_CAPACITY](class.ds-deque#ds-deque.constants.min-capacity) = 8; /\* Methods \*/
```
public allocate(int $capacity): void
```
```
public apply(callable $callback): void
```
```
public capacity(): int
```
```
public clear(): void
```
```
public contains(mixed ...$values): bool
```
```
public copy(): Ds\Deque
```
```
public filter(callable $callback = ?): Ds\Deque
```
```
public find(mixed $value): mixed
```
```
public first(): mixed
```
```
public get(int $index): mixed
```
```
public insert(int $index, mixed ...$values): void
```
```
public isEmpty(): bool
```
```
public join(string $glue = ?): string
```
```
public last(): mixed
```
```
public map(callable $callback): Ds\Deque
```
```
public merge(mixed $values): Ds\Deque
```
```
public pop(): mixed
```
```
public push(mixed ...$values): void
```
```
public reduce(callable $callback, mixed $initial = ?): mixed
```
```
public remove(int $index): mixed
```
```
public reverse(): void
```
```
public reversed(): Ds\Deque
```
```
public rotate(int $rotations): void
```
```
public set(int $index, mixed $value): void
```
```
public shift(): mixed
```
```
public slice(int $index, int $length = ?): Ds\Deque
```
```
public sort(callable $comparator = ?): void
```
```
public sorted(callable $comparator = ?): Ds\Deque
```
```
public sum(): int|float
```
```
public toArray(): array
```
```
public unshift(mixed $values = ?): void
```
} Predefined Constants
--------------------
**`Ds\Deque::MIN_CAPACITY`** Changelog
---------
| Version | Description |
| --- | --- |
| PECL ds 1.3.0 | The class now implements [ArrayAccess](class.arrayaccess). |
Table of Contents
-----------------
* [Ds\Deque::allocate](ds-deque.allocate) — Allocates enough memory for a required capacity
* [Ds\Deque::apply](ds-deque.apply) — Updates all values by applying a callback function to each value
* [Ds\Deque::capacity](ds-deque.capacity) — Returns the current capacity
* [Ds\Deque::clear](ds-deque.clear) — Removes all values from the deque
* [Ds\Deque::\_\_construct](ds-deque.construct) — Creates a new instance
* [Ds\Deque::contains](ds-deque.contains) — Determines if the deque contains given values
* [Ds\Deque::copy](ds-deque.copy) — Returns a shallow copy of the deque
* [Ds\Deque::count](ds-deque.count) — Returns the number of values in the collection
* [Ds\Deque::filter](ds-deque.filter) — Creates a new deque using a callable to determine which values to include
* [Ds\Deque::find](ds-deque.find) — Attempts to find a value's index
* [Ds\Deque::first](ds-deque.first) — Returns the first value in the deque
* [Ds\Deque::get](ds-deque.get) — Returns the value at a given index
* [Ds\Deque::insert](ds-deque.insert) — Inserts values at a given index
* [Ds\Deque::isEmpty](ds-deque.isempty) — Returns whether the deque is empty
* [Ds\Deque::join](ds-deque.join) — Joins all values together as a string
* [Ds\Deque::jsonSerialize](ds-deque.jsonserialize) — Returns a representation that can be converted to JSON
* [Ds\Deque::last](ds-deque.last) — Returns the last value
* [Ds\Deque::map](ds-deque.map) — Returns the result of applying a callback to each value
* [Ds\Deque::merge](ds-deque.merge) — Returns the result of adding all given values to the deque
* [Ds\Deque::pop](ds-deque.pop) — Removes and returns the last value
* [Ds\Deque::push](ds-deque.push) — Adds values to the end of the deque
* [Ds\Deque::reduce](ds-deque.reduce) — Reduces the deque to a single value using a callback function
* [Ds\Deque::remove](ds-deque.remove) — Removes and returns a value by index
* [Ds\Deque::reverse](ds-deque.reverse) — Reverses the deque in-place
* [Ds\Deque::reversed](ds-deque.reversed) — Returns a reversed copy
* [Ds\Deque::rotate](ds-deque.rotate) — Rotates the deque by a given number of rotations
* [Ds\Deque::set](ds-deque.set) — Updates a value at a given index
* [Ds\Deque::shift](ds-deque.shift) — Removes and returns the first value
* [Ds\Deque::slice](ds-deque.slice) — Returns a sub-deque of a given range
* [Ds\Deque::sort](ds-deque.sort) — Sorts the deque in-place
* [Ds\Deque::sorted](ds-deque.sorted) — Returns a sorted copy
* [Ds\Deque::sum](ds-deque.sum) — Returns the sum of all values in the deque
* [Ds\Deque::toArray](ds-deque.toarray) — Converts the deque to an array
* [Ds\Deque::unshift](ds-deque.unshift) — Adds values to the front of the deque
php SoapClient::__setSoapHeaders SoapClient::\_\_setSoapHeaders
==============================
(PHP 5 >= 5.0.5, PHP 7, PHP 8)
SoapClient::\_\_setSoapHeaders — Sets SOAP headers for subsequent calls
### Description
```
public SoapClient::__setSoapHeaders(SoapHeader|array|null $headers = null): bool
```
Defines headers to be sent along with the SOAP requests.
>
> **Note**:
>
>
> Calling this method will replace any previous values.
>
>
### Parameters
`headers`
The headers to be set. It could be [SoapHeader](class.soapheader) object or array of [SoapHeader](class.soapheader) objects. If not specified or set to **`null`**, the headers will be deleted.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **SoapClient::\_\_setSoapHeaders()** example**
```
<?php
$client = new SoapClient(null, array('location' => "http://localhost/soap.php",
'uri' => "http://test-uri/"));
$header = new SoapHeader('http://soapinterop.org/echoheader/',
'echoMeStringRequest',
'hello world');
$client->__setSoapHeaders($header);
$client->__soapCall("echoVoid", null);
?>
```
**Example #2 Set Multiple Headers**
```
<?php
$client = new SoapClient(null, array('location' => "http://localhost/soap.php",
'uri' => "http://test-uri/"));
$headers = array();
$headers[] = new SoapHeader('http://soapinterop.org/echoheader/',
'echoMeStringRequest',
'hello world');
$headers[] = new SoapHeader('http://soapinterop.org/echoheader/',
'echoMeStringRequest',
'hello world again');
$client->__setSoapHeaders($headers);
$client->__soapCall("echoVoid", null);
?>
```
php The Yaf_Loader class
The Yaf\_Loader class
=====================
Introduction
------------
(Yaf >=1.0.0)
**Yaf\_Loader** introduces a comprehensive autoloading solution for Yaf.
The first time an instance of [Yaf\_Application](class.yaf-application) is retrieved, **Yaf\_Loader** will instance a singleton, and registers itself with spl\_autoload. You retrieve an instance using the [Yaf\_Loader::getInstance()](yaf-loader.getinstance)
**Yaf\_Loader** attempt to load a class only one shot, if failed, depend on [yaf.use\_spl\_auload](https://www.php.net/manual/en/yaf.configuration.php#ini.yaf.use-spl-autoload), if this config is On [Yaf\_Loader::autoload()](yaf-loader.autoload) will return **`false`**, thus give the chance to other autoload function. if it is Off (by default), [Yaf\_Loader::autoload()](yaf-loader.autoload) will return **`true`**, and more important is that a very useful warning will be triggered (very useful to find out why a class could not be loaded).
>
> **Note**:
>
>
> Please keep yaf.use\_spl\_autoload Off unless there is some library have their own autoload mechanism and impossible to rewrite it.
>
>
By default, **Yaf\_Loader** assume all library (class defined script) store in the [global library directory](https://www.php.net/manual/en/yaf.configuration.php#ini.yaf.library), which is defined in the php.ini(yaf.library).
If you want **Yaf\_Loader** search some classes(libraries) in the [local class directory](class.yaf-loader#yaf-loader.props.library)(which is defined in application.ini, and by default, it is [application.directory](https://www.php.net/manual/en/yaf.appconfig.php#configuration.yaf.directory) . "/library"), you should register the class prefix using the [Yaf\_Loader::registerLocalNameSpace()](yaf-loader.registerlocalnamespace)
Let's see some examples(assuming APPLICATION\_PATH is [application.directory](https://www.php.net/manual/en/yaf.appconfig.php#configuration.yaf.directory)):
**Example #1 Config example**
```
// Assuming the following configure in php.ini:
yaf.library = "/global_dir"
//Assuming the following configure in application.ini
application.library = APPLICATION_PATH "/library"
```
Assuming the following local name space is registered: **Example #2 Register localnamespace**
```
<?php
class Bootstrap extends Yaf_Bootstrap_Abstract{
public function _initLoader($dispatcher) {
Yaf_Loader::getInstance()->registerLocalNameSpace(array("Foo", "Bar"));
}
?>
```
Then the autoload examples: **Example #3 Load class example**
```
class Foo_Bar_Test =>
// APPLICATION_PATH/library/Foo/Bar/Test.php
class GLO_Name =>
// /global_dir/Glo/Name.php
class BarNon_Test
// /global_dir/Barnon/Test.php
```
**Example #4 Load namespace class example**
```
class \Foo\Bar\Dummy =>
// APPLICATION_PATH/library/Foo/Bar/Dummy.php
class \FooBar\Bar\Dummy =>
// /global_dir/FooBar/Bar/Dummy.php
```
You may noticed that all the folder with the first letter capitalized, you can make them lowercase by set [yaf.lowcase\_path](https://www.php.net/manual/en/yaf.configuration.php#ini.yaf.lowcase-path) = On in php.ini
**Yaf\_Loader** is also designed to load the MVC classes, and the rule is:
**Example #5 MVC class loading example**
```
Controller Classes =>
// APPLICATION_PATH/controllers/
Model Classes =>
// APPLICATION_PATH/models/
Plugin Classes =>
// APPLICATION_PATH/plugins/
```
Yaf identify a class's suffix(this is by default, you can also change to the prefix by change the configure [yaf.name\_suffix](https://www.php.net/manual/en/yaf.configuration.php#ini.yaf.name-suffix)) to decide whether it is a MVC class: **Example #6 MVC class distinctions**
```
Controller Classes =>
// ***Controller
Model Classes =>
// ***Model
Plugin Classes =>
// ***Plugin
```
some examples: **Example #7 MVC loading example**
```
class IndexController
// APPLICATION_PATH/controllers/Index.php
class DataModel =>
// APPLICATION_PATH/models/Data.php
class DummyPlugin =>
// APPLICATION_PATH/plugins/Dummy.php
class A_B_TestModel =>
// APPLICATION_PATH/models/A/B/Test.php
```
>
> **Note**:
>
>
> As of 2.1.18, Yaf supports Controllers autoloading for user script side, (which means the autoloading triggered by user php script, eg: access a controller static property in Bootstrap or Plugins), but autoloader only try to locate controller class script under the default module folder, which is "APPLICATION\_PATH/controllers/".
>
>
also, the directory will be affected by [yaf.lowcase\_path](https://www.php.net/manual/en/yaf.configuration.php#ini.yaf.lowcase-path). Class synopsis
--------------
class **Yaf\_Loader** { /\* Properties \*/ protected [$\_local\_ns](class.yaf-loader#yaf-loader.props.local-ns);
protected [$\_library](class.yaf-loader#yaf-loader.props.library);
protected [$\_global\_library](class.yaf-loader#yaf-loader.props.global-library);
static [$\_instance](class.yaf-loader#yaf-loader.props.instance); /\* Methods \*/ private [\_\_construct](yaf-loader.construct)()
```
public autoload(): void
```
```
public clearLocalNamespace(): void
```
```
public static getInstance(): void
```
```
public getLibraryPath(bool $is_global = false): Yaf_Loader
```
```
public getLocalNamespace(): void
```
```
public getNamespacePath(string $namespaces): string
```
```
public getNamespaces(): array
```
```
public static import(): void
```
```
public isLocalName(): void
```
```
public registerLocalNamespace(mixed $prefix): void
```
```
public registerNamespace(string|array $namespaces, string $path = ?): bool
```
```
public setLibraryPath(string $directory, bool $is_global = false): Yaf_Loader
```
} Properties
----------
\_local\_ns \_library By default, this value is [application.directory](https://www.php.net/manual/en/yaf.appconfig.php#configuration.yaf.directory) . "/library", you can change this either in the application.ini(application.library) or call to [Yaf\_Loader::setLibraryPath()](yaf-loader.setlibrarypath)
\_global\_library \_instance Table of Contents
-----------------
* [Yaf\_Loader::autoload](yaf-loader.autoload) — The autoload purpose
* [Yaf\_Loader::clearLocalNamespace](yaf-loader.clearlocalnamespace) — The clearLocalNamespace purpose
* [Yaf\_Loader::\_\_construct](yaf-loader.construct) — The \_\_construct purpose
* [Yaf\_Loader::getInstance](yaf-loader.getinstance) — The getInstance purpose
* [Yaf\_Loader::getLibraryPath](yaf-loader.getlibrarypath) — Get the library path
* [Yaf\_Loader::getLocalNamespace](yaf-loader.getlocalnamespace) — The getLocalNamespace purpose
* [Yaf\_Loader::getNamespacePath](yaf-loader.getnamespacepath) — Retieve path of a registered namespace
* [Yaf\_Loader::getLocalNamespace](yaf-loader.getnamespaces) — Retrive all register namespaces info
* [Yaf\_Loader::import](yaf-loader.import) — The import purpose
* [Yaf\_Loader::isLocalName](yaf-loader.islocalname) — The isLocalName purpose
* [Yaf\_Loader::registerLocalNamespace](yaf-loader.registerlocalnamespace) — Register local class prefix
* [Yaf\_Loader::registerNamespace](yaf-loader.registernamespace) — Register namespace with searching path
* [Yaf\_Loader::setLibraryPath](yaf-loader.setlibrarypath) — Change the library path
php ftp_close ftp\_close
==========
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
ftp\_close — Closes an FTP connection
### Description
```
ftp_close(FTP\Connection $ftp): bool
```
**ftp\_close()** closes the given link identifier and releases the resource.
>
> **Note**:
>
>
> After calling this function, you can no longer use the FTP connection and must create a new one with [ftp\_connect()](function.ftp-connect).
>
>
### Parameters
`ftp`
An [FTP\Connection](class.ftp-connection) instance.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### 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\_close()** 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);
// print the current directory
echo ftp_pwd($ftp);
// close this connection
ftp_close($ftp);
?>
```
### See Also
* [ftp\_connect()](function.ftp-connect) - Opens an FTP connection
php ReflectionMethod::__toString ReflectionMethod::\_\_toString
==============================
(PHP 5, PHP 7, PHP 8)
ReflectionMethod::\_\_toString — Returns the string representation of the Reflection method object
### Description
```
public ReflectionMethod::__toString(): string
```
Returns the string representation of the Reflection method object.
### Parameters
This function has no parameters.
### Return Values
A string representation of this [ReflectionMethod](class.reflectionmethod) instance.
### Examples
**Example #1 **ReflectionMethod::\_\_toString()** example**
```
<?php
class HelloWorld {
public function sayHelloTo($name) {
return 'Hello ' . $name;
}
}
$reflectionMethod = new ReflectionMethod(new HelloWorld(), 'sayHelloTo');
echo $reflectionMethod;
?>
```
The above example will output:
```
Method [ <user> public method sayHelloTo ] {
@@ /var/www/examples/reflection.php 16 - 18
- Parameters [1] {
Parameter #0 [ <required> $name ]
}
}
```
### See Also
* [ReflectionMethod::export()](reflectionmethod.export) - Export a reflection method
* [\_\_toString()](language.oop5.magic#object.tostring)
php ibase_name_result ibase\_name\_result
===================
(PHP 5, PHP 7 < 7.4.0)
ibase\_name\_result — Assigns a name to a result set
### Description
```
ibase_name_result(resource $result, string $name): bool
```
This function assigns a name to a result set. This name can be used later in UPDATE|DELETE ... WHERE CURRENT OF `name` statements.
### Parameters
`result`
An InterBase result set.
`name`
The name to be assigned.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **ibase\_name\_result()** example**
```
<?php
$result = ibase_query("SELECT field1,field2 FROM table FOR UPDATE");
ibase_name_result($result, "my_cursor");
$updateqry = ibase_prepare("UPDATE table SET field2 = ? WHERE CURRENT OF my_cursor");
for ($i = 0; ibase_fetch_row($result); ++$i) {
ibase_execute($updateqry, $i);
}
?>
```
### See Also
* [ibase\_prepare()](function.ibase-prepare) - Prepare a query for later binding of parameter placeholders and execution
* [ibase\_execute()](function.ibase-execute) - Execute a previously prepared query
php pg_consume_input pg\_consume\_input
==================
(PHP 5 >= 5.6.0, PHP 7, PHP 8)
pg\_consume\_input — Reads input on the connection
### Description
```
pg_consume_input(PgSql\Connection $connection): bool
```
**pg\_consume\_input()** consumes any input waiting to be read from the database server.
### Parameters
`connection`
An [PgSql\Connection](class.pgsql-connection) instance.
### Return Values
**`true`** if no error occurred, or **`false`** if there was an error. Note that **`true`** does not necessarily indicate that input was waiting to be read.
### 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. |
php realpath realpath
========
(PHP 4, PHP 5, PHP 7, PHP 8)
realpath — Returns canonicalized absolute pathname
### Description
```
realpath(string $path): string|false
```
**realpath()** expands all symbolic links and resolves references to `/./`, `/../` and extra `/` characters in the input `path` and returns the canonicalized absolute pathname.
### Parameters
`path`
The path being checked.
>
> **Note**:
>
>
> Whilst a path must be supplied, the value can be an empty string. In this case, the value is interpreted as the current directory.
>
>
### Return Values
Returns the canonicalized absolute pathname on success. The resulting path will have no symbolic link, `/./` or `/../` components. Trailing delimiters, such as `\` and `/`, are also removed.
**realpath()** returns **`false`** on failure, e.g. if the file does not exist.
>
> **Note**:
>
>
> The running script must have executable permissions on all directories in the hierarchy, otherwise **realpath()** will return **`false`**.
>
>
>
> **Note**:
>
>
> For case-insensitive filesystems **realpath()** may or may not normalize the character case.
>
>
>
> **Note**:
>
>
> The function **realpath()** will not work for a file which is inside a Phar as such path would be a virtual path, not a real one.
>
>
>
> **Note**:
>
>
> On Windows, junctions and symbolic links to directories are only expanded by one level.
>
>
> **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.
>
>
### Examples
**Example #1 **realpath()** example**
```
<?php
chdir('/var/www/');
echo realpath('./../../etc/passwd') . PHP_EOL;
echo realpath('/tmp/') . PHP_EOL;
?>
```
The above example will output:
```
/etc/passwd
/tmp
```
**Example #2 **realpath()** on Windows**
On windows **realpath()** will change unix style paths to windows style.
```
<?php
echo realpath('/windows/system32'), PHP_EOL;
echo realpath('C:\Program Files\\'), PHP_EOL;
?>
```
The above example will output:
```
C:\WINDOWS\System32
C:\Program Files
```
### See Also
* [basename()](function.basename) - Returns trailing name component of path
* [dirname()](function.dirname) - Returns a parent directory's path
* [pathinfo()](function.pathinfo) - Returns information about a file path
| programming_docs |
php uopz_compose uopz\_compose
=============
(PECL uopz 1, PECL uopz 2)
uopz\_compose — Compose a class
**Warning**This function has been *REMOVED* in PECL uopz 5.0.0.
### Description
```
uopz_compose(
string $name,
array $classes,
array $methods = ?,
array $properties = ?,
int $flags = ?
): void
```
Creates a new class of the given name that implements, extends, or uses all of the provided classes
### Parameters
`name`
A legal class name
`classes`
An array of class, interface and trait names
`methods`
An associative array of methods, values are either closures or [modifiers => closure]
`properties`
An associative array of properties, keys are names, values are modifiers
`flags`
Entry type, by default ZEND\_ACC\_CLASS
### Return Values
### Examples
**Example #1 **uopz\_compose()** example**
```
<?php
class myClass {}
trait myTrait {}
interface myInterface {}
uopz_compose(
Composed::class, [
myClass::class,
myTrait::class,
myInterface::class
], [
"__construct" => function() {
/* ... */
}
]);
var_dump(
class_uses(Composed::class),
class_parents(Composed::class),
class_implements(Composed::class));
?>
```
The above example will output:
```
array(1) {
["myTrait"]=>
string(7) "myTrait"
}
array(1) {
["myClass"]=>
string(7) "myClass"
}
array(1) {
["myInterface"]=>
string(11) "myInterface"
}
```
php enchant_broker_request_dict enchant\_broker\_request\_dict
==============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant >= 0.1.0 )
enchant\_broker\_request\_dict — Create a new dictionary using a tag
### Description
```
enchant_broker_request_dict(EnchantBroker $broker, string $tag): EnchantDictionary|false
```
create a new dictionary using tag, the non-empty language tag you wish to request a dictionary for ("en\_US", "de\_DE", ...)
### Parameters
`broker`
An Enchant broker returned by [enchant\_broker\_init()](function.enchant-broker-init).
`tag`
A tag describing the locale, for example en\_US, de\_DE
### Return Values
Returns a dictionary resource on success or **`false`** on failure.
### 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 | On success, this function returns an [EnchantDictionary](class.enchantdictionary) instance now; previoulsy, a [resource](language.types.resource) was retured. |
### Examples
**Example #1 A **enchant\_broker\_request\_dict()** example**
Check if a dictionary exists using [enchant\_broker\_dict\_exists()](function.enchant-broker-dict-exists) and request it.
```
<?php
$tag = 'en_US';
$broker = enchant_broker_init();
if (enchant_broker_dict_exists($broker,$tag)) {
$dict = enchant_broker_request_dict($r, $tag);
}
?>
```
### See Also
* [enchant\_dict\_describe()](function.enchant-dict-describe) - Describes an individual dictionary
* [enchant\_broker\_dict\_exists()](function.enchant-broker-dict-exists) - Whether a dictionary exists or not. Using non-empty tag
* [enchant\_broker\_free\_dict()](function.enchant-broker-free-dict) - Free a dictionary resource
php EvWatcher::setCallback EvWatcher::setCallback
======================
(PECL ev >= 0.2.0)
EvWatcher::setCallback — Sets new callback for the watcher
### Description
```
public EvWatcher::setCallback( callable $callback ): void
```
Sets new callback for the watcher
### Parameters
`callback` See [Watcher callbacks](https://www.php.net/manual/en/ev.watcher-callbacks.php) .
### Return Values
No value is returned.
php EventHttpConnection::setCloseCallback EventHttpConnection::setCloseCallback
=====================================
(PECL event >= 1.8.0)
EventHttpConnection::setCloseCallback — Set callback for connection close
### Description
```
public EventHttpConnection::setCloseCallback( callable $callback , mixed $data = ?): void
```
Sets callback for connection close.
### Parameters
`callback` Callback which is called when connection is closed. Should match the following prototype:
```
callback( EventHttpConnection $conn = null , mixed $arg = null ): void
```
### Return Values
No value is returned.
### Examples
**Example #1 **EventHttpConnection::setCloseCallback()** example**
```
<?php
/*
* Setting up close-connection callback
*
* The script handles closed connections using HTTP API.
*
* Usage:
* 1) Launch the server:
* $ php examples/http_closecb.php 4242
*
* 2) Launch a client in another terminal. Telnet-like
* session should look like the following:
*
* $ nc -t 127.0.0.1 4242
* GET / HTTP/1.0
* Connection: close
*
* The server will output something similar to the following:
*
* HTTP/1.0 200 OK
* Content-Type: multipart/x-mixed-replace;boundary=boundarydonotcross
* Connection: close
*
* <html>
*
* 3) Terminate the client connection abruptly,
* i.e. kill the process, or just press Ctrl-C.
*
* 4) Check if the server called _close_callback.
* The script should output "_close_callback" string to standard output.
*
* 5) Check if the server's process has no orphaned connections,
* e.g. with `lsof` utility.
*/
function _close_callback($conn)
{
echo __FUNCTION__, PHP_EOL;
}
function _http_default($req, $dummy)
{
$conn = $req->getConnection();
$conn->setCloseCallback('_close_callback', NULL);
/*
By enabling Event::READ we protect the server against unclosed conections.
This is a peculiarity of Libevent. The library disables Event::READ events
on this connection, and the server is not notified about terminated
connections.
So each time client terminates connection abruptly, we get an orphaned
connection. For instance, the following is a part of `lsof -p $PID | grep TCP`
command after client has terminated connection:
57-php 15057 ruslan 6u unix 0xffff8802fb59c780 0t0 125187 socket
58:php 15057 ruslan 7u IPv4 125189 0t0 TCP *:4242 (LISTEN)
59:php 15057 ruslan 8u IPv4 124342 0t0 TCP localhost:4242->localhost:37375 (CLOSE_WAIT)
where $PID is our process ID.
The following block of code fixes such kind of orphaned connections.
*/
$bev = $req->getBufferEvent();
$bev->enable(Event::READ);
// We have to free it explicitly. See
```
[EventHttpRequest::getConnection()](eventhttprequest.getconnection)
```
$bev->free(); // we have to free it explicitly
$req->addHeader(
'Content-Type',
'multipart/x-mixed-replace;boundary=boundarydonotcross',
EventHttpRequest::OUTPUT_HEADER
);
$buf = new EventBuffer();
$buf->add('<html>');
$req->sendReply(200, "OK");
$req->sendReplyChunk($buf);
}
$port = 4242;
if ($argc > 1) {
$port = (int) $argv[1];
}
if ($port <= 0 || $port > 65535) {
exit("Invalid port");
}
$base = new EventBase();
$http = new EventHttp($base);
$http->setDefaultCallback("_http_default", NULL);
$http->bind("0.0.0.0", $port);
$base->loop();
?>
```
php sodium_crypto_stream_xchacha20_xor_ic sodium\_crypto\_stream\_xchacha20\_xor\_ic
==========================================
(PHP 8 >= 8.2.0)
sodium\_crypto\_stream\_xchacha20\_xor\_ic — Encrypts a message using a nonce and a secret key (no authentication)
### Description
```
sodium_crypto_stream_xchacha20_xor_ic(
string $message,
string $nonce,
int $counter,
string $key
): string
```
The function is similar to [sodium\_crypto\_stream\_xchacha20\_xor()](function.sodium-crypto-stream-xchacha20-xor) but adds the ability to set the initial value of the block counter to a non-zero value. This permits direct access to any block without having to compute the previous ones.
**Caution** This encryption is unauthenticated, and does not prevent chosen-ciphertext attacks. Make sure to combine the ciphertext with a Message Authentication Code, for example with [sodium\_crypto\_aead\_xchacha20poly1305\_ietf\_encrypt()](function.sodium-crypto-aead-xchacha20poly1305-ietf-encrypt) function, or [sodium\_crypto\_auth()](function.sodium-crypto-auth).
### Parameters
`message`
The message to encrypt.
`nonce`
24-byte nonce.
`counter`
The initial value of the block counter.
`key`
Key, possibly generated from [sodium\_crypto\_stream\_xchacha20\_keygen()](function.sodium-crypto-stream-xchacha20-keygen).
### Return Values
Encrypted message, or **`false`** on failure.
### Examples
**Example #1 **sodium\_crypto\_stream\_xchacha20\_xor\_ic()** example**
```
<?php
$n2 = random_bytes(SODIUM_CRYPTO_STREAM_XCHACHA20_NONCEBYTES);
$left = str_repeat("\x01", 64);
$right = str_repeat("\xfe", 64);
// All at once:
$stream7_unified = sodium_crypto_stream_xchacha20_xor($left . $right, $n2, $key);
// Piecewise, with initial counter:
$stream7_left = sodium_crypto_stream_xchacha20_xor_ic($left, $n2, 0, $key);
$stream7_right = sodium_crypto_stream_xchacha20_xor_ic($right, $n2, 1, $key);
$stream7_concat = $stream7_left . $stream7_right;
var_dump(strlen($stream7_concat));
var_dump($stream7_unified === $stream7_concat);
?>
```
The above example will output something similar to:
```
int(128)
bool(true)
```
### See Also
* [sodium\_crypto\_stream\_xchacha20\_xor()](function.sodium-crypto-stream-xchacha20-xor) - Encrypts a message using a nonce and a secret key (no authentication)
php RecursiveCallbackFilterIterator::getChildren RecursiveCallbackFilterIterator::getChildren
============================================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
RecursiveCallbackFilterIterator::getChildren — Return the inner iterator's children contained in a RecursiveCallbackFilterIterator
### Description
```
public RecursiveCallbackFilterIterator::getChildren(): RecursiveCallbackFilterIterator
```
Fetches the filtered children of the inner iterator.
[RecursiveCallbackFilterIterator::hasChildren()](recursivecallbackfilteriterator.haschildren) should be used to determine if there are children to be fetched.
### Parameters
This function has no parameters.
### Return Values
Returns a [RecursiveCallbackFilterIterator](class.recursivecallbackfilteriterator) containing the children.
### See Also
* [RecursiveCallbackFilterIterator Examples](class.recursivecallbackfilteriterator#recursivecallbackfilteriterator.examples)
* [RecursiveCallbackFilterIterator::\_\_construct()](recursivecallbackfilteriterator.construct) - Create a RecursiveCallbackFilterIterator from a RecursiveIterator
* [RecursiveCallbackFilteriterator::hasChildren()](recursivecallbackfilteriterator.haschildren) - Check whether the inner iterator's current element has children
php The SQLite3 class
The SQLite3 class
=================
Introduction
------------
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
A class that interfaces SQLite 3 databases.
Class synopsis
--------------
class **SQLite3** { /\* Methods \*/ public [\_\_construct](sqlite3.construct)(string `$filename`, int `$flags` = SQLITE3\_OPEN\_READWRITE | SQLITE3\_OPEN\_CREATE, string `$encryptionKey` = "")
```
public backup(SQLite3 $destination, string $sourceDatabase = "main", string $destinationDatabase = "main"): bool
```
```
public busyTimeout(int $milliseconds): bool
```
```
public changes(): int
```
```
public close(): bool
```
```
public createAggregate(
string $name,
callable $stepCallback,
callable $finalCallback,
int $argCount = -1
): bool
```
```
public createCollation(string $name, callable $callback): bool
```
```
public createFunction(
string $name,
callable $callback,
int $argCount = -1,
int $flags = 0
): bool
```
```
public enableExceptions(bool $enable = false): bool
```
```
public static escapeString(string $string): string
```
```
public exec(string $query): bool
```
```
public lastErrorCode(): int
```
```
public lastErrorMsg(): string
```
```
public lastInsertRowID(): int
```
```
public loadExtension(string $name): bool
```
```
public open(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryptionKey = ""): void
```
```
public openBlob(
string $table,
string $column,
int $rowid,
string $database = "main",
int $flags = SQLITE3_OPEN_READONLY
): resource|false
```
```
public prepare(string $query): SQLite3Stmt|false
```
```
public query(string $query): SQLite3Result|false
```
```
public querySingle(string $query, bool $entireRow = false): mixed
```
```
public setAuthorizer(?callable $callback): bool
```
```
public static version(): array
```
} Table of Contents
-----------------
* [SQLite3::backup](sqlite3.backup) — Backup one database to another database
* [SQLite3::busyTimeout](sqlite3.busytimeout) — Sets the busy connection handler
* [SQLite3::changes](sqlite3.changes) — Returns the number of database rows that were changed (or inserted or deleted) by the most recent SQL statement
* [SQLite3::close](sqlite3.close) — Closes the database connection
* [SQLite3::\_\_construct](sqlite3.construct) — Instantiates an SQLite3 object and opens an SQLite 3 database
* [SQLite3::createAggregate](sqlite3.createaggregate) — Registers a PHP function for use as an SQL aggregate function
* [SQLite3::createCollation](sqlite3.createcollation) — Registers a PHP function for use as an SQL collating function
* [SQLite3::createFunction](sqlite3.createfunction) — Registers a PHP function for use as an SQL scalar function
* [SQLite3::enableExceptions](sqlite3.enableexceptions) — Enable throwing exceptions
* [SQLite3::escapeString](sqlite3.escapestring) — Returns a string that has been properly escaped
* [SQLite3::exec](sqlite3.exec) — Executes a result-less query against a given database
* [SQLite3::lastErrorCode](sqlite3.lasterrorcode) — Returns the numeric result code of the most recent failed SQLite request
* [SQLite3::lastErrorMsg](sqlite3.lasterrormsg) — Returns English text describing the most recent failed SQLite request
* [SQLite3::lastInsertRowID](sqlite3.lastinsertrowid) — Returns the row ID of the most recent INSERT into the database
* [SQLite3::loadExtension](sqlite3.loadextension) — Attempts to load an SQLite extension library
* [SQLite3::open](sqlite3.open) — Opens an SQLite database
* [SQLite3::openBlob](sqlite3.openblob) — Opens a stream resource to read a BLOB
* [SQLite3::prepare](sqlite3.prepare) — Prepares an SQL statement for execution
* [SQLite3::query](sqlite3.query) — Executes an SQL query
* [SQLite3::querySingle](sqlite3.querysingle) — Executes a query and returns a single result
* [SQLite3::setAuthorizer](sqlite3.setauthorizer) — Configures a callback to be used as an authorizer to limit what a statement can do
* [SQLite3::version](sqlite3.version) — Returns the SQLite3 library version as a string constant and as a number
php SolrDisMaxQuery::setBoostFunction SolrDisMaxQuery::setBoostFunction
=================================
(No version information available, might only be in Git)
SolrDisMaxQuery::setBoostFunction — Sets a Boost Function (bf parameter)
### Description
```
public SolrDisMaxQuery::setBoostFunction(string $function): SolrDisMaxQuery
```
Sets Boost Function (bf parameter).
Functions (with optional boosts) that will be included in the user's query to influence the score. Any function supported natively by Solr can be used, along with a boost value. e.g.:
recip(rord(myfield),1,2,3)^1.5
### Parameters
`function`
### Return Values
[SolrDisMaxQuery](class.solrdismaxquery)
### Examples
**Example #1 **SolrDisMaxQuery::setBoostFunction()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery('lucene');
$boostRecentDocsFunction = "recip(ms(NOW,mydatefield),3.16e-11,1,1)";
$dismaxQuery->setBoostFunction($boostRecentDocsFunction);
echo $dismaxQuery.PHP_EOL;
?>
```
The above example will output something similar to:
```
q=lucene&defType=edismax&bf=recip(ms(NOW,mydatefield),3.16e-11,1,1)
```
php geoip_country_code3_by_name geoip\_country\_code3\_by\_name
===============================
(PECL geoip >= 0.2.0)
geoip\_country\_code3\_by\_name — Get the three letter country code
### Description
```
geoip_country_code3_by_name(string $hostname): string
```
The **geoip\_country\_code3\_by\_name()** function will return the three letter country code corresponding to a hostname or an IP address.
### Parameters
`hostname`
The hostname or IP address whose location is to be looked-up.
### Return Values
Returns the three letter country code on success, or **`false`** if the address cannot be found in the database.
### Examples
**Example #1 A **geoip\_country\_code3\_by\_name()** example**
This will print where the host example.com is located.
```
<?php
$country = geoip_country_code3_by_name('www.example.com');
if ($country) {
echo 'This host is located in: ' . $country;
}
?>
```
The above example will output:
```
This host is located in: USA
```
### See Also
* [geoip\_country\_code\_by\_name()](function.geoip-country-code-by-name) - Get the two letter country code
* [geoip\_country\_name\_by\_name()](function.geoip-country-name-by-name) - Get the full country name
php IntlGregorianCalendar::__construct IntlGregorianCalendar::\_\_construct
====================================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlGregorianCalendar::\_\_construct — Create the Gregorian Calendar class
### Description
public **IntlGregorianCalendar::\_\_construct**([IntlTimeZone](class.intltimezone) `$tz` = ?, string `$locale` = ?)
public **IntlGregorianCalendar::\_\_construct**(int `$timeZoneOrYear`, int `$localeOrMonth`, int `$dayOfMonth`)
public **IntlGregorianCalendar::\_\_construct**(
int `$timeZoneOrYear`,
int `$localeOrMonth`,
int `$dayOfMonth`,
int `$hour`,
int `$minute`,
int `$second` = ?
)
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`tz`
`locale`
`timeZoneOrYear`
`localeOrMonth`
`dayOfMonth`
`hour`
`minute`
`second`
php RarEntry::getName RarEntry::getName
=================
(PECL rar >= 0.1)
RarEntry::getName — Get name of the entry
### Description
```
public RarEntry::getName(): string
```
Returns the name (with path) of the archive entry.
### Parameters
This function has no parameters.
### Return Values
Returns the entry name as a string, or **`false`** on error.
### Changelog
| Version | Description |
| --- | --- |
| PECL rar 2.0.0 | As of version 2.0.0, the returned string is encoded in Unicode/UTF-8. |
### Examples
**Example #1 **RarEntry::getName()** example**
```
<?php
//this example is safe even in pages not encoded in UTF-8
//for those encoded in UTF-8, the call to mb_convert_encoding is unnecessary
$rar_file = rar_open('example.rar') or die("Failed to open Rar archive");
$entry = rar_entry_get($rar_file, 'Dir/file.txt') or die("Failed to find such entry");
echo "Entry name: " . mb_convert_encoding(
htmlentities(
$entry->getName(),
ENT_COMPAT,
"UTF-8"
),
"HTML-ENTITIES",
"UTF-8"
);
?>
```
php ArrayIterator::uasort ArrayIterator::uasort
=====================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
ArrayIterator::uasort — Sort with a user-defined comparison function and maintain index association
### Description
```
public ArrayIterator::uasort(callable $callback): bool
```
This method sorts the elements such that indices maintain their correlation with the values they are associated with, using a user-defined comparison function.
>
> **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`**.
### See Also
* [ArrayIterator::asort()](arrayiterator.asort) - Sort entries by values
* [ArrayIterator::ksort()](arrayiterator.ksort) - Sort entries by keys
* [ArrayIterator::natcasesort()](arrayiterator.natcasesort) - Sort entries naturally, case insensitive
* [ArrayIterator::natsort()](arrayiterator.natsort) - Sort entries naturally
* [ArrayIterator::uksort()](arrayiterator.uksort) - Sort by keys using a user-defined comparison function
* [uasort()](function.uasort) - Sort an array with a user-defined comparison function and maintain index association
| programming_docs |
php array_sum array\_sum
==========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
array\_sum — Calculate the sum of values in an array
### Description
```
array_sum(array $array): int|float
```
**array\_sum()** returns the sum of values in an array.
### Parameters
`array`
The input array.
### Return Values
Returns the sum of values as an integer or float; `0` if the `array` is empty.
### Examples
**Example #1 **array\_sum()** examples**
```
<?php
$a = array(2, 4, 6, 8);
echo "sum(a) = " . array_sum($a) . "\n";
$b = array("a" => 1.2, "b" => 2.3, "c" => 3.4);
echo "sum(b) = " . array_sum($b) . "\n";
?>
```
The above example will output:
```
sum(a) = 20
sum(b) = 6.9
```
php SolrDisMaxQuery::setTieBreaker SolrDisMaxQuery::setTieBreaker
==============================
(No version information available, might only be in Git)
SolrDisMaxQuery::setTieBreaker — Sets Tie Breaker parameter (tie parameter)
### Description
```
public SolrDisMaxQuery::setTieBreaker(string $tieBreaker): SolrDisMaxQuery
```
Sets Tie Breaker parameter (tie parameter)
### Parameters
`tieBreaker`
The *tie* parameter specifies a float value (which should be something much less than 1) to use as tiebreaker in DisMax queries.
### Return Values
[SolrDisMaxQuery](class.solrdismaxquery)
### Examples
**Example #1 **SolrDisMaxQuery::setTieBreaker()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery();
$dismaxQuery->setTieBreaker(0.1);
echo $dismaxQuery;
?>
```
The above example will output:
```
defType=edismax&tie=0.1
```
php Imagick::recolorImage Imagick::recolorImage
=====================
(PECL imagick 2 >= 2.3.0, PECL imagick 3)
Imagick::recolorImage — Recolors image
**Warning**This function has been *DEPRECATED* as of Imagick 3.4.4. Relying on this function is highly discouraged.
### Description
```
public Imagick::recolorImage(array $matrix): bool
```
Translate, scale, shear, or rotate image colors. This method supports variable sized matrices but normally 5x5 matrix is used for RGBA and 6x6 is used for CMYK. The last row should contain the normalized values. This method is available if Imagick has been compiled against ImageMagick version 6.3.6 or newer.
### Parameters
`matrix`
The matrix containing the color values
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::recolorImage()****
```
<?php
function recolorImage($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$remapColor = [ 1, 0, 0,
0, 0, 1,
0, 1, 0,];
//$remapColor = [
// 1.438, -0.122, -0.016, 0, 0, -0.03,
// -0.062, 1.378, -0.016, 0, 0, 0.05,
// -0.062, -0.122, 1.483, 0, 0, -0.02,
//];
@$imagick->recolorImage($remapColor);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
### See Also
* [Imagick::displayImage()](imagick.displayimage) - Displays an image
php Zookeeper::setLogStream Zookeeper::setLogStream
=======================
(PECL zookeeper >= 0.1.0)
Zookeeper::setLogStream — Sets the stream to be used by the library for logging
### Description
```
public Zookeeper::setLogStream(resource $stream): bool
```
The zookeeper library uses stderr as its default log stream. Application must make sure the stream is writable. Passing in NULL resets the stream to its default value (stderr).
### Parameters
`stream`
The stream to be used by the library for logging.
### 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.
### See Also
* [Zookeeper::setDebugLevel()](zookeeper.setdebuglevel) - Sets the debugging level for the library
* [ZookeeperException](class.zookeeperexception)
php sodium_crypto_stream_xchacha20_xor sodium\_crypto\_stream\_xchacha20\_xor
======================================
(PHP 8 >= 8.1.0)
sodium\_crypto\_stream\_xchacha20\_xor — Encrypts a message using a nonce and a secret key (no authentication)
### Description
```
sodium_crypto_stream_xchacha20_xor(string $message, string $nonce, string $key): string
```
Encrypts a `message` using a `nonce` and a secret `key` (no authentication).
**Caution** This encryption is unauthenticated, and does not prevent chosen-ciphertext attacks. Make sure to combine the ciphertext with a Message Authentication Code, for example with [sodium\_crypto\_aead\_xchacha20poly1305\_ietf\_encrypt()](function.sodium-crypto-aead-xchacha20poly1305-ietf-encrypt) function, or [sodium\_crypto\_auth()](function.sodium-crypto-auth).
### Parameters
`message`
The message to encrypt.
`nonce`
24-byte nonce.
`key`
Key, possibly generated from [sodium\_crypto\_stream\_xchacha20\_keygen()](function.sodium-crypto-stream-xchacha20-keygen).
### Return Values
Encrypted message.
### See Also
* [sodium\_crypto\_stream\_xchacha20\_xor\_ic()](function.sodium-crypto-stream-xchacha20-xor-ic) - Encrypts a message using a nonce and a secret key (no authentication)
php ZipArchive::getStreamName ZipArchive::getStreamName
=========================
(PHP 8 >= 8.2.0, PECL zip >= 1.20.0)
ZipArchive::getStreamName — Get a file handler to the entry defined by its name (read only)
### Description
```
public ZipArchive::getStreamName(string $name, int $flags = 0): resource|false
```
Get a file handler to the entry defined by its name. For now, it only supports read operations.
### Parameters
`name`
The name of the entry to use.
`flags`
If flags is set to **`ZipArchive::FL_UNCHANGED`**, the original unchanged stream is returned.
### Return Values
Returns a file pointer (resource) on success or **`false`** on failure.
### Examples
**Example #1 Get the entry contents with [fread()](function.fread) and store it**
```
<?php
$contents = '';
$z = new ZipArchive();
if ($z->open('test.zip')) {
$fp = $z->getStreamName('test', ZipArchive::FL_UNCHANGED);
if(!$fp) die($z->getStatusString());
echo stream_get_contents($fp);
fclose($fp);
}
?>
```
### See Also
* [ZipArchive::getStreamIndex()](ziparchive.getstreamindex) - Get a file handler to the entry defined by its index (read only)
php ReflectionMethod::getClosure ReflectionMethod::getClosure
============================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
ReflectionMethod::getClosure — Returns a dynamically created closure for the method
### Description
```
public ReflectionMethod::getClosure(?object $object = null): Closure
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`object`
Forbidden for static methods, required for other methods.
### Return Values
Returns [Closure](class.closure). Returns **`null`** in case of an error.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `object` is now nullable. |
php IntlChar::forDigit IntlChar::forDigit
==================
(PHP 7, PHP 8)
IntlChar::forDigit — Get character representation for a given digit and radix
### Description
```
public static IntlChar::forDigit(int $digit, int $base = 10): int
```
Determines the character representation for a specific digit in the specified radix.
If the value of radix is not a valid radix, or the value of digit is not a valid digit in the specified radix, the null character (`U+0000`) is returned.
The radix argument is valid if it is greater than or equal to `2` and less than or equal to `36`. The digit argument is valid if `0 <= digit < radix`.
If the digit is less than `10`, then '0' + digit is returned. Otherwise, the value 'a' + digit - 10 is returned.
### Parameters
`digit`
The number to convert to a character.
`base`
The radix (defaults to `10`).
### Return Values
The character representation (as a string) of the specified digit in the specified radix.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::forDigit(0));
var_dump(IntlChar::forDigit(3));
var_dump(IntlChar::forDigit(3, 10));
var_dump(IntlChar::forDigit(10));
var_dump(IntlChar::forDigit(10, 16));
?>
```
The above example will output:
```
int(48)
int(51)
int(51)
int(0)
int(97)
```
### See Also
* [IntlChar::digit()](intlchar.digit) - Get the decimal digit value of a code point for a given radix
* [IntlChar::charDigitValue()](intlchar.chardigitvalue) - Get the decimal digit value of a decimal digit character
* [IntlChar::isdigit()](intlchar.isdigit) - Check if code point is a digit character
* **`IntlChar::PROPERTY_NUMERIC_TYPE`**
php SolrDocument::fieldExists SolrDocument::fieldExists
=========================
(PECL solr >= 0.9.2)
SolrDocument::fieldExists — Checks if a field exists in the document
### Description
```
public SolrDocument::fieldExists(string $fieldName): bool
```
Checks if the requested field as a valid fieldname in the document.
### Parameters
`fieldName`
The name of the field.
### Return Values
Returns **`true`** if the field is present and **`false`** if it does not.
php fdf_header fdf\_header
===========
(PHP 4 >= 4.3.0, PHP 5 < 5.3.0, PECL fdf SVNf)
fdf\_header — Sets FDF-specific output headers
### Description
```
fdf_header(): void
```
This is a convenience function to set appropriate HTTP headers for FDF output. It sets the `Content-type:` to `application/vnd.fdf`.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php GearmanJob::exception GearmanJob::exception
=====================
(PECL gearman <= 0.5.0)
GearmanJob::exception — Send exception for running job (deprecated)
### Description
```
public GearmanJob::exception(string $exception): bool
```
Sends the supplied exception when this job is running.
>
> **Note**:
>
>
> This method has been replaced by [GearmanJob::sendException()](gearmanjob.sendexception) in the 0.6.0 release of the Gearman extension.
>
>
### Parameters
`exception`
An exception description.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [GearmanJob::setReturn()](gearmanjob.setreturn) - Set a return value
* [GearmanJob::sendStatus()](gearmanjob.sendstatus) - Send status
* [GearmanJob::sendWarning()](gearmanjob.sendwarning) - Send a warning
php None for
---
(PHP 4, PHP 5, PHP 7, PHP 8)
`for` loops are the most complex loops in PHP. They behave like their C counterparts. The syntax of a `for` loop is:
```
for (expr1; expr2; expr3)
statement
```
The first expression (expr1) is evaluated (executed) once unconditionally at the beginning of the loop.
In the beginning of each iteration, expr2 is evaluated. If it evaluates to **`true`**, the loop continues and the nested statement(s) are executed. If it evaluates to **`false`**, the execution of the loop ends.
At the end of each iteration, expr3 is evaluated (executed).
Each of the expressions can be empty or contain multiple expressions separated by commas. In expr2, all expressions separated by a comma are evaluated but the result is taken from the last part. expr2 being empty means the loop should be run indefinitely (PHP implicitly considers it as **`true`**, like C). This may not be as useless as you might think, since often you'd want to end the loop using a conditional [`break`](control-structures.break) statement instead of using the `for` truth expression.
Consider the following examples. All of them display the numbers 1 through 10:
```
<?php
/* example 1 */
for ($i = 1; $i <= 10; $i++) {
echo $i;
}
/* example 2 */
for ($i = 1; ; $i++) {
if ($i > 10) {
break;
}
echo $i;
}
/* example 3 */
$i = 1;
for (; ; ) {
if ($i > 10) {
break;
}
echo $i;
$i++;
}
/* example 4 */
for ($i = 1, $j = 0; $i <= 10; $j += $i, print $i, $i++);
?>
```
Of course, the first example appears to be the nicest one (or perhaps the fourth), but you may find that being able to use empty expressions in `for` loops comes in handy in many occasions.
PHP also supports the alternate "colon syntax" for `for` loops.
```
for (expr1; expr2; expr3):
statement
...
endfor;
```
It's a common thing to many users to iterate through arrays like in the example below.
```
<?php
/*
* This is an array with some data we want to modify
* when running through the for loop.
*/
$people = array(
array('name' => 'Kalle', 'salt' => 856412),
array('name' => 'Pierre', 'salt' => 215863)
);
for($i = 0; $i < count($people); ++$i) {
$people[$i]['salt'] = mt_rand(000000, 999999);
}
?>
```
The above code can be slow, because the array size is fetched on every iteration. Since the size never changes, the loop be easily optimized by using an intermediate variable to store the size instead of repeatedly calling [count()](function.count):
```
<?php
$people = array(
array('name' => 'Kalle', 'salt' => 856412),
array('name' => 'Pierre', 'salt' => 215863)
);
for($i = 0, $size = count($people); $i < $size; ++$i) {
$people[$i]['salt'] = mt_rand(000000, 999999);
}
?>
```
php Yaf_Response_Abstract::setHeader Yaf\_Response\_Abstract::setHeader
==================================
(Yaf >=1.0.0)
Yaf\_Response\_Abstract::setHeader — Set reponse header
### Description
```
public Yaf_Response_Abstract::setHeader(string $name, string $value, bool $replace = ?): bool
```
Used to send a HTTP header
### Parameters
This function has no parameters.
### Return Values
### See Also
* [Yaf\_Response\_Abstract::getHeader()](yaf-response-abstract.getheader) - The getHeader purpose
* **Yaf\_Response\_Abstract::cleanHeaders()**
php Memcached::casByKey Memcached::casByKey
===================
(PECL memcached >= 0.1.0)
Memcached::casByKey — Compare and swap an item on a specific server
### Description
```
public Memcached::casByKey(
float $cas_token,
string $server_key,
string $key,
mixed $value,
int $expiration = ?
): bool
```
**Memcached::casByKey()** is functionally equivalent to [Memcached::cas()](memcached.cas), 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
`cas_token`
Unique value associated with the existing item. Generated by memcache.
`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. The [Memcached::getResultCode()](memcached.getresultcode) will return **`Memcached::RES_DATA_EXISTS`** if the item you are trying to store has been modified since you last fetched it.
### See Also
* [Memcached::cas()](memcached.cas) - Compare and swap an item
php iconv_get_encoding iconv\_get\_encoding
====================
(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)
iconv\_get\_encoding — Retrieve internal configuration variables of iconv extension
### Description
```
iconv_get_encoding(string $type = "all"): array|string|false
```
Retrieve internal configuration variables of iconv extension.
### Parameters
`type`
The value of the optional `type` can be:
* all
* input\_encoding
* output\_encoding
* internal\_encoding
### Return Values
Returns the current value of the internal configuration variable if successful or **`false`** on failure.
If `type` is omitted or set to "all", **iconv\_get\_encoding()** returns an array that stores all these variables.
### Examples
**Example #1 **iconv\_get\_encoding()** example**
```
<pre>
<?php
iconv_set_encoding("internal_encoding", "UTF-8");
iconv_set_encoding("output_encoding", "ISO-8859-1");
var_dump(iconv_get_encoding('all'));
?>
</pre>
```
The above example will output:
```
Array
(
[input_encoding] => ISO-8859-1
[output_encoding] => ISO-8859-1
[internal_encoding] => UTF-8
)
```
### See Also
* [iconv\_set\_encoding()](function.iconv-set-encoding) - Set current setting for character encoding conversion
* [ob\_iconv\_handler()](function.ob-iconv-handler) - Convert character encoding as output buffer handler
php array_udiff_uassoc array\_udiff\_uassoc
====================
(PHP 5, PHP 7, PHP 8)
array\_udiff\_uassoc — Computes the difference of arrays with additional index check, compares data and indexes by a callback function
### Description
```
array_udiff_uassoc(
array $array,
array ...$arrays,
callable $value_compare_func,
callable $key_compare_func
): array
```
Computes the difference of arrays with additional index check, compares data and indexes by a callback function.
Note that the keys are used in the comparison unlike [array\_diff()](function.array-diff) and [array\_udiff()](function.array-udiff).
### 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
```
`key_compare_func`
The comparison of keys (indices) is done also by the callback function `key_compare_func`. This behaviour is unlike what [array\_udiff\_assoc()](function.array-udiff-assoc) does, since the latter compares the indices by using an internal function.
### Return Values
Returns an array containing all the values from `array` that are not present in any of the other arguments.
### Examples
**Example #1 **array\_udiff\_uassoc()** 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;
}
static function comp_func_key($a, $b)
{
if ($a === $b) return 0;
return ($a > $b)? 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_uassoc($a, $b, array("cr", "comp_func_cr"), array("cr", "comp_func_key"));
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. Keep in mind that you have to supply 2 callback functions.
### Notes
> **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_uassoc($array1[0], $array2[0], "data_compare_func",
> "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\_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
| programming_docs |
php Ds\Vector::join Ds\Vector::join
===============
(PECL ds >= 1.0.0)
Ds\Vector::join — Joins all values together as a string
### Description
```
public Ds\Vector::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 vector joined together as a string.
### Examples
**Example #1 **Ds\Vector::join()** example using a separator string**
```
<?php
$vector = new \Ds\Vector(["a", "b", "c", 1, 2, 3]);
var_dump($vector->join("|"));
?>
```
The above example will output something similar to:
```
string(11) "a|b|c|1|2|3"
```
**Example #2 **Ds\Vector::join()** example without a separator string**
```
<?php
$vector = new \Ds\Vector(["a", "b", "c", 1, 2, 3]);
var_dump($vector->join());
?>
```
The above example will output something similar to:
```
string(11) "abc123"
```
php hebrev hebrev
======
(PHP 4, PHP 5, PHP 7, PHP 8)
hebrev — Convert logical Hebrew text to visual text
### Description
```
hebrev(string $string, int $max_chars_per_line = 0): string
```
Converts logical Hebrew text to visual text.
The function tries to avoid breaking words.
### Parameters
`string`
A Hebrew input string.
`max_chars_per_line`
This optional parameter indicates maximum number of characters per line that will be returned.
### Return Values
Returns the visual string.
### See Also
* [hebrevc()](function.hebrevc) - Convert logical Hebrew text to visual text with newline conversion
php enchant_broker_list_dicts enchant\_broker\_list\_dicts
============================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL enchant >= 1.0.1)
enchant\_broker\_list\_dicts — Returns a list of available dictionaries
### Description
```
enchant_broker_list_dicts(EnchantBroker $broker): array
```
Returns a list of available dictionaries with their details.
### Parameters
`broker`
An Enchant broker returned by [enchant\_broker\_init()](function.enchant-broker-init).
### Return Values
Returns an array of available dictionaries 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 all available dictionaries for one broker**
```
<?php
$r = enchant_broker_init();
$dicts = enchant_broker_list_dicts($r);
print_r($dicts);
?>
```
The above example will output something similar to:
```
Array
(
[0] => Array
(
[lang_tag] => de
[provider_name] => aspell
[provider_desc] => Aspell Provider
[provider_file] => /usr/lib/enchant/libenchant_aspell.so
)
[1] => Array
(
[lang_tag] => de_DE
[provider_name] => aspell
[provider_desc] => Aspell Provider
[provider_file] => /usr/lib/enchant/libenchant_aspell.so
)
[3] => Array
(
[lang_tag] => en
[provider_name] => aspell
[provider_desc] => Aspell Provider
[provider_file] => /usr/lib/enchant/libenchant_aspell.so
)
[4] => Array
(
[lang_tag] => en_GB
[provider_name] => aspell
[provider_desc] => Aspell Provider
[provider_file] => /usr/lib/enchant/libenchant_aspell.so
)
[5] => Array
(
[lang_tag] => en_US
[provider_name] => aspell
[provider_desc] => Aspell Provider
[provider_file] => /usr/lib/enchant/libenchant_aspell.so
)
[6] => Array
(
[lang_tag] => hi_IN
[provider_name] => myspell
[provider_desc] => Myspell Provider
[provider_file] => /usr/lib/enchant/libenchant_myspell.so
)
)
```
### See Also
* [enchant\_broker\_describe()](function.enchant-broker-describe) - Enumerates the Enchant providers
php ssh2_forward_listen ssh2\_forward\_listen
=====================
(PECL ssh2 >= 0.9.0)
ssh2\_forward\_listen — Bind a port on the remote server and listen for connections
### Description
```
ssh2_forward_listen(
resource $session,
int $port,
string $host = ?,
int $max_connections = 16
): resource|false
```
Binds a port on the remote server and listen for connections.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`session`
An SSH Session resource, obtained from a call to [ssh2\_connect()](function.ssh2-connect).
`port`
The port of the remote server.
`host`
`max_connections`
### Return Values
Returns an SSH2 Listener, or **`false`** on failure.
### See Also
* [ssh2\_forward\_accept()](function.ssh2-forward-accept) - Accept a connection created by a listener
php Ds\Map::xor Ds\Map::xor
===========
(PECL ds >= 1.0.0)
Ds\Map::xor — Creates a new map using keys of either the current instance or of another map, but not of both
### Description
```
public Ds\Map::xor(Ds\Map $map): Ds\Map
```
Creates a new map containing keys of the current instance as well as another `map`, but not of both.
`A ⊖ B = {x : x ∈ (A \ B) ∪ (B \ A)}`
### Parameters
`map`
The other map.
### Return Values
A new map containing keys in the current instance as well as another `map`, but not in both.
### See Also
* [» Symmetric Difference](https://en.wikipedia.org/wiki/Symmetric_difference) on Wikipedia
### Examples
**Example #1 **Ds\Map::xor()** example**
```
<?php
$a = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]);
$b = new \Ds\Map(["b" => 4, "c" => 5, "d" => 6]);
print_r($a->xor($b));
?>
```
The above example will output something similar to:
```
Ds\Map Object
(
[0] => Ds\Pair Object
(
[key] => a
[value] => 1
)
[1] => Ds\Pair Object
(
[key] => d
[value] => 6
)
)
```
php IntlGregorianCalendar::getGregorianChange IntlGregorianCalendar::getGregorianChange
=========================================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlGregorianCalendar::getGregorianChange — Get the Gregorian Calendar change date
### Description
```
public IntlGregorianCalendar::getGregorianChange(): float
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
Returns the change date.
php is_subclass_of is\_subclass\_of
================
(PHP 4, PHP 5, PHP 7, PHP 8)
is\_subclass\_of — Checks if the object has this class as one of its parents or implements it
### Description
```
is_subclass_of(mixed $object_or_class, string $class, bool $allow_string = true): bool
```
Checks if the given `object_or_class` has the class `class` as one of its parents or implements it.
### Parameters
`object_or_class`
A class name or an object instance. No error is generated if the class does not exist.
`class`
The class name
`allow_string`
If this parameter set to false, string class name as `object_or_class` is not allowed. This also prevents from calling autoloader if the class doesn't exist.
### Return Values
This function returns **`true`** if the object `object_or_class`, belongs to a class which is a subclass of `class`, **`false`** otherwise.
### Examples
**Example #1 **is\_subclass\_of()** example**
```
<?php
// define a class
class WidgetFactory
{
var $oink = 'moo';
}
// define a child class
class WidgetFactory_Child extends WidgetFactory
{
var $oink = 'oink';
}
// create a new object
$WF = new WidgetFactory();
$WFC = new WidgetFactory_Child();
if (is_subclass_of($WFC, 'WidgetFactory')) {
echo "yes, \$WFC is a subclass of WidgetFactory\n";
} else {
echo "no, \$WFC is not a subclass of WidgetFactory\n";
}
if (is_subclass_of($WF, 'WidgetFactory')) {
echo "yes, \$WF is a subclass of WidgetFactory\n";
} else {
echo "no, \$WF is not a subclass of WidgetFactory\n";
}
if (is_subclass_of('WidgetFactory_Child', 'WidgetFactory')) {
echo "yes, WidgetFactory_Child is a subclass of WidgetFactory\n";
} else {
echo "no, WidgetFactory_Child is not a subclass of WidgetFactory\n";
}
?>
```
The above example will output:
```
yes, $WFC is a subclass of WidgetFactory
no, $WF is not a subclass of WidgetFactory
yes, WidgetFactory_Child is a subclass of WidgetFactory
```
**Example #2 **is\_subclass\_of()** using interface example**
```
<?php
// Define the Interface
interface MyInterface
{
public function MyFunction();
}
// Define the class implementation of the interface
class MyClass implements MyInterface
{
public function MyFunction()
{
return "MyClass Implements MyInterface!";
}
}
// Instantiate the object
$my_object = new MyClass;
// Works since 5.3.7
// Test using the object instance of the class
if (is_subclass_of($my_object, 'MyInterface')) {
echo "Yes, \$my_object is a subclass of MyInterface\n";
} else {
echo "No, \$my_object is not a subclass of MyInterface\n";
}
// Test using a string of the class name
if (is_subclass_of('MyClass', 'MyInterface')) {
echo "Yes, MyClass is a subclass of MyInterface\n";
} else {
echo "No, MyClass is not a subclass of MyInterface\n";
}
?>
```
The above example will output:
```
Yes, $my_object is a subclass of MyInterface
Yes, MyClass is a subclass of MyInterface
```
### Notes
>
> **Note**:
>
>
> Using this function will use any registered [autoloaders](language.oop5.autoload) if the class is not already known.
>
>
>
### See Also
* [get\_class()](function.get-class) - Returns the name of the class of an object
* [get\_parent\_class()](function.get-parent-class) - Retrieves the parent class name for object or class
* [is\_a()](function.is-a) - Checks if the object is of this object type or has this object type as one of its parents
* [class\_parents()](function.class-parents) - Return the parent classes of the given class
php EvLoop::prepare EvLoop::prepare
===============
(PECL ev >= 0.2.0)
EvLoop::prepare — Creates EvPrepare watcher object associated with the current event loop instance
### Description
```
final public EvLoop::prepare( callable $callback , mixed $data = null , int $priority = 0 ): EvPrepare
```
Creates EvPrepare watcher object associated with the current event loop instance
### Parameters
All parameters have the same maening as for **EvPrepare()**
### Return Values
Returns EvPrepare object on success
### See Also
* [EvPrepare::\_\_construct()](evprepare.construct) - Constructs EvPrepare watcher object
php ldap_exop_refresh ldap\_exop\_refresh
===================
(PHP 7 >= 7.3.0, PHP 8)
ldap\_exop\_refresh — Refresh extended operation helper
### Description
```
ldap_exop_refresh(LDAP\Connection $ldap, string $dn, int $ttl): int|false
```
Performs a Refresh extended operation and returns the data.
### Parameters
`ldap`
An [LDAP\Connection](class.ldap-connection) instance, returned by [ldap\_connect()](function.ldap-connect).
`dn`
dn of the entry to refresh.
`ttl`
Time in seconds (between 1 and 31557600) that the client requests that the entry exists in the directory before being automatically removed.
### Return Values
From RFC: The responseTtl field is the time in seconds which the server chooses to have as the time-to-live field for that entry. It must not be any smaller than that which the client requested, and it may be larger. However, to allow servers to maintain a relatively accurate directory, and to prevent clients from abusing the dynamic extensions, servers are permitted to shorten a client-requested time-to-live value, down to a minimum of 86400 seconds (one day). **`false`** will be returned on error.
### 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\_exop()](function.ldap-exop) - Performs an extended operation
php echo echo
====
(PHP 4, PHP 5, PHP 7, PHP 8)
echo — Output one or more strings
### Description
```
echo(string ...$expressions): void
```
Outputs one or more expressions, with no additional newlines or spaces.
`echo` is not a function but a language construct. Its arguments are a list of expressions following the `echo` keyword, separated by commas, and not delimited by parentheses. Unlike some other language constructs, `echo` does not have any return value, so it cannot be used in the context of an expression.
`echo` also has a shortcut syntax, where you can immediately follow the opening tag with an equals sign. This syntax is available even with the [short\_open\_tag](https://www.php.net/manual/en/ini.core.php#ini.short-open-tag) configuration setting disabled.
```
I have <?=$foo?> foo.
```
The major differences to [print](function.print) are that `echo` accepts multiple arguments and doesn't have a return value.
### Parameters
`expressions`
One or more string expressions to output, separated by commas. Non-string values will be coerced to strings, even when [the `strict_types` directive](language.types.declarations#language.types.declarations.strict) is enabled.
### Return Values
No value is returned.
### Examples
**Example #1 `echo` examples**
```
<?php
echo "echo does not require parentheses.";
// Strings can either be passed individually as multiple arguments or
// concatenated together and passed as a single argument
echo 'This ', 'string ', 'was ', 'made ', 'with multiple parameters.', "\n";
echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\n";
// No newline or space is added; the below outputs "helloworld" all on one line
echo "hello";
echo "world";
// Same as above
echo "hello", "world";
echo "This string spans
multiple lines. The newlines will be
output as well";
echo "This string spans\nmultiple lines. The newlines will be\noutput as well.";
// The argument can be any expression which produces a string
$foo = "example";
echo "foo is $foo"; // foo is example
$fruits = ["lemon", "orange", "banana"];
echo implode(" and ", $fruits); // lemon and orange and banana
// Non-string expressions are coerced to string, even if declare(strict_types=1) is used
echo 6 * 7; // 42
// Because echo does not behave as an expression, the following code is invalid.
($some_var) ? echo 'true' : echo 'false';
// However, the following examples will work:
($some_var) ? print 'true' : print 'false'; // print is also a construct, but
// it is a valid expression, returning 1,
// so it may be used in this context.
echo $some_var ? 'true': 'false'; // evaluating the expression first and passing it to echo
?>
```
### 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**: **Using with parentheses**
>
>
>
> Surrounding a single argument to `echo` with parentheses will not raise a syntax error, and produces syntax which looks like a normal function call. However, this can be misleading, because the parentheses are actually part of the expression being output, not part of the `echo` syntax itself.
>
>
>
> ```
> <?php
> echo "hello";
> // outputs "hello"
>
> echo("hello");
> // also outputs "hello", because ("hello") is a valid expression
>
> echo(1 + 2) * 3;
> // outputs "9"; the parentheses cause 1+2 to be evaluated first, then 3*3
> // the echo statement sees the whole expression as one argument
>
> echo "hello", " world";
> // outputs "hello world"
>
> echo("hello"), (" world");
> // outputs "hello world"; the parentheses are part of each expression
>
> echo("hello", " world");
> // Throws a Parse Error because ("hello", " world") is not a valid expression
> ?>
> ```
>
**Tip** Passing multiple arguments to `echo` can avoid complications arising from the precedence of the concatenation operator in PHP. For instance, the concatenation operator has higher precedence than the ternary operator, and prior to PHP 8.0.0 had the same precedence as addition and subtraction:
```
<?php
// Below, the expression 'Hello ' . isset($name) is evaluated first,
// and is always true, so the argument to echo is always $name
echo 'Hello ' . isset($name) ? $name : 'John Doe' . '!';
// The intended behaviour requires additional parentheses
echo 'Hello ' . (isset($name) ? $name : 'John Doe') . '!';
// In PHP prior to 8.0.0, the below outputs "2", rather than "Sum: 3"
echo 'Sum: ' . 1 + 2;
// Again, adding parentheses ensures the intended order of evaluation
echo 'Sum: ' . (1 + 2);
```
If multiple arguments are passed in, then parentheses will not be required to enforce precedence, because each expression is separate:
```
<?php
echo "Hello ", isset($name) ? $name : "John Doe", "!";
echo "Sum: ", 1 + 2;
```
### See Also
* [print](function.print) - Output a string
* [printf()](function.printf) - Output a formatted string
* [flush()](function.flush) - Flush system output buffer
* [Ways to specify literal strings](language.types.string)
php ImagickPixelIterator::syncIterator ImagickPixelIterator::syncIterator
==================================
(PECL imagick 2, PECL imagick 3)
ImagickPixelIterator::syncIterator — Syncs the pixel iterator
### Description
```
public ImagickPixelIterator::syncIterator(): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Syncs the pixel iterator.
### Return Values
Returns **`true`** on success.
php ibase_blob_open ibase\_blob\_open
=================
(PHP 5, PHP 7 < 7.4.0)
ibase\_blob\_open — Open blob for retrieving data parts
### Description
```
ibase_blob_open(resource $link_identifier, string $blob_id): resource|false
```
```
ibase_blob_open(string $blob_id): resource|false
```
Opens an existing BLOB for reading.
### Parameters
`link_identifier`
An InterBase link identifier. If omitted, the last opened link is assumed.
`blob_id`
A BLOB id.
### Return Values
Returns a BLOB handle for later use with [ibase\_blob\_get()](function.ibase-blob-get) or **`false`** on failure.
### See Also
* [ibase\_blob\_close()](function.ibase-blob-close) - Close blob
* [ibase\_blob\_echo()](function.ibase-blob-echo) - Output blob contents to browser
* [ibase\_blob\_get()](function.ibase-blob-get) - Get len bytes data from open blob
php preg_quote preg\_quote
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
preg\_quote — Quote regular expression characters
### Description
```
preg_quote(string $str, ?string $delimiter = null): string
```
**preg\_quote()** takes `str` and puts a backslash in front of every character that is part of the regular expression syntax. This is useful if you have a run-time string that you need to match in some text and the string may contain special regex characters.
The special regular expression characters are: `. \ + * ? [ ^ ] $ ( ) { } = ! < > | : - #`
Note that `/` is not a special regular expression character.
>
> **Note**:
>
>
> Note that **preg\_quote()** is not meant to be applied to the $replacement string(s) of [preg\_replace()](function.preg-replace) etc.
>
>
### Parameters
`str`
The input string.
`delimiter`
If the optional `delimiter` is specified, it will also be escaped. This is useful for escaping the delimiter that is required by the PCRE functions. The `/` is the most commonly used delimiter.
### Return Values
Returns the quoted (escaped) string.
### Changelog
| Version | Description |
| --- | --- |
| 7.3.0 | The `#` character is now quoted |
| 7.2.0 | `delimiter` is nullable now. |
### Examples
**Example #1 **preg\_quote()** example**
```
<?php
$keywords = '$40 for a g3/400';
$keywords = preg_quote($keywords, '/');
echo $keywords; // returns \$40 for a g3\/400
?>
```
**Example #2 Italicizing a word within some text**
```
<?php
// In this example, preg_quote($word) is used to keep the
// asterisks from having special meaning to the regular
// expression.
$textbody = "This book is *very* difficult to find.";
$word = "*very*";
$textbody = preg_replace ("/" . preg_quote($word, '/') . "/",
"<i>" . $word . "</i>",
$textbody);
?>
```
### Notes
> **Note**: This function is binary-safe.
>
>
### See Also
* [PCRE Patterns](https://www.php.net/manual/en/pcre.pattern.php)
* [escapeshellcmd()](function.escapeshellcmd) - Escape shell metacharacters
| programming_docs |
php Throwable::getTrace Throwable::getTrace
===================
(PHP 7, PHP 8)
Throwable::getTrace — Gets the stack trace
### Description
```
public Throwable::getTrace(): array
```
Returns the stack trace as an array.
### Parameters
This function has no parameters.
### Return Values
Returns the stack trace as an array in the same format as [debug\_backtrace()](function.debug-backtrace).
### See Also
* [Exception::getTrace()](exception.gettrace) - Gets the stack trace
php sodium_crypto_aead_xchacha20poly1305_ietf_decrypt sodium\_crypto\_aead\_xchacha20poly1305\_ietf\_decrypt
======================================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_aead\_xchacha20poly1305\_ietf\_decrypt — (Preferred) Verify then decrypt with XChaCha20-Poly1305
### Description
```
sodium_crypto_aead_xchacha20poly1305_ietf_decrypt(
string $ciphertext,
string $additional_data,
string $nonce,
string $key
): string|false
```
Verify then decrypt with ChaCha20-Poly1305 (eXtended-nonce variant).
Generally, XChaCha20-Poly1305 is the best of the provided AEAD modes to use.
### 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. 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
Returns the plaintext on success, or **`false`** on failure.
php phpdbg_clear phpdbg\_clear
=============
(PHP 5 >= 5.6.0, PHP 7, PHP 8)
phpdbg\_clear — Clears all breakpoints
### Description
```
phpdbg_clear(): void
```
Clear all breakpoints that have been set, either via one of the **phpdbg\_break\_\*()** functions or interactively in the console.
**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
* [phpdbg\_break\_file()](function.phpdbg-break-file) - Inserts a breakpoint at a line in a file
* [phpdbg\_break\_function()](function.phpdbg-break-function) - Inserts a breakpoint at entry to a function
* [phpdbg\_break\_method()](function.phpdbg-break-method) - Inserts a breakpoint at entry to a method
* [phpdbg\_break\_next()](function.phpdbg-break-next) - Inserts a breakpoint at the next opcode
php sodium_crypto_core_ristretto255_scalar_add sodium\_crypto\_core\_ristretto255\_scalar\_add
===============================================
(PHP 8 >= 8.1.0)
sodium\_crypto\_core\_ristretto255\_scalar\_add — Adds a scalar value
### Description
```
sodium_crypto_core_ristretto255_scalar_add(string $x, string $y): string
```
Adds an element `y` to `x`. Available as of libsodium 1.0.18.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`x`
Scalar, representing the X coordinate.
`y`
Scalar, representing the Y coordinate.
### Return Values
Returns a 32-byte random string.
### Examples
**Example #1 **sodium\_crypto\_core\_ristretto255\_scalar\_add()** example**
```
<?php
$foo = sodium_crypto_core_ristretto255_scalar_random();
$bar = sodium_crypto_core_ristretto255_scalar_random();
$value = sodium_crypto_core_ristretto255_scalar_add($foo, $bar);
$value = sodium_crypto_core_ristretto255_scalar_sub($value, $bar);
var_dump(hash_equals($foo, $value));
?>
```
The above example will output:
```
bool(true)
```
### See Also
* [sodium\_crypto\_core\_ristretto255\_scalar\_random()](function.sodium-crypto-core-ristretto255-scalar-random) - Generates a random key
* [sodium\_crypto\_core\_ristretto255\_scalar\_sub()](function.sodium-crypto-core-ristretto255-scalar-sub) - Subtracts a scalar value
php SQLite3::lastErrorMsg SQLite3::lastErrorMsg
=====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3::lastErrorMsg — Returns English text describing the most recent failed SQLite request
### Description
```
public SQLite3::lastErrorMsg(): string
```
Returns English text describing the most recent failed SQLite request.
### Parameters
This function has no parameters.
### Return Values
Returns an English string describing the most recent failed SQLite request.
php None Error Control Operators
-----------------------
PHP supports one error control operator: the at sign (`@`). When prepended to an expression in PHP, any diagnostic error that might be generated by that expression will be suppressed.
If a custom error handler function is set with [set\_error\_handler()](function.set-error-handler), it will still be called even though the diagnostic has been suppressed.
**Warning** Prior to PHP 8.0.0, the [error\_reporting()](function.error-reporting) called inside the custom error handler always returned `0` if the error was suppressed by the `@` operator. As of PHP 8.0.0, it returns the value `E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE`.
Any error message generated by the expression is available in the `"message"` element of the array returned by [error\_get\_last()](function.error-get-last). The result of that function will change on each error, so it needs to be checked early.
```
<?php
/* Intentional file error */
$my_file = @file ('non_existent_file') or
die ("Failed opening file: error was '" . error_get_last()['message'] . "'");
// this works for any expression, not just functions:
$value = @$cache[$key];
// will not issue a notice if the index $key doesn't exist.
?>
```
> **Note**: The `@`-operator works only on [expressions](language.expressions). A simple rule of thumb is: if one can take the value of something, then one can prepend the `@` operator to it. For instance, it can be prepended to variables, functions calls, certain language construct calls (e.g. [include](function.include)), and so forth. It cannot be prepended to function or class definitions, or conditional structures such as `if` and [foreach](control-structures.foreach), and so forth.
>
>
**Warning** Prior to PHP 8.0.0, it was possible for the `@` operator to disable critical errors that will terminate script execution. For example, prepending `@` to a call of a function which did not exist, by being unavailable or mistyped, would cause the script to terminate with no indication as to why.
### See Also
* [error\_reporting()](function.error-reporting)
* [Error Handling and Logging functions](https://www.php.net/manual/en/ref.errorfunc.php)
php None What References Do
------------------
There are three basic operations performed using references: [assigning by reference](language.references.whatdo#language.references.whatdo.assign), [passing by reference](language.references.whatdo#language.references.whatdo.pass), and [returning by reference](language.references.whatdo#language.references.whatdo.return). This section will give an introduction to these operations, with links for further reading.
### Assign By Reference
In the first of these, PHP references allow you to make two variables refer to the same content. Meaning, when you do:
```
<?php
$a =& $b;
?>
```
it means that $a and $b point to the same content.
>
> **Note**:
>
>
> $a and $b are completely equal here. $a is not pointing to $b or vice versa. $a and $b are pointing to the same place.
>
>
>
> **Note**:
>
>
> If you assign, pass, or return an undefined variable by reference, it will get created.
>
>
> **Example #1 Using references with undefined variables**
>
>
> ```
> <?php
> function foo(&$var) { }
>
> foo($a); // $a is "created" and assigned to null
>
> $b = array();
> foo($b['b']);
> var_dump(array_key_exists('b', $b)); // bool(true)
>
> $c = new StdClass;
> foo($c->d);
> var_dump(property_exists($c, 'd')); // bool(true)
> ?>
> ```
>
The same syntax can be used with functions that return references:
```
<?php
$foo =& find_var($bar);
?>
```
Using the same syntax with a function that does *not* return by reference will give an error, as will using it with the result of the [new](language.oop5.basic#language.oop5.basic.new) operator. Although objects are passed around as pointers, these are not the same as references, as explained under [Objects and references](language.oop5.references).
**Warning** If you assign a reference to a variable declared `global` inside a function, the reference will be visible only inside the function. You can avoid this by using the [$GLOBALS](reserved.variables.globals) array.
**Example #2 Referencing global variables inside functions**
```
<?php
$var1 = "Example variable";
$var2 = "";
function global_references($use_globals)
{
global $var1, $var2;
if (!$use_globals) {
$var2 =& $var1; // visible only inside the function
} else {
$GLOBALS["var2"] =& $var1; // visible also in global context
}
}
global_references(false);
echo "var2 is set to '$var2'\n"; // var2 is set to ''
global_references(true);
echo "var2 is set to '$var2'\n"; // var2 is set to 'Example variable'
?>
```
Think about `global $var;` as a shortcut to `$var
=& $GLOBALS['var'];`. Thus assigning another reference to `$var` only changes the local variable's reference.
>
> **Note**:
>
>
> If you assign a value to a variable with references in a [foreach](control-structures.foreach) statement, the references are modified too.
>
>
> **Example #3 References and foreach statement**
>
>
> ```
> <?php
> $ref = 0;
> $row =& $ref;
> foreach (array(1, 2, 3) as $row) {
> // do something
> }
> echo $ref; // 3 - last element of the iterated array
> ?>
> ```
>
While not being strictly an assignment by reference, expressions created with the language construct [`array()`](function.array) can also behave as such by prefixing `&` to the array element to add. Example:
```
<?php
$a = 1;
$b = array(2, 3);
$arr = array(&$a, &$b[0], &$b[1]);
$arr[0]++; $arr[1]++; $arr[2]++;
/* $a == 2, $b == array(3, 4); */
?>
```
Note, however, that references inside arrays are potentially dangerous. Doing a normal (not by reference) assignment with a reference on the right side does not turn the left side into a reference, but references inside arrays are preserved in these normal assignments. This also applies to function calls where the array is passed by value. Example:
```
<?php
/* Assignment of scalar variables */
$a = 1;
$b =& $a;
$c = $b;
$c = 7; //$c is not a reference; no change to $a or $b
/* Assignment of array variables */
$arr = array(1);
$a =& $arr[0]; //$a and $arr[0] are in the same reference set
$arr2 = $arr; //not an assignment-by-reference!
$arr2[0]++;
/* $a == 2, $arr == array(2) */
/* The contents of $arr are changed even though it's not a reference! */
?>
```
In other words, the reference behavior of arrays is defined in an element-by-element basis; the reference behavior of individual elements is dissociated from the reference status of the array container. ### Pass By Reference
The second thing references do is to pass variables by reference. This is done by making a local variable in a function and a variable in the calling scope referencing the same content. Example:
```
<?php
function foo(&$var)
{
$var++;
}
$a=5;
foo($a);
?>
```
will make $a to be 6. This happens because in the function foo the variable $var refers to the same content as $a. For more information on this, read the [passing by reference](language.references.pass) section. ### Return By Reference
The third thing references can do is [return by reference](language.references.return).
php symlink symlink
=======
(PHP 4, PHP 5, PHP 7, PHP 8)
symlink — Creates a symbolic link
### Description
```
symlink(string $target, string $link): bool
```
**symlink()** creates a symbolic link to the existing `target` with the specified name `link`.
### Parameters
`target`
Target of the link.
`link`
The link name.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
The function fails, and issues **`E_WARNING`**, if `link` already exists. On Windows, the function also fails, and issues **`E_WARNING`**, if `target` does not exist.
### Examples
**Example #1 Create a symbolic link**
```
<?php
$target = 'uploads.php';
$link = 'uploads';
symlink($target, $link);
echo readlink($link);
?>
```
### See Also
* [link()](function.link) - Create a hard link
* [readlink()](function.readlink) - Returns the target of a symbolic link
* [linkinfo()](function.linkinfo) - Gets information about a link
* [unlink()](function.unlink) - Deletes a file
php None Integers
--------
An int is a number of the set ℤ = {..., -2, -1, 0, 1, 2, ...}.
### See Also
* [Floating point numbers](language.types.float)
* [Arbitrary precision / BCMath](https://www.php.net/manual/en/book.bc.php)
* [Arbitrary length integer / GMP](https://www.php.net/manual/en/book.gmp.php)
### Syntax
Ints can be specified in decimal (base 10), hexadecimal (base 16), octal (base 8) or binary (base 2) notation. The [negation operator](language.operators.arithmetic) can be used to denote a negative int.
To use octal notation, precede the number with a `0` (zero). As of PHP 8.1.0, octal notation can also be preceded with `0o` or `0O`. To use hexadecimal notation precede the number with `0x`. To use binary notation precede the number with `0b`.
As of PHP 7.4.0, integer literals may contain underscores (`_`) between digits, for better readability of literals. These underscores are removed by PHP's scanner.
**Example #1 Integer literals**
```
<?php
$a = 1234; // decimal number
$a = 0123; // octal number (equivalent to 83 decimal)
$a = 0o123; // octal number (as of PHP 8.1.0)
$a = 0x1A; // hexadecimal number (equivalent to 26 decimal)
$a = 0b11111111; // binary number (equivalent to 255 decimal)
$a = 1_234_567; // decimal number (as of PHP 7.4.0)
?>
```
Formally, the structure for int literals is as of PHP 8.1.0 (previously, the `0o` or `0O` octal prefixes were not allowed, and prior to PHP 7.4.0 the underscores were not allowed):
```
decimal : [1-9][0-9]*(_[0-9]+)*
| 0
hexadecimal : 0[xX][0-9a-fA-F]+(_[0-9a-fA-F]+)*
octal : 0[oO]?[0-7]+(_[0-7]+)*
binary : 0[bB][01]+(_[01]+)*
integer : decimal
| hexadecimal
| octal
| binary
```
The size of an int is platform-dependent, although a maximum value of about two billion is the usual value (that's 32 bits signed). 64-bit platforms usually have a maximum value of about 9E18. PHP does not support unsigned ints. int size can be determined using the constant **`PHP_INT_SIZE`**, maximum value using the constant **`PHP_INT_MAX`**, and minimum value using the constant **`PHP_INT_MIN`**.
### Integer overflow
If PHP encounters a number beyond the bounds of the int type, it will be interpreted as a float instead. Also, an operation which results in a number beyond the bounds of the int type will return a float instead.
**Example #2 Integer overflow on a 32-bit system**
```
<?php
$large_number = 2147483647;
var_dump($large_number); // int(2147483647)
$large_number = 2147483648;
var_dump($large_number); // float(2147483648)
$million = 1000000;
$large_number = 50000 * $million;
var_dump($large_number); // float(50000000000)
?>
```
**Example #3 Integer overflow on a 64-bit system**
```
<?php
$large_number = 9223372036854775807;
var_dump($large_number); // int(9223372036854775807)
$large_number = 9223372036854775808;
var_dump($large_number); // float(9.2233720368548E+18)
$million = 1000000;
$large_number = 50000000000000 * $million;
var_dump($large_number); // float(5.0E+19)
?>
```
There is no int division operator in PHP, to achieve this use the [intdiv()](function.intdiv) function. `1/2` yields the float `0.5`. The value can be cast to an int to round it towards zero, or the [round()](function.round) function provides finer control over rounding.
```
<?php
var_dump(25/7); // float(3.5714285714286)
var_dump((int) (25/7)); // int(3)
var_dump(round(25/7)); // float(4)
?>
```
### Converting to integer
To explicitly convert a value to int, use either the `(int)` or `(integer)` casts. However, in most cases the cast is not needed, since a value will be automatically converted if an operator, function or control structure requires an int argument. A value can also be converted to int with the [intval()](function.intval) function.
If a resource is converted to an int, then the result will be the unique resource number assigned to the resource by PHP at runtime.
See also [Type Juggling](language.types.type-juggling).
#### From [booleans](language.types.boolean)
**`false`** will yield `0` (zero), and **`true`** will yield `1` (one).
#### From [floating point numbers](language.types.float)
When converting from float to int, the number will be rounded *towards zero*. As of PHP 8.1.0, a deprecation notice is emitted when implicitly converting a non-integral float to int which loses precision.
```
<?php
function foo($value): int {
return $value;
}
var_dump(foo(8.1)); // "Deprecated: Implicit conversion from float 8.1 to int loses precision" as of PHP 8.1.0
var_dump(foo(8.1)); // 8 prior to PHP 8.1.0
var_dump(foo(8.0)); // 8 in both cases
var_dump((int)8.1); // 8 in both cases
var_dump(intval(8.1)); // 8 in both cases
?>
```
If the float is beyond the boundaries of int (usually `+/- 2.15e+9 = 2^31` on 32-bit platforms and `+/- 9.22e+18 = 2^63` on 64-bit platforms), the result is undefined, since the float doesn't have enough precision to give an exact int result. No warning, not even a notice will be issued when this happens!
>
> **Note**:
>
>
> NaN and Infinity will always be zero when cast to int.
>
>
**Warning** Never cast an unknown fraction to int, as this can sometimes lead to unexpected results.
```
<?php
echo (int) ( (0.1+0.7) * 10 ); // echoes 7!
?>
```
See also the [warning about float precision](language.types.float#warn.float-precision).
#### From strings
If the string is [numeric](language.types.numeric-strings) or leading numeric then it will resolve to the corresponding integer value, otherwise it is converted to zero (`0`).
#### From NULL
**`null`** is always converted to zero (`0`).
#### From other types
**Caution** The behaviour of converting to int is undefined for other types. Do *not* rely on any observed behaviour, as it can change without notice.
php SimpleXMLElement::saveXML SimpleXMLElement::saveXML
=========================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
SimpleXMLElement::saveXML — Alias of [SimpleXMLElement::asXML()](simplexmlelement.asxml)
### Description
This method is an alias of: [SimpleXMLElement::asXML()](simplexmlelement.asxml)
php Imagick::getImageProfile Imagick::getImageProfile
========================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageProfile — Returns the named image profile
### Description
```
public Imagick::getImageProfile(string $name): string
```
Returns the named image profile.
### Parameters
`name`
The name of the profile to return.
### Return Values
Returns a string containing the image profile.
### Errors/Exceptions
Throws ImagickException on error.
| programming_docs |
php gmp_div_q gmp\_div\_q
===========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_div\_q — Divide numbers
### Description
```
gmp_div_q(GMP|int|string $num1, GMP|int|string $num2, int $rounding_mode = GMP_ROUND_ZERO): GMP
```
Divides `num1` by `num2` and returns the integer result.
### Parameters
`num1`
The number being divided.
A [GMP](class.gmp) object, an int or a numeric string.
`num2`
The number that `num1` is being divided by.
A [GMP](class.gmp) object, an int or a numeric string.
`rounding_mode`
The result rounding is defined by the `rounding_mode`, which can have the following values:
* **`GMP_ROUND_ZERO`**: The result is truncated towards 0.
* **`GMP_ROUND_PLUSINF`**: The result is rounded towards `+infinity`.
* **`GMP_ROUND_MINUSINF`**: The result is rounded towards `-infinity`.
A [GMP](class.gmp) object, an int or a numeric string.
### Return Values
A [GMP](class.gmp) object.
### Examples
**Example #1 **gmp\_div\_q()** example**
```
<?php
$div1 = gmp_div_q("100", "5");
echo gmp_strval($div1) . "\n";
$div2 = gmp_div_q("1", "3");
echo gmp_strval($div2) . "\n";
$div3 = gmp_div_q("1", "3", GMP_ROUND_PLUSINF);
echo gmp_strval($div3) . "\n";
$div4 = gmp_div_q("-1", "4", GMP_ROUND_PLUSINF);
echo gmp_strval($div4) . "\n";
$div5 = gmp_div_q("-1", "4", GMP_ROUND_MINUSINF);
echo gmp_strval($div5) . "\n";
?>
```
The above example will output:
```
20
0
1
0
-1
```
### Notes
>
> **Note**:
>
>
> This function can also be called as [gmp\_div()](function.gmp-div).
>
>
### See Also
* [gmp\_div\_r()](function.gmp-div-r) - Remainder of the division of numbers
* [gmp\_div\_qr()](function.gmp-div-qr) - Divide numbers and get quotient and remainder
php pcntl_unshare pcntl\_unshare
==============
(PHP 7 >= 7.4.0, PHP 8)
pcntl\_unshare — Dissociates parts of the process execution context
### Description
```
pcntl_unshare(int $flags): bool
```
**pcntl\_unshare()** allows a process to disassociate parts of its execution context that are currently being shared with other processes. The main use of **pcntl\_unshare()** is to allow a process to control its shared execution context without creating a new process.
### Parameters
`flags`
The `flags` parameter is a bitmask that specifies which parts of the execution context should be unshared. This parameter is specified by ORing together zero or more of the `CLONE_*` constants:
* **`CLONE_NEWNS`**
* **`CLONE_NEWIPC`**
* **`CLONE_NEWUTS`**
* **`CLONE_NEWNET`**
* **`CLONE_NEWPID`**
* **`CLONE_NEWUSER`**
* **`CLONE_NEWCGROUP`**
### Return Values
Returns `0` on success, `-1` otherwise. On failure it sets an error code, that can be retrieved with [pcntl\_get\_last\_error()](function.pcntl-get-last-error).
### See Also
* [PCNTL Constants](https://www.php.net/manual/en/pcntl.constants.php#pcntl.constants.clone)
* [pcntl\_get\_last\_error()](function.pcntl-get-last-error) - Retrieve the error number set by the last pcntl function which failed
php The EventBase class
The EventBase class
===================
Introduction
------------
(PECL event >= 1.2.6-beta)
**EventBase** class represents libevent's event base structure. It holds a set of events and can poll to determine which events are active.
Each event base has a *method* , or a *backend* that it uses to determine which events are ready. The recognized methods are: `select` , `poll` , `epoll` , `kqueue` , `devpoll` , `evport` and `win32` .
To configure event base to use, or avoid specific backend [EventConfig](class.eventconfig) class can be used.
**Warning** Do *NOT* destroy the **EventBase** object as long as resources of the associated `Event` objects are not released. Otherwise, it will lead to unpredictable results!
Class synopsis
--------------
final class **EventBase** { /\* Constants \*/ const int [LOOP\_ONCE](class.eventbase#eventbase.constants.loop-once) = 1;
const int [LOOP\_NONBLOCK](class.eventbase#eventbase.constants.loop-nonblock) = 2;
const int [NOLOCK](class.eventbase#eventbase.constants.nolock) = 1;
const int [STARTUP\_IOCP](class.eventbase#eventbase.constants.startup-iocp) = 4;
const int [NO\_CACHE\_TIME](class.eventbase#eventbase.constants.no-cache-time) = 8;
const int [EPOLL\_USE\_CHANGELIST](class.eventbase#eventbase.constants.epoll-use-changelist) = 16; /\* Methods \*/
```
public __construct( EventConfig $cfg = ?)
```
```
public dispatch(): void
```
```
public exit( float $timeout = ?): bool
```
```
public free(): void
```
```
public getFeatures(): int
```
```
public getMethod(): string
```
```
public getTimeOfDayCached(): float
```
```
public gotExit(): bool
```
```
public gotStop(): bool
```
```
public loop( int $flags = ?): bool
```
```
public priorityInit( int $n_priorities ): bool
```
```
public reInit(): bool
```
```
public stop(): bool
```
} Predefined Constants
--------------------
**`EventBase::LOOP_ONCE`** Flag used with [EventBase::loop()](eventbase.loop) method which means: "block until libevent has an active event, then exit once all active events have had their callbacks run".
**`EventBase::LOOP_NONBLOCK`** Flag used with [EventBase::loop()](eventbase.loop) method which means: "do not block: see which events are ready now, run the callbacks of the highest-priority ones, then exit".
**`EventBase::NOLOCK`** Configuration flag. Do not allocate a lock for the event base, even if we have locking set up".
**`EventBase::STARTUP_IOCP`** Windows-only configuration flag. Enables the IOCP dispatcher at startup.
**`EventBase::NO_CACHE_TIME`** Configuration flag. Instead of checking the current time every time the event loop is ready to run timeout callbacks, check after each timeout callback.
**`EventBase::EPOLL_USE_CHANGELIST`** If we are using the `epoll` backend, this flag says that it is safe to use Libevent's internal change-list code to batch up adds and deletes in order to try to do as few syscalls as possible.
Setting this flag can make code run faster, but it may trigger a Linux bug: it is not safe to use this flag if one has any fds cloned by dup(), or its variants. Doing so will produce strange and hard-to-diagnose bugs.
This flag can also be activated by settnig the `EVENT_EPOLL_USE_CHANGELIST` environment variable.
This flag has no effect if one winds up using a backend other than `epoll` .
Table of Contents
-----------------
* [EventBase::\_\_construct](eventbase.construct) — Constructs EventBase object
* [EventBase::dispatch](eventbase.dispatch) — Dispatch pending events
* [EventBase::exit](eventbase.exit) — Stop dispatching events
* [EventBase::free](eventbase.free) — Free resources allocated for this event base
* [EventBase::getFeatures](eventbase.getfeatures) — Returns bitmask of features supported
* [EventBase::getMethod](eventbase.getmethod) — Returns event method in use
* [EventBase::getTimeOfDayCached](eventbase.gettimeofdaycached) — Returns the current event base time
* [EventBase::gotExit](eventbase.gotexit) — Checks if the event loop was told to exit
* [EventBase::gotStop](eventbase.gotstop) — Checks if the event loop was told to exit
* [EventBase::loop](eventbase.loop) — Dispatch pending events
* [EventBase::priorityInit](eventbase.priorityinit) — Sets number of priorities per event base
* [EventBase::reInit](eventbase.reinit) — Re-initialize event base(after a fork)
* [EventBase::stop](eventbase.stop) — Tells event\_base to stop dispatching events
php IntlChar::isWhitespace IntlChar::isWhitespace
======================
(PHP 7, PHP 8)
IntlChar::isWhitespace — Check if code point is a whitespace character according to ICU
### Description
```
public static IntlChar::isWhitespace(int|string $codepoint): ?bool
```
Determines if the specified code point is a whitespace character according to ICU.
A character is considered to be a ICU whitespace character if and only if it satisfies one of the following criteria:
* It is a Unicode Separator character (categories "Z" = "Zs" or "Zl" or "Zp"), but is not also a non-breaking space (U+00A0 NBSP or U+2007 Figure Space or U+202F Narrow NBSP).
* It is U+0009 HORIZONTAL TABULATION.
* It is U+000A LINE FEED.
* It is U+000B VERTICAL TABULATION.
* It is U+000C FORM FEED.
* It is U+000D CARRIAGE RETURN.
* It is U+001C FILE SEPARATOR.
* It is U+001D GROUP SEPARATOR.
* It is U+001E RECORD SEPARATOR.
* It is U+001F UNIT SEPARATOR.
### 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 whitespace character according to ICU, **`false`** if not. Returns **`null`** on failure.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::iswhitespace("A"));
var_dump(IntlChar::iswhitespace(" "));
var_dump(IntlChar::iswhitespace("\n"));
var_dump(IntlChar::iswhitespace("\t"));
var_dump(IntlChar::iswhitespace("\u{00A0}"));
?>
```
The above example will output:
```
bool(false)
bool(true)
bool(true)
bool(true)
bool(false)
```
### 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
php DateTime::createFromImmutable DateTime::createFromImmutable
=============================
(PHP 7 >= 7.3.0, PHP 8)
DateTime::createFromImmutable — Returns new DateTime instance encapsulating the given DateTimeImmutable object
### Description
```
public static DateTime::createFromImmutable(DateTimeImmutable $object): static
```
### Parameters
`object`
The immutable [DateTimeImmutable](class.datetimeimmutable) object that needs to be converted to a mutable version. This object is not modified, but instead a new [DateTime](class.datetime) instance is created containing the same date, time, and timezone information.
### Return Values
Returns a new [DateTime](class.datetime) instance.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | The method returns an instance of the currently invoked class now. Previously, it created a new instance of [DateTime](class.datetime). |
### Examples
**Example #1 Creating a mutable date time object**
```
<?php
$date = new DateTimeImmutable("2014-06-20 11:45 Europe/London");
$mutable = DateTime::createFromImmutable( $date );
?>
```
php imagealphablending imagealphablending
==================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
imagealphablending — Set the blending mode for an image
### Description
```
imagealphablending(GdImage $image, bool $enable): bool
```
**imagealphablending()** allows for two different modes of drawing on truecolor images. In blending mode, the alpha channel component of the color supplied to all drawing function, such as [imagesetpixel()](function.imagesetpixel) determines how much of the underlying color should be allowed to shine through. As a result, gd automatically blends the existing color at that point with the drawing color, and stores the result in the image. The resulting pixel is opaque. In non-blending mode, the drawing color is copied literally with its alpha channel information, replacing the destination pixel. Blending mode is not available when drawing on palette images.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`enable`
Whether to enable the blending mode or not. On true color images the default value is **`true`** otherwise the default value is **`false`**
### 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 **imagealphablending()** usage example**
```
<?php
// Create image
$im = imagecreatetruecolor(100, 100);
// Set alphablending to on
imagealphablending($im, true);
// Draw a square
imagefilledrectangle($im, 30, 30, 70, 70, imagecolorallocate($im, 255, 0, 0));
// Output
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>
```
php Imagick::modulateImage Imagick::modulateImage
======================
(PECL imagick 2, PECL imagick 3)
Imagick::modulateImage — Control the brightness, saturation, and hue
### Description
```
public Imagick::modulateImage(float $brightness, float $saturation, float $hue): bool
```
Lets you control the brightness, saturation, and hue of an image. Hue is the percentage of absolute rotation from the current position. For example 50 results in a counter-clockwise rotation of 90 degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200 both resulting in a rotation of 180 degrees.
### Parameters
`brightness`
`saturation`
`hue`
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::modulateImage()****
```
<?php
function modulateImage($imagePath, $hue, $brightness, $saturation) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->modulateImage($brightness, $saturation, $hue);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php sodium_crypto_core_ristretto255_random sodium\_crypto\_core\_ristretto255\_random
==========================================
(PHP 8 >= 8.1.0)
sodium\_crypto\_core\_ristretto255\_random — Generates a random key
### Description
```
sodium_crypto_core_ristretto255_random(): string
```
Generates a random key. Available as of libsodium 1.0.18.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
Returns a 32-byte random string.
### Examples
**Example #1 **sodium\_crypto\_core\_ristretto255\_random()** 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\_add()](function.sodium-crypto-core-ristretto255-add) - Adds an element
* [sodium\_crypto\_core\_ristretto255\_sub()](function.sodium-crypto-core-ristretto255-sub) - Subtracts an element
php opcache_reset opcache\_reset
==============
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL ZendOpcache >= 7.0.0)
opcache\_reset — Resets the contents of the opcode cache
### Description
```
opcache_reset(): bool
```
This function resets the entire opcode cache. After calling **opcache\_reset()**, all scripts will be reloaded and reparsed the next time they are hit. This function only resets in-memory cache, not the file cache.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the opcode cache was reset, or **`false`** if the opcode cache is disabled.
### See Also
* [opcache\_invalidate()](function.opcache-invalidate) - Invalidates a cached script
php Parle\Stack::push Parle\Stack::push
=================
(PECL parle >= 0.5.1)
Parle\Stack::push — Push an item into the stack
### Description
```
public Parle\Stack::push(mixed $item): void
```
### Parameters
`item`
Variable to be pushed.
### Return Values
No value is returned.
php Gmagick::setimagebordercolor Gmagick::setimagebordercolor
============================
(PECL gmagick >= Unknown)
Gmagick::setimagebordercolor — Sets the image border color
### Description
```
public Gmagick::setimagebordercolor(GmagickPixel $color): Gmagick
```
Sets the image border color.
### Parameters
`color`
The border pixel wand.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php Ds\Queue::capacity Ds\Queue::capacity
==================
(PECL ds >= 1.0.0)
Ds\Queue::capacity — Returns the current capacity
### Description
```
public Ds\Queue::capacity(): int
```
Returns the current capacity.
### Parameters
This function has no parameters.
### Return Values
The current capacity.
### Examples
**Example #1 **Ds\Queue::capacity()** example**
```
<?php
$queue = new \Ds\Queue();
var_dump($queue->capacity());
$queue->push(...range(1, 50));
var_dump($queue->capacity());
?>
```
The above example will output something similar to:
```
int(8)
int(64)
```
php DOMCharacterData::appendData DOMCharacterData::appendData
============================
(PHP 5, PHP 7, PHP 8)
DOMCharacterData::appendData — Append the string to the end of the character data of the node
### Description
```
public DOMCharacterData::appendData(string $data): bool
```
Append the string `data` to the end of the character data of the node.
### Parameters
`data`
The string to append.
### Return Values
No value is returned.
### See Also
* [DOMCharacterData::deleteData()](domcharacterdata.deletedata) - Remove a range of characters from the node
* [DOMCharacterData::insertData()](domcharacterdata.insertdata) - Insert a string at the specified 16-bit unit offset
* [DOMCharacterData::replaceData()](domcharacterdata.replacedata) - Replace a substring within the DOMCharacterData node
* [DOMCharacterData::substringData()](domcharacterdata.substringdata) - Extracts a range of data from the node
php RecursiveDirectoryIterator::getSubPath RecursiveDirectoryIterator::getSubPath
======================================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
RecursiveDirectoryIterator::getSubPath — Get sub path
### Description
```
public RecursiveDirectoryIterator::getSubPath(): string
```
Returns the sub path relative to the directory given in the constructor.
### Parameters
This function has no parameters.
### Return Values
The sub path.
### Examples
**Example #1 **getSubPath()** example**
```
$directory = '/tmp';
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory));
foreach ($it as $file) {
echo 'SubPathName: ' . $it->getSubPathName() . "\n";
echo 'SubPath: ' . $it->getSubPath() . "\n\n";
}
```
The above example will output something similar to:
```
SubPathName: fruit/apple.xml
SubPath: fruit
SubPathName: stuff.xml
SubPath:
SubPathName: veggies/carrot.xml
SubPath: veggies
```
### See Also
* [RecursiveDirectoryIterator::getSubPathName()](recursivedirectoryiterator.getsubpathname) - Get sub path and name
* [RecursiveDirectoryIterator::key()](recursivedirectoryiterator.key) - Return path and filename of current dir entry
php SolrDocument::sort SolrDocument::sort
==================
(PECL solr >= 0.9.2)
SolrDocument::sort — Sorts the fields in the document
### Description
```
public SolrDocument::sort(int $sortOrderBy, int $sortDirection = SolrDocument::SORT_ASC): bool
```
```
The fields are rearranged according to the specified criteria and sort direction
Fields can be sorted by boost values, field names and number of values.
The sortOrderBy parameter must be one of :
* SolrDocument::SORT_FIELD_NAME
* SolrDocument::SORT_FIELD_BOOST_VALUE
* SolrDocument::SORT_FIELD_VALUE_COUNT
The sortDirection can be one of :
* SolrDocument::SORT_DEFAULT
* SolrDocument::SORT_ASC
* SolrDocument::SORT_DESC
The default way is to sort in ascending order.
```
### Parameters
`sortOrderBy`
The sort criteria.
`sortDirection`
The sort direction.
### Return Values
Returns **`true`** on success or **`false`** on failure.
| programming_docs |
php libxml_use_internal_errors libxml\_use\_internal\_errors
=============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
libxml\_use\_internal\_errors — Disable libxml errors and allow user to fetch error information as needed
### Description
```
libxml_use_internal_errors(?bool $use_errors = null): bool
```
**libxml\_use\_internal\_errors()** allows you to disable standard libxml errors and enable user error handling.
### Parameters
`use_errors`
Enable (**`true`**) user error handling or disable (**`false`**) user error handling. Disabling will also clear any existing libxml errors.
### Return Values
This function returns the previous value of `use_errors`.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `use_errors` is nullable now. Previously, its default was **`false`**. |
### Examples
**Example #1 A **libxml\_use\_internal\_errors()** example**
This example demonstrates the basic usage of libxml errors and the value returned by this function.
```
<?php
// enable user error handling
var_dump(libxml_use_internal_errors(true));
// load the document
$doc = new DOMDocument;
if (!$doc->load('file.xml')) {
foreach (libxml_get_errors() as $error) {
// handle errors here
}
libxml_clear_errors();
}
?>
```
The above example will output:
```
bool(false)
```
### See Also
* [libxml\_clear\_errors()](function.libxml-clear-errors) - Clear libxml error buffer
* [libxml\_get\_errors()](function.libxml-get-errors) - Retrieve array of errors
php Ev::supportedBackends Ev::supportedBackends
=====================
(PECL ev >= 0.2.0)
Ev::supportedBackends — Returns the set of backends supported by current libev configuration
### Description
```
final public static Ev::supportedBackends(): int
```
Returns the set of backends supported by current libev configuration.
### Parameters
This function has no parameters.
### Return Values
Returns a bit mask which can containing [backend flags](class.ev#ev.constants.watcher-backends) combined using bitwise *OR* operator.
### 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
* [EvEmbed](class.evembed)
* [Ev::recommendedBackends()](ev.recommendedbackends) - Returns a bit mask of recommended backends for current platform
* [Ev::embeddableBackends()](ev.embeddablebackends) - Returns the set of backends that are embeddable in other event loops
* [Backend flags](class.ev#ev.constants.watcher-backends)
* [Examples](https://www.php.net/manual/en/ev.examples.php)
php openssl_csr_get_public_key openssl\_csr\_get\_public\_key
==============================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
openssl\_csr\_get\_public\_key — Returns the public key of a CSR
### Description
```
openssl_csr_get_public_key(OpenSSLCertificateSigningRequest|string $csr, bool $short_names = true): OpenSSLAsymmetricKey|false
```
**openssl\_csr\_get\_public\_key()** extracts the public key from `csr` and prepares it for use by other functions.
### Parameters
`csr`
See [CSR parameters](https://www.php.net/manual/en/openssl.certparams.php) for a list of valid values.
`short_names`
**Warning** This parameter is ignored
### Return Values
Returns an [OpenSSLAsymmetricKey](class.opensslasymmetrickey) on success, or **`false`** on error.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | On success, this function returns an [OpenSSLAsymmetricKey](class.opensslasymmetrickey) instance now; previously, a [resource](language.types.resource) of type `OpenSSL key` was returned. |
| 8.0.0 | `csr` accepts an [OpenSSLCertificateSigningRequest](class.opensslcertificatesigningrequest) instance now; previously, a [resource](language.types.resource) of type `OpenSSL X.509 CSR` was accepted. |
### Examples
**Example #1 openssl\_csr\_get\_public\_key() example**
```
<?php
$subject = array(
"commonName" => "example.com",
);
$private_key = openssl_pkey_new(array(
"private_key_bits" => 2048,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
));
$csr = openssl_csr_new($subject, $private_key, array('digest_alg' => 'sha256') );
$public_key = openssl_csr_get_public_key($csr);
$info = openssl_pkey_get_details($public_key);
echo $info['key'];
?>
```
### See Also
* [openssl\_csr\_get\_subject()](function.openssl-csr-get-subject) - Returns the subject of a CSR
* [openssl\_csr\_new()](function.openssl-csr-new) - Generates a CSR
* [openssl\_pkey\_get\_details()](function.openssl-pkey-get-details) - Returns an array with the key details
* [openssl\_pkey\_export\_to\_file()](function.openssl-pkey-export-to-file) - Gets an exportable representation of a key into a file
* [openssl\_pkey\_export()](function.openssl-pkey-export) - Gets an exportable representation of a key into a string
php tidy::isXhtml tidy::isXhtml
=============
tidy\_is\_xhtml
===============
(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.5.2)
tidy::isXhtml -- tidy\_is\_xhtml — Indicates if the document is a XHTML document
### Description
Object-oriented style
```
public tidy::isXhtml(): bool
```
Procedural style
```
tidy_is_xhtml(tidy $tidy): bool
```
Tells if the document is a XHTML document.
### Parameters
`tidy`
The [Tidy](class.tidy) object.
### Return Values
This function returns **`true`** if the specified tidy `tidy` is a XHTML document, or **`false`** otherwise.
**Warning** This function is not yet implemented in the Tidylib itself, so it always return **`false`**.
php $GLOBALS $GLOBALS
========
(PHP 4, PHP 5, PHP 7, PHP 8)
$GLOBALS — References all variables available in global scope
### Description
An associative array containing references to all variables which are currently defined in the global scope of the script. The variable names are the keys of the array.
### Examples
**Example #1 $GLOBALS example**
```
<?php
function test() {
$foo = "local variable";
echo '$foo in global scope: ' . $GLOBALS["foo"] . "\n";
echo '$foo in current scope: ' . $foo . "\n";
}
$foo = "Example content";
test();
?>
```
The above example will output something similar to:
```
$foo in global scope: Example content
$foo in current scope: local variable
```
**Warning** As of PHP 8.1.0, write access to the entire $GLOBALS array is no longer supported:
**Example #2 writing entire $GLOBALS will result in error.**
```
<?php
// Generates compile-time error:
$GLOBALS = [];
$GLOBALS += [];
$GLOBALS =& $x;
$x =& $GLOBALS;
unset($GLOBALS);
array_pop($GLOBALS);
// ...and any other write/read-write operation on $GLOBALS
?>
```
### 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.
>
>
>
>
> **Note**: **Variable availability**
>
>
>
> Unlike all of the other [superglobals](language.variables.superglobals), $GLOBALS has essentially always been available in PHP.
>
>
>
> **Note**:
>
>
> As of PHP 8.1.0, $GLOBALS is now a read-only copy of the global symbol table. That is, global variables cannot be modified via its copy. Previously, $GLOBALS array is excluded from the usual by-value behavior of PHP arrays and global variables can be modified via its copy.
>
>
>
> ```
> <?php
> // Before PHP 8.1.0
> $a = 1;
> $globals = $GLOBALS; // Ostensibly by-value copy
> $globals['a'] = 2;
> var_dump($a); // int(2)
>
> // As of PHP 8.1.0
> // this no longer modifies $a. The previous behavior violated by-value semantics.
> $globals = $GLOBALS;
> $globals['a'] = 1;
>
> // To restore the previous behavior, iterate its copy and assign each property back to $GLOBALS.
> foreach ($globals as $key => $value) {
> $GLOBALS[$key] = $value;
> }
> ?>
> ```
>
php Ds\Map::union Ds\Map::union
=============
(PECL ds >= 1.0.0)
Ds\Map::union — Creates a new map using values from the current instance and another map
### Description
```
public Ds\Map::union(Ds\Map $map): Ds\Map
```
Creates a new map that contains the pairs of the current instance as well as the pairs of another `map`.
`A ∪ B = {x: x ∈ A ∨ x ∈ B}`
>
> **Note**:
>
>
> Values of the current instance will be overwritten by those provided where keys are equal.
>
>
### Parameters
`map`
The other map, to combine with the current instance.
### Return Values
A new map containing all the pairs of the current instance as well as another `map`.
### See Also
* [» Union](https://en.wikipedia.org/wiki/Union_(set_theory)) on Wikipedia
### Examples
**Example #1 **Ds\Map::union()** example**
```
<?php
$a = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]);
$b = new \Ds\Map(["b" => 3, "c" => 4, "d" => 5]);
print_r($a->union($b));
?>
```
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] => 3
)
[2] => Ds\Pair Object
(
[key] => c
[value] => 4
)
[3] => Ds\Pair Object
(
[key] => d
[value] => 5
)
)
```
php ReflectionFiber::getCallable ReflectionFiber::getCallable
============================
(PHP 8 >= 8.1.0)
ReflectionFiber::getCallable — Gets the callable used to create the Fiber
### Description
```
public ReflectionFiber::getCallable(): callable
```
Returns the callable used to construct the [Fiber](class.fiber). If the fiber has terminated, an [Error](class.error) is thrown.
### Parameters
This function has no parameters.
### Return Values
The callable used to create the [Fiber](class.fiber).
php Parle\RLexer::callout Parle\RLexer::callout
=====================
(PECL parle >= 0.7.2)
Parle\RLexer::callout — Define token callback
### Description
```
public Parle\RLexer::callout(int $id, callable $callback): void
```
Define a callback to be invoked once lexer encounters a particular token.
### Parameters
`id`
Token id.
`callback`
Callable to be invoked. The callable doesn't receive any arguments and its return value is ignored.
### Return Values
No value is returned.
php Yaf_Action_Abstract::getController Yaf\_Action\_Abstract::getController
====================================
(Yaf >=1.0.0)
Yaf\_Action\_Abstract::getController — Retrieve controller object
### Description
```
publicYaf_Action_Abstract::getController(): Yaf_Controller_Abstract
```
retrieve current controller object.
### Parameters
This function has no parameters.
### Return Values
[Yaf\_Controller\_Abstract](class.yaf-controller-abstract) instance
php libxml_get_last_error libxml\_get\_last\_error
========================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
libxml\_get\_last\_error — Retrieve last error from libxml
### Description
```
libxml_get_last_error(): LibXMLError|false
```
Retrieve last error from libxml.
### Parameters
This function has no parameters.
### Return Values
Returns a [LibXMLError](class.libxmlerror) object if there is any error in the buffer, **`false`** otherwise.
### See Also
* [libxml\_get\_errors()](function.libxml-get-errors) - Retrieve array of errors
* [libxml\_clear\_errors()](function.libxml-clear-errors) - Clear libxml error buffer
php getlastmod getlastmod
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
getlastmod — Gets time of last page modification
### Description
```
getlastmod(): int|false
```
Gets the time of the last modification of the main script of execution.
If you're interested in getting the last modification time of a different file, consider using [filemtime()](function.filemtime).
### Parameters
This function has no parameters.
### Return Values
Returns the time of the last modification of the current page. The value returned is a Unix timestamp, suitable for feeding to [date()](function.date). Returns **`false`** on error.
### Examples
**Example #1 **getlastmod()** example**
```
<?php
// outputs e.g. 'Last modified: March 04 1998 20:43:59.'
echo "Last modified: " . date ("F d Y H:i:s.", getlastmod());
?>
```
### See Also
* [date()](function.date) - Format a Unix timestamp
* [getmyuid()](function.getmyuid) - Gets PHP script owner's UID
* [getmygid()](function.getmygid) - Get PHP script owner's GID
* [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
* [getmypid()](function.getmypid) - Gets PHP's process ID
* [filemtime()](function.filemtime) - Gets file modification time
php highlight_file highlight\_file
===============
(PHP 4, PHP 5, PHP 7, PHP 8)
highlight\_file — Syntax highlighting of a file
### Description
```
highlight_file(string $filename, bool $return = false): string|bool
```
Prints out or returns a syntax highlighted version of the code contained in `filename` using the colors defined in the built-in syntax highlighter for PHP.
Many servers are configured to automatically highlight files with a *phps* extension. For example, example.phps when viewed will show the syntax highlighted source of the file. To enable this, add this line to the httpd.conf:
```
AddType application/x-httpd-php-source .phps
```
### Parameters
`filename`
Path to the PHP file to be highlighted.
`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.
### Notes
**Caution** Care should be taken when using the **highlight\_file()** function to make sure that you do not inadvertently reveal sensitive information such as passwords or any other type of information that might create a potential security risk.
>
> **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.
>
>
>
### See Also
* [highlight\_string()](function.highlight-string) - Syntax highlighting of a string
* [Highlighting INI directives](https://www.php.net/manual/en/misc.configuration.php#ini.syntax-highlighting)
php The Parle\RParser class
The Parle\RParser class
=======================
Introduction
------------
(PECL parle >= 0.7.0)
Parser class. Rules can be defined on the fly. Once finalized, a [Parle\RLexer](class.parle-rlexer) instance is required to deliver the token stream.
Class synopsis
--------------
class **Parle\RParser** { /\* Constants \*/ const int [ACTION\_ERROR](class.parle-rparser#parle-rparser.constants.action-error) = 0;
const int [ACTION\_SHIFT](class.parle-rparser#parle-rparser.constants.action-shift) = 1;
const int [ACTION\_REDUCE](class.parle-rparser#parle-rparser.constants.action-reduce) = 2;
const int [ACTION\_GOTO](class.parle-rparser#parle-rparser.constants.action-goto) = 3;
const int [ACTION\_ACCEPT](class.parle-rparser#parle-rparser.constants.action-accept) = 4;
const int [ERROR\_SYNTAX](class.parle-rparser#parle-rparser.constants.error-syntax) = 0;
const int [ERROR\_NON\_ASSOCIATIVE](class.parle-rparser#parle-rparser.constants.error-non-associative) = 1;
const int [ERROR\_UNKNOWN\_TOKEN](class.parle-rparser#parle-rparser.constants.error-unknown-token) = 2; /\* Properties \*/
public int [$action](class.parle-rparser#parle-rparser.props.action) = 0;
public int [$reduceId](class.parle-rparser#parle-rparser.props.reduceId) = 0; /\* Methods \*/
```
public advance(): void
```
```
public build(): void
```
```
public consume(string $data, Parle\RLexer $rlexer): void
```
```
public dump(): void
```
```
public errorInfo(): Parle\ErrorInfo
```
```
public left(string $tok): void
```
```
public nonassoc(string $tok): void
```
```
public precedence(string $tok): void
```
```
public push(string $name, string $rule): int
```
```
public reset(int $tokenId = ?): void
```
```
public right(string $tok): void
```
```
public sigil(int $idx = ?): string
```
```
public token(string $tok): void
```
```
public tokenId(string $tok): int
```
```
public trace(): string
```
```
public validate(string $data, Parle\RLexer $lexer): bool
```
} Predefined Constants
--------------------
**`Parle\RParser::ACTION_ERROR`** **`Parle\RParser::ACTION_SHIFT`** **`Parle\RParser::ACTION_REDUCE`** **`Parle\RParser::ACTION_GOTO`** **`Parle\RParser::ACTION_ACCEPT`** **`Parle\RParser::ERROR_SYNTAX`** **`Parle\RParser::ERROR_NON_ASSOCIATIVE`** **`Parle\RParser::ERROR_UNKNOWN_TOKEN`** Properties
----------
action Current parser action that matches one of the action class constants, readonly.
reduceId Grammar rule id just processed in the reduce action. The value corresponds either to a token or to a production id. Readonly.
Table of Contents
-----------------
* [Parle\RParser::advance](parle-rparser.advance) — Process next parser rule
* [Parle\RParser::build](parle-rparser.build) — Finalize the grammar rules
* [Parle\RParser::consume](parle-rparser.consume) — Consume the data for processing
* [Parle\RParser::dump](parle-rparser.dump) — Dump the grammar
* [Parle\RParser::errorInfo](parle-rparser.errorinfo) — Retrieve the error information
* [Parle\RParser::left](parle-rparser.left) — Declare a token with left-associativity
* [Parle\RParser::nonassoc](parle-rparser.nonassoc) — Declare a token with no associativity
* [Parle\RParser::precedence](parle-rparser.precedence) — Declare a precedence rule
* [Parle\RParser::push](parle-rparser.push) — Add a grammar rule
* [Parle\RParser::reset](parle-rparser.reset) — Reset parser state
* [Parle\RParser::right](parle-rparser.right) — Declare a token with right-associativity
* [Parle\RParser::sigil](parle-rparser.sigil) — Retrieve a matching part of a rule
* [Parle\RParser::token](parle-rparser.token) — Declare a token
* [Parle\RParser::tokenId](parle-rparser.tokenid) — Get token id
* [Parle\RParser::trace](parle-rparser.trace) — Trace the parser operation
* [Parle\RParser::validate](parle-rparser.validate) — Validate input
php EventBuffer::readLine EventBuffer::readLine
=====================
(PECL event >= 1.2.6-beta)
EventBuffer::readLine — Extracts a line from the front of the buffer
### Description
```
public EventBuffer::readLine( int $eol_style ): string
```
Extracts a line from the front of the buffer and returns it in a newly allocated string. If there is not a whole line to read, the function returns **`null`**. The line terminator is not included in the copied string.
### Parameters
`eol_style` One of [EventBuffer:EOL\_\* constants](class.eventbuffer#eventbuffer.constants) .
### Return Values
On success returns the line read from the buffer, otherwise **`null`**.
### 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::read()](eventbuffer.read) - Read data from an evbuffer and drain the bytes read
* [EventBuffer::appendFrom()](eventbuffer.appendfrom) - Moves the specified number of bytes from a source buffer to the end of the current buffer
| programming_docs |
php SolrClient::getOptions SolrClient::getOptions
======================
(PECL solr >= 0.9.6)
SolrClient::getOptions — Returns the client options set internally
### Description
```
public SolrClient::getOptions(): array
```
Returns the client options set internally. Very useful for debugging. The values returned are readonly and can only be set when the object is instantiated.
### Parameters
This function has no parameters.
### Return Values
Returns an array containing all the options for the SolrClient object set internally.
### See Also
* [SolrClient::\_\_construct()](solrclient.construct) - Constructor for the SolrClient object
php RegexIterator::setPregFlags RegexIterator::setPregFlags
===========================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
RegexIterator::setPregFlags — Sets the regular expression flags
### Description
```
public RegexIterator::setPregFlags(int $pregFlags): void
```
Sets the regular expression flags.
### Parameters
`pregFlags`
The regular expression flags. See [RegexIterator::\_\_construct()](regexiterator.construct) for an overview of available flags.
### Return Values
No value is returned.
### Examples
**Example #1 **RegexIterator::setPregFlags()** example**
Creates a new RegexIterator that filters all entries with where the array key starts with 'test'.
```
<?php
$test = array ('test 1', 'another test', 'test 123');
$arrayIterator = new ArrayIterator($test);
$regexIterator = new RegexIterator($arrayIterator, '/^test/', RegexIterator::GET_MATCH);
$regexIterator->setPregFlags(PREG_OFFSET_CAPTURE);
foreach ($regexIterator as $key => $value) {
var_dump($value);
}
?>
```
The above example will output something similar to:
```
array(1) {
[0]=>
array(2) {
[0]=>
string(4) "test"
[1]=>
int(0)
}
}
array(1) {
[0]=>
array(2) {
[0]=>
string(4) "test"
[1]=>
int(0)
}
}
```
### See Also
* [RegexIterator::getPregFlags()](regexiterator.getpregflags) - Returns the regular expression flags
php diskfreespace diskfreespace
=============
(PHP 4, PHP 5, PHP 7, PHP 8)
diskfreespace — Alias of [disk\_free\_space()](function.disk-free-space)
### Description
This function is an alias of: [disk\_free\_space()](function.disk-free-space).
php mysqli::execute_query mysqli::execute\_query
======================
mysqli\_execute\_query
======================
(PHP 8 >= 8.2.0)
mysqli::execute\_query -- mysqli\_execute\_query — Prepares, binds parameters, and executes SQL statement
### Description
Object-oriented style
```
public mysqli::execute_query(string $query, ?array $params = null): mysqli_result|bool
```
Procedural style
```
mysqli_execute_query(mysqli $mysql, string $query, ?array $params = null): mysqli_result|bool
```
Prepares the SQL query, binds parameters, and executes it. The **mysqli::execute\_query()** method is a shortcut for [mysqli::prepare()](mysqli.prepare), [mysqli\_stmt::bind\_param()](mysqli-stmt.bind-param), [mysqli\_stmt::execute()](mysqli-stmt.execute), and [mysqli\_stmt::get\_result()](mysqli-stmt.get-result).
The statement template can contain zero or more question mark (`?`) parameter markers—also called placeholders. The parameter values must be provided as an array using `params` parameter.
A prepared statement is created under the hood but it's never exposed outside of the function. It's impossible to access properties of the statement as one would do with the [mysqli\_stmt](class.mysqli-stmt) object. Due to this limitation, the status information is copied to the [mysqli](class.mysqli) object and is available using its methods, e.g. [mysqli\_affected\_rows()](mysqli.affected-rows) or [mysqli\_error()](mysqli.error).
>
> **Note**:
>
>
> In the case where a statement is passed to **mysqli\_execute\_query()** that is longer than `max_allowed_packet` of the server, the returned error codes are different depending on the operating system. The behavior is as follows:
>
> * On Linux returns an error code of 1153. The error message means got a packet bigger than `max_allowed_packet` bytes.
> * On Windows returns an error code 2006. This error message means server has gone away.
>
>
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
`query`
The query, as a string. It must consist of a single SQL statement.
The SQL statement may contain zero or more parameter markers represented by question mark (`?`) characters at the appropriate positions.
>
> **Note**:
>
>
> The markers are legal only in certain places in SQL statements. For example, they are permitted in the `VALUES()` list of an `INSERT` statement (to specify column values for a row), or in a comparison with a column in a `WHERE` clause to specify a comparison value. However, they are not permitted for identifiers (such as table or column names).
>
>
`params`
An optional list array with as many elements as there are bound parameters in the SQL statement being executed. Each value is treated as a string.
### Return Values
Returns **`false`** on failure. For successful queries which produce a result set, such as `SELECT, SHOW, DESCRIBE` or `EXPLAIN`, returns a [mysqli\_result](class.mysqli-result) object. For other successful queries, returns **`true`**.
### Examples
**Example #1 **mysqli::execute\_query()** 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, District FROM City WHERE CountryCode=? ORDER BY Name LIMIT 5';
$result = $mysqli->execute_query($query, ['DEU']);
foreach ($result as $row) {
printf("%s (%s)\n", $row["Name"], $row["District"]);
}
```
Procedural style
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
$query = 'SELECT Name, District FROM City WHERE CountryCode=? ORDER BY Name LIMIT 5';
$result = mysqli_execute_query($link, $query, ['DEU']);
foreach ($result as $row) {
printf("%s (%s)\n", $row["Name"], $row["District"]);
}
```
The above examples will output something similar to:
```
Aachen (Nordrhein-Westfalen)
Augsburg (Baijeri)
Bergisch Gladbach (Nordrhein-Westfalen)
Berlin (Berliini)
Bielefeld (Nordrhein-Westfalen)
```
### See Also
* [mysqli\_prepare()](mysqli.prepare) - Prepares an SQL statement for execution
* [mysqli\_stmt\_execute()](mysqli-stmt.execute) - Executes a prepared statement
* [mysqli\_stmt\_bind\_param()](mysqli-stmt.bind-param) - Binds variables to a prepared statement as parameters
* [mysqli\_stmt\_get\_result()](mysqli-stmt.get-result) - Gets a result set from a prepared statement as a mysqli\_result object
php Imagick::getRegistry Imagick::getRegistry
====================
(PECL imagick 3 >= 3.3.0)
Imagick::getRegistry — Description
### Description
```
public static Imagick::getRegistry(string $key): string
```
Get the StringRegistry entry for the named key or false if not set.
### Parameters
`key`
The entry to get.
### Return Values
php GearmanWorker::options GearmanWorker::options
======================
(PECL gearman >= 0.6.0)
GearmanWorker::options — Get worker options
### Description
```
public GearmanWorker::options(): int
```
Gets the options previously set for the worker.
### Parameters
This function has no parameters.
### Return Values
The options currently set for the worker.
### See Also
* [GearmanWorker::setOptions()](gearmanworker.setoptions) - Set worker options
php SQLite3::escapeString SQLite3::escapeString
=====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3::escapeString — Returns a string that has been properly escaped
### Description
```
public static SQLite3::escapeString(string $string): string
```
Returns a string that has been properly escaped for safe inclusion in an SQL statement.
**Warning**This function is not (yet) binary safe!
To properly handle BLOB fields which may contain NUL characters, use [SQLite3Stmt::bindParam()](sqlite3stmt.bindparam) instead.
### Parameters
`string`
The string to be escaped.
### Return Values
Returns a properly escaped string that may be used safely in an SQL statement.
### Notes
**Warning** [addslashes()](function.addslashes) should *NOT* be used to quote your strings for SQLite queries; it will lead to strange results when retrieving your data.
php SolrDisMaxQuery::setBigramPhraseFields SolrDisMaxQuery::setBigramPhraseFields
======================================
(No version information available, might only be in Git)
SolrDisMaxQuery::setBigramPhraseFields — Sets Bigram Phrase Fields and their boosts (and slops) using pf2 parameter
### Description
```
public SolrDisMaxQuery::setBigramPhraseFields(string $fields): SolrDisMaxQuery
```
Sets Bigram Phrase Fields (pf2) and their boosts (and slops)
### Parameters
`fields`
Fields boosts (slops)
### Return Values
[SolrDisMaxQuery](class.solrdismaxquery)
### Examples
**Example #1 **SolrDisMaxQuery::setBigramPhraseFields()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery("lucene");
$dismaxQuery->setBigramPhraseFields("cat~5.1^2 feature^4.5");
echo $dismaxQuery.PHP_EOL;
?>
```
The above example will output something similar to:
```
q=lucene&defType=edismax&pf2=cat~5.1^2 feature^4.5
```
### See Also
* [SolrDisMaxQuery::setBigramPhraseSlop()](solrdismaxquery.setbigramphraseslop) - Sets Bigram Phrase Slop (ps2 parameter)
* **SolrDisMaxQuery::addBigramPhraseFields()**
* [SolrDisMaxQuery::removeBigramPhraseField()](solrdismaxquery.removebigramphrasefield) - Removes phrase bigram field (pf2 parameter)
* [SolrDisMaxQuery::setTrigramPhraseFields()](solrdismaxquery.settrigramphrasefields) - Directly Sets Trigram Phrase Fields (pf3 parameter)
php VarnishLog::__construct VarnishLog::\_\_construct
=========================
(PECL varnish >= 0.6)
VarnishLog::\_\_construct — Varnishlog constructor
### Description
```
public VarnishLog::__construct(array $args = ?)
```
### Parameters
`args`
Configuration arguments. The possible keys are:
```
VARNISH_CONFIG_IDENT - local varnish instance ident path
```
### Return Values
php sodium_crypto_core_ristretto255_is_valid_point sodium\_crypto\_core\_ristretto255\_is\_valid\_point
====================================================
(PHP 8 >= 8.1.0)
sodium\_crypto\_core\_ristretto255\_is\_valid\_point — Determines if a point on the ristretto255 curve
### Description
```
sodium_crypto_core_ristretto255_is_valid_point(string $s): bool
```
Determines if a point on the ristretto255 curve, in canonical form, on the main subgroup, and that the point doesn't have a small order. Available as of libsodium 1.0.18.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`s`
An Elliptic-curve point.
### Return Values
Returns **`true`** if `s` is on the ristretto255 curve, **`false`** otherwise.
### Examples
**Example #1 **sodium\_crypto\_core\_ristretto255\_is\_valid\_point()** example**
```
<?php
$foo = sodium_crypto_core_ristretto255_scalar_random();
$bar = sodium_crypto_scalarmult_ristretto255_base($foo);
var_dump(sodium_crypto_core_ristretto255_is_valid_point($bar));
?>
```
The above example will output:
```
bool(true)
```
### See Also
* [sodium\_crypto\_core\_ristretto255\_scalar\_random()](function.sodium-crypto-core-ristretto255-scalar-random) - Generates a random key
* [sodium\_crypto\_scalarmult\_ristretto255\_base()](function.sodium-crypto-scalarmult-ristretto255-base) - Calculates the public key from a secret key
php Imagick::getImageVirtualPixelMethod Imagick::getImageVirtualPixelMethod
===================================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageVirtualPixelMethod — Returns the virtual pixel method
### Description
```
public Imagick::getImageVirtualPixelMethod(): int
```
Returns the virtual pixel method for the specified image.
### Parameters
This function has no parameters.
### Return Values
Returns the virtual pixel method on success.
### Errors/Exceptions
Throws ImagickException on error.
php openssl_cms_sign openssl\_cms\_sign
==================
(PHP 8)
openssl\_cms\_sign — Sign a file
### Description
```
openssl_cms_sign(
string $input_filename,
string $output_filename,
OpenSSLCertificate|string $certificate,
OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key,
?array $headers,
int $flags = 0,
int $encoding = OPENSSL_ENCODING_SMIME,
?string $untrusted_certificates_filename = null
): bool
```
This function signs a file with an X.509 certificate and key.
### Parameters
`input_filename`
The name of the file to be signed.
`output_filename`
The name of the file to deposit the results.
`certificate`
The signing certificate. See [Key/Certificate parameters](https://www.php.net/manual/en/openssl.certparams.php) for a list of valid values.
`private_key`
The key associated with `certificate`. See [Key/Certificate parameters](https://www.php.net/manual/en/openssl.certparams.php) for a list of valid values.
`headers`
An array of headers to be included in S/MIME output.
`flags`
Flags to be passed to **cms\_sign()**.
`encoding`
The encoding of the output file. One of **`OPENSSL_ENCODING_SMIME`**, **`OPENSSL_ENCODING_DER`** or **`OPENSSL_ENCODING_PEM`**.
`untrusted_certificates_filename`
Intermediate certificates to be included in the signature.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **openssl\_cms\_sign()** example**
```
<?php
openssl_cms_sign('input.txt', 'output.txt', 'file://cert.pem', 'file://privkey.pem', null, OPENSSL_CMS_BINARY, OPENSSL_ENCODING_DER, 'chain.pem');
?>
```
php uopz_overload uopz\_overload
==============
(PECL uopz 1, PECL uopz 2)
uopz\_overload — Overload a VM opcode
**Warning**This function has been *REMOVED* in PECL uopz 5.0.0.
### Description
```
uopz_overload(int $opcode, Callable $callable): void
```
Overloads the specified `opcode` with the user defined function
### Parameters
`opcode`
A valid opcode, see constants for details of supported codes
`callable`
### Return Values
### Examples
**Example #1 **uopz\_overload()** example**
```
<?php
uopz_overload(ZEND_EXIT, function(){});
exit();
echo "Hello World";
?>
```
The above example will output:
```
Hello World
```
php sodium_crypto_box_seed_keypair sodium\_crypto\_box\_seed\_keypair
==================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_box\_seed\_keypair — Deterministically derive the key pair from a single key
### Description
```
sodium_crypto_box_seed_keypair(string $seed): string
```
Clamps the seed to form a secret key, derives the public key, and returns the two as a keypair.
The `*_seed_keypair` functions are ideal for generating a keypair from a password and salt. Use the result as a `seed` to generate the desired keys.
### Parameters
`seed`
Some cryptographic input. Must be 32 bytes.
### Return Values
X25519 Keypair (secret key and public key).
php pcntl_wifexited pcntl\_wifexited
================
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
pcntl\_wifexited — Checks if status code represents a normal exit
### Description
```
pcntl_wifexited(int $status): bool
```
Checks whether the child status code represents a normal exit.
### Parameters
`status`
The `status` parameter is the status parameter supplied to a successful call to [pcntl\_waitpid()](function.pcntl-waitpid).
### Return Values
Returns **`true`** if the child status code represents a normal exit, **`false`** otherwise.
### See Also
* [pcntl\_waitpid()](function.pcntl-waitpid) - Waits on or returns the status of a forked child
* [pcntl\_wexitstatus()](function.pcntl-wexitstatus) - Returns the return code of a terminated child
php Imagick::mosaicImages Imagick::mosaicImages
=====================
(PECL imagick 2, PECL imagick 3)
Imagick::mosaicImages — Forms a mosaic from images
**Warning**This function has been *DEPRECATED* as of Imagick 3.4.4. Relying on this function is highly discouraged.
### Description
```
public Imagick::mosaicImages(): Imagick
```
Inlays an image sequence to form a single coherent picture. It returns a wand with each image in the sequence composited at the location defined by the page offset of the image.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success.
php imap_fetchmime imap\_fetchmime
===============
(PHP 5 >= 5.3.6, PHP 7, PHP 8)
imap\_fetchmime — Fetch MIME headers for a particular section of the message
### Description
```
imap_fetchmime(
IMAP\Connection $imap,
int $message_num,
string $section,
int $flags = 0
): string|false
```
Fetch the MIME headers of a particular section of the body of the specified messages.
### Parameters
`imap`
An [IMAP\Connection](class.imap-connection) instance.
`message_num`
The message number
`section`
The part number. It is a string of integers delimited by period which index into a body part list as per the IMAP4 specification
`flags`
A bitmask with one or more of the following:
* **`FT_UID`** - The `message_num` is a UID
* **`FT_PEEK`** - Do not set the \Seen flag if not already set
* **`FT_INTERNAL`** - The return string is in internal format, will not canonicalize to CRLF.
### Return Values
Returns the MIME headers of a particular section of the body of the specified messages as a text string, 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. |
### See Also
* [imap\_fetchbody()](function.imap-fetchbody) - Fetch a particular section of the body of the message
* [imap\_fetchstructure()](function.imap-fetchstructure) - Read the structure of a particular message
* [imap\_fetchheader()](function.imap-fetchheader) - Returns header for a message
php SolrDocument::getFieldNames SolrDocument::getFieldNames
===========================
(PECL solr >= 0.9.2)
SolrDocument::getFieldNames — Returns an array of fields names in the document
### Description
```
public SolrDocument::getFieldNames(): array
```
Returns an array of fields names in the document.
### Parameters
This function has no parameters.
### Return Values
Returns an array containing the names of the fields in this document.
php Imagick::setImageCompressionQuality Imagick::setImageCompressionQuality
===================================
(PECL imagick 2, PECL imagick 3)
Imagick::setImageCompressionQuality — Sets the image compression quality
### Description
```
public Imagick::setImageCompressionQuality(int $quality): bool
```
Sets the image compression quality.
### Parameters
`quality`
The image compression quality as an integer
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::setImageCompressionQuality()****
```
<?php
function setImageCompressionQuality($imagePath, $quality) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->setImageCompressionQuality($quality);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
| programming_docs |
php fbird_errcode fbird\_errcode
==============
(PHP 5, PHP 7 < 7.4.0)
fbird\_errcode — Alias of [ibase\_errcode()](function.ibase-errcode)
### Description
This function is an alias of: [ibase\_errcode()](function.ibase-errcode).
### See Also
* [fbird\_errmsg()](function.fbird-errmsg) - Alias of ibase\_errmsg
php The PharData class
The PharData class
==================
Introduction
------------
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
The PharData class provides a high-level interface to accessing and creating non-executable tar and zip archives. Because these archives do not contain a stub and cannot be executed by the phar extension, it is possible to create and manipulate regular zip and tar files using the PharData class even if `phar.readonly` php.ini setting is `1`.
Class synopsis
--------------
class **PharData** 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](phardata.construct)(
string `$filename`,
int `$flags` = FilesystemIterator::SKIP\_DOTS | FilesystemIterator::UNIX\_PATHS,
?string `$alias` = **`null`**,
int `$format` = 0
)
```
public addEmptyDir(string $directory): void
```
```
public addFile(string $filename, ?string $localName = null): void
```
```
public addFromString(string $localName, string $contents): void
```
```
public buildFromDirectory(string $directory, string $pattern = ""): array
```
```
public buildFromIterator(Traversable $iterator, ?string $baseDirectory = null): array
```
```
public compress(int $compression, ?string $extension = null): ?PharData
```
```
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 decompress(?string $extension = null): ?PharData
```
```
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 isWritable(): bool
```
```
public offsetSet(string $localName, resource|string $value): void
```
```
public offsetUnset(string $localName): void
```
```
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 [\_\_destruct](phardata.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
-----------------
* [PharData::addEmptyDir](phardata.addemptydir) — Add an empty directory to the tar/zip 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
* [PharData::buildFromDirectory](phardata.buildfromdirectory) — Construct a tar/zip archive from the files within a directory
* [PharData::buildFromIterator](phardata.buildfromiterator) — Construct a tar or zip archive from an iterator
* [PharData::compress](phardata.compress) — Compresses the entire tar/zip archive using Gzip or Bzip2 compression
* [PharData::compressFiles](phardata.compressfiles) — Compresses all files in the current tar/zip archive
* [PharData::\_\_construct](phardata.construct) — Construct a non-executable tar or zip archive object
* [PharData::convertToData](phardata.converttodata) — Convert a phar archive to a non-executable tar or zip file
* [PharData::convertToExecutable](phardata.converttoexecutable) — Convert a non-executable tar/zip archive to an executable phar archive
* [PharData::copy](phardata.copy) — Copy a file internal to the phar archive to another new file within the phar
* [PharData::decompress](phardata.decompress) — Decompresses the entire Phar archive
* [PharData::decompressFiles](phardata.decompressfiles) — Decompresses all files in the current zip archive
* [PharData::delMetadata](phardata.delmetadata) — Deletes the global metadata of a zip archive
* [PharData::delete](phardata.delete) — Delete a file within a tar/zip archive
* [PharData::\_\_destruct](phardata.destruct) — Destructs a non-executable tar or zip archive object
* [PharData::extractTo](phardata.extractto) — Extract the contents of a tar/zip archive to a directory
* [PharData::isWritable](phardata.iswritable) — Returns true if the tar/zip archive can be modified
* [PharData::offsetSet](phardata.offsetset) — Set the contents of a file within the tar/zip to those of an external file or string
* [PharData::offsetUnset](phardata.offsetunset) — Remove a file from a tar/zip archive
* [PharData::setAlias](phardata.setalias) — Dummy function (Phar::setAlias is not valid for PharData)
* [PharData::setDefaultStub](phardata.setdefaultstub) — Dummy function (Phar::setDefaultStub is not valid for PharData)
* [PharData::setMetadata](phardata.setmetadata) — Sets phar archive meta-data
* [PharData::setSignatureAlgorithm](phardata.setsignaturealgorithm) — Set the signature algorithm for a phar and apply it
* [PharData::setStub](phardata.setstub) — Dummy function (Phar::setStub is not valid for PharData)
php func_get_args func\_get\_args
===============
(PHP 4, PHP 5, PHP 7, PHP 8)
func\_get\_args — Returns an array comprising a function's argument list
### Description
```
func_get_args(): array
```
Gets an array of the function's argument list.
This function may be used in conjunction with [func\_get\_arg()](function.func-get-arg) and [func\_num\_args()](function.func-num-args) to allow user-defined functions to accept variable-length argument lists.
### Parameters
This function has no parameters.
### Return Values
Returns an array in which each element is a copy of the corresponding member of the current user-defined function's argument list.
### Errors/Exceptions
Generates a warning if called from outside of a user-defined function.
### Examples
**Example #1 **func\_get\_args()** example**
```
<?php
function foo()
{
$numargs = func_num_args();
echo "Number of arguments: $numargs \n";
if ($numargs >= 2) {
echo "Second argument is: " . func_get_arg(1) . "\n";
}
$arg_list = func_get_args();
for ($i = 0; $i < $numargs; $i++) {
echo "Argument $i is: " . $arg_list[$i] . "\n";
}
}
foo(1, 2, 3);
?>
```
The above example will output:
```
Number of arguments: 3
Second argument is: 2
Argument 0 is: 1
Argument 1 is: 2
Argument 2 is: 3
```
**Example #2 **func\_get\_args()** example of byref and byval arguments**
```
<?php
function byVal($arg) {
echo 'As passed : ', var_export(func_get_args()), PHP_EOL;
$arg = 'baz';
echo 'After change : ', var_export(func_get_args()), PHP_EOL;
}
function byRef(&$arg) {
echo 'As passed : ', var_export(func_get_args()), PHP_EOL;
$arg = 'baz';
echo 'After change : ', var_export(func_get_args()), PHP_EOL;
}
$arg = 'bar';
byVal($arg);
byRef($arg);
?>
```
The above example will output:
As passed : array (
0 => 'bar',
)
After change : array (
0 => 'baz',
)
As passed : array (
0 => 'bar',
)
After change : array (
0 => 'baz',
)
### 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.
>
>
>
>
> **Note**:
>
>
> If the arguments are passed by reference, any changes to the arguments will be reflected in the values returned by this function. As of PHP 7 the current values will also be returned if the arguments are passed by value.
>
>
>
> **Note**: This function returns a copy of the passed arguments only, and does not account for default (non-passed) arguments.
>
>
### See Also
* [`...` syntax](functions.arguments#functions.variable-arg-list)
* [func\_get\_arg()](function.func-get-arg)
* [func\_num\_args()](function.func-num-args)
* [ReflectionFunctionAbstract::getParameters()](reflectionfunctionabstract.getparameters)
php IntlCalendar::__construct IntlCalendar::\_\_construct
===========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::\_\_construct — Private constructor for disallowing instantiation
### Description
private **IntlCalendar::\_\_construct**() A private constructor for disallowing instantiation with the [new](language.oop5.basic#language.oop5.basic.new) operator.
Call [IntlCalendar::createInstance()](intlcalendar.createinstance) instead.
### Parameters
This function has no parameters.
php SyncEvent::wait SyncEvent::wait
===============
(PECL sync >= 1.0.0)
SyncEvent::wait — Waits for the event to be fired/set
### Description
```
public SyncEvent::wait(int $wait = -1): bool
```
Waits for the [SyncEvent](class.syncevent) object to be fired.
### Parameters
`wait`
The number of milliseconds to wait for the event to be fired. A value of -1 is infinite.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **SyncEvent::wait()** example**
```
<?php
// In a web application:
$event = new SyncEvent("GetAppReport");
$event->fire();
// In a cron job:
$event = new SyncEvent("GetAppReport");
$event->wait();
?>
```
### See Also
* [SyncEvent::fire()](syncevent.fire) - Fires/sets the event
php ReflectionMethod::isConstructor ReflectionMethod::isConstructor
===============================
(PHP 5, PHP 7, PHP 8)
ReflectionMethod::isConstructor — Checks if method is a constructor
### Description
```
public ReflectionMethod::isConstructor(): bool
```
Checks if the method is a constructor.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the method is a constructor, otherwise **`false`**
### See Also
* [ReflectionMethod::\_\_construct()](reflectionmethod.construct) - Constructs a ReflectionMethod
* [ReflectionMethod::isAbstract()](reflectionmethod.isabstract) - Checks if method is abstract
* [ReflectionMethod::isDestructor()](reflectionmethod.isdestructor) - Checks if method is a destructor
php set_include_path set\_include\_path
==================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
set\_include\_path — Sets the include\_path configuration option
### Description
```
set_include_path(string $include_path): string|false
```
Sets the [include\_path](https://www.php.net/manual/en/ini.core.php#ini.include-path) configuration option for the duration of the script.
### Parameters
`include_path`
The new value for the [include\_path](https://www.php.net/manual/en/ini.core.php#ini.include-path)
### Return Values
Returns the old [include\_path](https://www.php.net/manual/en/ini.core.php#ini.include-path) on success or **`false`** on failure.
### Examples
**Example #1 **set\_include\_path()** example**
```
<?php
set_include_path('/usr/lib/pear');
// Or using ini_set()
ini_set('include_path', '/usr/lib/pear');
?>
```
**Example #2 Adding to the include path**
Making use of the **`PATH_SEPARATOR`** constant, it is possible to extend the include path regardless of the operating system.
In this example we add /usr/lib/pear to the end of the existing `include_path`.
```
<?php
$path = '/usr/lib/pear';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
?>
```
### See Also
* [ini\_set()](function.ini-set) - Sets the value of a configuration option
* [get\_include\_path()](function.get-include-path) - Gets the current include\_path configuration option
* [restore\_include\_path()](function.restore-include-path) - Restores the value of the include\_path configuration option
* [include](function.include) - include
php pg_escape_literal pg\_escape\_literal
===================
(PHP 5 >= 5.4.4, PHP 7, PHP 8)
pg\_escape\_literal — Escape a literal for insertion into a text field
### Description
```
pg_escape_literal(PgSql\Connection $connection = ?, string $data): string
```
**pg\_escape\_literal()** escapes a literal for querying the PostgreSQL database. It returns an escaped literal in the PostgreSQL format. **pg\_escape\_literal()** adds quotes before and after data. Users should not add quotes. Use of this function is recommended instead of [pg\_escape\_string()](function.pg-escape-string). If the type of the column is bytea, [pg\_escape\_bytea()](function.pg-escape-bytea) must be used instead. For escaping identifiers (e.g. table, field names), [pg\_escape\_identifier()](function.pg-escape-identifier) must be used.
>
> **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\_literal()** example**
```
<?php
// Connect to the database
$dbconn = pg_connect('dbname=foo');
// Read in a text file (containing apostrophes and backslashes)
$data = file_get_contents('letter.txt');
// Escape the text data
$escaped = pg_escape_literal($data);
// Insert it into the database. Note that no quotes around {$escaped}
pg_query("INSERT INTO correspondence (name, data) VALUES ('My letter', {$escaped})");
?>
```
### See Also
* [pg\_escape\_identifier()](function.pg-escape-identifier) - Escape a identifier 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
| programming_docs |
php Ev::feedSignalEvent Ev::feedSignalEvent
===================
(No version information available, might only be in Git)
Ev::feedSignalEvent — Feed signal event into the default loop
### Description
```
final public static Ev::feedSignalEvent( int $signum ): void
```
Feed signal event into the default loop. Ev will react to this call as if the signal specified by `signal` had occurred.
### Parameters
`signum` Signal number. See `signal(7)` man page for detals. See also constants exported by `pcntl` extension.
### Return Values
No value is returned.
### See Also
* [Ev::feedSignal()](ev.feedsignal) - Feed a signal event info Ev
php gettimeofday gettimeofday
============
(PHP 4, PHP 5, PHP 7, PHP 8)
gettimeofday — Get current time
### Description
```
gettimeofday(bool $as_float = false): array|float
```
This is an interface to gettimeofday(2). It returns an associative array containing the data returned from the system call.
### Parameters
`as_float`
When set to **`true`**, a float instead of an array is returned.
### Return Values
By default an array is returned. If `as_float` is set, then a float is returned.
Array keys:
* "sec" - seconds since the Unix Epoch
* "usec" - microseconds
* "minuteswest" - minutes west of Greenwich
* "dsttime" - type of dst correction
### Examples
**Example #1 **gettimeofday()** example**
```
<?php
print_r(gettimeofday());
echo gettimeofday(true);
?>
```
The above example will output something similar to:
```
Array
(
[sec] => 1073504408
[usec] => 238215
[minuteswest] => 0
[dsttime] => 1
)
1073504408.23910
```
php Closure::bind Closure::bind
=============
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
Closure::bind — Duplicates a closure with a specific bound object and class scope
### Description
```
public static Closure::bind(Closure $closure, ?object $newThis, object|string|null $newScope = "static"): ?Closure
```
This method is a static version of [Closure::bindTo()](closure.bindto). See the documentation of that method for more information.
### Parameters
`closure`
The anonymous functions to bind.
`newThis`
The object to which the given anonymous function should be bound, or **`null`** for the closure to be unbound.
`newScope`
The class scope to which the closure is to be associated, or 'static' to keep the current one. If an object is given, the type of the object will be used instead. This determines the visibility of protected and private methods of the bound object. It is not allowed to pass (an object of) an internal class as this parameter.
### Return Values
Returns a new [Closure](class.closure) object, or **`null`** on failure.
### Examples
**Example #1 **Closure::bind()** example**
```
<?php
class A {
private static $sfoo = 1;
private $ifoo = 2;
}
$cl1 = static function() {
return A::$sfoo;
};
$cl2 = function() {
return $this->ifoo;
};
$bcl1 = Closure::bind($cl1, null, 'A');
$bcl2 = Closure::bind($cl2, new A(), 'A');
echo $bcl1(), "\n";
echo $bcl2(), "\n";
?>
```
The above example will output something similar to:
```
1
2
```
### See Also
* [Anonymous functions](functions.anonymous)
* [Closure::bindTo()](closure.bindto) - Duplicates the closure with a new bound object and class scope
php sodium_crypto_core_ristretto255_from_hash sodium\_crypto\_core\_ristretto255\_from\_hash
==============================================
(PHP 8 >= 8.1.0)
sodium\_crypto\_core\_ristretto255\_from\_hash — Maps a vector
### Description
```
sodium_crypto_core_ristretto255_from_hash(string $s): string
```
Maps a 64-bytes vector `s` to a group element. Available as of libsodium 1.0.18.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`s`
A 64-bytes vector.
### Return Values
Returns a 32-byte random string.
### Examples
**Example #1 **sodium\_crypto\_core\_ristretto255\_from\_hash()** example**
```
<?php
$hashes = sodium_hex2bin(
'5d1be09e3d0c82fc538112490e35701979d99e06ca3e2b5b54bffe8b4dc772c1' .
'4d98b696a1bbfb5ca32c436cc61c16563790306c79eaca7705668b47dffe5bb6'
);
var_dump(sodium_bin2hex(sodium_crypto_core_ristretto255_from_hash($hashes)));
?>
```
The above example will output:
```
string(64) "3066f82a1a747d45120d1740f14358531a8f04bbffe6a819f86dfe50f44a0a46"
```
### See Also
* [sodium\_hex2bin()](function.sodium-hex2bin) - Decodes a hexadecimally encoded binary string
* [sodium\_bin2hex()](function.sodium-bin2hex) - Encode to hexadecimal
* **sodium\_crypto\_core\_ristretto255\_from\_hash()**
php SVM::getOptions SVM::getOptions
===============
(PECL svm >= 0.1.0)
SVM::getOptions — Return the current training parameters
### Description
```
public SVM::getOptions(): array
```
Retrieve an array containing the training parameters. The parameters will be keyed on the predefined SVM constants.
### Parameters
This function has no parameters.
### Return Values
Returns an array of configuration settings.
php Memcached::delete Memcached::delete
=================
(PECL memcached >= 0.1.0)
Memcached::delete — Delete an item
### Description
```
public Memcached::delete(string $key, int $time = 0): bool
```
Delete the `key` from the server.
### Parameters
`key`
The key to be deleted.
`time`
The amount of time the server will wait to delete the item.
> **Note**: As of memcached 1.3.0 (released 2009) this feature is no longer supported. Passing a non-zero `time` will cause the deletion to fail. [Memcached::getResultCode()](memcached.getresultcode) will return **`MEMCACHED_INVALID_ARGUMENTS`**.
>
>
### Return Values
Returns **`true`** on success or **`false`** on failure. The [Memcached::getResultCode()](memcached.getresultcode) will return **`Memcached::RES_NOTFOUND`** if the key does not exist.
### Examples
**Example #1 **Memcached::delete()** example**
```
<?php
$m = new Memcached();
$m->addServer('localhost', 11211);
$m->delete('key1');
?>
```
### See Also
* [Memcached::deleteByKey()](memcached.deletebykey) - Delete an item from a specific server
* [Memcached::deleteMulti()](memcached.deletemulti) - Delete multiple items
php lstat lstat
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
lstat — Gives information about a file or symbolic link
### Description
```
lstat(string $filename): array|false
```
Gathers the statistics of the file or symbolic link named by `filename`.
### Parameters
`filename`
Path to a file or a symbolic link.
### Return Values
See the manual page for [stat()](function.stat) for information on the structure of the array that **lstat()** returns. This function is identical to the [stat()](function.stat) function except that if the `filename` parameter is a symbolic link, the status of the symbolic link is returned, not the status of the file pointed to by the symbolic link.
On failure, **`false`** is returned.
### Errors/Exceptions
Upon failure, an **`E_WARNING`** is emitted.
### Examples
**Example #1 Comparison of [stat()](function.stat) and **lstat()****
```
<?php
symlink('uploads.php', 'uploads');
// Contrast information for uploads.php and uploads
array_diff(stat('uploads'), lstat('uploads'));
?>
```
The above example will output something similar to:
Information that differs between the two files.
```
Array
(
[ino] => 97236376
[mode] => 33188
[size] => 34
[atime] => 1223580003
[mtime] => 1223581848
[ctime] => 1223581848
[blocks] => 8
)
```
### Notes
> **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.
### See Also
* [stat()](function.stat) - Gives information about a file
php IntlCalendar::get IntlCalendar::get
=================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::get — Get the value for a field
### Description
Object-oriented style
```
public IntlCalendar::get(int $field): int|false
```
Procedural style
```
intlcal_get(IntlCalendar $calendar, int $field): int|false
```
Gets the value for a specific 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 integer with the value of the time field.
### Examples
**Example #1 **IntlCalendar::get()****
```
<?php
ini_set('date.timezone', 'Europe/Lisbon');
ini_set('intl.default_locale', 'en_US');
$class = new ReflectionClass('IntlCalendar');
$fields = array();
foreach ($class->getConstants() as $name => $val) {
if (strpos($name, 'FIELD_') !== 0 || $val > 22)
continue;
$fields[$val] = $name;
}
$cal = IntlCalendar::createInstance(); // current time
var_dump(IntlDateFormatter::formatObject($cal));
foreach ($fields as $val => $name) {
echo "$val ($name)", "\n ", $cal->get($val), "\n";
}
```
The above example will output:
```
string(23) "Jul 1, 2013, 4:44:44 AM"
0 (FIELD_ERA)
1
1 (FIELD_YEAR)
2013
2 (FIELD_MONTH)
6
3 (FIELD_WEEK_OF_YEAR)
27
4 (FIELD_WEEK_OF_MONTH)
1
5 (FIELD_DAY_OF_MONTH)
1
6 (FIELD_DAY_OF_YEAR)
182
7 (FIELD_DAY_OF_WEEK)
2
8 (FIELD_DAY_OF_WEEK_IN_MONTH)
1
9 (FIELD_AM_PM)
0
10 (FIELD_HOUR)
4
11 (FIELD_HOUR_OF_DAY)
4
12 (FIELD_MINUTE)
44
13 (FIELD_SECOND)
44
14 (FIELD_MILLISECOND)
551
15 (FIELD_ZONE_OFFSET)
0
16 (FIELD_DST_OFFSET)
3600000
17 (FIELD_YEAR_WOY)
2013
18 (FIELD_DOW_LOCAL)
2
19 (FIELD_EXTENDED_YEAR)
2013
20 (FIELD_JULIAN_DAY)
2456475
21 (FIELD_MILLISECONDS_IN_DAY)
17084551
22 (FIELD_IS_LEAP_MONTH)
0
```
php None namespace keyword and \_\_NAMESPACE\_\_ constant
------------------------------------------------
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
PHP supports two ways of abstractly accessing elements within the current namespace, the **`__NAMESPACE__`** magic constant, and the `namespace` keyword.
The value of **`__NAMESPACE__`** is a string that contains the current namespace name. In global, un-namespaced code, it contains an empty string.
**Example #1 \_\_NAMESPACE\_\_ example, namespaced code**
```
<?php
namespace MyProject;
echo '"', __NAMESPACE__, '"'; // outputs "MyProject"
?>
```
**Example #2 \_\_NAMESPACE\_\_ example, global code**
```
<?php
echo '"', __NAMESPACE__, '"'; // outputs ""
?>
```
The **`__NAMESPACE__`** constant is useful for dynamically constructing names, for instance: **Example #3 using \_\_NAMESPACE\_\_ for dynamic name construction**
```
<?php
namespace MyProject;
function get($classname)
{
$a = __NAMESPACE__ . '\\' . $classname;
return new $a;
}
?>
```
The `namespace` keyword can be used to explicitly request an element from the current namespace or a sub-namespace. It is the namespace equivalent of the `self` operator for classes.
**Example #4 the namespace operator, inside a namespace**
```
<?php
namespace MyProject;
use blah\blah as mine; // see "Using namespaces: Aliasing/Importing"
blah\mine(); // calls function MyProject\blah\mine()
namespace\blah\mine(); // calls function MyProject\blah\mine()
namespace\func(); // calls function MyProject\func()
namespace\sub\func(); // calls function MyProject\sub\func()
namespace\cname::method(); // calls static method "method" of class MyProject\cname
$a = new namespace\sub\cname(); // instantiates object of class MyProject\sub\cname
$b = namespace\CONSTANT; // assigns value of constant MyProject\CONSTANT to $b
?>
```
**Example #5 the namespace operator, in global code**
```
<?php
namespace\func(); // calls function func()
namespace\sub\func(); // calls function sub\func()
namespace\cname::method(); // calls static method "method" of class cname
$a = new namespace\sub\cname(); // instantiates object of class sub\cname
$b = namespace\CONSTANT; // assigns value of constant CONSTANT to $b
?>
```
php The LuaClosure class
The LuaClosure class
====================
Introduction
------------
(PECL lua >=0.9.0)
LuaClosure is a wrapper class for LUA\_TFUNCTION which could be return from calling to Lua function.
Class synopsis
--------------
class **LuaClosure** { /\* Methods \*/
```
public __invoke(mixed ...$args): void
```
} Table of Contents
-----------------
* [LuaClosure::\_\_invoke](luaclosure.invoke) — Invoke luaclosure
php ReflectionMethod::isProtected ReflectionMethod::isProtected
=============================
(PHP 5, PHP 7, PHP 8)
ReflectionMethod::isProtected — Checks if method is protected
### Description
```
public ReflectionMethod::isProtected(): bool
```
Checks if the method is protected.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the method is protected, otherwise **`false`**
### See Also
* [ReflectionMethod::isPrivate()](reflectionmethod.isprivate) - Checks if method is private
php grapheme_stristr grapheme\_stristr
=================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
grapheme\_stristr — Returns part of haystack string from the first occurrence of case-insensitive needle to the end of haystack
### Description
Procedural style
```
grapheme_stristr(string $haystack, string $needle, bool $beforeNeedle = false): string|false
```
Returns part of `haystack` string starting from and including the first occurrence of case-insensitive needle to the end of `haystack`.
### Parameters
`haystack`
The input string. Must be valid UTF-8.
`needle`
The string to look for. Must be valid UTF-8.
`beforeNeedle`
If **`true`**, [grapheme\_strstr()](function.grapheme-strstr) returns the part of the `haystack` before the first occurrence of the needle (excluding `needle`).
### Return Values
Returns the portion of `haystack`, or **`false`** if `needle` is not found.
### Examples
**Example #1 **grapheme\_stristr()** 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 urlencode(grapheme_stristr( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_a_ring_nfd, $char_O_diaeresis_nfd));
?>
```
The above example will output:
```
o%CC%88a%CC%8A
```
### See Also
* [grapheme\_stripos()](function.grapheme-stripos) - Find position (in grapheme units) of first occurrence of a case-insensitive string
* [grapheme\_strpos()](function.grapheme-strpos) - Find position (in grapheme units) of first occurrence of a string
* [grapheme\_strripos()](function.grapheme-strripos) - Find position (in grapheme units) of last occurrence of a case-insensitive 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 PharFileInfo::getMetadata PharFileInfo::getMetadata
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
PharFileInfo::getMetadata — Returns file-specific meta-data saved with a file
### Description
```
public PharFileInfo::getMetadata(array $unserializeOptions = []): mixed
```
Return meta-data that was saved in the Phar archive's manifest for this file.
### Parameters
### Return Values
any PHP variable that can be serialized and is stored as meta-data for the file, or **`null`** if no meta-data is stored.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | The parameter `unserializeOptions` has been added. |
### Examples
**Example #1 A **PharFileInfo::getMetadata()** example**
```
<?php
// make sure it doesn't exist
@unlink('brandnewphar.phar');
try {
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
$p['file.txt'] = 'hello';
$p['file.txt']->setMetadata(array('user' => 'bill', 'mime-type' => 'text/plain'));
var_dump($p['file.txt']->getMetadata());
} catch (Exception $e) {
echo 'Could not create/modify brandnewphar.phar: ', $e;
}
?>
```
The above example will output:
```
array(2) {
["user"]=>
string(4) "bill"
["mime-type"]=>
string(10) "text/plain"
}
```
### See Also
* [PharFileInfo::setMetadata()](pharfileinfo.setmetadata) - Sets file-specific meta-data saved with a file
* [PharFileInfo::hasMetadata()](pharfileinfo.hasmetadata) - Returns the metadata of the entry
* [PharFileInfo::delMetadata()](pharfileinfo.delmetadata) - Deletes the metadata of the entry
* [Phar::setMetadata()](phar.setmetadata) - Sets phar archive meta-data
* [Phar::hasMetadata()](phar.hasmetadata) - Returns whether phar has global meta-data
* [Phar::getMetadata()](phar.getmetadata) - Returns phar archive meta-data
php Imagick::transformImageColorspace Imagick::transformImageColorspace
=================================
(PECL imagick 3)
Imagick::transformImageColorspace — Transforms an image to a new colorspace
### Description
```
public Imagick::transformImageColorspace(int $colorspace): bool
```
Transforms an image to a new colorspace.
### Parameters
`colorspace`
The colorspace the image should be transformed to, one of the [COLORSPACE constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.colorspace) e.g. Imagick::COLORSPACE\_CMYK.
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::transformImageColorspace()** example**
Transforms an image to a new colorspace, and then extracts a single channel so that the individual channel values can be viewed.
```
<?php
function transformImageColorspace($imagePath, $colorSpace, $channel) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->transformimagecolorspace($colorSpace);
//channel should be one of the channel constants e.g. \Imagick::CHANNEL_BLUE
$imagick->separateImageChannel($channel);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
### See Also
* [Imagick::setColorSpace()](imagick.setcolorspace) - Set colorspace
php SQLite3::enableExceptions SQLite3::enableExceptions
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3::enableExceptions — Enable throwing exceptions
### Description
```
public SQLite3::enableExceptions(bool $enable = false): bool
```
Controls whether the [SQLite3](class.sqlite3) instance will throw exceptions or warnings on error.
### Parameters
`enable`
When **`true`**, the [SQLite3](class.sqlite3) instance, and [SQLite3Stmt](class.sqlite3stmt) and [SQLite3Result](class.sqlite3result) instances derived from it, will throw exceptions on error.
When **`false`**, the [SQLite3](class.sqlite3) instance, and [SQLite3Stmt](class.sqlite3stmt) and [SQLite3Result](class.sqlite3result) instances derived from it, will raise warnings on error.
For either mode, the error code and message, if any, will be available via [SQLite3::lastErrorCode()](sqlite3.lasterrorcode) and [SQLite3::lastErrorMsg()](sqlite3.lasterrormsg) respectively.
### Return Values
Returns the old value; **`true`** if exceptions were enabled, **`false`** otherwise.
### Examples
**Example #1 **SQLite3::enableExceptions()** example**
```
<?php
$sqlite = new SQLite3(':memory:');
try {
$sqlite->exec('create table foo');
$sqlite->enableExceptions(true);
$sqlite->exec('create table bar');
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage();
}
?>
```
The above example will output something similar to:
```
Warning: SQLite3::exec(): near "foo": syntax error in example.php on line 4
Caught exception: near "bar": syntax error
```
| programming_docs |
php SyncReaderWriter::writeunlock SyncReaderWriter::writeunlock
=============================
(PECL sync >= 1.0.0)
SyncReaderWriter::writeunlock — Releases a write lock
### Description
```
public SyncReaderWriter::writeunlock(): bool
```
Releases a write lock on a [SyncReaderWriter](class.syncreaderwriter) object.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **SyncReaderWriter::writeunlock()** example**
```
<?php
$readwrite = new SyncReaderWriter("FileCacheLock");
$readwrite->writelock();
/* ... */
$readwrite->writeunlock();
?>
```
### See Also
* [SyncReaderWriter::writelock()](syncreaderwriter.writelock) - Waits for an exclusive write lock
php The VarnishStat class
The VarnishStat class
=====================
Introduction
------------
(PECL varnish >= 0.3)
Class synopsis
--------------
class **VarnishStat** { /\* Methods \*/
```
public __construct(array $args = ?)
```
```
public getSnapshot(): array
```
} Table of Contents
-----------------
* [VarnishStat::\_\_construct](varnishstat.construct) — VarnishStat constructor
* [VarnishStat::getSnapshot](varnishstat.getsnapshot) — Get the current varnish instance statistics snapshot
php OAuthProvider::setParam OAuthProvider::setParam
=======================
(PECL OAuth >= 1.0.0)
OAuthProvider::setParam — Set a parameter
### Description
```
final public OAuthProvider::setParam(string $param_key, mixed $param_val = ?): bool
```
Sets a parameter.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`param_key`
The parameter key.
`param_val`
The optional parameter value.
To exclude a parameter from signature verification, set its value to **`null`**.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [OAuthProvider::addRequiredParameter()](oauthprovider.addrequiredparameter) - Add required parameters
php The SplSubject interface
The SplSubject interface
========================
Introduction
------------
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
The **SplSubject** interface is used alongside [SplObserver](class.splobserver) to implement the Observer Design Pattern.
Interface synopsis
------------------
interface **SplSubject** { /\* Methods \*/
```
public attach(SplObserver $observer): void
```
```
public detach(SplObserver $observer): void
```
```
public notify(): void
```
} Table of Contents
-----------------
* [SplSubject::attach](splsubject.attach) — Attach an SplObserver
* [SplSubject::detach](splsubject.detach) — Detach an observer
* [SplSubject::notify](splsubject.notify) — Notify an observer
php session_id session\_id
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
session\_id — Get and/or set the current session id
### Description
```
session_id(?string $id = null): string|false
```
**session\_id()** is used to get or set the session id for the current session.
The constant **`SID`** can also be used to retrieve the current name and session id as a string suitable for adding to URLs. See also [Session handling](https://www.php.net/manual/en/ref.session.php).
### Parameters
`id`
If `id` is specified and not **`null`**, it will replace the current session id. **session\_id()** needs to be called before [session\_start()](function.session-start) for that purpose. Depending on the session handler, not all characters are allowed within the session id. For example, the file session handler only allows characters in the range `a-z A-Z 0-9 , (comma) and - (minus)`!
> **Note**: When using session cookies, specifying an `id` for **session\_id()** will always send a new cookie when [session\_start()](function.session-start) is called, regardless if the current session id is identical to the one being set.
>
>
### Return Values
**session\_id()** returns the session id for the current session or the empty string (`""`) if there is no current session (no current session id exists). On failure, **`false`** is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `id` is nullable now. |
### See Also
* [session\_regenerate\_id()](function.session-regenerate-id) - Update the current session id with a newly generated one
* [session\_start()](function.session-start) - Start new or resume existing session
* [session\_set\_save\_handler()](function.session-set-save-handler) - Sets user-level session storage functions
* [session.save\_handler](https://www.php.net/manual/en/session.configuration.php#ini.session.save-handler)
php SolrQuery::addField SolrQuery::addField
===================
(PECL solr >= 0.9.2)
SolrQuery::addField — Specifies which fields to return in the result
### Description
```
public SolrQuery::addField(string $field): SolrQuery
```
This method is used to used to specify a set of fields to return, thereby restricting the amount of data returned in the response.
It should be called multiple time, once for each field name.
### Parameters
`field`
The name of the field
### Return Values
Returns the current SolrQuery object
php pg_host pg\_host
========
(PHP 4, PHP 5, PHP 7, PHP 8)
pg\_host — Returns the host name associated with the connection
### Description
```
pg_host(?PgSql\Connection $connection = null): string
```
**pg\_host()** returns the host name of 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 name of the host the `connection` is to, or an 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\_host()** example**
```
<?php
$pgsql_conn = pg_connect("dbname=mark host=localhost");
if ($pgsql_conn) {
print "Successfully connected to: " . pg_host($pgsql_conn) . "<br/>\n";
} else {
print pg_last_error($pgsql_conn);
exit;
}
?>
```
### See Also
* [pg\_connect()](function.pg-connect) - Open a PostgreSQL connection
* [pg\_pconnect()](function.pg-pconnect) - Open a persistent PostgreSQL connection
php Componere\Value::isPrivate Componere\Value::isPrivate
==========================
(Componere 2 >= 2.1.0)
Componere\Value::isPrivate — Accessibility Detection
### Description
```
public Componere\Value::isPrivate(): bool
```
php sodium_crypto_pwhash_str_needs_rehash sodium\_crypto\_pwhash\_str\_needs\_rehash
==========================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_pwhash\_str\_needs\_rehash — Determine whether or not to rehash a password
### Description
```
sodium_crypto_pwhash_str_needs_rehash(string $password, int $opslimit, int $memlimit): bool
```
Determine whether or not to rehash a password, based on the current hash `opslimit` and `memlimit`.
### Parameters
`password`
Password hash
`opslimit`
Configured opslimit; see [sodium\_crypto\_pwhash\_str()](function.sodium-crypto-pwhash-str)
`memlimit`
Configured memlimit; see [sodium\_crypto\_pwhash\_str()](function.sodium-crypto-pwhash-str)
### Return Values
Returns **`true`** if the provided memlimit/opslimit do not match what's stored in the hash. Returns **`false`** if they match.
php SolrClient::deleteById SolrClient::deleteById
======================
(PECL solr >= 0.9.2)
SolrClient::deleteById — Delete by Id
### Description
```
public SolrClient::deleteById(string $id): SolrUpdateResponse
```
Deletes the document with the specified ID. Where ID is the value of the uniqueKey field declared in the schema
### Parameters
`id`
The value of the uniqueKey field declared in the schema
### Return Values
Returns a [SolrUpdateResponse](class.solrupdateresponse) on success and 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.
### See Also
* [SolrClient::deleteByIds()](solrclient.deletebyids) - Deletes by Ids
* [SolrClient::deleteByQuery()](solrclient.deletebyquery) - Deletes all documents matching the given query
* [SolrClient::deleteByQueries()](solrclient.deletebyqueries) - Removes all documents matching any of the queries
php tidyNode::hasSiblings tidyNode::hasSiblings
=====================
(PHP 5, PHP 7, PHP 8)
tidyNode::hasSiblings — Checks if a node has siblings
### Description
```
public tidyNode::hasSiblings(): bool
```
Tells if the node has siblings.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the node has siblings, **`false`** otherwise.
### Examples
**Example #1 **tidyNode::hasSiblings()** example**
```
<?php
$html = <<< HTML
<html><head>
<?php echo '<title>title</title>'; ?>
<#
/* JSTE code */
alert('Hello World');
#>
</head>
<body>
<?php
// PHP code
echo 'hello world!';
?>
<%
/* ASP code */
response.write("Hello World!")
%>
<!-- Comments -->
Hello World
</body></html>
Outside HTML
HTML;
$tidy = tidy_parse_string($html);
$num = 0;
// the html tag
var_dump($tidy->html()->hasSiblings());
// the head tag
var_dump($tidy->html()->child[0]->hasSiblings());
?>
```
The above example will output:
```
bool(false)
bool(true)
```
php fbird_blob_add fbird\_blob\_add
================
(PHP 5, PHP 7 < 7.4.0)
fbird\_blob\_add — Alias of [ibase\_blob\_add()](function.ibase-blob-add)
### Description
This function is an alias of: [ibase\_blob\_add()](function.ibase-blob-add).
### See Also
* [fbird\_blob\_cancel()](function.fbird-blob-cancel) - Cancel creating blob
* [fbird\_blob\_close()](function.fbird-blob-close) - Alias of ibase\_blob\_close
* [fbird\_blob\_create()](function.fbird-blob-create) - Alias of ibase\_blob\_create
* [fbird\_blob\_import()](function.fbird-blob-import) - Alias of ibase\_blob\_import
php Yaf_Dispatcher::catchException Yaf\_Dispatcher::catchException
===============================
(Yaf >=1.0.0)
Yaf\_Dispatcher::catchException — Switch on/off exception catching
### Description
```
public Yaf_Dispatcher::catchException(bool $flag = ?): Yaf_Dispatcher
```
While the application.dispatcher.throwException is On(you can also calling to **Yaf\_Dispatcher::throwException(TRUE)()** to enable it), Yaf will throw Exception when error occurs instead of trigger error.
then if you enable **Yaf\_Dispatcher::catchException()**(also can enabled by set [application.dispatcher.catchException](https://www.php.net/manual/en/yaf.appconfig.php#configuration.yaf.dispatcher.catchexception)), all uncaught Exceptions will be caught by ErrorController::error if you have defined one.
### Parameters
`flag`
bool
### Return Values
### Examples
**Example #1 **Yaf\_Dispatcher::catchException()** example**
```
/* if you defined a ErrorController like following */
<?php
class ErrorController extends Yaf_Controller_Abstract {
/**
* you can also call to Yaf_Request_Abstract::getException to get the
* un-caught exception.
*/
public function errorAction($exception) {
/* error occurs */
switch ($exception->getCode()) {
case YAF_ERR_NOTFOUND_MODULE:
case YAF_ERR_NOTFOUND_CONTROLLER:
case YAF_ERR_NOTFOUND_ACTION:
case YAF_ERR_NOTFOUND_VIEW:
echo 404, ":", $exception->getMessage();
break;
default :
$message = $exception->getMessage();
echo 0, ":", $exception->getMessage();
break;
}
}
}
?>
```
The above example will output something similar to:
```
/* now if some error occur, assuming access a non-exists controller(or you can throw a exception yourself): */
404:Could not find controller script **/application/controllers/No-exists-controller.php
```
### See Also
* [Yaf\_Dispatcher::throwException()](yaf-dispatcher.throwexception) - Switch on/off exception throwing
* [Yaf\_Dispatcher::setErrorHandler()](yaf-dispatcher.seterrorhandler) - Set error handler
php ImagickKernel::getMatrix ImagickKernel::getMatrix
========================
(PECL imagick >= 3.3.0)
ImagickKernel::getMatrix — Description
### Description
```
public ImagickKernel::getMatrix(): array
```
Get the 2d matrix of values used in this kernel. The elements are either float for elements that are used or 'false' if the element should be skipped.
### Parameters
This function has no parameters.
### Return Values
A matrix (2d array) of the values that represent the kernel.
### Examples
**Example #1 **ImagickKernel::getMatrix()****
```
<?php
function renderKernelTable($matrix) {
$output = "<table class='infoTable'>";
foreach ($matrix as $row) {
$output .= "<tr>";
foreach ($row as $cell) {
$output .= "<td style='text-align:left'>";
if ($cell === false) {
$output .= "false";
}
else {
$output .= round($cell, 3);
}
$output .= "</td>";
}
$output .= "</tr>";
}
$output .= "</table>";
return $output;
}
$output = "The built-in kernel name 'ring' with parameters of '2,3.5':<br/>";
$kernel = \ImagickKernel::fromBuiltIn(
\Imagick::KERNEL_RING,
"2,3.5"
);
$matrix = $kernel->getMatrix();
$output .= renderKernelTable($matrix);
echo $output;
?>
```
php SessionHandlerInterface::write SessionHandlerInterface::write
==============================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
SessionHandlerInterface::write — Write session data
### Description
```
public SessionHandlerInterface::write(string $id, string $data): bool
```
Writes the session data to the session storage. Called by [session\_write\_close()](function.session-write-close), when [session\_register\_shutdown()](function.session-register-shutdown) fails, or during a normal shutdown. Note: [SessionHandlerInterface::close()](sessionhandlerinterface.close) is called immediately after this function.
PHP will call this method when the session is ready to be saved and closed. It encodes the session data from the [$\_SESSION](reserved.variables.session) superglobal to a serialized string and passes this along with the session ID to this method for storage. The serialization method used is specified in the [session.serialize\_handler](https://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler) setting.
Note this method is normally called by PHP after the output buffers have been closed unless explicitly called by [session\_write\_close()](function.session-write-close)
### Parameters
`id`
The session id.
`data`
The encoded session data. This data is the result of the PHP internally encoding the [$\_SESSION](reserved.variables.session) superglobal to a serialized string and passing it as this parameter. Please note sessions use an alternative serialization method.
### Return Values
The return value (usually **`true`** on success, **`false`** on failure). Note this value is returned internally to PHP for processing.
### See Also
* The [session.serialize\_handler](https://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler) configuration directive.
php Yaf_Session::__unset Yaf\_Session::\_\_unset
=======================
(Yaf >=1.0.0)
Yaf\_Session::\_\_unset — The \_\_unset purpose
### Description
```
public Yaf_Session::__unset(string $name): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`name`
### Return Values
php wincache_ucache_delete wincache\_ucache\_delete
========================
(PECL wincache >= 1.1.0)
wincache\_ucache\_delete — Deletes variables from the user cache
### Description
```
wincache_ucache_delete(mixed $key): bool
```
Deletes the elements in the user cache pointed by `key`.
### 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.
### Return Values
Returns **`true`** on success or **`false`** on failure.
If `key` is an array then the function returns **`false`** if every element of the array fails to get deleted from the user cache, otherwise returns an array which consists of all the keys that are deleted.
### Examples
**Example #1 Using **wincache\_ucache\_delete()** with `key` as a string**
```
<?php
wincache_ucache_set('foo', 'bar');
var_dump(wincache_ucache_delete('foo'));
var_dump(wincache_ucache_exists('foo'));
?>
```
The above example will output:
```
bool(true)
bool(false)
```
**Example #2 Using**wincache\_ucache\_delete()** 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_delete($array2));
?>
```
The above example will output:
```
array(4) { [0]=> string(5) "green"
[1]=> string(4) "Blue"
[2]=> string(6) "yellow"
[3]=> string(4) "cyan" }
```
**Example #3 Using **wincache\_ucache\_delete()** with `key` as an array where some elements cannot be deleted**
```
<?php
$array1 = array('green' => '5', 'blue' => '6', 'yellow' => '7', 'cyan' => '8');
wincache_ucache_set($array1);
$array2 = array('orange', 'red', 'yellow', 'cyan');
var_dump(wincache_ucache_delete($array2));
?>
```
The above example will output:
```
array(2) { [0]=> string(6) "yellow"
[1]=> string(4) "cyan" }
```
### See Also
* [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\_add()](function.wincache-ucache-add) - Adds a variable in user cache only if variable does not already exist in the cache
* [wincache\_ucache\_get()](function.wincache-ucache-get) - Gets a variable stored in 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
php mysqli_driver::embedded_server_end mysqli\_driver::embedded\_server\_end
=====================================
mysqli\_embedded\_server\_end
=============================
(PHP 5 >= 5.1.0, PHP 7 < 7.4.0)
mysqli\_driver::embedded\_server\_end -- mysqli\_embedded\_server\_end — Stop embedded server
**Warning**This function was *REMOVED* in PHP 7.4.0.
### Description
Object-oriented style
```
public mysqli_driver::embedded_server_end(): void
```
Procedural style
```
mysqli_embedded_server_end(): void
```
**Warning**This function is currently not documented; only its argument list is available.
| programming_docs |
php EventDnsBase::addSearch EventDnsBase::addSearch
=======================
(PECL event >= 1.2.6-beta)
EventDnsBase::addSearch — Adds a domain to the list of search domains
### Description
```
public EventDnsBase::addSearch( string $domain ): void
```
Adds a domain to the list of search domains
### Parameters
`domain` Search domain.
### Return Values
No value is returned.
php Gmagick::newimage Gmagick::newimage
=================
(PECL gmagick >= Unknown)
Gmagick::newimage — Creates a new image
### Description
```
public Gmagick::newimage(
int $width,
int $height,
string $background,
string $format = ?
): Gmagick
```
Creates a new image with the specified background color.
### Parameters
`width`
Width of the new image.
`height`
Height of the new image.
`background`
The background color used for this image (as float).
`format`
Image format.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php DOMCharacterData::replaceData DOMCharacterData::replaceData
=============================
(PHP 5, PHP 7, PHP 8)
DOMCharacterData::replaceData — Replace a substring within the DOMCharacterData node
### Description
```
public DOMCharacterData::replaceData(int $offset, int $count, string $data): bool
```
Replace `count` characters starting from position `offset` with `data`.
### Parameters
`offset`
The offset from which to start replacing.
`count`
The number of characters to replace. If the sum of `offset` and `count` exceeds the length, then all characters to the end of the data are replaced.
`data`
The string with which the range must be replaced.
### 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, or if `count` is negative.
### 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::insertData()](domcharacterdata.insertdata) - Insert a string at the specified 16-bit unit offset
* [DOMCharacterData::substringData()](domcharacterdata.substringdata) - Extracts a range of data from the node
php Yaf_Request_Abstract::isPut Yaf\_Request\_Abstract::isPut
=============================
(Yaf >=1.0.0)
Yaf\_Request\_Abstract::isPut — Determine if request is PUT request
### Description
```
public Yaf_Request_Abstract::isPut(): bool
```
### Parameters
This function has no parameters.
### Return Values
boolean
### 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::isGet()](yaf-request-abstract.isget) - Determine if request is GET 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 get_magic_quotes_gpc get\_magic\_quotes\_gpc
=======================
(PHP 4, PHP 5, PHP 7)
get\_magic\_quotes\_gpc — Gets the current configuration setting of magic\_quotes\_gpc
**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_gpc(): bool
```
Always returns **`false`**.
### Parameters
This function has no parameters.
### Return Values
Always returns **`false`**.
### Changelog
| Version | Description |
| --- | --- |
| 7.4.0 | This function has been deprecated. |
### See Also
* [addslashes()](function.addslashes) - Quote string with slashes
* [stripslashes()](function.stripslashes) - Un-quotes a quoted string
* [get\_magic\_quotes\_runtime()](function.get-magic-quotes-runtime) - Gets the current active configuration setting of magic\_quotes\_runtime
* [ini\_get()](function.ini-get) - Gets the value of a configuration option
php gmp_intval gmp\_intval
===========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_intval — Convert GMP number to integer
### Description
```
gmp_intval(GMP|int|string $num): int
```
This function converts GMP number into native PHP ints.
### Parameters
`num`
A [GMP](class.gmp) object, an int or a numeric string.
### Return Values
The int value of `num`.
### Examples
**Example #1 **gmp\_intval()** example**
```
<?php
// displays correct result
echo gmp_intval("2147483647") . "\n";
// displays wrong result, above PHP integer limit
echo gmp_intval("2147483648") . "\n";
// displays correct result
echo gmp_strval("2147483648") . "\n";
?>
```
The above example will output:
```
2147483647
2147483647
2147483648
```
### Notes
**Warning** This function returns a useful result only if the number actually fits the PHP integer (i.e., signed long type). To simply print the GMP number, use [gmp\_strval()](function.gmp-strval).
php NumberFormatter::parse NumberFormatter::parse
======================
numfmt\_parse
=============
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
NumberFormatter::parse -- numfmt\_parse — Parse a number
### Description
Object-oriented style
```
public NumberFormatter::parse(string $string, int $type = NumberFormatter::TYPE_DOUBLE, int &$offset = null): int|float|false
```
Procedural style
```
numfmt_parse(
NumberFormatter $formatter,
string $string,
int $type = NumberFormatter::TYPE_DOUBLE,
int &$offset = null
): int|float|false
```
Parse a string into a number using the current formatter rules.
### Parameters
`formatter`
[NumberFormatter](class.numberformatter) object.
`string`
The string to parse for the number.
`type`
The [formatting type](class.numberformatter#intl.numberformatter-constants.types) to use. By default, **`NumberFormatter::TYPE_DOUBLE`** is used. Note that **`NumberFormatter::TYPE_CURRENCY`** is not supported; use [NumberFormatter::parseCurrency()](numberformatter.parsecurrency) instead.
`offset`
Offset in the string at which to begin parsing. On return, this value will hold the offset at which parsing ended.
### Return Values
The value of the parsed number or **`false`** on error.
### Examples
**Example #1 **numfmt\_parse()** example**
```
<?php
$fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL );
$num = "1.234.567,891";
echo numfmt_parse($fmt, $num)."\n";
echo numfmt_parse($fmt, $num, NumberFormatter::TYPE_INT32)."\n";
?>
```
**Example #2 OO example**
```
<?php
$fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL );
$num = "1.234.567,891";
echo $fmt->parse($num)."\n";
echo $fmt->parse($num, NumberFormatter::TYPE_INT32)."\n";
?>
```
The above example will output:
```
1234567.891
1234567
```
### See Also
* [numfmt\_get\_error\_code()](numberformatter.geterrorcode) - Get formatter's last error code
* [numfmt\_format()](numberformatter.format) - Format a number
* [numfmt\_parse\_currency()](numberformatter.parsecurrency) - Parse a currency number
php SolrQuery::setExpandRows SolrQuery::setExpandRows
========================
(PECL solr >= 2.2.0)
SolrQuery::setExpandRows — Sets the number of rows to display in each group (expand.rows). Server Default 5
### Description
```
public SolrQuery::setExpandRows(int $value): SolrQuery
```
Sets the number of rows to display in each group (expand.rows). Server Default 5
### Parameters
`value`
### 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::setExpandQuery()](solrquery.setexpandquery) - Sets the expand.q parameter
* [SolrQuery::addExpandFilterQuery()](solrquery.addexpandfilterquery) - Overrides main filter query, determines which documents to include in the main group
* [SolrQuery::removeExpandFilterQuery()](solrquery.removeexpandfilterquery) - Removes an expand filter query
php intl_error_name intl\_error\_name
=================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
intl\_error\_name — Get symbolic name for a given error code
### Description
```
intl_error_name(int $errorCode): string
```
Return ICU error code name.
### Parameters
`errorCode`
ICU error code.
### Return Values
The returned string will be the same as the name of the error code constant.
### Examples
**Example #1 **intl\_error\_name()** example**
```
<?php
$coll = collator_create( 'en_RU' );
$err_code = collator_get_error_code( $coll );
printf( "Symbolic name for %d is %s\n.", $err_code, intl_error_name( $err_code ) );
?>
```
The above example will output something similar to:
```
Symbolic name for -128 is U_USING_FALLBACK_WARNING.
```
### See Also
* [intl\_is\_failure()](function.intl-is-failure) - Check whether the given error code indicates failure
* [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 Yaf_Dispatcher::__construct Yaf\_Dispatcher::\_\_construct
==============================
(Yaf >=1.0.0)
Yaf\_Dispatcher::\_\_construct — Yaf\_Dispatcher constructor
### Description
public **Yaf\_Dispatcher::\_\_construct**() ### Parameters
This function has no parameters.
### Return Values
php mysqli::character_set_name mysqli::character\_set\_name
============================
mysqli\_character\_set\_name
============================
(PHP 5, PHP 7, PHP 8)
mysqli::character\_set\_name -- mysqli\_character\_set\_name — Returns the current character set of the database connection
### Description
Object-oriented style
```
public mysqli::character_set_name(): string
```
Procedural style
```
mysqli_character_set_name(mysqli $mysql): string
```
Returns the current character set of the database connection.
### 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 current character set of the connection
### Examples
**Example #1 **mysqli::character\_set\_name()** example**
Object-oriented style
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* Set the default character set */
$mysqli->set_charset('utf8mb4');
/* Print current character set */
$charset = $mysqli->character_set_name();
printf("Current character set is %s\n", $charset);
```
Procedural style
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = mysqli_connect("localhost", "my_user", "my_password", "world");
/* Set the default character set */
mysqli_set_charset($mysqli, 'utf8mb4');
/* Print current character set */
$charset = mysqli_character_set_name($mysqli);
printf("Current character set is %s\n", $charset);
```
The above examples will output:
```
Current character set is utf8mb4
```
### See Also
* [mysqli\_set\_charset()](mysqli.set-charset) - Sets the client character set
* [mysqli\_real\_escape\_string()](mysqli.real-escape-string) - Escapes special characters in a string for use in an SQL statement, taking into account the current charset of the connection
php RecursiveIteratorIterator::valid RecursiveIteratorIterator::valid
================================
(PHP 5, PHP 7, PHP 8)
RecursiveIteratorIterator::valid — Check whether the current position is valid
### Description
```
public RecursiveIteratorIterator::valid(): bool
```
**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 QuickHashIntStringHash::exists QuickHashIntStringHash::exists
==============================
(PECL quickhash >= Unknown)
QuickHashIntStringHash::exists — This method checks whether a key is part of the hash
### Description
```
public QuickHashIntStringHash::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.
php DOMDocument::getElementsByTagNameNS DOMDocument::getElementsByTagNameNS
===================================
(PHP 5, PHP 7, PHP 8)
DOMDocument::getElementsByTagNameNS — Searches for all elements with given tag name in specified namespace
### Description
```
public DOMDocument::getElementsByTagNameNS(?string $namespace, string $localName): DOMNodeList
```
Returns a [DOMNodeList](class.domnodelist) of all elements with a given local name and a namespace URI.
### Parameters
`namespace`
The namespace URI of the elements to match on. The special value `*` matches all namespaces.
`localName`
The local name of the elements to match on. The special value `*` matches all local names.
### Return Values
A new [DOMNodeList](class.domnodelist) object containing all the matched elements.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.3 | `namespace` is nullable now. |
### Examples
**Example #1 Get all the XInclude elements**
```
<?php
$xml = <<<EOD
<?xml version="1.0" ?>
<chapter xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Books of the other guy..</title>
<para>
<xi:include href="book.xml">
<xi:fallback>
<error>xinclude: book.xml not found</error>
</xi:fallback>
</xi:include>
<include>
This is another namespace
</include>
</para>
</chapter>
EOD;
$dom = new DOMDocument;
// load the XML string defined above
$dom->loadXML($xml);
foreach ($dom->getElementsByTagNameNS('http://www.w3.org/2001/XInclude', '*') as $element) {
echo 'local name: ', $element->localName, ', prefix: ', $element->prefix, "\n";
}
?>
```
The above example will output:
```
local name: include, prefix: xi
local name: fallback, prefix: xi
```
### See Also
* [DOMDocument::getElementsByTagName()](domdocument.getelementsbytagname) - Searches for all elements with given local tag name
php Yaf_Config_Simple::valid Yaf\_Config\_Simple::valid
==========================
(Yaf >=1.0.0)
Yaf\_Config\_Simple::valid — The valid purpose
### Description
```
public Yaf_Config_Simple::valid(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php XMLWriter::startDocument XMLWriter::startDocument
========================
xmlwriter\_start\_document
==========================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::startDocument -- xmlwriter\_start\_document — Create document tag
### Description
Object-oriented style
```
public XMLWriter::startDocument(?string $version = "1.0", ?string $encoding = null, ?string $standalone = null): bool
```
Procedural style
```
xmlwriter_start_document(
XMLWriter $writer,
?string $version = "1.0",
?string $encoding = null,
?string $standalone = null
): bool
```
Starts a document.
### 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).
`version`
The version number of the document as part of the XML declaration.
`encoding`
The encoding of the document as part of the XML declaration.
`standalone`
`yes` or `no`.
### 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::endDocument()](xmlwriter.enddocument) - End current document
php SolrQuery::getExpandSortFields SolrQuery::getExpandSortFields
==============================
(PECL solr >= 2.2.0)
SolrQuery::getExpandSortFields — Returns an array of fields
### Description
```
public SolrQuery::getExpandSortFields(): array
```
Returns an array of fields
### Parameters
This function has no parameters.
### Return Values
Returns an array of fields.
php CURLFile::getPostFilename CURLFile::getPostFilename
=========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
CURLFile::getPostFilename — Get file name for POST
### Description
```
public CURLFile::getPostFilename(): string
```
### Parameters
This function has no parameters.
### Return Values
Returns file name for POST.
php gmp_div_qr gmp\_div\_qr
============
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_div\_qr — Divide numbers and get quotient and remainder
### Description
```
gmp_div_qr(GMP|int|string $num1, GMP|int|string $num2, int $rounding_mode = GMP_ROUND_ZERO): array
```
The function divides `num1` by `num2`.
### Parameters
`num1`
The number being divided.
A [GMP](class.gmp) object, an int or a numeric string.
`num2`
The number that `num1` is being divided by.
A [GMP](class.gmp) object, an int or a numeric string.
`rounding_mode`
See the [gmp\_div\_q()](function.gmp-div-q) function for description of the `rounding_mode` argument.
### Return Values
Returns an array, with the first element being `[n/d]` (the integer result of the division) and the second being `(n - [n/d] * d)` (the remainder of the division).
### Examples
**Example #1 Division of GMP numbers**
```
<?php
$a = gmp_init("0x41682179fbf5");
$res = gmp_div_qr($a, "0xDEFE75");
printf("Result is: q - %s, r - %s",
gmp_strval($res[0]), gmp_strval($res[1]));
?>
```
### See Also
* [gmp\_div\_q()](function.gmp-div-q) - Divide numbers
* [gmp\_div\_r()](function.gmp-div-r) - Remainder of the division of numbers
php DateTimeImmutable::createFromInterface DateTimeImmutable::createFromInterface
======================================
(PHP 8)
DateTimeImmutable::createFromInterface — Returns new DateTimeImmutable object encapsulating the given DateTimeInterface object
### Description
```
public static DateTimeImmutable::createFromInterface(DateTimeInterface $object): DateTimeImmutable
```
### Parameters
`object`
The [DateTimeInterface](class.datetimeinterface) object that needs to be converted to an immutable version. This object is not modified, but instead a new [DateTimeImmutable](class.datetimeimmutable) object is created containing the same date, time, and timezone information.
### Return Values
Returns a new [DateTimeImmutable](class.datetimeimmutable) instance.
### Examples
**Example #1 Creating an immutable date time object**
```
<?php
$date = new DateTime("2014-06-20 11:45 Europe/London");
$immutable = DateTimeImmutable::createFromInterface($date);
$date = new DateTimeImmutable("2014-06-20 11:45 Europe/London");
$also_immutable = DateTimeImmutable::createFromInterface($date);
?>
```
| programming_docs |
php SolrQuery::addFacetDateOther SolrQuery::addFacetDateOther
============================
(PECL solr >= 0.9.2)
SolrQuery::addFacetDateOther — Adds another facet.date.other parameter
### Description
```
public SolrQuery::addFacetDateOther(string $value, string $field_override = ?): SolrQuery
```
Sets the facet.date.other parameter. Accepts an optional field override
### Parameters
`value`
The value to use.
`field_override`
The field name for the override.
### Return Values
Returns the current SolrQuery object, if the return value is used.
php The ZookeeperConnectionException class
The ZookeeperConnectionException class
======================================
Introduction
------------
(PECL zookeeper >= 0.3.0)
The ZooKeeper connection exception handling class.
Class synopsis
--------------
class **ZookeeperConnectionException** 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 ZipArchive::unchangeName ZipArchive::unchangeName
========================
(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.5.0)
ZipArchive::unchangeName — Revert all changes done to an entry with the given name
### Description
```
public ZipArchive::unchangeName(string $name): bool
```
Revert all changes done to an entry.
### Parameters
`name`
Name of the entry.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php ReflectionClass::getStaticPropertyValue ReflectionClass::getStaticPropertyValue
=======================================
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
ReflectionClass::getStaticPropertyValue — Gets static property value
### Description
```
public ReflectionClass::getStaticPropertyValue(string $name, mixed &$def_value = ?): mixed
```
Gets the value of a static property on this class.
### Parameters
`name`
The name of the static property for which to return a value.
`def_value`
A default value to return in case the class does not declare a static property with the given `name`. If the property does not exist and this argument is omitted, a [ReflectionException](class.reflectionexception) is thrown.
### Return Values
The value of the static property.
### Examples
**Example #1 Basic usage of **ReflectionClass::getStaticPropertyValue()****
```
<?php
class Apple {
public static $color = 'Red';
}
$class = new ReflectionClass('Apple');
var_dump($class->getStaticPropertyValue('color'));
?>
```
The above example will output:
```
string(3) "Red"
```
### See Also
* [ReflectionClass::getStaticProperties()](reflectionclass.getstaticproperties) - Gets static properties
* [ReflectionClass::setStaticPropertyValue()](reflectionclass.setstaticpropertyvalue) - Sets static property value
php EventBuffer::search EventBuffer::search
===================
(PECL event >= 1.2.6-beta)
EventBuffer::search — Scans the buffer for an occurrence of a string
### Description
```
public EventBuffer::search( string $what , int $start = -1 , int $end = -1 ): mixed
```
Scans the buffer for an occurrence of the string `what` . It returns numeric position of the string, or **`false`** if the string was not found.
If the `start` argument is provided, it points to 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
`what` String to search.
`start` Start search position.
`end` End search position.
### Return Values
Returns numeric position of the first occurrence of the string in the buffer, or **`false`** if string is 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.
### Examples
**Example #1 **EventBuffer::search()** example**
```
<?php
// Count total occurrences of 'str' in 'buf'
function count_instances($buf, $str) {
$total = 0;
$p = 0;
$i = 0;
while (1) {
$p = $buf->search($str, $p);
if ($p === FALSE) {
break;
}
++$total;
++$p;
}
return $total;
}
$buf = new EventBuffer();
$buf->add("Some string within a string inside another string");
var_dump(count_instances($buf, "str"));
?>
```
The above example will output something similar to:
```
int(3)
```
### See Also
* [EventBuffer::searchEol()](eventbuffer.searcheol) - Scans the buffer for an occurrence of an end of line
php SolrDocument::getChildDocuments SolrDocument::getChildDocuments
===============================
(PECL solr >= 2.3.0)
SolrDocument::getChildDocuments — Returns an array of child documents (SolrDocument)
### Description
```
public SolrDocument::getChildDocuments(): array
```
Returns an array of child documents (SolrDocument)
### Parameters
This function has no parameters.
### Return Values
### See Also
* [SolrDocument::hasChildDocuments()](solrdocument.haschilddocuments) - Checks whether the document has any child documents
* [SolrDocument::getChildDocumentsCount()](solrdocument.getchilddocumentscount) - Returns the number of child documents
php The IntlRuleBasedBreakIterator class
The IntlRuleBasedBreakIterator class
====================================
Introduction
------------
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
A subclass of [IntlBreakIterator](class.intlbreakiterator) that encapsulates ICU break iterators whose behavior is specified using a set of rules. This is the most common kind of break iterators.
These rules are described in the [» ICU Boundary Analysis User Guide](http://userguide.icu-project.org/boundaryanalysis#TOC-RBBI-Rules).
Class synopsis
--------------
class **IntlRuleBasedBreakIterator** 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 [\_\_construct](intlrulebasedbreakiterator.construct)(string `$rules`, bool `$compiled` = **`false`**)
```
public getBinaryRules(): string|false
```
```
public getRules(): string|false
```
```
public getRuleStatus(): int
```
```
public getRuleStatusVec(): array|false
```
/\* 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
-----------------
* [IntlRuleBasedBreakIterator::\_\_construct](intlrulebasedbreakiterator.construct) — Create iterator from ruleset
* [IntlRuleBasedBreakIterator::getBinaryRules](intlrulebasedbreakiterator.getbinaryrules) — Get the binary form of compiled rules
* [IntlRuleBasedBreakIterator::getRules](intlrulebasedbreakiterator.getrules) — Get the rule set used to create this object
* [IntlRuleBasedBreakIterator::getRuleStatus](intlrulebasedbreakiterator.getrulestatus) — Get the largest status value from the break rules that determined the current break position
* [IntlRuleBasedBreakIterator::getRuleStatusVec](intlrulebasedbreakiterator.getrulestatusvec) — Get the status values from the break rules that determined the current break position
php XMLReader::open XMLReader::open
===============
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
XMLReader::open — Set the URI containing the XML to parse
### Description
```
public static XMLReader::open(string $uri, ?string $encoding = null, int $flags = 0): bool|XMLReader
```
Set the URI containing the XML document to be parsed.
### Parameters
`uri`
URI pointing to the document.
`encoding`
The document encoding or **`null`**.
`flags`
A bitmask of the [LIBXML\_\*](https://www.php.net/manual/en/libxml.constants.php) constants.
### Return Values
Returns **`true`** on success or **`false`** on failure. If called statically, returns an [XMLReader](class.xmlreader) or **`false`** on failure.
### Errors/Exceptions
This method may be called statically, but prior to PHP 8.0.0, will issue an **`E_DEPRECATED`** error in this case.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | **XMLReader::open()** is now declared as static method, but can still be called on an [XMLReader](class.xmlreader) instance. |
### See Also
* [XMLReader::xml()](xmlreader.xml) - Set the data containing the XML to parse
* [XMLReader::close()](xmlreader.close) - Close the XMLReader input
php array_slice array\_slice
============
(PHP 4, PHP 5, PHP 7, PHP 8)
array\_slice — Extract a slice of the array
### Description
```
array_slice(
array $array,
int $offset,
?int $length = null,
bool $preserve_keys = false
): array
```
**array\_slice()** returns the sequence of elements from the array `array` as specified by the `offset` and `length` parameters.
### Parameters
`array`
The input array.
`offset`
If `offset` is non-negative, the sequence will start at that offset in the `array`.
If `offset` is negative, the sequence will start that far from the end of the `array`.
>
> **Note**:
>
>
> The `offset` parameter denotes the position in the array, not the key.
>
>
`length`
If `length` is given and is positive, then the sequence will have up to that many elements in it.
If the array is shorter than the `length`, then only the available array elements will be present.
If `length` is given and is negative then the sequence will stop that many elements from the end of the array.
If it is omitted, then the sequence will have everything from `offset` up until the end of the `array`.
`preserve_keys`
>
> **Note**:
>
>
> **array\_slice()** will reorder and reset the integer array indices by default. This behaviour can be changed by setting `preserve_keys` to **`true`**. String keys are always preserved, regardless of this parameter.
>
>
### Return Values
Returns the slice. If the offset is larger than the size of the array, an empty array is returned.
### Examples
**Example #1 **array\_slice()** examples**
```
<?php
$input = array("a", "b", "c", "d", "e");
$output = array_slice($input, 2); // returns "c", "d", and "e"
$output = array_slice($input, -2, 1); // returns "d"
$output = array_slice($input, 0, 3); // returns "a", "b", and "c"
// note the differences in the array keys
print_r(array_slice($input, 2, -1));
print_r(array_slice($input, 2, -1, true));
?>
```
The above example will output:
```
Array
(
[0] => c
[1] => d
)
Array
(
[2] => c
[3] => d
)
```
**Example #2 **array\_slice()** and one-based array**
```
<?php
$input = array(1 => "a", "b", "c", "d", "e");
print_r(array_slice($input, 1, 2));
?>
```
The above example will output:
```
Array
(
[0] => b
[1] => c
)
```
**Example #3 **array\_slice()** and array with mixed keys**
```
<?php
$ar = array('a'=>'apple', 'b'=>'banana', '42'=>'pear', 'd'=>'orange');
print_r(array_slice($ar, 0, 3));
print_r(array_slice($ar, 0, 3, true));
?>
```
The above example will output:
```
Array
(
[a] => apple
[b] => banana
[0] => pear
)
Array
(
[a] => apple
[b] => banana
[42] => pear
)
```
### See Also
* [array\_chunk()](function.array-chunk) - Split an array into chunks
* [array\_splice()](function.array-splice) - Remove a portion of the array and replace it with something else
* [unset()](function.unset) - Unset a given variable
php sodium_crypto_scalarmult_ristretto255 sodium\_crypto\_scalarmult\_ristretto255
========================================
(PHP 8 >= 8.1.1)
sodium\_crypto\_scalarmult\_ristretto255 — Computes a shared secret
### Description
```
sodium_crypto_scalarmult_ristretto255(string $n, string $p): string
```
Calculates scalar `n` times point `p`. Available as of libsodium 1.0.18.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`n`
A scalar, which is typically a secret key.
`p`
A point (x-coordinate), which is typically a public key.
### Return Values
Returns a 32-byte random string.
### See Also
* [sodium\_crypto\_scalarmult\_ristretto255\_base()](function.sodium-crypto-scalarmult-ristretto255-base) - Calculates the public key from a secret key
php Event::pending Event::pending
==============
(PECL event >= 1.2.6-beta)
Event::pending — Detects whether event is pending or scheduled
### Description
```
public Event::pending( int $flags ): bool
```
Detects whether event is pending or scheduled
### Parameters
`flags` One of, or a composition of the following constants: **`Event::READ`** , **`Event::WRITE`** , **`Event::TIMEOUT`** , **`Event::SIGNAL`** .
### Return Values
Returns **`true`** if event is pending or scheduled. Otherwise **`false`**.
php None Basics
------
Variables in PHP are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive.
Variable names follow the same rules as other labels in PHP. A valid variable 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]*$`
> **Note**: For our purposes here, a letter is a-z, A-Z, and the bytes from 128 through 255 (`0x80-0xff`).
>
>
> **Note**: `$this` is a special variable that can't be assigned. Prior to PHP 7.1.0, indirect assignment (e.g. by using [variable variables](language.variables.variable)) was possible.
>
>
**Tip**See also the [Userland Naming Guide](https://www.php.net/manual/en/userlandnaming.php).
For information on variable related functions, see the [Variable Functions Reference](https://www.php.net/manual/en/ref.var.php).
```
<?php
$var = 'Bob';
$Var = 'Joe';
echo "$var, $Var"; // outputs "Bob, Joe"
$4site = 'not yet'; // invalid; starts with a number
$_4site = 'not yet'; // valid; starts with an underscore
$täyte = 'mansikka'; // valid; 'ä' is (Extended) ASCII 228.
?>
```
By default, variables are always assigned by value. That is to say, when you assign an expression to a variable, the entire value of the original expression is copied into the destination variable. This means, for instance, that after assigning one variable's value to another, changing one of those variables will have no effect on the other. For more information on this kind of assignment, see the chapter on [Expressions](language.expressions).
PHP also offers another way to assign values to variables: [assign by reference](https://www.php.net/manual/en/language.references.php). This means that the new variable simply references (in other words, "becomes an alias for" or "points to") the original variable. Changes to the new variable affect the original, and vice versa.
To assign by reference, simply prepend an ampersand (&) to the beginning of the variable which is being assigned (the source variable). For instance, the following code snippet outputs '`My
name is Bob`' twice:
```
<?php
$foo = 'Bob'; // Assign the value 'Bob' to $foo
$bar = &$foo; // Reference $foo via $bar.
$bar = "My name is $bar"; // Alter $bar...
echo $bar;
echo $foo; // $foo is altered too.
?>
```
One important thing to note is that only named variables may be assigned by reference.
```
<?php
$foo = 25;
$bar = &$foo; // This is a valid assignment.
$bar = &(24 * 7); // Invalid; references an unnamed expression.
function test()
{
return 25;
}
$bar = &test(); // Invalid.
?>
```
It is not necessary to initialize variables in PHP however it is a very good practice. Uninitialized variables have a default value of their type depending on the context in which they are used - booleans default to **`false`**, integers and floats default to zero, strings (e.g. used in [echo](function.echo)) are set as an empty string and arrays become to an empty array.
**Example #1 Default values of uninitialized variables**
```
<?php
// Unset AND unreferenced (no use context) variable; outputs NULL
var_dump($unset_var);
// Boolean usage; outputs 'false' (See ternary operators for more on this syntax)
echo($unset_bool ? "true\n" : "false\n");
// String usage; outputs 'string(3) "abc"'
$unset_str .= 'abc';
var_dump($unset_str);
// Integer usage; outputs 'int(25)'
$unset_int += 25; // 0 + 25 => 25
var_dump($unset_int);
// Float usage; outputs 'float(1.25)'
$unset_float += 1.25;
var_dump($unset_float);
// Array usage; outputs array(1) { [3]=> string(3) "def" }
$unset_arr[3] = "def"; // array() + array(3 => "def") => array(3 => "def")
var_dump($unset_arr);
// Object usage; creates new stdClass object (see http://www.php.net/manual/en/reserved.classes.php)
// Outputs: object(stdClass)#1 (1) { ["foo"]=> string(3) "bar" }
$unset_obj->foo = 'bar';
var_dump($unset_obj);
?>
```
Relying on the default value of an uninitialized variable is problematic in the case of including one file into another which uses the same variable name. [E\_NOTICE](language.variables.basics) level error is issued in case of working with uninitialized variables, however not in the case of appending elements to the uninitialized array. [isset()](function.isset) language construct can be used to detect if a variable has been already initialized.
| programming_docs |
php GmagickDraw::bezier GmagickDraw::bezier
===================
(PECL gmagick >= Unknown)
GmagickDraw::bezier — Draws a bezier curve
### Description
```
public GmagickDraw::bezier(array $coordinate_array): GmagickDraw
```
Draws a bezier curve through a set of points on the image.
### Parameters
`coordinate_array`
Coordinates array
### Return Values
The [GmagickDraw](class.gmagickdraw) object.
php Imagick::despeckleImage Imagick::despeckleImage
=======================
(PECL imagick 2, PECL imagick 3)
Imagick::despeckleImage — Reduces the speckle noise in an image
### Description
```
public Imagick::despeckleImage(): bool
```
Reduces the speckle noise in an image while preserving the edges of the original image.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::despeckleImage()****
```
<?php
function despeckleImage($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->despeckleImage();
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php pcntl_sigtimedwait pcntl\_sigtimedwait
===================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
pcntl\_sigtimedwait — Waits for signals, with a timeout
### Description
```
pcntl_sigtimedwait(
array $signals,
array &$info = [],
int $seconds = 0,
int $nanoseconds = 0
): int|false
```
The **pcntl\_sigtimedwait()** function operates in exactly the same way as [pcntl\_sigwaitinfo()](function.pcntl-sigwaitinfo) except that it takes two additional parameters, `seconds` and `nanoseconds`, which enable an upper bound to be placed on the time for which the script is suspended.
### Parameters
`signals`
Array of signals to wait for.
`info`
The `info` is set to an array containing information about the signal. See [pcntl\_sigwaitinfo()](function.pcntl-sigwaitinfo).
`seconds`
Timeout in seconds.
`nanoseconds`
Timeout in nanoseconds.
### Return Values
**pcntl\_sigtimedwait()** returns a signal number on success, or **`false`** on failure.
### See Also
* [pcntl\_sigprocmask()](function.pcntl-sigprocmask) - Sets and retrieves blocked signals
* [pcntl\_sigwaitinfo()](function.pcntl-sigwaitinfo) - Waits for signals
php zip_entry_read zip\_entry\_read
================
(PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.0.0)
zip\_entry\_read — Read from an open directory entry
**Warning**This function has been *DEPRECATED* as of PHP 8.0.0. Relying on this function is highly discouraged.
### Description
```
zip_entry_read(resource $zip_entry, int $len = 1024): string|false
```
Reads from an open directory entry.
### Parameters
`zip_entry`
A directory entry returned by [zip\_read()](function.zip-read).
`len`
The number of bytes to return.
>
> **Note**:
>
>
> This should be the uncompressed length you wish to read.
>
>
### Return Values
Returns the data read, empty string on end of a file, or **`false`** on error.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | This function is deprecated in favor of the Object API, see [ZipArchive::getFromIndex()](ziparchive.getfromindex). |
### See Also
* [zip\_entry\_open()](function.zip-entry-open) - Open a directory entry for reading
* [zip\_entry\_close()](function.zip-entry-close) - Close a directory entry
* [zip\_entry\_filesize()](function.zip-entry-filesize) - Retrieve the actual file size of a directory entry
php Gmagick::previousimage Gmagick::previousimage
======================
(PECL gmagick >= Unknown)
Gmagick::previousimage — Move to the previous image in the object
### Description
```
public Gmagick::previousimage(): bool
```
Associates the previous image in an image list with the Gmagick object.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
Throws an **GmagickException** on error.
php sqlsrv_connect sqlsrv\_connect
===============
(No version information available, might only be in Git)
sqlsrv\_connect — Opens a connection to a Microsoft SQL Server database
### Description
```
sqlsrv_connect(string $serverName, array $connectionInfo = ?): resource
```
Opens a connection to a Microsoft SQL Server database. By default, the connection is attempted using Windows Authentication. To connect using SQL Server Authentication, include "UID" and "PWD" in the connection options array.
### Parameters
`serverName`
The name of the server to which a connection is established. To connect to a specific instance, follow the server name with a backward slash and the instance name (e.g. serverName\sqlexpress).
`connectionInfo`
An associative array that specifies options for connecting to the server. If values for the UID and PWD keys are not specified, the connection will be attempted using Windows Authentication. For a complete list of supported keys, see [» SQLSRV Connection Options](http://msdn.microsoft.com/en-us/library/ff628167.aspx).
### Return Values
A connection resource. If a connection cannot be successfully opened, **`false`** is returned.
### Examples
**Example #1 Connect using Windows Authentication.**
```
<?php
$serverName = "serverName\\sqlexpress"; //serverName\instanceName
// Since UID and PWD are not specified in the $connectionInfo array,
// The connection will be attempted using Windows Authentication.
$connectionInfo = array( "Database"=>"dbName");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
```
**Example #2 Connect by specifying a user name and password.**
```
<?php
$serverName = "serverName\\sqlexpress"; //serverName\instanceName
$connectionInfo = array( "Database"=>"dbName", "UID"=>"userName", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
```
**Example #3 Connect on a specified port.**
```
<?php
$serverName = "serverName\\sqlexpress, 1542"; //serverName\instanceName, portNumber (default is 1433)
$connectionInfo = array( "Database"=>"dbName", "UID"=>"userName", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
```
### Notes
By default, the **sqlsrv\_connect()** uses connection pooling to improve connection performance. To turn off connection pooling (i.e. force a new connection on each call), set the "ConnectionPooling" option in the $connectionOptions array to 0 (or **`false`**). For more information, see [» SQLSRV Connection Pooling](http://msdn.microsoft.com/en-us/library/cc644930.aspx).
The SQLSRV extension does not have a dedicated function for changing which database is connected to. The target database is specified in the $connectionOptions array that is passed to sqlsrv\_connect. To change the database on an open connection, execute the following query "USE dbName" (e.g. sqlsrv\_query($conn, "USE dbName")).
### See Also
* [sqlsrv\_close()](function.sqlsrv-close) - Closes an open connection and releases resourses associated with the connection
* [sqlsrv\_errors()](function.sqlsrv-errors) - Returns error and warning information about the last SQLSRV operation performed
* [sqlsrv\_query()](function.sqlsrv-query) - Prepares and executes a query
php SyncSharedMemory::first SyncSharedMemory::first
=======================
(PECL sync >= 1.1.0)
SyncSharedMemory::first — Check to see if the object is the first instance system-wide of named shared memory
### Description
```
public SyncSharedMemory::first(): bool
```
Retrieves the system-wide first instance status of a [SyncSharedMemory](class.syncsharedmemory) object.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **SyncSharedMemory::first()** example**
```
<?php
$mem = new SyncSharedMemory("AppReportName", 1024);
if ($mem->first())
{
// Do first time initialization work here.
}
var_dump($mem->first());
$mem2 = new SyncSharedMemory("AppReportName", 1024);
var_dump($mem2->first());
?>
```
The above example will output something similar to:
```
bool(true)
bool(false)
```
### See Also
* [SyncSharedMemory::write()](syncsharedmemory.write) - Copy data to named shared memory
* [SyncSharedMemory::read()](syncsharedmemory.read) - Copy data from named shared memory
php wincache_scache_meminfo wincache\_scache\_meminfo
=========================
(PECL wincache >= 1.1.0)
wincache\_scache\_meminfo — Retrieves information about session cache memory usage
### Description
```
wincache_scache_meminfo(): array|false
```
Retrieves information about memory usage by session cache.
### Parameters
This function has no parameters.
### Return Values
Array of meta data about session 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 session cache
* `memory_free` - amount of free memory in bytes available for the session cache
* `num_used_blks` - number of memory blocks used by the session cache
* `num_free_blks` - number of free memory blocks available for the session cache
* `memory_overhead` - amount of memory in bytes used for the session cache internal structures
### Examples
**Example #1 A **wincache\_scache\_meminfo()** example**
```
<pre>
<?php
print_r(wincache_scache_meminfo());
?>
</pre>
```
The above example will output:
```
Array
(
[memory_total] => 5242880
[memory_free] => 5215056
[num_used_blks] => 6
[num_free_blks] => 3
[memory_overhead] => 176
)
```
### 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\_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\_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 GearmanJob::setReturn GearmanJob::setReturn
=====================
(PECL gearman >= 0.5.0)
GearmanJob::setReturn — Set a return value
### Description
```
public GearmanJob::setReturn(int $gearman_return_t): bool
```
Sets the return value for this job, indicates how the job completed.
### Parameters
`gearman_return_t`
A valid Gearman return value.
### Return Values
Description...
php gnupg_decryptverify gnupg\_decryptverify
====================
(PECL gnupg >= 0.2)
gnupg\_decryptverify — Decrypts and verifies a given text
### Description
```
gnupg_decryptverify(resource $identifier, string $text, string &$plaintext): array
```
Decrypts and verifies a given text and returns information about the signature.
### Parameters
`identifier`
The gnupg identifier, from a call to [gnupg\_init()](function.gnupg-init) or **gnupg**.
`text`
The text being decrypted.
`plaintext`
The parameter `plaintext` gets filled with the decrypted text.
### Return Values
On success, this function returns information about the signature and fills the `plaintext` parameter with the decrypted text. On failure, this function returns **`false`**.
### Examples
**Example #1 Procedural **gnupg\_decryptverify()** example**
```
<?php
$plaintext = "";
$res = gnupg_init();
gnupg_adddecryptkey($res,"8660281B6051D071D94B5B230549F9DC851566DC","test");
$info = gnupg_decryptverify($res,$text,$plaintext);
print_r($info);
?>
```
**Example #2 OO **gnupg\_decryptverify()** example**
```
<?php
$plaintext = "";
$gpg = new gnupg();
$gpg->adddecryptkey("8660281B6051D071D94B5B230549F9DC851566DC","test");
$info = $gpg->decryptverify($text,$plaintext);
print_r($info);
?>
```
php DOMDocumentFragment::appendXML DOMDocumentFragment::appendXML
==============================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
DOMDocumentFragment::appendXML — Append raw XML data
### Description
```
public DOMDocumentFragment::appendXML(string $data): bool
```
Appends raw XML data to a DOMDocumentFragment.
This method is not part of the DOM standard. It was created as a simpler approach for appending an XML DocumentFragment in a DOMDocument.
If you want to stick to the standards, you will have to create a temporary DOMDocument with a dummy root and then loop through the child nodes of the root of your XML data to append them.
### Parameters
`data`
XML to append.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Appending XML data to your document**
```
<?php
$doc = new DOMDocument();
$doc->loadXML("<root/>");
$f = $doc->createDocumentFragment();
$f->appendXML("<foo>text</foo><bar>text2</bar>");
$doc->documentElement->appendChild($f);
echo $doc->saveXML();
?>
```
The above example will output:
```
<?xml version="1.0"?>
<root><foo>text</foo><bar>text2</bar></root>
```
php filetype filetype
========
(PHP 4, PHP 5, PHP 7, PHP 8)
filetype — Gets file type
### Description
```
filetype(string $filename): string|false
```
Returns the type of the given file.
### Parameters
`filename`
Path to the file.
### Return Values
Returns the type of the file. Possible values are fifo, char, dir, block, link, file, socket and unknown.
Returns **`false`** if an error occurs. **filetype()** will also produce an **`E_NOTICE`** message if the stat call fails or if the file type is unknown.
### Errors/Exceptions
Upon failure, an **`E_WARNING`** is emitted.
### Examples
**Example #1 **filetype()** example**
```
<?php
echo filetype('/etc/passwd');
echo "\n";
echo filetype('/etc/');
?>
```
The above example will output:
```
file
dir
```
### Notes
> **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.
### See Also
* [is\_dir()](function.is-dir) - Tells whether the filename is a directory
* [is\_file()](function.is-file) - Tells whether the filename is a regular file
* [is\_link()](function.is-link) - Tells whether the filename is a symbolic link
* [file\_exists()](function.file-exists) - Checks whether a file or directory exists
* [mime\_content\_type()](function.mime-content-type) - Detect MIME Content-type for a file
* [pathinfo()](function.pathinfo) - Returns information about a file path
* [stat()](function.stat) - Gives information about a file
php Imagick::charcoalImage Imagick::charcoalImage
======================
(PECL imagick 2, PECL imagick 3)
Imagick::charcoalImage — Simulates a charcoal drawing
### Description
```
public Imagick::charcoalImage(float $radius, float $sigma): bool
```
Simulates a charcoal drawing.
### Parameters
`radius`
The radius of the Gaussian, in pixels, not counting the center pixel
`sigma`
The standard deviation of the Gaussian, in pixels
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::charcoalImage()****
```
<?php
function charcoalImage($imagePath, $radius, $sigma) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->charcoalImage($radius, $sigma);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php CachingIterator::current CachingIterator::current
========================
(PHP 5, PHP 7, PHP 8)
CachingIterator::current — Return the current element
### Description
```
public CachingIterator::current(): mixed
```
**Warning**This function is currently not documented; only its argument list is available.
May return the current element in the iteration.
### Parameters
This function has no parameters.
### Return Values
Mixed
### See Also
* [Iterator::current()](iterator.current) - Return the current element
php hash_update hash\_update
============
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL hash >= 1.1)
hash\_update — Pump data into an active hashing context
### Description
```
hash_update(HashContext $context, string $data): bool
```
### Parameters
`context`
Hashing context returned by [hash\_init()](function.hash-init).
`data`
Message to be included in the hash digest.
### Return Values
Returns **`true`**.
### Changelog
| Version | Description |
| --- | --- |
| 7.2.0 | Accept [HashContext](class.hashcontext) instead of resource. |
### See Also
* [hash\_init()](function.hash-init) - Initialize an incremental hashing context
* [hash\_update\_file()](function.hash-update-file) - Pump data into an active hashing context from a file
* [hash\_update\_stream()](function.hash-update-stream) - Pump data into an active hashing context from an open stream
* [hash\_final()](function.hash-final) - Finalize an incremental hash and return resulting digest
php SolrUtils::escapeQueryChars SolrUtils::escapeQueryChars
===========================
(PECL solr >= 0.9.2)
SolrUtils::escapeQueryChars — Escapes a lucene query string
### Description
```
public static SolrUtils::escapeQueryChars(string $str): string|false
```
Lucene supports escaping special characters that are part of the query syntax.
The current list special characters are:
```
+ - && || ! ( ) { } [ ] ^ " ~ * ? : \ /
```
These characters are part of the query syntax and must be escaped
### Parameters
`str`
This is the query string to be escaped.
### Return Values
Returns the escaped string or **`false`** on failure.
php fbird_fetch_object fbird\_fetch\_object
====================
(PHP 5, PHP 7 < 7.4.0)
fbird\_fetch\_object — Alias of [ibase\_fetch\_object()](function.ibase-fetch-object)
### Description
This function is an alias of: [ibase\_fetch\_object()](function.ibase-fetch-object).
### See Also
* [fbird\_fetch\_row()](function.fbird-fetch-row) - Alias of ibase\_fetch\_row
* [fbird\_fetch\_assoc()](function.fbird-fetch-assoc) - Alias of ibase\_fetch\_assoc
php CachingIterator::rewind CachingIterator::rewind
=======================
(PHP 5, PHP 7, PHP 8)
CachingIterator::rewind — Rewind the iterator
### Description
```
public CachingIterator::rewind(): void
```
**Warning**This function is currently not documented; only its argument list is available.
Rewind the iterator.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
| programming_docs |
php ImagickDraw::pathCurveToQuadraticBezierAbsolute ImagickDraw::pathCurveToQuadraticBezierAbsolute
===============================================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::pathCurveToQuadraticBezierAbsolute — Draws a quadratic Bezier curve
### Description
```
public ImagickDraw::pathCurveToQuadraticBezierAbsolute(
float $x1,
float $y1,
float $x,
float $y
): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Draws a quadratic Bezier curve from the current point to (x,y) using (x1,y1) as the control point using absolute coordinates. At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier.
### Parameters
`x1`
x coordinate of the control point
`y1`
y coordinate of the control point
`x`
x coordinate of the end point
`y`
y coordinate of the end point
### Return Values
No value is returned.
### Examples
**Example #1 **ImagickDraw::pathCurveToQuadraticBezierAbsolute()** example**
```
<?php
function pathCurveToQuadraticBezierAbsolute($strokeColor, $fillColor, $backgroundColor) {
$draw = new \ImagickDraw();
$draw->setStrokeOpacity(1);
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFontSize(72);
$draw->pathStart();
$draw->pathMoveToAbsolute(50,250);
// This specifies a quadratic bezier curve with the current position as the start
// point, the control point is the first two params, and the end point is the last two params.
$draw->pathCurveToQuadraticBezierAbsolute(
150,50,
250,250
);
// This specifies a quadratic bezier curve with the current position as the start
// point, the control point is mirrored from the previous curves control point
// and the end point is defined by the x, y values.
$draw->pathCurveToQuadraticBezierSmoothAbsolute(
450,250
);
// This specifies a quadratic bezier curve with the current position as the start
// point, the control point is mirrored from the previous curves control point
// and the end point is defined relative from the current position by the x, y values.
$draw->pathCurveToQuadraticBezierSmoothRelative(
200,-100
);
$draw->pathFinish();
$imagick = new \Imagick();
$imagick->newImage(700, 500, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
php SolrDocument::serialize SolrDocument::serialize
=======================
(PECL solr >= 0.9.2)
SolrDocument::serialize — Used for custom serialization
### Description
```
public SolrDocument::serialize(): string
```
Used for custom serialization.
### Parameters
This function has no parameters.
### Return Values
Returns a string representing the serialized Solr document.
php The Shmop class
The Shmop class
===============
Introduction
------------
(PHP 8)
A fully opaque class which replaces `shmop` resources as of PHP 8.0.0.
Class synopsis
--------------
final class **Shmop** { }
php DateTimeImmutable::setTimestamp DateTimeImmutable::setTimestamp
===============================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
DateTimeImmutable::setTimestamp — Sets the date and time based on a Unix timestamp
### Description
```
public DateTimeImmutable::setTimestamp(int $timestamp): DateTimeImmutable
```
Returns a new [DateTimeImmutable](class.datetimeimmutable) object constructed from the old one, with the date and time set based on an Unix timestamp.
### Parameters
`timestamp`
Unix timestamp representing the date. Setting timestamps outside the range of int is possible by using [DateTimeImmutable::modify()](datetimeimmutable.modify) with the `@` format.
### Return Values
Returns a new [DateTimeImmutable](class.datetimeimmutable) object with the modified data.
### Examples
**Example #1 **DateTimeImmutable::setTimestamp()** example**
Object-oriented style
```
<?php
$date = new DateTimeImmutable();
echo $date->format('U = Y-m-d H:i:s') . "\n";
$newDate = $date->setTimestamp(1171502725);
echo $newDate->format('U = Y-m-d H:i:s') . "\n";
?>
```
The above examples will output something similar to:
```
1272508903 = 2010-04-28 22:41:43
1171502725 = 2007-02-14 20:25:25
```
### See Also
* [DateTimeImmutable::getTimestamp()](datetime.gettimestamp) - Gets the Unix timestamp
php dba_delete dba\_delete
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
dba\_delete — Delete DBA entry specified by key
### Description
```
dba_delete(string|array $key, resource $dba): bool
```
**dba\_delete()** deletes the specified entry from the database.
### Parameters
`key`
The key of the entry which is deleted.
`dba`
The database handler, returned by [dba\_open()](function.dba-open) or [dba\_popen()](function.dba-popen).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [dba\_exists()](function.dba-exists) - Check whether key exists
* [dba\_fetch()](function.dba-fetch) - Fetch data specified by key
* [dba\_insert()](function.dba-insert) - Insert entry
* [dba\_replace()](function.dba-replace) - Replace or insert entry
php wincache_ucache_info wincache\_ucache\_info
======================
(PECL wincache >= 1.1.0)
wincache\_ucache\_info — Retrieves information about data stored in the user cache
### Description
```
wincache_ucache_info(bool $summaryonly = false, string $key = NULL): array|false
```
Retrieves information about data stored in the user cache.
### Parameters
`summaryonly`
Controls whether the returned array will contain information about individual cache entries along with the user cache summary.
`key`
The key of an entry in the user cache. If specified then the returned array will contain information only about that cache entry. If not specified and `summaryonly` is set to **`false`** then the returned array will contain information about all entries in the cache.
### Return Values
Array of meta data about user cache or **`false`** on failure
The array returned by this function contains the following elements:
* `total_cache_uptime` - total time in seconds that the user cache has been active
* `total_item_count` - total number of elements that are currently in the user cache
* `is_local_cache` - true is the cache metadata is for a local cache instance, false if the metadata is for the global cache
* `total_hit_count` - number of times the data has been served from the cache
* `total_miss_count` - number of times the data has not been found in the cache
* `ucache_entries` - an array that contains the information about all the cached items:
+ `key_name` - name of the key which is used to store the data
+ `value_type` - type of value stored by the key
+ `use_time` - time in seconds since the file has been accessed in the opcode cache
+ `last_check` - time in seconds since the file has been checked for modifications
+ `is_session` - indicates if the data is a session variable
+ `ttl_seconds` - time remaining for the data to live in the cache, 0 meaning infinite
+ `age_seconds` - time elapsed from the time data has been added in the cache
+ `hitcount` - number of times data has been served from the cache
### Examples
**Example #1 Using **wincache\_ucache\_info()****
```
<?php
wincache_ucache_get('green');
wincache_ucache_set('green', 2922);
wincache_ucache_get('green');
wincache_ucache_get('green');
wincache_ucache_get('green');
print_r(wincache_ucache_info());
?>
```
The above example will output:
```
Array
( ["total_cache_uptime"] => int(0)
["is_local_cache"] => bool(false)
["total_item_count"] => int(1)
["total_hit_count"] => int(3)
["total_miss_count"] => int(1)
["ucache_entries"] => Array(1)
( [1] => Array(6)
(
["key_name"] => string(5) "green"
["value_type"] => string(4) "long"
["is_session"] => int(0)
["ttl_seconds"] => int(0)
["age_seconds"] => int(0)
["hitcount"] => int(3)
)
)
)
```
### See Also
* [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\_meminfo()](function.wincache-rplist-meminfo) - Retrieves information about memory usage by the resolve file path cache
* [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\_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 SplFileInfo::__toString SplFileInfo::\_\_toString
=========================
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
SplFileInfo::\_\_toString — Returns the path to the file as a string
### Description
```
public SplFileInfo::__toString(): string
```
This method will return the file name of the referenced file.
### Parameters
This function has no parameters.
### Return Values
Returns the path to the file.
### Examples
**Example #1 **SplFileInfo::\_\_toString()** example**
```
<?php
$info = new SplFileInfo('foo');
var_dump($info->__toString());
echo $info.PHP_EOL;
$info = new SplFileInfo('/usr/bin/php');
var_dump($info->__toString());
echo $info.PHP_EOL;
?>
```
The above example will output something similar to:
```
string(3) "foo"
foo
string(12) "/usr/bin/php"
/usr/bin/php
```
php mb_regex_set_options mb\_regex\_set\_options
=======================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
mb\_regex\_set\_options — Set/Get the default options for mbregex functions
### Description
```
mb_regex_set_options(?string $options = null): string
```
Sets the default options described by `options` for multibyte regex functions.
### Parameters
`options`
The options to set. This is a string where each character is an option. To set a mode, the mode character must be the last one set, however there can only be set one mode but multiple options.
**Regex options**| Option | Meaning |
| --- | --- |
| i | Ambiguity match on |
| x | Enables extended pattern form |
| m | `'.'` matches with newlines |
| s | `'^'` -> `'\A'`, `'$'` -> `'\Z'` |
| p | Same as both the `m` and `s` options |
| l | Finds longest matches |
| n | Ignores empty matches |
| e | [eval()](function.eval) resulting code |
**Regex syntax modes**| Mode | Meaning |
| --- | --- |
| j | Java (Sun java.util.regex) |
| u | GNU regex |
| g | grep |
| c | Emacs |
| r | Ruby |
| z | Perl |
| b | POSIX Basic regex |
| d | POSIX Extended regex |
### Return Values
The previous options. If `options` is omitted or **`null`**, it returns the string that describes the current options.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | If the parameter `options` is given and not **`null`**, the *previous* options are returned. Formerly, the *current* options have been returned. |
| 8.0.0 | `options` is nullable now. |
### See Also
* [mb\_split()](function.mb-split) - Split multibyte string using regular expression
* [mb\_ereg()](function.mb-ereg) - Regular expression match with multibyte support
* [mb\_eregi()](function.mb-eregi) - Regular expression match ignoring case with multibyte support
php Gmagick::oilpaintimage Gmagick::oilpaintimage
======================
(PECL gmagick >= Unknown)
Gmagick::oilpaintimage — Simulates an oil painting
### Description
```
public Gmagick::oilpaintimage( float $radius ): Gmagick
```
Applies a special effect filter that simulates an oil painting. Each pixel is replaced by the most frequent color occurring in a circular region defined by radius.
### Parameters
`radius` The radius of the circular neighborhood.
### Return Values
The Gmagick object on success
### Errors/Exceptions
Throws an **GmagickException** on error.
php DOMDocument::xinclude DOMDocument::xinclude
=====================
(PHP 5, PHP 7, PHP 8)
DOMDocument::xinclude — Substitutes XIncludes in a DOMDocument Object
### Description
```
public DOMDocument::xinclude(int $options = 0): int|false
```
This method substitutes [» XIncludes](http://www.w3.org/TR/xinclude/) in a DOMDocument object.
>
> **Note**:
>
>
> Due to libxml2 automatically resolving entities, this method will produce unexpected results if the included XML file have an attached DTD.
>
>
### Parameters
`options`
[libxml parameters](https://www.php.net/manual/en/libxml.constants.php). Available since Libxml 2.6.7.
### Return Values
Returns the number of XIncludes in the document, -1 if some processing failed, or **`false`** if there were no substitutions.
### Examples
**Example #1 DOMDocument::xinclude() example**
```
<?php
$xml = <<<EOD
<?xml version="1.0" ?>
<chapter xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Books of the other guy..</title>
<para>
<xi:include href="book.xml">
<xi:fallback>
<error>xinclude: book.xml not found</error>
</xi:fallback>
</xi:include>
</para>
</chapter>
EOD;
$dom = new DOMDocument;
// let's have a nice output
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
// load the XML string defined above
$dom->loadXML($xml);
// substitute xincludes
$dom->xinclude();
echo $dom->saveXML();
?>
```
The above example will output something similar to:
```
<?xml version="1.0"?>
<chapter xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Books of the other guy..</title>
<para>
<row xml:base="/home/didou/book.xml">
<entry>The Grapes of Wrath</entry>
<entry>John Steinbeck</entry>
<entry>en</entry>
<entry>0140186409</entry>
</row>
<row xml:base="/home/didou/book.xml">
<entry>The Pearl</entry>
<entry>John Steinbeck</entry>
<entry>en</entry>
<entry>014017737X</entry>
</row>
<row xml:base="/home/didou/book.xml">
<entry>Samarcande</entry>
<entry>Amine Maalouf</entry>
<entry>fr</entry>
<entry>2253051209</entry>
</row>
</para>
</chapter>
```
php Zookeeper::getClientId Zookeeper::getClientId
======================
(PECL zookeeper >= 0.1.0)
Zookeeper::getClientId — Return the client session id, only valid if the connections is currently connected (ie. last watcher state is ZOO\_CONNECTED\_STATE)
### Description
```
public Zookeeper::getClientId(): int
```
### Parameters
This function has no parameters.
### Return Values
Returns the client session id on success, and false on failure.
### Errors/Exceptions
This method emits PHP error/warning when it could not get client session id.
**Caution** Since version 0.3.0, this method emits [ZookeeperException](class.zookeeperexception) and it's derivatives.
### See Also
* [Zookeeper::\_\_construct()](zookeeper.construct) - Create a handle to used communicate with zookeeper
* [Zookeeper::connect()](zookeeper.connect) - Create a handle to used communicate with zookeeper
* [Zookeeper::getState()](zookeeper.getstate) - Get the state of the zookeeper connection
* [ZooKeeper States](class.zookeeper#zookeeper.class.constants.states)
* [ZookeeperException](class.zookeeperexception)
php Yaf_Request_Abstract::getBaseUri Yaf\_Request\_Abstract::getBaseUri
==================================
(Yaf >=1.0.0)
Yaf\_Request\_Abstract::getBaseUri — The getBaseUri purpose
### Description
```
public Yaf_Request_Abstract::getBaseUri(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php gmp_div gmp\_div
========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_div — Alias of [gmp\_div\_q()](function.gmp-div-q)
### Description
This function is an alias of: [gmp\_div\_q()](function.gmp-div-q).
php DirectoryIterator::getOwner DirectoryIterator::getOwner
===========================
(PHP 5, PHP 7, PHP 8)
DirectoryIterator::getOwner — Get owner of current DirectoryIterator item
### Description
```
public DirectoryIterator::getOwner(): int
```
Get the owner of the current [DirectoryIterator](class.directoryiterator) item, in numerical format.
### Parameters
This function has no parameters.
### Return Values
The file owner of the file, in numerical format.
### Examples
**Example #1 **DirectoryIterator::getOwner()** example**
This example displays the owner of the directory which contains the script.
```
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
print_r(posix_getpwuid($iterator->getOwner()));
?>
```
The above example will output something similar to:
```
Array
(
[name] => tom
[passwd] => x
[uid] => 501
[gid] => 42
[gecos] => Tom Cat
[dir] => /home/tom
[shell] => /bin/bash
)
```
### See Also
* [DirectoryIterator::getGroup()](directoryiterator.getgroup) - Get group for the current DirectoryIterator item
* [DirectoryIterator::getiNode()](directoryiterator.getinode) - Get inode for the current DirectoryIterator item
* [DirectoryIterator::getPerms()](directoryiterator.getperms) - Get the permissions of current DirectoryIterator item
* [posix\_getpwuid()](function.posix-getpwuid) - Return info about a user by user id
php imagefontheight imagefontheight
===============
(PHP 4, PHP 5, PHP 7, PHP 8)
imagefontheight — Get font height
### Description
```
imagefontheight(GdFont|int $font): int
```
Returns the pixel height of a character in the specified font.
### Parameters
`font`
Can be 1, 2, 3, 4, 5 for built-in fonts in latin2 encoding (where higher numbers corresponding to larger fonts) or [GdFont](class.gdfont) instance, returned by [imageloadfont()](function.imageloadfont).
### Return Values
Returns the pixel height of the font.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `font` parameter now accepts both an [GdFont](class.gdfont) instance and an int; previously only int was accepted. |
### Examples
**Example #1 Using **imagefontheight()** on built-in fonts**
```
<?php
echo 'Font height: ' . imagefontheight(4);
?>
```
The above example will output something similar to:
```
Font height: 16
```
**Example #2 Using **imagefontheight()** together with [imageloadfont()](function.imageloadfont)**
```
<?php
// Load a .gdf font
$font = imageloadfont('anonymous.gdf');
echo 'Font height: ' . imagefontheight($font);
?>
```
The above example will output something similar to:
```
Font height: 43
```
### See Also
* [imagefontwidth()](function.imagefontwidth) - Get font width
* [imageloadfont()](function.imageloadfont) - Load a new font
php ReflectionAttribute::newInstance ReflectionAttribute::newInstance
================================
(PHP 8)
ReflectionAttribute::newInstance — Instantiates the attribute class represented by this ReflectionAttribute class and arguments
### Description
```
public ReflectionAttribute::newInstance(): object
```
Instantiates the attribute class represented by this ReflectionAttribute class and arguments.
### Parameters
This function has no parameters.
### Return Values
New instance of the attribute.
| programming_docs |
php ReflectionParameter::getName ReflectionParameter::getName
============================
(PHP 5, PHP 7, PHP 8)
ReflectionParameter::getName — Gets parameter name
### Description
```
public ReflectionParameter::getName(): string
```
Gets the name of the parameter.
### Parameters
This function has no parameters.
### Return Values
The name of the reflected parameter.
### See Also
* **ReflectionParameter::getValue()**
php imagecolorclosestalpha imagecolorclosestalpha
======================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
imagecolorclosestalpha — Get the index of the closest color to the specified color + alpha
### Description
```
imagecolorclosestalpha(
GdImage $image,
int $red,
int $green,
int $blue,
int $alpha
): int
```
Returns the index of the color in the palette of the image which is "closest" to the specified RGB value and `alpha` level.
### 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 the index of the closest color in the palette.
### Examples
**Example #1 Search for a set of colors in an image**
```
<?php
// Start with an image and convert it to a palette-based image
$im = imagecreatefrompng('figures/imagecolorclosest.png');
imagetruecolortopalette($im, false, 255);
// Search colors (RGB)
$colors = array(
array(254, 145, 154, 50),
array(153, 145, 188, 127),
array(153, 90, 145, 0),
array(255, 137, 92, 84)
);
// Loop through each search and find the closest color in the palette.
// Return the search number, the search RGB and the converted RGB match
foreach($colors as $id => $rgb)
{
$result = imagecolorclosestalpha($im, $rgb[0], $rgb[1], $rgb[2], $rgb[3]);
$result = imagecolorsforindex($im, $result);
$result = "({$result['red']}, {$result['green']}, {$result['blue']}, {$result['alpha']})";
echo "#$id: Search ($rgb[0], $rgb[1], $rgb[2], $rgb[3]); Closest match: $result.\n";
}
imagedestroy($im);
?>
```
The above example will output something similar to:
```
#0: Search (254, 145, 154, 50); Closest match: (252, 150, 148, 0).
#1: Search (153, 145, 188, 127); Closest match: (148, 150, 196, 0).
#2: Search (153, 90, 145, 0); Closest match: (148, 90, 156, 0).
#3: Search (255, 137, 92, 84); Closest match: (252, 150, 92, 0).
```
### See Also
* [imagecolorexactalpha()](function.imagecolorexactalpha) - Get the index of the specified color + alpha
* [imagecolorclosest()](function.imagecolorclosest) - Get the index of the closest color to the specified color
* [imagecolorclosesthwb()](function.imagecolorclosesthwb) - Get the index of the color which has the hue, white and blackness
php finfo::file finfo::file
===========
(PHP >= 5.3.0, PHP 7, PHP 8, PECL fileinfo >= 0.1.0)
finfo::file — Alias of [finfo\_file()](function.finfo-file)
### Description
```
public finfo::file(string $filename, int $flags = FILEINFO_NONE, ?resource $context = null): string|false
```
This function is an alias of: [finfo\_file()](function.finfo-file)
php Memcached::setSaslAuthData Memcached::setSaslAuthData
==========================
(PECL memcached >= 2.0.0)
Memcached::setSaslAuthData — Set the credentials to use for authentication
### Description
```
public Memcached::setSaslAuthData(string $username, string $password): void
```
**Memcached::setSaslAuthData()** sets the username and password that should be used for SASL authentication with the memcache servers.
*This method is only available when the memcached extension is built with SASL support.* Please refer to [Memcached setup](https://www.php.net/manual/en/memcached.setup.php) for how to do this.
### Parameters
`username`
The username to use for authentication.
`password`
The password to use for authentication.
### Return Values
No value is returned.
php GmagickDraw::rotate GmagickDraw::rotate
===================
(PECL gmagick >= Unknown)
GmagickDraw::rotate — Applies the specified rotation to the current coordinate space
### Description
```
public GmagickDraw::rotate(float $degrees): GmagickDraw
```
Applies the specified rotation to the current coordinate space.
### Parameters
`degrees`
degrees of rotation
### Return Values
The [GmagickDraw](class.gmagickdraw) object.
php Imagick::polaroidImage Imagick::polaroidImage
======================
(PECL imagick 2, PECL imagick 3)
Imagick::polaroidImage — Simulates a Polaroid picture
### Description
```
public Imagick::polaroidImage(ImagickDraw $properties, float $angle): bool
```
Simulates a Polaroid picture. This method is available if Imagick has been compiled against ImageMagick version 6.3.2 or newer.
### Parameters
`properties`
The polaroid properties
`angle`
The polaroid angle
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 A **Imagick::polaroidImage()** example**
An example of using Imagick::polaroidImage()
```
<?php
/* Create the object */
$image = new Imagick('source.png');
/* Set the opacity */
$image->polaroidImage(new ImagickDraw(), 25);
/* output the image */
header('Content-type: image/png');
echo $image;
?>
```
php sodium_crypto_stream_xor sodium\_crypto\_stream\_xor
===========================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_stream\_xor — Encrypt a message without authentication
### Description
```
sodium_crypto_stream_xor(string $message, string $nonce, string $key): string
```
This function encrypts a message with XSalsa20, but does not provide any ciphertext guarantees about the plaintext.
### Parameters
`message`
The message to encrypt
`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
Encrypted message.
php disk_total_space disk\_total\_space
==================
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
disk\_total\_space — Returns the total size of a filesystem or disk partition
### Description
```
disk_total_space(string $directory): float|false
```
Given a string containing a directory, this function will return the total number of bytes on the corresponding filesystem or disk partition.
### Parameters
`directory`
A directory of the filesystem or disk partition.
### Return Values
Returns the total number of bytes as a float or **`false`** on failure.
### Examples
**Example #1 **disk\_total\_space()** example**
```
<?php
// $ds contains the total number of bytes available on "/"
$ds = disk_total_space("/");
// On Windows:
$ds = disk_total_space("C:");
$ds = disk_total_space("D:");
?>
```
### 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.
>
>
### See Also
* [disk\_free\_space()](function.disk-free-space) - Returns available space on filesystem or disk partition
php VarnishLog::getTagName VarnishLog::getTagName
======================
(PECL varnish >= 0.6)
VarnishLog::getTagName — Get the log tag string representation by its index
### Description
```
public static VarnishLog::getTagName(int $index): string
```
### Parameters
`index`
Log tag index.
### Return Values
Returns the log tag name as string.
php mdecrypt_generic mdecrypt\_generic
=================
(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mdecrypt\_generic — Decrypts data
**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
```
mdecrypt_generic(resource $td, string $data): string
```
This function decrypts data. Note that the length of the returned string can in fact be longer than the unencrypted string, due to the padding of the data.
### Parameters
`td`
An encryption descriptor returned by [mcrypt\_module\_open()](function.mcrypt-module-open)
`data`
Encrypted data.
### Return Values
Returns decrypted string.
### Examples
**Example #1 **mdecrypt\_generic()** Example**
```
<?php
/* Data */
$key = 'this is a very long key, even too long for the cipher';
$plain_text = 'very important data';
/* Open module, and create IV */
$td = mcrypt_module_open('des', '', 'ecb', '');
$key = substr($key, 0, mcrypt_enc_get_key_size($td));
$iv_size = mcrypt_enc_get_iv_size($td);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
/* Initialize encryption handle */
if (mcrypt_generic_init($td, $key, $iv) != -1) {
/* Encrypt data */
$c_t = mcrypt_generic($td, $plain_text);
mcrypt_generic_deinit($td);
/* Reinitialize buffers for decryption */
mcrypt_generic_init($td, $key, $iv);
$p_t = mdecrypt_generic($td, $c_t);
/* Clean up */
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
}
if (strncmp($p_t, $plain_text, strlen($plain_text)) == 0) {
echo "ok\n";
} else {
echo "error\n";
}
?>
```
The example above shows how to check if the data before the encryption is the same as the data after the decryption. It is very important to reinitialize the encryption buffer with [mcrypt\_generic\_init()](function.mcrypt-generic-init) before you try to decrypt the data.
The decryption handle should always be initialized with [mcrypt\_generic\_init()](function.mcrypt-generic-init) with a key and an IV before calling this function. Where the encryption is done, you should free the encryption buffers by calling [mcrypt\_generic\_deinit()](function.mcrypt-generic-deinit). See [mcrypt\_module\_open()](function.mcrypt-module-open) for an example.
### See Also
* [mcrypt\_generic()](function.mcrypt-generic) - This function encrypts data
* [mcrypt\_generic\_init()](function.mcrypt-generic-init) - This function initializes all buffers needed for encryption
* [mcrypt\_generic\_deinit()](function.mcrypt-generic-deinit) - This function deinitializes an encryption module
php mysqli::get_warnings mysqli::get\_warnings
=====================
mysqli\_get\_warnings
=====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
mysqli::get\_warnings -- mysqli\_get\_warnings — Get result of SHOW WARNINGS
### Description
Object-oriented style
```
public mysqli::get_warnings(): mysqli_warning|false
```
Procedural style
```
mysqli_get_warnings(mysqli $mysql): mysqli_warning|false
```
**Warning**This function is currently not documented; only its argument list is available.
php Ds\Deque::map Ds\Deque::map
=============
(PECL ds >= 1.0.0)
Ds\Deque::map — Returns the result of applying a callback to each value
### Description
```
public Ds\Deque::map(callable $callback): Ds\Deque
```
Returns the result of applying a `callback` function to each value in the deque.
### Parameters
`callback`
```
callback(mixed $value): mixed
```
A [callable](language.types.callable) to apply to each value in the deque.
The callable should return what the new value will be in the new deque.
### Return Values
The result of applying a `callback` to each value in the deque.
>
> **Note**:
>
>
> The values of the current instance won't be affected.
>
>
### Examples
**Example #1 **Ds\Deque::map()** example**
```
<?php
$deque = new \Ds\Deque([1, 2, 3]);
print_r($deque->map(function($value) { return $value * 2; }));
print_r($deque);
?>
```
The above example will output something similar to:
```
Ds\Deque Object
(
[0] => 2
[1] => 4
[2] => 6
)
Ds\Deque Object
(
[0] => 1
[1] => 2
[2] => 3
)
```
php None Comments
--------
The sequence (?# marks the start of a comment which continues up to the next closing parenthesis. Nested parentheses are not permitted. The characters that make up a comment play no part in the pattern matching at all.
If the [PCRE\_EXTENDED](reference.pcre.pattern.modifiers) option is set, an unescaped # character outside a character class introduces a comment that continues up to the next newline character in the pattern.
**Example #1 Usage of comments in PCRE pattern**
```
<?php
$subject = 'test';
/* (?# can be used to add comments without enabling PCRE_EXTENDED */
$match = preg_match('/te(?# this is a comment)st/', $subject);
var_dump($match);
/* Whitespace and # is treated as part of the pattern unless PCRE_EXTENDED is enabled */
$match = preg_match('/te #~~~~
st/', $subject);
var_dump($match);
/* When PCRE_EXTENDED is enabled, all whitespace data characters and anything
that follows an unescaped # on the same line is ignored */
$match = preg_match('/te #~~~~
st/x', $subject);
var_dump($match);
```
The above example will output:
```
int(1)
int(0)
int(1)
```
php SplHeap::extract SplHeap::extract
================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplHeap::extract — Extracts a node from top of the heap and sift up
### Description
```
public SplHeap::extract(): mixed
```
### Parameters
This function has no parameters.
### Return Values
The value of the extracted node.
### Errors/Exceptions
Throws [RuntimeException](class.runtimeexception) when the data-structure is empty.
php Parle\Lexer::consume Parle\Lexer::consume
====================
(PECL parle >= 0.5.1)
Parle\Lexer::consume — Pass the data for processing
### Description
```
public Parle\Lexer::consume(string $data): void
```
Consume the data for lexing.
### Parameters
`data`
Data to be lexed.
### Return Values
No value is returned.
php mysqli_stmt::attr_get mysqli\_stmt::attr\_get
=======================
mysqli\_stmt\_attr\_get
=======================
(PHP 5, PHP 7, PHP 8)
mysqli\_stmt::attr\_get -- mysqli\_stmt\_attr\_get — Used to get the current value of a statement attribute
### Description
Object-oriented style
```
public mysqli_stmt::attr_get(int $attribute): int
```
Procedural style
```
mysqli_stmt_attr_get(mysqli_stmt $statement, int $attribute): int
```
Gets the current value of a statement attribute.
### Parameters
`statement`
Procedural style only: A [mysqli\_stmt](class.mysqli-stmt) object returned by [mysqli\_stmt\_init()](mysqli.stmt-init).
`attribute`
The attribute that you want to get.
### Return Values
Returns the value of the attribute.
php Imagick::stereoImage Imagick::stereoImage
====================
(PECL imagick 2, PECL imagick 3)
Imagick::stereoImage — Composites two images
### Description
```
public Imagick::stereoImage(Imagick $offset_wand): bool
```
Composites two images and produces a single image that is the composite of a left and right image of a stereo pair.
### Parameters
`offset_wand`
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
php DOMDocument::createCDATASection DOMDocument::createCDATASection
===============================
(PHP 5, PHP 7, PHP 8)
DOMDocument::createCDATASection — Create new cdata node
### Description
```
public DOMDocument::createCDATASection(string $data): DOMCdataSection|false
```
This function creates a new instance of class [DOMCDATASection](class.domcdatasection). 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 cdata.
### Return Values
The new [DOMCDATASection](class.domcdatasection) or **`false`** if an error occurred.
### 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::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
* [DOMDocument::createTextNode()](domdocument.createtextnode) - Create new text node
php imagecolorstotal imagecolorstotal
================
(PHP 4, PHP 5, PHP 7, PHP 8)
imagecolorstotal — Find out the number of colors in an image's palette
### Description
```
imagecolorstotal(GdImage $image): int
```
Returns the number of colors in an image palette.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
### Return Values
Returns the number of colors in the specified image's palette or 0 for truecolor images.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 Getting total number of colors in an image using **imagecolorstotal()****
```
<?php
// Create image instance
$im = imagecreatefromgif('php.gif');
echo 'Total colors in image: ' . imagecolorstotal($im);
// Free image
imagedestroy($im);
?>
```
The above example will output something similar to:
```
Total colors in image: 128
```
### See Also
* [imagecolorat()](function.imagecolorat) - Get the index of the color of a pixel
* [imagecolorsforindex()](function.imagecolorsforindex) - Get the colors for an index
* [imageistruecolor()](function.imageistruecolor) - Finds whether an image is a truecolor image
php mysqli::$insert_id mysqli::$insert\_id
===================
mysqli\_insert\_id
==================
(PHP 5, PHP 7, PHP 8)
mysqli::$insert\_id -- mysqli\_insert\_id — Returns the value generated for an AUTO\_INCREMENT column by the last query
### Description
Object-oriented style
int|string [$mysqli->insert\_id](mysqli.insert-id); Procedural style
```
mysqli_insert_id(mysqli $mysql): int|string
```
Returns the ID generated by an `INSERT` or `UPDATE` query on a table with a column having the `AUTO_INCREMENT` attribute. In the case of a multiple-row `INSERT` statement, it returns the first automatically generated value that was successfully inserted.
Performing an `INSERT` or `UPDATE` statement using the `LAST_INSERT_ID()` MySQL function will also modify the value returned by **mysqli\_insert\_id()**. If `LAST_INSERT_ID(expr)` was used to generate the value of `AUTO_INCREMENT`, it returns the value of the last `expr` instead of the generated `AUTO_INCREMENT` value.
Returns `0` if the previous statement did not change an `AUTO_INCREMENT` value. **mysqli\_insert\_id()** must be called immediately after the statement that generated the value.
### 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 value of the `AUTO_INCREMENT` field that was updated by the previous query. Returns zero if there was no previous query on the connection or if the query did not update an `AUTO_INCREMENT` value.
Only statements issued using the current connection affect the return value. The value is not affected by statements issued using other connections or clients.
>
> **Note**:
>
>
> If the number is greater than the maximum int value, it will be returned as a string.
>
>
### Examples
**Example #1 $mysqli->insert\_id example**
Object-oriented style
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
$mysqli->query("CREATE TABLE myCity LIKE City");
$query = "INSERT INTO myCity VALUES (NULL, 'Stuttgart', 'DEU', 'Stuttgart', 617000)";
$mysqli->query($query);
printf("New record has ID %d.\n", $mysqli->insert_id);
/* drop table */
$mysqli->query("DROP TABLE myCity");
```
Procedural style
```
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
mysqli_query($link, "CREATE TABLE myCity LIKE City");
$query = "INSERT INTO myCity VALUES (NULL, 'Stuttgart', 'DEU', 'Stuttgart', 617000)";
mysqli_query($link, $query);
printf("New record has ID %d.\n", mysqli_insert_id($link));
/* drop table */
mysqli_query($link, "DROP TABLE myCity");
```
The above examples will output:
```
New record has ID 1.
```
| programming_docs |
php The CURLFile class
The CURLFile class
==================
Introduction
------------
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
This class or [CURLStringFile](class.curlstringfile) should be used to upload a file with **`CURLOPT_POSTFIELDS`**.
Unserialization of **CURLFile** instances is not allowed. As of PHP 7.4.0, serialization is forbidden in the first place.
Class synopsis
--------------
class **CURLFile** { /\* Properties \*/ public string [$name](class.curlfile#curlfile.props.name) = "";
public string [$mime](class.curlfile#curlfile.props.mime) = "";
public string [$postname](class.curlfile#curlfile.props.postname) = ""; /\* Methods \*/ public [\_\_construct](curlfile.construct)(string `$filename`, ?string `$mime_type` = **`null`**, ?string `$posted_filename` = **`null`**)
```
public getFilename(): string
```
```
public getMimeType(): string
```
```
public getPostFilename(): string
```
```
public setMimeType(string $mime_type): void
```
```
public setPostFilename(string $posted_filename): void
```
} Properties
----------
name Name of the file to be uploaded.
mime MIME type of the file (default is `application/octet-stream`).
postname The name of the file in the upload data (defaults to the name property).
See Also
--------
* [curl\_setopt()](function.curl-setopt)
* [CURLStringFile](class.curlstringfile)
Table of Contents
-----------------
* [CURLFile::\_\_construct](curlfile.construct) — Create a CURLFile object
* [CURLFile::getFilename](curlfile.getfilename) — Get file name
* [CURLFile::getMimeType](curlfile.getmimetype) — Get MIME type
* [CURLFile::getPostFilename](curlfile.getpostfilename) — Get file name for POST
* [CURLFile::setMimeType](curlfile.setmimetype) — Set MIME type
* [CURLFile::setPostFilename](curlfile.setpostfilename) — Set file name for POST
php OAuth::setRSACertificate OAuth::setRSACertificate
========================
(PECL OAuth >= 1.0.0)
OAuth::setRSACertificate — Set the RSA certificate
### Description
```
public OAuth::setRSACertificate(string $cert): mixed
```
Sets the RSA certificate.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`cert`
The RSA certificate.
### Return Values
Returns **`true`** on success, or **`false`** on failure (e.g., the RSA certificate cannot be parsed.)
### Changelog
| Version | Description |
| --- | --- |
| PECL oauth 1.0.0 | Previously returned **`null`** on failure, instead of **`false`**. |
### Examples
**Example #1 An **OAuth::setRsaCertificate()** example**
```
<?php
$consume = new OAuth('1234', '', OAUTH_SIG_METHOD_RSASHA1);
$consume->setRSACertificate(file_get_contents('test.pem'));
?>
```
### See Also
* [OAuth::setCaPath()](oauth.setcapath) - Set CA path and info
php mysqli_driver::embedded_server_start mysqli\_driver::embedded\_server\_start
=======================================
mysqli\_embedded\_server\_start
===============================
(PHP 5 >= 5.1.0, PHP 7 < 7.4.0)
mysqli\_driver::embedded\_server\_start -- mysqli\_embedded\_server\_start — Initialize and start embedded server
**Warning**This function was *REMOVED* in PHP 7.4.0.
### Description
Object-oriented style
```
public mysqli_driver::embedded_server_start(int $start, array $arguments, array $groups): bool
```
Procedural style
```
mysqli_embedded_server_start(int $start, array $arguments, array $groups): bool
```
**Warning**This function is currently not documented; only its argument list is available.
php The SolrPingResponse class
The SolrPingResponse class
==========================
Introduction
------------
(PECL solr >= 0.9.2)
Represents a response to a ping request to the server
Class synopsis
--------------
final class **SolrPingResponse** extends [SolrResponse](class.solrresponse) { /\* Constants \*/ const int [PARSE\_SOLR\_OBJ](class.solrpingresponse#solrpingresponse.constants.parse-solr-obj) = 0;
const int [PARSE\_SOLR\_DOC](class.solrpingresponse#solrpingresponse.constants.parse-solr-doc) = 1; /\* Properties \*/ /\* Methods \*/ public [\_\_construct](solrpingresponse.construct)()
```
public getResponse(): string
```
public [\_\_destruct](solrpingresponse.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
```
} 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
--------------------
SolrPingResponse Class Constants
--------------------------------
**`SolrPingResponse::PARSE_SOLR_OBJ`** Documents should be parsed as SolrObject instances
**`SolrPingResponse::PARSE_SOLR_DOC`** Documents should be parsed as SolrDocument instances.
Table of Contents
-----------------
* [SolrPingResponse::\_\_construct](solrpingresponse.construct) — Constructor
* [SolrPingResponse::\_\_destruct](solrpingresponse.destruct) — Destructor
* [SolrPingResponse::getResponse](solrpingresponse.getresponse) — Returns the response from the server
php sodium_add sodium\_add
===========
(PHP 7 >= 7.2.0, PHP 8)
sodium\_add — Add large numbers
### Description
```
sodium_add(string &$string1, string $string2): void
```
This adds the parameter `string2` to `string1`, overwriting the value stored in `string1`. This function assumes both parameters are binary strings that represent unsigned integers in little-endian byte order.
### Parameters
`string1`
String representing an arbitrary-length unsigned integer in little-endian byte order. This parameter is passed by reference and will hold the sum of the two parameters.
`string2`
String representing an arbitrary-length unsigned integer in little-endian byte order.
### Return Values
No value is returned.
php IntlTimeZone::getTZDataVersion IntlTimeZone::getTZDataVersion
==============================
intltz\_get\_tz\_data\_version
==============================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlTimeZone::getTZDataVersion -- intltz\_get\_tz\_data\_version — Get the timezone data version currently used by ICU
### Description
Object-oriented style (method):
```
public static IntlTimeZone::getTZDataVersion(): string|false
```
Procedural style:
```
intltz_get_tz_data_version(): string|false
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php NumberFormatter::getLocale NumberFormatter::getLocale
==========================
numfmt\_get\_locale
===================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
NumberFormatter::getLocale -- numfmt\_get\_locale — Get formatter locale
### Description
Object-oriented style
```
public NumberFormatter::getLocale(int $type = ULOC_ACTUAL_LOCALE): string|false
```
Procedural style
```
numfmt_get_locale(NumberFormatter $formatter, int $type = ULOC_ACTUAL_LOCALE): string|false
```
Get formatter locale name.
### Parameters
`formatter`
[NumberFormatter](class.numberformatter) object.
`type`
You can choose between valid and actual locale ( **`Locale::VALID_LOCALE`**, **`Locale::ACTUAL_LOCALE`**, respectively). The default is the actual locale.
### Return Values
The locale name used to create the formatter, or **`false`** on failure.
### Examples
**Example #1 **numfmt\_get\_locale()** example**
```
<?php
$req = 'fr_FR_PARIS';
$fmt = numfmt_create( $req, NumberFormatter::DECIMAL);
$res_val = numfmt_get_locale( $fmt, Locale::VALID_LOCALE );
$res_act = numfmt_get_locale( $fmt, Locale::ACTUAL_LOCALE );
printf( "Requested locale name: %s\nValid locale name: %s\nActual locale name: %s\n",
$req, $res_val, $res_act );
?>
```
The above example will output:
```
Requested locale name: fr_FR_PARIS
Valid locale name: fr_FR
Actual locale name: fr
```
### See Also
* [numfmt\_create()](numberformatter.create) - Create a number formatter
* [numfmt\_get\_error\_code()](numberformatter.geterrorcode) - Get formatter's last error code
php EventHttp::setCallback EventHttp::setCallback
======================
(PECL event >= 1.4.0-beta)
EventHttp::setCallback — Sets a callback for specified URI
### Description
```
public EventHttp::setCallback( string $path , string $cb , string $arg = ?): void
```
Sets a callback for specified URI.
### Parameters
`path` The path for which to invoke the callback.
`cb` The callback [callable](language.types.callable) that gets invoked on requested `path` . It should match the following prototype:
```
callback( EventHttpRequest $req = NULL , mixed $arg = NULL ): void
```
`req` [EventHttpRequest](class.eventhttprequest) object.
`arg` Custom data.
`arg` Custom data.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **EventHttp::setCallback()** example**
```
<?php
/*
* Simple HTTP server.
*
* To test it:
* 1) Run it on a port of your choice, e.g.:
* $ php examples/http.php 8010
* 2) In another terminal connect to some address on this port
* and make GET or POST request(others are turned off here), e.g.:
* $ nc -t 127.0.0.1 8010
* POST /about HTTP/1.0
* Content-Type: text/plain
* Content-Length: 4
* Connection: close
* (press Enter)
*
* It will output
* a=12
* HTTP/1.0 200 OK
* Content-Type: text/html; charset=ISO-8859-1
* Connection: close
*
* 3) See what the server outputs on the previous terminal window.
*/
function _http_dump($req, $data) {
static $counter = 0;
static $max_requests = 2;
if (++$counter >= $max_requests) {
echo "Counter reached max requests $max_requests. Exiting\n";
exit();
}
echo __METHOD__, " called\n";
echo "request:"; var_dump($req);
echo "data:"; var_dump($data);
echo "\n===== DUMP =====\n";
echo "Command:", $req->getCommand(), PHP_EOL;
echo "URI:", $req->getUri(), PHP_EOL;
echo "Input headers:"; var_dump($req->getInputHeaders());
echo "Output headers:"; var_dump($req->getOutputHeaders());
echo "\n >> Sending reply ...";
$req->sendReply(200, "OK");
echo "OK\n";
echo "\n >> Reading input buffer ...\n";
$buf = $req->getInputBuffer();
while ($s = $buf->readLine(EventBuffer::EOL_ANY)) {
echo $s, PHP_EOL;
}
echo "No more data in the buffer\n";
}
function _http_about($req) {
echo __METHOD__, PHP_EOL;
echo "URI: ", $req->getUri(), PHP_EOL;
echo "\n >> Sending reply ...";
$req->sendReply(200, "OK");
echo "OK\n";
}
function _http_default($req, $data) {
echo __METHOD__, PHP_EOL;
echo "URI: ", $req->getUri(), PHP_EOL;
echo "\n >> Sending reply ...";
$req->sendReply(200, "OK");
echo "OK\n";
}
$port = 8010;
if ($argc > 1) {
$port = (int) $argv[1];
}
if ($port <= 0 || $port > 65535) {
exit("Invalid port");
}
$base = new EventBase();
$http = new EventHttp($base);
$http->setAllowedMethods(EventHttpRequest::CMD_GET | EventHttpRequest::CMD_POST);
$http->setCallback("/dump", "_http_dump", array(4, 8));
$http->setCallback("/about", "_http_about");
$http->setDefaultCallback("_http_default", "custom data value");
$http->bind("0.0.0.0", 8010);
$base->loop();
?>
```
The above example will output something similar to:
```
a=12
HTTP/1.0 200 OK
Content-Type: text/html; charset=ISO-8859-1
Connection: close
```
### See Also
* [EventHttp::setDefaultCallback()](eventhttp.setdefaultcallback) - Sets default callback to handle requests that are not caught by specific callbacks
php OAuth::disableRedirects OAuth::disableRedirects
=======================
(PECL OAuth >= 0.99.9)
OAuth::disableRedirects — Turn off redirects
### Description
```
public OAuth::disableRedirects(): bool
```
Disable redirects from being followed automatically, thus allowing the request to be manually redirected.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
**`true`**
### See Also
* [OAuth::enableRedirects()](oauth.enableredirects) - Turn on redirects
php ImagickPixel::__construct ImagickPixel::\_\_construct
===========================
(PECL imagick 2, PECL imagick 3)
ImagickPixel::\_\_construct — The ImagickPixel constructor
### Description
```
public ImagickPixel::__construct(string $color = ?)
```
**Warning**This function is currently not documented; only its argument list is available.
Constructs an ImagickPixel object. If a color is specified, the object is constructed and then initialised with that color before being returned.
### Parameters
`color`
The optional color string to use as the initial value of this object.
### Return Values
Returns an ImagickPixel object on success, throwing ImagickPixelException on failure.
### Examples
**Example #1 **ImagickPixel::construct()****
```
<?php
function construct() {
$columns = 4;
$exampleColors = array(
"rgba(100%, 0%, 0%, 0.5)",
"hsb(33.3333%, 100%, 75%)", // medium green
"hsl(120, 255, 191.25)", //medium green
"graya(50%, 0.5)", // semi-transparent mid gray
"LightCoral", "none", //"cmyk(0.9, 0.48, 0.83, 0.50)",
"#f00", // #rgb
"#ff0000", // #rrggbb
"#ff0000ff", // #rrggbbaa
"#ffff00000000", // #rrrrggggbbbb
"#ffff00000000ffff", // #rrrrggggbbbbaaaa
"rgb(255, 0, 0)", // an integer in the range 0—255 for each component
"rgb(100.0%, 0.0%, 0.0%)", // a float in the range 0—100% for each component
"rgb(255, 0, 0)", // range 0 - 255
"rgba(255, 0, 0, 1.0)", // the same, with an explicit alpha value
"rgb(100%, 0%, 0%)", // range 0.0% - 100.0%
"rgba(100%, 0%, 0%, 1.0)", // the same, with an explicit alpha value
);
$draw = new \ImagickDraw();
$count = 0;
$black = new \ImagickPixel('rgb(0, 0, 0)');
foreach ($exampleColors as $exampleColor) {
$color = new \ImagickPixel($exampleColor);
$draw->setstrokewidth(1.0);
$draw->setStrokeColor($black);
$draw->setFillColor($color);
$offsetX = ($count % $columns) * 50 + 5;
$offsetY = intval($count / $columns) * 50 + 5;
$draw->rectangle(0 + $offsetX, 0 + $offsetY, 40 + $offsetX, 40 + $offsetY);
$count++;
}
$image = new \Imagick();
$image->newImage(350, 350, "blue");
$image->setImageFormat("png");
$image->drawImage($draw);
header("Content-Type: image/png");
echo $image->getImageBlob();
}
?>
```
php PDOStatement::errorInfo PDOStatement::errorInfo
=======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0)
PDOStatement::errorInfo — Fetch extended error information associated with the last operation on the statement handle
### Description
```
public PDOStatement::errorInfo(): array
```
### Parameters
This function has no parameters.
### Return Values
**PDOStatement::errorInfo()** returns an array of error information about the last operation performed by this statement 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. |
### Examples
**Example #1 Displaying errorInfo() fields for a PDO\_ODBC connection to a DB2 database**
```
<?php
/* Provoke an error -- the BONES table does not exist */
$sth = $dbh->prepare('SELECT skull FROM bones');
$sth->execute();
echo "\nPDOStatement::errorInfo():\n";
$arr = $sth->errorInfo();
print_r($arr);
?>
```
The above example will output:
```
PDOStatement::errorInfo():
Array
(
[0] => 42S02
[1] => -204
[2] => [IBM][CLI Driver][DB2/LINUX] SQL0204N "DANIELS.BONES" is an undefined name. SQLSTATE=42704
)
```
### 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::errorCode()](pdostatement.errorcode) - Fetch the SQLSTATE associated with the last operation on the statement handle
php DatePeriod::getEndDate DatePeriod::getEndDate
======================
(PHP 5 >= 5.6.5, PHP 7, PHP 8)
DatePeriod::getEndDate — Gets the end date
### Description
Object-oriented style
```
public DatePeriod::getEndDate(): ?DateTimeInterface
```
Gets the end date of the period.
### Parameters
This function has no parameters.
### Return Values
Returns **`null`** if the [DatePeriod](class.dateperiod) does not have an end date. For example, when initialized with the `recurrences` parameter, or the `isostr` parameter without an end date.
Returns a [DateTimeImmutable](class.datetimeimmutable) object when the [DatePeriod](class.dateperiod) is initialized with a [DateTimeImmutable](class.datetimeimmutable) object as the `end` parameter.
Returns a cloned [DateTime](class.datetime) object representing the end date otherwise.
### Examples
**Example #1 **DatePeriod::getEndDate()** example**
```
<?php
$period = new DatePeriod(
new DateTime('2016-05-16T00:00:00Z'),
new DateInterval('P1D'),
new DateTime('2016-05-20T00:00:00Z')
);
$start = $period->getEndDate();
echo $start->format(DateTime::ISO8601);
?>
```
The above examples will output:
```
2016-05-20T00:00:00+0000
```
**Example #2 **DatePeriod::getEndDate()** without an end date**
```
<?php
$period = new DatePeriod(
new DateTime('2016-05-16T00:00:00Z'),
new DateInterval('P1D'),
7
);
var_dump($period->getEndDate());
?>
```
The above example will output:
```
NULL
```
### See Also
* [DatePeriod::getStartDate()](dateperiod.getstartdate) - Gets the start date
* [DatePeriod::getDateInterval()](dateperiod.getdateinterval) - Gets the interval
php ftp_mkdir ftp\_mkdir
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
ftp\_mkdir — Creates a directory
### Description
```
ftp_mkdir(FTP\Connection $ftp, string $directory): string|false
```
Creates the specified `directory` on the FTP server.
### Parameters
`ftp`
An [FTP\Connection](class.ftp-connection) instance.
`directory`
The name of the directory that will be created.
### Return Values
Returns the newly created directory name on success or **`false`** on error.
### Errors/Exceptions
Emits an **`E_WARNING`** level error if the directory already exists or the relevant permissions prevent creating the directory.
### 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\_mkdir()** example**
```
<?php
$dir = 'www';
// 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 create the directory $dir
if (ftp_mkdir($ftp, $dir)) {
echo "successfully created $dir\n";
} else {
echo "There was a problem while creating $dir\n";
}
// close the connection
ftp_close($ftp);
?>
```
### See Also
* [ftp\_rmdir()](function.ftp-rmdir) - Removes a directory
| programming_docs |
php imap_binary imap\_binary
============
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_binary — Convert an 8bit string to a base64 string
### Description
```
imap_binary(string $string): string|false
```
Convert an 8bit string to a base64 string according to [» RFC2045](http://www.faqs.org/rfcs/rfc2045), Section 6.8.
### Parameters
`string`
The 8bit string
### Return Values
Returns a base64 encoded string, or **`false`** on failure.
### See Also
* [imap\_base64()](function.imap-base64) - Decode BASE64 encoded text
php imagecolorclosest imagecolorclosest
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
imagecolorclosest — Get the index of the closest color to the specified color
### Description
```
imagecolorclosest(
GdImage $image,
int $red,
int $green,
int $blue
): int
```
Returns the index of the color in the palette of the image which is "closest" to the specified RGB value.
The "distance" between the desired color and each color in the palette is calculated as if the RGB values represented points in three-dimensional space.
If you created the image from a file, only colors used in the image are resolved. Colors present only in the palette are not resolved.
### 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.
The colors parameters are integers between 0 and 255 or hexadecimals between 0x00 and 0xFF. ### Return Values
Returns the index of the closest color, in the palette of the image, to the specified one
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 Search for a set of colors in an image**
```
<?php
// Start with an image and convert it to a palette-based image
$im = imagecreatefrompng('figures/imagecolorclosest.png');
imagetruecolortopalette($im, false, 255);
// Search colors (RGB)
$colors = array(
array(254, 145, 154),
array(153, 145, 188),
array(153, 90, 145),
array(255, 137, 92)
);
// Loop through each search and find the closest color in the palette.
// Return the search number, the search RGB and the converted RGB match
foreach($colors as $id => $rgb)
{
$result = imagecolorclosest($im, $rgb[0], $rgb[1], $rgb[2]);
$result = imagecolorsforindex($im, $result);
$result = "({$result['red']}, {$result['green']}, {$result['blue']})";
echo "#$id: Search ($rgb[0], $rgb[1], $rgb[2]); Closest match: $result.\n";
}
imagedestroy($im);
?>
```
The above example will output something similar to:
```
#0: Search (254, 145, 154); Closest match: (252, 150, 148).
#1: Search (153, 145, 188); Closest match: (148, 150, 196).
#2: Search (153, 90, 145); Closest match: (148, 90, 156).
#3: Search (255, 137, 92); Closest match: (252, 150, 92).
```
### See Also
* [imagecolorexact()](function.imagecolorexact) - Get the index of the specified color
* [imagecolorclosestalpha()](function.imagecolorclosestalpha) - Get the index of the closest color to the specified color + alpha
* [imagecolorclosesthwb()](function.imagecolorclosesthwb) - Get the index of the color which has the hue, white and blackness
php EventBufferEvent::sslGetCipherInfo EventBufferEvent::sslGetCipherInfo
==================================
(PECL event >= 1.10.0)
EventBufferEvent::sslGetCipherInfo — Returns a textual description of the cipher
### Description
```
public EventBufferEvent::sslGetCipherInfo(): string
```
Retrieves description of the current cipher by means of the `SSL_CIPHER_description` SSL API function (see *SSL\_CIPHER\_get\_name(3)* man page).
>
> **Note**:
>
>
> This function is available only if `Event` is compiled with OpenSSL support.
>
>
### Parameters
This function has no parameters.
### Return Values
Returns a textual description of the cipher on success, or **`false`** on error.
php imageaffine imageaffine
===========
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
imageaffine — Return an image containing the affine transformed src image, using an optional clipping area
### Description
```
imageaffine(GdImage $image, array $affine, ?array $clip = null): GdImage|false
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`affine`
Array with keys 0 to 5.
`clip`
Array with keys "x", "y", "width" and "height"; or **`null`**.
### Return Values
Return affined image object on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `clip` is now nullable. |
| 8.0.0 | On success, this function returns a [GDImage](class.gdimage) instance now; previously, a resource was returned. |
php dns_check_record dns\_check\_record
==================
(PHP 5, PHP 7, PHP 8)
dns\_check\_record — Alias of [checkdnsrr()](function.checkdnsrr)
### Description
This function is an alias of: [checkdnsrr()](function.checkdnsrr).
php IntlCalendar::getSkippedWallTimeOption IntlCalendar::getSkippedWallTimeOption
======================================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::getSkippedWallTimeOption — Get behavior for handling skipped wall time
### Description
Object-oriented style
```
public IntlCalendar::getSkippedWallTimeOption(): int
```
Procedural style
```
intlcal_get_skipped_wall_time_option(IntlCalendar $calendar): int
```
Gets the current strategy for dealing with wall times that are skipped whenever the clock is forwarded during dailight saving time start transitions. The default value is **`IntlCalendar::WALLTIME_LAST`**.
The calendar must be [lenient](intlcalendar.setlenient) for this option to have any effect, otherwise attempting to set a non-existing time will cause an error.
This function requires ICU 4.9 or later.
### Parameters
`calendar`
An [IntlCalendar](class.intlcalendar) instance.
### Return Values
One of the constants **`IntlCalendar::WALLTIME_FIRST`**, **`IntlCalendar::WALLTIME_LAST`** or **`IntlCalendar::WALLTIME_NEXT_VALID`**.
### Examples
**Example #1 **IntlCalendar::getSkippedWallTimeOption()****
```
<?php
ini_set('date.timezone', 'Europe/Lisbon');
ini_set('intl.default_locale', 'en_US');
ini_set('intl.error_level', E_WARNING);
//On March 31st at 0100, the clock goes forward 1 hour and from GMT+00 to GMT+01
$cal = new IntlGregorianCalendar(2013, 2 /* March */, 31, 1, 30);
var_dump(
$cal->isLenient(), // true
$cal->getSkippedWalltimeOption() // 0 WALLTIME_LAST
);
$formatter = IntlDateFormatter::create(
NULL,
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'UTC'
);
var_dump($formatter->format($cal->getTime() / 1000));
$cal->setSkippedWallTimeOption(IntlCalendar::WALLTIME_FIRST);
var_dump($cal->getSkippedWalltimeOption()); // 1 WALLTIME_FIRST
$cal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 1);
var_dump($formatter->format($cal->getTime() / 1000));
$cal->setSkippedWallTimeOption(IntlCalendar::WALLTIME_NEXT_VALID);
var_dump($cal->getSkippedWalltimeOption()); // 2 WALLTIME_NEXT_VALID
$cal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 1);
var_dump($formatter->format($cal->getTime() / 1000));
```
The above example will output:
```
bool(true)
int(0)
string(40) "Sunday, March 31, 2013 at 1:30:00 AM GMT"
int(1)
string(41) "Sunday, March 31, 2013 at 12:30:00 AM GMT"
int(2)
string(40) "Sunday, March 31, 2013 at 1:00:00 AM GMT"
```
### See Also
* [IntlCalendar::getRepeatedWallTimeOption()](intlcalendar.getrepeatedwalltimeoption) - Get behavior for handling repeating wall time
* [IntlCalendar::setSkippedWallTimeOption()](intlcalendar.setskippedwalltimeoption) - Set behavior for handling skipped wall times at positive timezone offset transitions
* [IntlCalendar::setRepeatedWallTimeOption()](intlcalendar.setrepeatedwalltimeoption) - Set behavior for handling repeating wall times at negative timezone offset transitions
php None Type System
-----------
PHP uses a nominal type system with a strong behavioral subtyping relation. The subtyping relation is checked at compile time whereas the verification of types is dynamically checked at run time.
PHP's type system supports various base types that can be composed together to create more complex types. Some of these types can be written as [type declarations](language.types.declarations).
### Base types
Some base types are built-in types which are tightly integrated with the language and cannot be reproduced with user defined types.
The list of base types is:
* Built-in types
+ null type
+ Scalar types:
- bool type
- int type
- float type
- string type
+ array type
+ object type
+ resource type
+ never type
+ void type
+ [Relative class types](language.types.relative-class-types): self, parent, and static
* [Literal types](language.types.literal)
+ false
+ true
* User-defined types (generally referred to as class-types)
+ [Interfaces](language.oop5.interfaces)
+ [Classes](language.oop5.basic#language.oop5.basic.class)
+ [Enumerations](language.types.enumerations)
* [callable](language.types.callable) type
### Composite types
It is possible to combine simple types into composite types. PHP allows types to be combined in the following ways:
* Intersection of class-types (interfaces and class names).
* Union of types.
#### Intersection types
An intersection type accepts values which satisfies multiple class-type declarations, rather than a single one. Individual types which form the intersection type are joined by the `&` symbol. Therefore, an intersection type comprised of the types `T`, `U`, and `V` will be written as `T&U&V`.
#### Union types
A union type accepts values of multiple different types, rather than a single one. Individual types which form the union type are joined by the `|` symbol. Therefore, a union type comprised of the types `T`, `U`, and `V` will be written as `T|U|V`. If one of the types is an intersection type, it needs to be bracketed with parenthesis for it to written in DNF: `T|(X&Y)`.
### Type aliases
PHP supports a two type aliases: [mixed](language.types.declarations#language.types.declarations.mixed) and [iterable](language.types.iterable) which corresponds to the [union type](language.types.type-system#language.types.type-system.composite.union) of `object|resource|array|string|float|int|bool|null` and `Traversable|array` respectively.
> **Note**: PHP does not support user-defined type aliases.
>
>
php Parle\Lexer::reset Parle\Lexer::reset
==================
(PECL parle >= 0.7.1)
Parle\Lexer::reset — Reset lexer
### Description
```
public Parle\Lexer::reset(int $pos): void
```
Reset lexing optionally supplying the desired offset.
### Parameters
`pos`
Reset position.
### Return Values
No value is returned.
php SessionHandler::open SessionHandler::open
====================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
SessionHandler::open — Initialize session
### Description
```
public SessionHandler::open(string $path, string $name): bool
```
Create new session, or re-initialize existing session. Called internally by PHP when a session starts either automatically or when [session\_start()](function.session-start) is invoked.
This method wraps the internal PHP save handler defined in the [session.save\_handler](https://www.php.net/manual/en/session.configuration.php#ini.session.save-handler) ini setting that was set before this handler was set by [session\_set\_save\_handler()](function.session-set-save-handler).
If this class is extended by inheritance, calling the parent `open` method will invoke the wrapper for this method and therefore invoke the associated internal callback. This allows this method to be overridden and or intercepted and filtered.
For more information on what this method is expected to do, please refer to the documentation at [SessionHandlerInterface::open()](sessionhandlerinterface.open).
### Parameters
`path`
The path where to store/retrieve the session.
`name`
The session name.
### Return Values
The return value (usually **`true`** on success, **`false`** on failure). Note this value is returned internally to PHP for processing.
### See Also
* The [session.auto-start](https://www.php.net/manual/en/session.configuration.php#ini.session.auto-start) configuration directive.
php odbc_field_name odbc\_field\_name
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
odbc\_field\_name — Get the columnname
### Description
```
odbc_field_name(resource $statement, int $field): string|false
```
Gets the name of the field occupying the given column number in the given result identifier.
### Parameters
`statement`
The result identifier.
`field`
The field number. Field numbering starts at 1.
### Return Values
Returns the field name as a string, or **`false`** on error.
php Gmagick::solarizeimage Gmagick::solarizeimage
======================
(PECL gmagick >= Unknown)
Gmagick::solarizeimage — Applies a solarizing effect to the image
### Description
```
public Gmagick::solarizeimage(int $threshold): Gmagick
```
Applies a special effect to the image, similar to the effect achieved in a photo darkroom by selectively exposing areas of photo sensitive paper to light. Threshold ranges from 0 to QuantumRange and is a measure of the extent of the solarization.
### Parameters
`threshold`
Define the extent of the solarization.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php IntlChar::isdefined IntlChar::isdefined
===================
(PHP 7, PHP 8)
IntlChar::isdefined — Check whether the code point is defined
### Description
```
public static IntlChar::isdefined(int|string $codepoint): ?bool
```
Determines whether the specified code point is "defined", which usually means that it is assigned a character.
**`true`** for general categories other than "Cn" (other, not assigned).
>
> **Note**:
>
>
> Note that non-character code points (e.g., U+FDD0) are not "defined" (they are Cn), but surrogate code points are "defined" (Cs).
>
>
### 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 defined character, **`false`** if not. Returns **`null`** on failure.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::isdefined("A"));
var_dump(IntlChar::isdefined(" "));
var_dump(IntlChar::isdefined("\u{FDD0}"));
?>
```
The above example will output:
```
bool(true)
bool(true)
bool(false)
```
### See Also
* [IntlChar::isdigit()](intlchar.isdigit) - Check if code point is a digit character
* [IntlChar::isalpha()](intlchar.isalpha) - Check if code point is a letter character
* [IntlChar::isalnum()](intlchar.isalnum) - Check if code point is an alphanumeric character
* [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::istitle()](intlchar.istitle) - Check if code point is a titlecase letter
php GearmanClient::setTimeout GearmanClient::setTimeout
=========================
(PECL gearman >= 0.6.0)
GearmanClient::setTimeout — Set socket I/O activity timeout
### Description
```
public GearmanClient::setTimeout(int $timeout): bool
```
Sets the timeout for socket I/O activity.
### Parameters
`timeout`
An interval of time in milliseconds
### Return Values
Always returns **`true`**.
php The UnexpectedValueException class
The UnexpectedValueException class
==================================
Introduction
------------
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
Exception thrown if a value does not match with a set of values. Typically this happens when a function calls another function and expects the return value to be of a certain type or value not including arithmetic or buffer related errors.
Class synopsis
--------------
class **UnexpectedValueException** 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 Imagick::thresholdImage Imagick::thresholdImage
=======================
(PECL imagick 2, PECL imagick 3)
Imagick::thresholdImage — Changes the value of individual pixels based on a threshold
### Description
```
public Imagick::thresholdImage(float $threshold, 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.
### Parameters
`threshold`
`channel`
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::thresholdImage()****
```
<?php
function thresholdimage($imagePath, $threshold, $channel) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->thresholdimage($threshold * \Imagick::getQuantum(), $channel);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php The RecursiveRegexIterator class
The RecursiveRegexIterator class
================================
Introduction
------------
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
This recursive iterator can filter another recursive iterator via a regular expression.
Class synopsis
--------------
class **RecursiveRegexIterator** extends [RegexIterator](class.regexiterator) implements [RecursiveIterator](class.recursiveiterator) { /\* Inherited constants \*/ public const int [RegexIterator::USE\_KEY](class.regexiterator#regexiterator.constants.use-key);
public const int [RegexIterator::INVERT\_MATCH](class.regexiterator#regexiterator.constants.invert-match);
public const int [RegexIterator::MATCH](class.regexiterator#regexiterator.constants.match);
public const int [RegexIterator::GET\_MATCH](class.regexiterator#regexiterator.constants.get-match);
public const int [RegexIterator::ALL\_MATCHES](class.regexiterator#regexiterator.constants.all-matches);
public const int [RegexIterator::SPLIT](class.regexiterator#regexiterator.constants.split);
public const int [RegexIterator::REPLACE](class.regexiterator#regexiterator.constants.replace); /\* Inherited properties \*/
public ?string [$replacement](class.regexiterator#regexiterator.props.replacement) = null; /\* Methods \*/ public [\_\_construct](recursiveregexiterator.construct)(
[RecursiveIterator](class.recursiveiterator) `$iterator`,
string `$pattern`,
int `$mode` = RecursiveRegexIterator::MATCH,
int `$flags` = 0,
int `$pregFlags` = 0
)
```
public getChildren(): RecursiveRegexIterator
```
```
public hasChildren(): bool
```
/\* Inherited methods \*/
```
public RegexIterator::accept(): bool
```
```
public RegexIterator::getFlags(): int
```
```
public RegexIterator::getMode(): int
```
```
public RegexIterator::getPregFlags(): int
```
```
public RegexIterator::getRegex(): string
```
```
public RegexIterator::setFlags(int $flags): void
```
```
public RegexIterator::setMode(int $mode): void
```
```
public RegexIterator::setPregFlags(int $pregFlags): void
```
```
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
-----------------
* [RecursiveRegexIterator::\_\_construct](recursiveregexiterator.construct) — Creates a new RecursiveRegexIterator
* [RecursiveRegexIterator::getChildren](recursiveregexiterator.getchildren) — Returns an iterator for the current entry
* [RecursiveRegexIterator::hasChildren](recursiveregexiterator.haschildren) — Returns whether an iterator can be obtained for the current entry
| programming_docs |
php IntlCalendar::set IntlCalendar::set
=================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::set — Set a time field or several common fields at once
### Description
Object-oriented style
```
public IntlCalendar::set(int $field, int $value): bool
```
```
public IntlCalendar::set(
int $year,
int $month,
int $dayOfMonth = NULL,
int $hour = NULL,
int $minute = NULL,
int $second = NULL
): bool
```
Procedural style
```
intlcal_set(IntlCalendar $cal, int $field, int $value): bool
```
```
intlcal_set(
IntlCalendar $cal,
int $year,
int $month,
int $dayOfMonth = NULL,
int $hour = NULL,
int $minute = NULL,
int $second = NULL
): bool
```
Sets either a specific field to the given value, or sets at once several common fields. The range of values that are accepted depend on whether the calendar is using the [lenient mode](intlcalendar.setlenient).
For fields that conflict, the fields that are set later have priority.
This method cannot be called with exactly four arguments.
### Parameters
`cal`
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 new value of the given field.
`year`
The new value for **`IntlCalendar::FIELD_YEAR`**.
`month`
The new value for **`IntlCalendar::FIELD_MONTH`**. The month sequence is zero-based, i.e., January is represented by 0, February by 1, …, December is 11 and Undecember (if the calendar has it) is 12.
`dayOfMonth`
The new value for **`IntlCalendar::FIELD_DAY_OF_MONTH`**.
`hour`
The new value for **`IntlCalendar::FIELD_HOUR_OF_DAY`**.
`minute`
The new value for **`IntlCalendar::FIELD_MINUTE`**.
`second`
The new value for **`IntlCalendar::FIELD_SECOND`**.
### Return Values
Always returns **`true`**.
### Examples
**Example #1 **IntlCalendar::set()****
```
<?php
ini_set('date.timezone', 'Europe/Lisbon');
ini_set('intl.default_locale', 'pt_PT');
//Calls made later have priority
$cal = new IntlGregorianCalendar(2013, 6 /* July */, 1);
$cal->set(IntlCalendar::FIELD_YEAR, 2012);
$cal->set(IntlCalendar::FIELD_EXTENDED_YEAR, 2011);
var_dump(IntlDateFormatter::formatObject($cal));
$cal = new IntlGregorianCalendar(2013, 6 /* July */, 1);
$cal->set(IntlCalendar::FIELD_YEAR, 2012);
$cal->set(IntlCalendar::FIELD_EXTENDED_YEAR, 2011);
//the time has not been recalculated yet. If we clear the extended year,
//the year set before will be used
$cal->clear(IntlCalendar::FIELD_EXTENDED_YEAR);
var_dump(IntlDateFormatter::formatObject($cal));
```
The above example will output:
```
string(20) "01/07/2011, 00:00:00"
string(20) "01/07/2012, 00:00:00"
```
### See Also
* [IntlCalendar::get()](intlcalendar.get) - Get the value for a field
* [IntlCalendar::add()](intlcalendar.add) - Add a (signed) amount of time to a field
* [IntlCalendar::roll()](intlcalendar.roll) - Add value to field without carrying into more significant fields
php QuickHashStringIntHash::saveToFile QuickHashStringIntHash::saveToFile
==================================
(No version information available, might only be in Git)
QuickHashStringIntHash::saveToFile — This method stores an in-memory hash to disk
### Description
```
public QuickHashStringIntHash::saveToFile(string $filename): void
```
This method stores an existing hash to a file on disk, in the same format that loadFromFile() can read.
### Parameters
`filename`
The filename of the file to store the hash in.
### Return Values
No value is returned.
### Examples
**Example #1 **QuickHashStringIntHash::saveToFile()** example**
```
<?php
$hash = new QuickHashStringIntHash( 1024 );
var_dump( $hash->add( "forty three", 42 ) );
var_dump( $hash->add( "fifty two", 52 ) );
$hash->saveToFile( '/tmp/test.hash.string' );
?>
```
php ssh2_forward_accept ssh2\_forward\_accept
=====================
(PECL ssh2 >= 0.9.0)
ssh2\_forward\_accept — Accept a connection created by a listener
### Description
```
ssh2_forward_accept(resource $listener): resource|false
```
Accepts a connection created by a listener.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`desc`
An SSH2 Listener resource, obtained from a call to [ssh2\_forward\_listen()](function.ssh2-forward-listen).
### Return Values
Returns a stream resource, or **`false`** on failure.
php Phar::webPhar Phar::webPhar
=============
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
Phar::webPhar — Routes a request from a web browser to an internal file within the phar archive
### Description
```
final public static Phar::webPhar(
?string $alias = null,
?string $index = null,
?string $fileNotFoundScript = null,
array $mimeTypes = [],
?callable $rewrite = null
): void
```
**Phar::webPhar()** serves as [Phar::mapPhar()](phar.mapphar) for web-based phars. This method parses [$\_SERVER['REQUEST\_URI']](reserved.variables.server) and routes a request from a web browser to an internal file within the phar archive. It simulates a web server, routing requests to the correct file, echoing the correct headers and parsing PHP files as needed. Combined with [Phar::mungServer()](phar.mungserver) and [Phar::interceptFileFuncs()](phar.interceptfilefuncs), any web application can be used unmodified from a phar archive.
**Phar::webPhar()** should only be called from the stub of a phar archive (see [here](https://www.php.net/manual/en/phar.fileformat.stub.php) for more information on what a stub is).
### Parameters
`alias`
The alias that can be used in `phar://` URLs to refer to this archive, rather than its full path.
`index`
The location within the phar of the directory index.
`fileNotFoundScript`
The location of the script to run when a file is not found. This script should output the proper HTTP 404 headers.
`mimeTypes`
An array mapping additional file extensions to MIME type. If the default mapping is sufficient, pass an empty array. By default, these extensions are mapped to these MIME types:
```
<?php
$mimes = array(
'phps' => Phar::PHPS, // pass to highlight_file()
'c' => 'text/plain',
'cc' => 'text/plain',
'cpp' => 'text/plain',
'c++' => 'text/plain',
'dtd' => 'text/plain',
'h' => 'text/plain',
'log' => 'text/plain',
'rng' => 'text/plain',
'txt' => 'text/plain',
'xsd' => 'text/plain',
'php' => Phar::PHP, // parse as PHP
'inc' => Phar::PHP, // parse as PHP
'avi' => 'video/avi',
'bmp' => 'image/bmp',
'css' => 'text/css',
'gif' => 'image/gif',
'htm' => 'text/html',
'html' => 'text/html',
'htmls' => 'text/html',
'ico' => 'image/x-ico',
'jpe' => 'image/jpeg',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'js' => 'application/x-javascript',
'midi' => 'audio/midi',
'mid' => 'audio/midi',
'mod' => 'audio/mod',
'mov' => 'movie/quicktime',
'mp3' => 'audio/mp3',
'mpg' => 'video/mpeg',
'mpeg' => 'video/mpeg',
'pdf' => 'application/pdf',
'png' => 'image/png',
'swf' => 'application/shockwave-flash',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'wav' => 'audio/wav',
'xbm' => 'image/xbm',
'xml' => 'text/xml',
);
?>
```
`rewrite`
The rewrites function is passed a string as its only parameter and must return a string or **`false`**.
If you are using fast-cgi or cgi then the parameter passed to the function is the value of the [$\_SERVER['PATH\_INFO']](reserved.variables.server) variable. Otherwise, the parameter passed to the function is the value of the [$\_SERVER['REQUEST\_URI']](reserved.variables.server) variable.
If a string is returned it is used as the internal file path. If **`false`** is returned then webPhar() will send a HTTP 403 Denied Code.
### Return Values
No value is returned.
### Errors/Exceptions
Throws [PharException](class.pharexception) when unable to open the internal file to output, or if called from a non-stub. If an invalid array value is passed into `mimeTypes` or an invalid callback is passed into `rewrite`, then [UnexpectedValueException](class.unexpectedvalueexception) is thrown.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `fileNotFoundScript`, `mimeTypes` and `rewrite` are nullable now. |
### Examples
**Example #1 A **Phar::webPhar()** example**
With the example below, the created phar will display `Hello World` if one browses to `/myphar.phar/index.php` or to `/myphar.phar`, and will display the source of `index.phps` if one browses to `/myphar.phar/index.phps`.
```
<?php
// creating the phar archive:
try {
$phar = new Phar('myphar.phar');
$phar['index.php'] = '<?php echo "Hello World"; ?>';
$phar['index.phps'] = '<?php echo "Hello World"; ?>';
$phar->setStub('<?php
Phar::webPhar();
__HALT_COMPILER(); ?>');
} catch (Exception $e) {
// handle error here
}
?>
```
### See Also
* [Phar::mungServer()](phar.mungserver) - Defines a list of up to 4 $\_SERVER variables that should be modified for execution
* [Phar::interceptFileFuncs()](phar.interceptfilefuncs) - Instructs phar to intercept fopen, file\_get\_contents, opendir, and all of the stat-related functions
php imagesetclip imagesetclip
============
(PHP 7 >= 7.2.0, PHP 8)
imagesetclip — Set the clipping rectangle
### Description
```
imagesetclip(
GdImage $image,
int $x1,
int $y1,
int $x2,
int $y2
): bool
```
**imagesetclip()** sets the current clipping rectangle, i.e. the area beyond which no pixels will be drawn.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`x1`
The x-coordinate of the upper left corner.
`y1`
The y-coordinate of the upper left corner.
`x2`
The x-coordinate of the lower right corner.
`y2`
The y-coordinate of the lower right corner.
### 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. |
### See Also
* [imagegetclip()](function.imagegetclip) - Get the clipping rectangle
php XMLWriter::startComment XMLWriter::startComment
=======================
xmlwriter\_start\_comment
=========================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 1.0.0)
XMLWriter::startComment -- xmlwriter\_start\_comment — Create start comment
### Description
Object-oriented style
```
public XMLWriter::startComment(): bool
```
Procedural style
```
xmlwriter_start_comment(XMLWriter $writer): bool
```
Starts a comment.
### 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::endComment()](xmlwriter.endcomment) - Create end comment
* [XMLWriter::writeComment()](xmlwriter.writecomment) - Write full comment tag
php The DirectoryIterator class
The DirectoryIterator class
===========================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
The DirectoryIterator class provides a simple interface for viewing the contents of filesystem directories.
Class synopsis
--------------
class **DirectoryIterator** extends [SplFileInfo](class.splfileinfo) implements [SeekableIterator](class.seekableiterator) { /\* Methods \*/ public [\_\_construct](directoryiterator.construct)(string `$directory`)
```
public current(): mixed
```
```
public getATime(): int
```
```
public getBasename(string $suffix = ""): string
```
```
public getCTime(): int
```
```
public getExtension(): string
```
```
public getFilename(): string
```
```
public getGroup(): int
```
```
public getInode(): int
```
```
public getMTime(): int
```
```
public getOwner(): int
```
```
public getPath(): string
```
```
public getPathname(): string
```
```
public getPerms(): int
```
```
public getSize(): int
```
```
public getType(): string
```
```
public isDir(): bool
```
```
public isDot(): bool
```
```
public isExecutable(): bool
```
```
public isFile(): bool
```
```
public isLink(): bool
```
```
public isReadable(): bool
```
```
public isWritable(): bool
```
```
public key(): mixed
```
```
public next(): void
```
```
public rewind(): void
```
```
public seek(int $offset): void
```
```
public __toString(): string
```
```
public valid(): bool
```
/\* Inherited methods \*/
```
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
-----------------
* [DirectoryIterator::\_\_construct](directoryiterator.construct) — Constructs a new directory iterator from a path
* [DirectoryIterator::current](directoryiterator.current) — Return the current DirectoryIterator item
* [DirectoryIterator::getATime](directoryiterator.getatime) — Get last access time of the current DirectoryIterator item
* [DirectoryIterator::getBasename](directoryiterator.getbasename) — Get base name of current DirectoryIterator item
* [DirectoryIterator::getCTime](directoryiterator.getctime) — Get inode change time of the current DirectoryIterator item
* [DirectoryIterator::getExtension](directoryiterator.getextension) — Gets the file extension
* [DirectoryIterator::getFilename](directoryiterator.getfilename) — Return file name of current DirectoryIterator item
* [DirectoryIterator::getGroup](directoryiterator.getgroup) — Get group for the current DirectoryIterator item
* [DirectoryIterator::getInode](directoryiterator.getinode) — Get inode for the current DirectoryIterator item
* [DirectoryIterator::getMTime](directoryiterator.getmtime) — Get last modification time of current DirectoryIterator item
* [DirectoryIterator::getOwner](directoryiterator.getowner) — Get owner of current DirectoryIterator item
* [DirectoryIterator::getPath](directoryiterator.getpath) — Get path of current Iterator item without filename
* [DirectoryIterator::getPathname](directoryiterator.getpathname) — Return path and file name of current DirectoryIterator item
* [DirectoryIterator::getPerms](directoryiterator.getperms) — Get the permissions of current DirectoryIterator item
* [DirectoryIterator::getSize](directoryiterator.getsize) — Get size of current DirectoryIterator item
* [DirectoryIterator::getType](directoryiterator.gettype) — Determine the type of the current DirectoryIterator item
* [DirectoryIterator::isDir](directoryiterator.isdir) — Determine if current DirectoryIterator item is a directory
* [DirectoryIterator::isDot](directoryiterator.isdot) — Determine if current DirectoryIterator item is '.' or '..'
* [DirectoryIterator::isExecutable](directoryiterator.isexecutable) — Determine if current DirectoryIterator item is executable
* [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
* [DirectoryIterator::isReadable](directoryiterator.isreadable) — Determine if current DirectoryIterator item can be read
* [DirectoryIterator::isWritable](directoryiterator.iswritable) — Determine if current DirectoryIterator item can be written to
* [DirectoryIterator::key](directoryiterator.key) — Return the key for the current DirectoryIterator item
* [DirectoryIterator::next](directoryiterator.next) — Move forward to next DirectoryIterator item
* [DirectoryIterator::rewind](directoryiterator.rewind) — Rewind the DirectoryIterator back to the start
* [DirectoryIterator::seek](directoryiterator.seek) — Seek to a DirectoryIterator item
* [DirectoryIterator::\_\_toString](directoryiterator.tostring) — Get file name as a string
* [DirectoryIterator::valid](directoryiterator.valid) — Check whether current DirectoryIterator position is a valid file
php svn_diff svn\_diff
=========
(PECL svn >= 0.1.0)
svn\_diff — Recursively diffs two paths
### Description
```
svn_diff(
string $path1,
int $rev1,
string $path2,
int $rev2
): array
```
Recursively diffs two paths, `path1` and `path2`.
>
> **Note**:
>
>
> This is not a general-purpose diff utility. Only local files that are versioned may be diffed: other files will fail.
>
>
### Parameters
`path1`
First path to diff. This can be a URL to a file/directory in an SVN repository or a local file/directory path.
> **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\_\_).
>
>
**Warning** If a local file path has only backslashes and no forward slashes, this extension will fail to find the path. Always replace all backslashes with forward slashes when using this function.
`rev1`
First path's revision number. Use **`SVN_REVISION_HEAD`** to specify the most recent revision.
`path2`
Second path to diff. See `path1` for description.
`rev2`
Second path's revision number. See `rev1` for description.
### Return Values
Returns an array-list consisting of two streams: the first is the diff output and the second contains error stream output. The streams can be read using [fread()](function.fread). Returns **`false`** or **`null`** on error.
The diff output will, by default, be in the form of Subversion's custom unified diff format, but an [» external diff engine](http://svnbook.red-bean.com/en/1.2/svn.advanced.externaldifftools.html) may be used depending on Subversion's configuration.
### Examples
**Example #1 Basic example**
This example demonstrates the basic usage of this function, and the retrieval of contents from the stream:
```
<?php
list($diff, $errors) = svn_diff(
'http://www.example.com/svnroot/trunk/foo', SVN_REVISION_HEAD,
'http://www.example.com/svnroot/branches/dev/foo', SVN_REVISION_HEAD
);
if (!$diff) exit;
$contents = '';
while (!feof($diff)) {
$contents .= fread($diff, 8192);
}
fclose($diff);
fclose($errors);
var_dump($contents);
?>
```
The above example will output:
```
Index: http://www.example.com/svnroot/trunk/foo
===================================================================
--- http://www.example.com/svnroot/trunk/foo (.../foo) (revision 23)
+++ http://www.example.com/svnroot/branches/dev/foo (.../foo) (revision 27)
// further diff output
```
**Example #2 Diffing two revisions of a repository path**
This example implements a wrapper function that allows a user to easily diff two revisions of the same item using an external repository path (the default syntax is somewhat verbose):
```
<?php
function svn_diff_same_item($path, $rev1, $rev2) {
return svn_diff($path, $rev1, $path, $rev2);
}
?>
```
**Example #3 Portably diffing two local files**
This example implements a wrapper function that portably diffs two local files, compensating for the [realpath()](function.realpath) fix and the backslashes bug:
```
<?php
function svn_diff_local($path1, $rev1, $path2, $rev2) {
$path1 = str_replace('\\', '/', realpath($path1));
$path2 = str_replace('\\', '/', realpath($path2));
return svn_diff($path1, $rev1, $path2, $rev2);
}
?>
```
### 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 diff](http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.diff.html)
| programming_docs |
php mcrypt_module_self_test mcrypt\_module\_self\_test
==========================
(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mcrypt\_module\_self\_test — This function runs a self test on the specified module
**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_self_test(string $algorithm, string $lib_dir = ?): bool
```
This function runs the self test on the algorithm specified.
### Parameters
`algorithm`
One of the **`MCRYPT_ciphername`** constants, or the name of the algorithm as string.
`lib_dir`
The optional `lib_dir` parameter can contain the location where the algorithm module is on the system.
### Return Values
The function returns **`true`** if the self test succeeds, or **`false`** when it fails.
### Examples
**Example #1 **mcrypt\_module\_self\_test()** example**
```
<?php
var_dump(mcrypt_module_self_test(MCRYPT_RIJNDAEL_128)) . "\n";
var_dump(mcrypt_module_self_test(MCRYPT_BOGUS_CYPHER));
?>
```
The above example will output:
```
bool(true)
bool(false)
```
php VarnishAdmin::disconnect VarnishAdmin::disconnect
========================
(PECL varnish >= 1.0.0)
VarnishAdmin::disconnect — Disconnect from a varnish instance administration interface
### Description
```
public VarnishAdmin::disconnect(): bool
```
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php odbc_result_all odbc\_result\_all
=================
(PHP 4, PHP 5, PHP 7, PHP 8)
odbc\_result\_all — Print result as HTML table
**Warning**This function has been *DEPRECATED* as of PHP 8.1.0. Relying on this function is highly discouraged.
### Description
```
odbc_result_all(resource $statement, string $format = ""): int|false
```
Prints all rows from a result identifier produced by [odbc\_exec()](function.odbc-exec). The result is printed in HTML table format. The data is *not* escaped.
This function is not supposed to be used in production environments; it is merely meant for development purposes, to get a result set quickly rendered.
### Parameters
`statement`
The result identifier.
`format`
Additional overall table formatting.
### Return Values
Returns the number of rows in the result or **`false`** on error.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | This function has been deprecated. |
php socket_close socket\_close
=============
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
socket\_close — Closes a [Socket](class.socket) instance
### Description
```
socket_close(Socket $socket): void
```
**socket\_close()** closes the [Socket](class.socket) instance given by `socket`.
### Parameters
`socket`
A [Socket](class.socket) instance created with [socket\_create()](function.socket-create) or [socket\_accept()](function.socket-accept).
### Return Values
No value is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `socket` is a [Socket](class.socket) instance now; previously, it was a resource. |
### See Also
* [socket\_bind()](function.socket-bind) - Binds a name to a socket
* [socket\_listen()](function.socket-listen) - Listens for a connection on a socket
* [socket\_create()](function.socket-create) - Create a socket (endpoint for communication)
* [socket\_strerror()](function.socket-strerror) - Return a string describing a socket error
php ReflectionParameter::getAttributes ReflectionParameter::getAttributes
==================================
(PHP 8)
ReflectionParameter::getAttributes — Gets Attributes
### Description
```
public ReflectionParameter::getAttributes(?string $name = null, int $flags = 0): array
```
Returns all attributes declared on this parameter as an array of [ReflectionAttribute](class.reflectionattribute).
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`name`
`flags`
### Return Values
Array of attributes, as a [ReflectionAttribute](class.reflectionattribute) object.
### See Also
* [ReflectionClass::getAttributes()](reflectionclass.getattributes) - Gets Attributes
* [ReflectionClassConstant::getAttributes()](reflectionclassconstant.getattributes) - Gets Attributes
* [ReflectionFunctionAbstract::getAttributes()](reflectionfunctionabstract.getattributes) - Gets Attributes
* [ReflectionProperty::getAttributes()](reflectionproperty.getattributes) - Gets Attributes
php EvPeriodic::at EvPeriodic::at
==============
(PECL ev >= 0.2.0)
EvPeriodic::at — Returns the absolute time that this watcher is supposed to trigger next
### Description
```
public EvPeriodic::at(): float
```
When the watcher is active, returns the absolute time that this watcher is supposed to trigger next. This is not the same as the offset argument to [EvPeriodic::set()](evperiodic.set) or [EvPeriodic::\_\_construct()](evperiodic.construct) , but indeed works even in interval mode.
### Parameters
This function has no parameters.
### Return Values
Returns the absolute time this watcher is supposed to trigger next in seconds.
php ReflectionFunctionAbstract::isVariadic ReflectionFunctionAbstract::isVariadic
======================================
(PHP 5 >= 5.6.0, PHP 7, PHP 8)
ReflectionFunctionAbstract::isVariadic — Checks if the function is variadic
### Description
```
public ReflectionFunctionAbstract::isVariadic(): bool
```
Checks if the function is [variadic](functions.arguments#functions.variable-arg-list).
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the function is variadic, otherwise **`false`**.
php ArrayObject::natsort ArrayObject::natsort
====================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
ArrayObject::natsort — Sort entries using a "natural order" algorithm
### Description
```
public ArrayObject::natsort(): bool
```
This method 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 [ArrayObject::asort](arrayobject.asort)) method 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.
>
>
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Examples
**Example #1 **ArrayObject::natsort()** example**
```
<?php
$array = array("img12.png", "img10.png", "img2.png", "img1.png");
$arr1 = new ArrayObject($array);
$arr2 = clone $arr1;
$arr1->asort();
echo "Standard sorting\n";
print_r($arr1);
$arr2->natsort();
echo "\nNatural order sorting\n";
print_r($arr2);
?>
```
The above example will output:
```
Standard sorting
ArrayObject Object
(
[3] => img1.png
[1] => img10.png
[0] => img12.png
[2] => img2.png
)
Natural order sorting
ArrayObject Object
(
[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.
### See Also
* [ArrayObject::asort()](arrayobject.asort) - Sort the entries by value
* [ArrayObject::ksort()](arrayobject.ksort) - Sort the entries by key
* [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
* [natsort()](function.natsort) - Sort an array using a "natural order" algorithm
php The Collectable interface
The Collectable interface
=========================
Introduction
------------
(PECL pthreads >= 2.0.8)
Represents a garbage-collectable object.
Interface synopsis
------------------
interface **Collectable** { /\* Methods \*/
```
public isGarbage(): bool
```
} Table of Contents
-----------------
* [Collectable::isGarbage](collectable.isgarbage) — Determine whether an object has been marked as garbage
php ZipArchive::statIndex ZipArchive::statIndex
=====================
(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.1.0)
ZipArchive::statIndex — Get the details of an entry defined by its index
### Description
```
public ZipArchive::statIndex(int $index, int $flags = 0): array|false
```
The function obtains information about the entry defined by its index.
### Parameters
`index`
Index of the entry
`flags`
**`ZipArchive::FL_UNCHANGED`** may be ORed to it to request information about the original file in the archive, ignoring any changes made.
### Return Values
Returns an array containing the entry details or **`false`** on failure.
### Examples
**Example #1 Dump the stat info of an entry**
```
<?php
$zip = new ZipArchive;
$res = $zip->open('test.zip');
if ($res === TRUE) {
print_r($zip->statIndex(3));
$zip->close();
} else {
echo 'failed, code:' . $res;
}
?>
```
The above example will output something similar to:
```
Array
(
[name] => foobar/baz
[index] => 3
[crc] => 499465816
[size] => 27
[mtime] => 1123164748
[comp_size] => 24
[comp_method] => 8
)
```
php socket_bind socket\_bind
============
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
socket\_bind — Binds a name to a socket
### Description
```
socket_bind(Socket $socket, string $address, int $port = 0): bool
```
Binds the name given in `address` to the socket described by `socket`. This has to be done before a connection is be established using [socket\_connect()](function.socket-connect) or [socket\_listen()](function.socket-listen).
### Parameters
`socket`
A [Socket](class.socket) instance created with [socket\_create()](function.socket-create).
`address`
If the socket is of the **`AF_INET`** family, the `address` is an IP in dotted-quad notation (e.g. `127.0.0.1`).
If the socket is of the **`AF_UNIX`** family, the `address` is the path of a Unix-domain socket (e.g. /tmp/my.sock).
`port` (Optional) The `port` parameter is only used when binding an **`AF_INET`** socket, and designates the port on which to listen for connections.
### Return Values
Returns **`true`** on success or **`false`** on failure.
The error code can be retrieved with [socket\_last\_error()](function.socket-last-error). This code may be passed to [socket\_strerror()](function.socket-strerror) to get a textual explanation of the error.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `socket` is a [Socket](class.socket) instance now; previously, it was a resource. |
### Examples
**Example #1 Using **socket\_bind()** to set the source address**
```
<?php
// Create a new socket
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
// An example list of IP addresses owned by the computer
$sourceips['kevin'] = '127.0.0.1';
$sourceips['madcoder'] = '127.0.0.2';
// Bind the source address
socket_bind($sock, $sourceips['madcoder']);
// Connect to destination address
socket_connect($sock, '127.0.0.1', 80);
// Write
$request = 'GET / HTTP/1.1' . "\r\n" .
'Host: example.com' . "\r\n\r\n";
socket_write($sock, $request);
// Close
socket_close($sock);
?>
```
### Notes
>
> **Note**:
>
>
> This function must be used on the socket before [socket\_connect()](function.socket-connect).
>
>
>
> **Note**:
>
>
> Windows 9x/ME compatibility note: [socket\_last\_error()](function.socket-last-error) may return an invalid error code if trying to bind the socket to a wrong address that does not belong to your machine.
>
>
### See Also
* [socket\_connect()](function.socket-connect) - Initiates a connection on a socket
* [socket\_listen()](function.socket-listen) - Listens for a connection on a socket
* [socket\_create()](function.socket-create) - Create a socket (endpoint for communication)
* [socket\_last\_error()](function.socket-last-error) - Returns the last error on the socket
* [socket\_strerror()](function.socket-strerror) - Return a string describing a socket error
php Gmagick::getsamplingfactors Gmagick::getsamplingfactors
===========================
(PECL gmagick >= Unknown)
Gmagick::getsamplingfactors — Gets the horizontal and vertical sampling factor
### Description
```
public Gmagick::getsamplingfactors(): array
```
Gets the horizontal and vertical sampling factor.
### Parameters
This function has no parameters.
### Return Values
Returns an associative array with the horizontal and vertical sampling factors of the image.
### Errors/Exceptions
Throws an **GmagickException** on error.
php tidyNode::getParent tidyNode::getParent
===================
(PHP 5 >= 5.2.2, PHP 7, PHP 8)
tidyNode::getParent — Returns the parent node of the current node
### Description
```
public tidyNode::getParent(): ?tidyNode
```
Returns the parent node of the current node.
### Parameters
This function has no parameters.
### Return Values
Returns a [tidyNode](class.tidynode) if the node has a parent, or **`null`** otherwise.
### Examples
**Example #1 [tidyNode::hasChildren()](tidynode.haschildren) example**
```
<?php
$html = <<< HTML
<html><head>
<?php echo '<title>title</title>'; ?>
<#
/* JSTE code */
alert('Hello World');
#>
</head>
<body>
Hello World
</body>
</html>
HTML;
$tidy = tidy_parse_string($html);
$num = 0;
$node = $tidy->html()->child[0]->child[0];
var_dump($node->getparent()->name);
?>
```
The above example will output:
```
string(4) "head"
```
php SolrUpdateResponse::__destruct SolrUpdateResponse::\_\_destruct
================================
(PECL solr >= 0.9.2)
SolrUpdateResponse::\_\_destruct — Destructor
### Description
public **SolrUpdateResponse::\_\_destruct**() Destructor
### Parameters
This function has no parameters.
### Return Values
None
php imap_lsub imap\_lsub
==========
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_lsub — List all the subscribed mailboxes
### Description
```
imap_lsub(IMAP\Connection $imap, string $reference, string $pattern): array|false
```
Gets an array of all the mailboxes that you have subscribed.
### 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 all the subscribed mailboxes, 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. |
### See Also
* [imap\_list()](function.imap-list) - Read the list of mailboxes
* [imap\_getmailboxes()](function.imap-getmailboxes) - Read the list of mailboxes, returning detailed information on each one
php ReflectionFunctionAbstract::getFileName ReflectionFunctionAbstract::getFileName
=======================================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
ReflectionFunctionAbstract::getFileName — Gets file name
### Description
```
public ReflectionFunctionAbstract::getFileName(): string|false
```
Gets the file name from a user-defined function.
### Parameters
This function has no parameters.
### Return Values
Returns the filename of the file in which the function has been defined. If the class is defined in the PHP core or in a PHP extension, **`false`** is returned.
### See Also
* [ReflectionFunctionAbstract::getNamespaceName()](reflectionfunctionabstract.getnamespacename) - Gets namespace name
php Lua::include Lua::include
============
(PECL lua >=0.9.0)
Lua::include — Parse a Lua script file
### Description
```
public Lua::include(string $file): mixed
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`file`
### Return Values
Returns result of included code, **`null`** for wrong arguments or **`false`** on other failure.
php DOMDocument::createProcessingInstruction DOMDocument::createProcessingInstruction
========================================
(PHP 5, PHP 7, PHP 8)
DOMDocument::createProcessingInstruction — Creates new PI node
### Description
```
public DOMDocument::createProcessingInstruction(string $target, string $data = ""): DOMProcessingInstruction|false
```
This function creates a new instance of class [DOMProcessingInstruction](class.domprocessinginstruction). This node will not show up in the document unless it is inserted with (e.g.) [DOMNode::appendChild()](domnode.appendchild).
### Parameters
`target`
The target of the processing instruction.
`data`
The content of the processing instruction.
### Return Values
The new [DOMProcessingInstruction](class.domprocessinginstruction) or **`false`** if an error occurred.
### Errors/Exceptions
**`DOM_INVALID_CHARACTER_ERR`**
Raised if `target` contains an invalid character.
### 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::createTextNode()](domdocument.createtextnode) - Create new text node
php Parle\Lexer::build Parle\Lexer::build
==================
(PECL parle >= 0.5.1)
Parle\Lexer::build — Finalize the lexer rule set
### Description
```
public Parle\Lexer::build(): void
```
Rules, previously added with [Parle\Lexer::push()](parle-lexer.push) are finalized. This method call has to be done after all the necessary rules was pushed. The rule set becomes read only. The lexing can begin.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
| programming_docs |
php ReflectionProperty::isPublic ReflectionProperty::isPublic
============================
(PHP 5, PHP 7, PHP 8)
ReflectionProperty::isPublic — Checks if property is public
### Description
```
public ReflectionProperty::isPublic(): bool
```
Checks whether the property is public.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the property is public, **`false`** otherwise.
### See Also
* [ReflectionProperty::isProtected()](reflectionproperty.isprotected) - Checks if property is protected
* [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 XMLReader::XML XMLReader::XML
==============
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
XMLReader::XML — Set the data containing the XML to parse
### Description
```
public static XMLReader::XML(string $source, ?string $encoding = null, int $flags = 0): bool|XMLReader
```
Set the data containing the XML to parse.
### Parameters
`source`
String containing the XML to be parsed.
`encoding`
The document encoding or **`null`**.
`flags`
A bitmask of the [LIBXML\_\*](https://www.php.net/manual/en/libxml.constants.php) constants.
### Return Values
Returns **`true`** on success or **`false`** on failure. If called statically, returns an [XMLReader](class.xmlreader) or **`false`** on failure.
### Errors/Exceptions
This method may be called statically, but prior to PHP 8.0.0, will issue an **`E_DEPRECATED`** error in this case.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | **XMLReader::XML()** is now declared as static method, but can still be called on an [XMLReader](class.xmlreader) instance. |
### See Also
* [XMLReader::open()](xmlreader.open) - Set the URI containing the XML to parse
* [XMLReader::close()](xmlreader.close) - Close the XMLReader input
php XMLWriter::writeDtd XMLWriter::writeDtd
===================
xmlwriter\_write\_dtd
=====================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::writeDtd -- xmlwriter\_write\_dtd — Write full DTD tag
### Description
Object-oriented style
```
public XMLWriter::writeDtd(
string $name,
?string $publicId = null,
?string $systemId = null,
?string $content = null
): bool
```
Procedural style
```
xmlwriter_write_dtd(
XMLWriter $writer,
string $name,
?string $publicId = null,
?string $systemId = null,
?string $content = null
): bool
```
Writes a full DTD.
### 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 DTD name.
`publicId`
The external subset public identifier.
`systemId`
The external subset system identifier.
`content`
The content of the DTD.
### 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::startDtd()](xmlwriter.startdtd) - Create start DTD tag
* [XMLWriter::endDtd()](xmlwriter.enddtd) - End current DTD
php ReflectionClass::__construct ReflectionClass::\_\_construct
==============================
(PHP 5, PHP 7, PHP 8)
ReflectionClass::\_\_construct — Constructs a ReflectionClass
### Description
public **ReflectionClass::\_\_construct**(object|string `$objectOrClass`) Constructs a new [ReflectionClass](class.reflectionclass) object.
### Parameters
`objectOrClass`
Either a string containing the name of the class to reflect, or an object.
### Errors/Exceptions
Throws [ReflectionException](class.reflectionexception) if the class to reflect does not exist.
### Examples
**Example #1 Basic usage ReflectionClass**
```
<?php
Reflection::export(new ReflectionClass('Exception'));
?>
```
The above example will output something similar to:
```
Class [ <internal:Core> class Exception ] {
- Constants [0] {
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [7] {
Property [ <default> protected $message ]
Property [ <default> private $string ]
Property [ <default> protected $code ]
Property [ <default> protected $file ]
Property [ <default> protected $line ]
Property [ <default> private $trace ]
Property [ <default> private $previous ]
}
- Methods [10] {
Method [ <internal:Core> final private method __clone ] {
}
Method [ <internal:Core, ctor> public method __construct ] {
- Parameters [3] {
Parameter #0 [ <optional> $message ]
Parameter #1 [ <optional> $code ]
Parameter #2 [ <optional> $previous ]
}
}
Method [ <internal:Core> final public method getMessage ] {
}
Method [ <internal:Core> final public method getCode ] {
}
Method [ <internal:Core> final public method getFile ] {
}
Method [ <internal:Core> final public method getLine ] {
}
Method [ <internal:Core> final public method getTrace ] {
}
Method [ <internal:Core> final public method getPrevious ] {
}
Method [ <internal:Core> final public method getTraceAsString ] {
}
Method [ <internal:Core> public method __toString ] {
}
}
}
```
### See Also
* [ReflectionObject::\_\_construct()](reflectionobject.construct) - Constructs a ReflectionObject
* [Constructors](language.oop5.decon#language.oop5.decon.constructor)
php Imagick::getImageDispose Imagick::getImageDispose
========================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageDispose — Gets the image disposal method
### Description
```
public Imagick::getImageDispose(): int
```
Gets the image disposal method.
### Parameters
This function has no parameters.
### Return Values
Returns the dispose method on success.
### Errors/Exceptions
Throws ImagickException on error.
php eio_syncfs eio\_syncfs
===========
(PECL eio >= 0.0.1dev)
eio\_syncfs — Calls Linux' syncfs syscall, if available
### Description
```
eio_syncfs(
mixed $fd,
int $pri = EIO_PRI_DEFAULT,
callable $callback = NULL,
mixed $data = NULL
): resource
```
### Parameters
`fd`
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\_syncfs()** returns request resource on success, or **`false`** on failure.
php sodium_crypto_secretstream_xchacha20poly1305_rekey sodium\_crypto\_secretstream\_xchacha20poly1305\_rekey
======================================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_secretstream\_xchacha20poly1305\_rekey — Explicitly rotate the key in the secretstream state
### Description
```
sodium_crypto_secretstream_xchacha20poly1305_rekey(string &$state): void
```
Explicitly rotate the key in the secretstream state. Overwrites the value passed in.
### Parameters
`state`
Secretstream state.
### Return Values
No value is returned.
php stream_filter_register stream\_filter\_register
========================
(PHP 5, PHP 7, PHP 8)
stream\_filter\_register — Register a user defined stream filter
### Description
```
stream_filter_register(string $filter_name, string $class): bool
```
**stream\_filter\_register()** allows you to implement your own filter on any registered stream used with all the other filesystem functions (such as [fopen()](function.fopen), [fread()](function.fread) etc.).
### Parameters
`filter_name`
The filter name to be registered.
`class`
To implement a filter, you need to define a class as an extension of [php\_user\_filter](class.php-user-filter) with a number of member functions. When performing read/write operations on the stream to which your filter is attached, PHP will pass the data through your filter (and any other filters attached to that stream) so that the data may be modified as desired. You must implement the methods exactly as described in [php\_user\_filter](class.php-user-filter) - doing otherwise will lead to undefined behaviour.
### Return Values
Returns **`true`** on success or **`false`** on failure.
**stream\_filter\_register()** will return **`false`** if the `filter_name` is already defined.
### Examples
**Example #1 Filter for capitalizing characters on foo-bar.txt stream**
The example below implements a filter named `strtoupper` on the foo-bar.txt stream which will capitalize all letter characters written to/read from that stream.
```
<?php
/* Define our filter class */
class strtoupper_filter extends php_user_filter {
function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
$bucket->data = strtoupper($bucket->data);
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
}
/* Register our filter with PHP */
stream_filter_register("strtoupper", "strtoupper_filter")
or die("Failed to register filter");
$fp = fopen("foo-bar.txt", "w");
/* Attach the registered filter to the stream just opened */
stream_filter_append($fp, "strtoupper");
fwrite($fp, "Line1\n");
fwrite($fp, "Word - 2\n");
fwrite($fp, "Easy As 123\n");
fclose($fp);
/* Read the contents back out
*/
readfile("foo-bar.txt");
?>
```
The above example will output:
```
LINE1
WORD - 2
EASY AS 123
```
**Example #2 Registering a generic filter class to match multiple filter names.**
```
<?php
/* Define our filter class */
class string_filter extends php_user_filter {
var $mode;
function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
if ($this->mode == 1) {
$bucket->data = strtoupper($bucket->data);
} elseif ($this->mode == 0) {
$bucket->data = strtolower($bucket->data);
}
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
function onCreate()
{
if ($this->filtername == 'str.toupper') {
$this->mode = 1;
} elseif ($this->filtername == 'str.tolower') {
$this->mode = 0;
} else {
/* Some other str.* filter was asked for,
report failure so that PHP will keep looking */
return false;
}
return true;
}
}
/* Register our filter with PHP */
stream_filter_register("str.*", "string_filter")
or die("Failed to register filter");
$fp = fopen("foo-bar.txt", "w");
/* Attach the registered filter to the stream just opened
We could alternately bind to str.tolower here */
stream_filter_append($fp, "str.toupper");
fwrite($fp, "Line1\n");
fwrite($fp, "Word - 2\n");
fwrite($fp, "Easy As 123\n");
fclose($fp);
/* Read the contents back out
*/
readfile("foo-bar.txt");
?>
```
The above example will output:
```
LINE1
WORD - 2
EASY AS 123
```
### See Also
* [stream\_wrapper\_register()](function.stream-wrapper-register) - Register a URL wrapper implemented as a PHP class
* [stream\_filter\_append()](function.stream-filter-append) - Attach a filter to a stream
* [stream\_filter\_prepend()](function.stream-filter-prepend) - Attach a filter to a stream
php radius_config radius\_config
==============
(PECL radius >= 1.1.0)
radius\_config — Causes the library to read the given configuration file
### Description
```
radius_config(resource $radius_handle, string $file): bool
```
Before issuing any Radius requests, the library must be made aware of the servers it can contact. The easiest way to configure the library is to call **radius\_config()**. **radius\_config()** causes the library to read a configuration file whose format is described in [» radius.conf](http://www.freebsd.org/cgi/man.cgi?query=radius.conf).
### Parameters
`radius_handle`
`file`
The pathname of the configuration file is passed as the file argument to **radius\_config()**. The library can also be configured programmatically by calls to [radius\_add\_server()](function.radius-add-server).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [radius\_add\_server()](function.radius-add-server) - Adds a server
php svn_fs_contents_changed svn\_fs\_contents\_changed
==========================
(PECL svn >= 0.2.0)
svn\_fs\_contents\_changed — Return true if content is different, false otherwise
### Description
```
svn_fs_contents_changed(
resource $root1,
string $path1,
resource $root2,
string $path2
): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Return true if content is different, false otherwise
### 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 RecursiveRegexIterator::getChildren RecursiveRegexIterator::getChildren
===================================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
RecursiveRegexIterator::getChildren — Returns an iterator for the current entry
### Description
```
public RecursiveRegexIterator::getChildren(): RecursiveRegexIterator
```
Returns an iterator for the current iterator entry.
### Parameters
This function has no parameters.
### Return Values
An iterator for the current entry, if it can be iterated over by the inner iterator.
### Errors/Exceptions
An [InvalidArgumentException](class.invalidargumentexception) will be thrown if the current entry does not contain a value that can be iterated over by the inner iterator.
### Examples
**Example #1 **RecursiveRegexIterator::getChildren()** example**
```
<?php
$rArrayIterator = new RecursiveArrayIterator(array('test1', array('tet3', 'test4', 'test5')));
$rRegexIterator = new RecursiveRegexIterator($rArrayIterator, '/^test/',
RecursiveRegexIterator::ALL_MATCHES);
foreach ($rRegexIterator as $key1 => $value1) {
if ($rRegexIterator->hasChildren()) {
// print all children
echo "Children: ";
foreach ($rRegexIterator->getChildren() as $key => $value) {
echo $value . " ";
}
echo "\n";
} else {
echo "No children\n";
}
}
?>
```
The above example will output:
```
No children
Children: test4 test5
```
### See Also
* [RecursiveRegexIterator::hasChildren()](recursiveregexiterator.haschildren) - Returns whether an iterator can be obtained for the current entry
php SolrQuery::getExpandRows SolrQuery::getExpandRows
========================
(PECL solr >= 2.2.0)
SolrQuery::getExpandRows — Returns The number of rows to display in each group (expand.rows)
### Description
```
public SolrQuery::getExpandRows(): int
```
Returns The number of rows to display in each group (expand.rows)
### Parameters
This function has no parameters.
### Return Values
Returns the number of rows.
php imagechar imagechar
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
imagechar — Draw a character horizontally
### Description
```
imagechar(
GdImage $image,
GdFont|int $font,
int $x,
int $y,
string $char,
int $color
): bool
```
**imagechar()** draws the first character of `char` in the image identified by `image` with its upper-left at `x`,`y` (top left is 0, 0) with the color `color`.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`font`
Can be 1, 2, 3, 4, 5 for built-in fonts in latin2 encoding (where higher numbers corresponding to larger fonts) or [GdFont](class.gdfont) instance, returned by [imageloadfont()](function.imageloadfont).
`x`
x-coordinate of the start.
`y`
y-coordinate of the start.
`char`
The character to draw.
`color`
A color identifier created with [imagecolorallocate()](function.imagecolorallocate).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The `font` parameter now accepts both an [GdFont](class.gdfont) instance and an int; previously only int was accepted. |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
### Examples
**Example #1 **imagechar()** example**
```
<?php
$im = imagecreate(100, 100);
$string = 'PHP';
$bg = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// prints a black "P" in the top left corner
imagechar($im, 1, 0, 0, $string, $black);
header('Content-type: image/png');
imagepng($im);
?>
```
The above example will output something similar to:
### See Also
* [imagecharup()](function.imagecharup) - Draw a character vertically
* [imageloadfont()](function.imageloadfont) - Load a new font
php XMLWriter::writeAttribute XMLWriter::writeAttribute
=========================
xmlwriter\_write\_attribute
===========================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::writeAttribute -- xmlwriter\_write\_attribute — Write full attribute
### Description
Object-oriented style
```
public XMLWriter::writeAttribute(string $name, string $value): bool
```
Procedural style
```
xmlwriter_write_attribute(XMLWriter $writer, string $name, string $value): bool
```
Writes a full 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 name of the attribute.
`value`
The value of the attribute.
### 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 Intermixing Sub-elements and Attributes**
If writing sub-elements and attributes is intermixed, any attempt to write attributes after the first sub-element will fail and return false.
```
<?php
$xml = new XMLWriter();
$xml->openMemory();
$xml->startElement('element');
$xml->writeAttribute('attr1', '0');
$xml->writeElement('subelem', '0');
var_dump($xml->writeAttribute('attr2', '0'));
$xml->endElement();
echo $xml->flush();
?>
```
The above example will output:
```
bool(false)
<element attr1="0"><subelem>0</subelem></element>
```
### See Also
* [XMLWriter::writeAttributeNs()](xmlwriter.writeattributens) - Write full namespaced attribute
* [XMLWriter::startAttribute()](xmlwriter.startattribute) - Create start attribute
* [XMLWriter::startAttributeNs()](xmlwriter.startattributens) - Create start namespaced attribute
* [XMLWriter::endAttribute()](xmlwriter.endattribute) - End attribute
| programming_docs |
php Gmagick::__construct Gmagick::\_\_construct
======================
(PECL gmagick >= Unknown)
Gmagick::\_\_construct — The Gmagick constructor
### Description
public **Gmagick::\_\_construct**(string `$filename` = ?) The [Gmagick](class.gmagick) constructor.
### Parameters
`filename`
The path to an image to load or array of paths.
### Errors/Exceptions
Throws an **GmagickException** on error.
php SQLite3::close SQLite3::close
==============
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3::close — Closes the database connection
### Description
```
public SQLite3::close(): bool
```
Closes the database connection.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **SQLite3::close()** example**
```
<?php
$db = new SQLite3('mysqlitedb.db');
$db->close();
?>
```
php eio_poll eio\_poll
=========
(PECL eio >= 0.0.1dev)
eio\_poll — Can be to be called whenever there are pending requests that need finishing
### Description
```
eio_poll(): int
```
**eio\_poll()** can be used to implement special event loop. For this [eio\_nreqs()](function.eio-nreqs) could be used to test if there are unprocessed requests.
>
> **Note**:
>
>
> Applicable only when implementing userspace event loop.
>
>
>
### Parameters
This function has no parameters.
### Return Values
If any request invocation returns a non-zero value, returns that value. Otherwise, it returns **`0`**.
### Examples
**Example #1 **eio\_poll()** example**
```
<?php
function res_cb($data, $result) {
var_dump($data);
var_dump($result);
}
eio_nop(EIO_PRI_DEFAULT, "res_cb", "1");
eio_nop(EIO_PRI_DEFAULT, "res_cb", "2");
eio_nop(EIO_PRI_DEFAULT, "res_cb", "3");
while (eio_nreqs()) {
// Some specific IPC or so
eio_poll();
}
?>
```
The above example will output something similar to:
```
string(1) "1"
int(0)
string(1) "3"
int(0)
string(1) "2"
int(0)
```
### See Also
* [eio\_nreqs()](function.eio-nreqs) - Returns number of requests to be processed
php The Gmagick class
The Gmagick class
=================
Introduction
------------
(PECL gmagick >= Unknown)
Class synopsis
--------------
class **Gmagick** { /\* Methods \*/ public [\_\_construct](gmagick.construct)(string `$filename` = ?)
```
public addimage(Gmagick $source): Gmagick
```
```
public addnoiseimage(int $noise_type): Gmagick
```
```
public annotateimage(
GmagickDraw $GmagickDraw,
float $x,
float $y,
float $angle,
string $text
): Gmagick
```
```
public blurimage(float $radius, float $sigma, int $channel = ?): Gmagick
```
```
public borderimage(GmagickPixel $color, int $width, int $height): Gmagick
```
```
public charcoalimage(float $radius, float $sigma): Gmagick
```
```
public chopimage(
int $width,
int $height,
int $x,
int $y
): Gmagick
```
```
public clear(): Gmagick
```
```
public commentimage(string $comment): Gmagick
```
```
public compositeimage(
Gmagick $source,
int $COMPOSE,
int $x,
int $y
): Gmagick
```
```
public cropimage(
int $width ,
int $height ,
int $x,
int $y
): Gmagick
```
```
public cropthumbnailimage(int $width, int $height): Gmagick
```
```
public current(): Gmagick
```
```
public cyclecolormapimage(int $displace): Gmagick
```
```
public deconstructimages(): Gmagick
```
```
public despeckleimage(): Gmagick
```
```
public destroy(): bool
```
```
public drawimage(GmagickDraw $GmagickDraw): Gmagick
```
```
public edgeimage(float $radius): Gmagick
```
```
public embossimage(float $radius, float $sigma): Gmagick
```
```
public enhanceimage(): Gmagick
```
```
public equalizeimage(): Gmagick
```
```
public flipimage(): Gmagick
```
```
public flopimage(): Gmagick
```
```
public frameimage(
GmagickPixel $color,
int $width,
int $height,
int $inner_bevel,
int $outer_bevel
): Gmagick
```
```
public gammaimage(float $gamma): Gmagick
```
```
public getcopyright(): string
```
```
public getfilename(): string
```
```
public getimagebackgroundcolor(): GmagickPixel
```
```
public getimageblueprimary(): array
```
```
public getimagebordercolor(): GmagickPixel
```
```
public getimagechanneldepth(int $channel_type): int
```
```
public getimagecolors(): int
```
```
public getimagecolorspace(): int
```
```
public getimagecompose(): int
```
```
public getimagedelay(): int
```
```
public getimagedepth(): int
```
```
public getimagedispose(): int
```
```
public getimageextrema(): array
```
```
public getimagefilename(): string
```
```
public getimageformat(): string
```
```
public getimagegamma(): float
```
```
public getimagegreenprimary(): array
```
```
public getimageheight(): int
```
```
public getimagehistogram(): array
```
```
public getimageindex(): int
```
```
public getimageinterlacescheme(): int
```
```
public getimageiterations(): int
```
```
public getimagematte(): int
```
```
public getimagemattecolor(): GmagickPixel
```
```
public getimageprofile(string $name): string
```
```
public getimageredprimary(): array
```
```
public getimagerenderingintent(): int
```
```
public getimageresolution(): array
```
```
public getimagescene(): int
```
```
public getimagesignature(): string
```
```
public getimagetype(): int
```
```
public getimageunits(): int
```
```
public getimagewhitepoint(): array
```
```
public getimagewidth(): int
```
```
public getpackagename(): string
```
```
public getquantumdepth(): array
```
```
public getreleasedate(): string
```
```
public getsamplingfactors(): array
```
```
public getsize(): array
```
```
public getversion(): array
```
```
public hasnextimage(): mixed
```
```
public haspreviousimage(): mixed
```
```
public implodeimage(float $radius): mixed
```
```
public labelimage(string $label): mixed
```
```
public levelimage(
float $blackPoint,
float $gamma,
float $whitePoint,
int $channel = Gmagick::CHANNEL_DEFAULT
): mixed
```
```
public magnifyimage(): mixed
```
```
public mapimage(gmagick $gmagick, bool $dither): Gmagick
```
```
public medianfilterimage(float $radius): void
```
```
public minifyimage(): Gmagick
```
```
public modulateimage(float $brightness, float $saturation, float $hue): Gmagick
```
```
public motionblurimage(float $radius, float $sigma, float $angle): Gmagick
```
```
public newimage(
int $width,
int $height,
string $background,
string $format = ?
): Gmagick
```
```
public nextimage(): bool
```
```
public normalizeimage(int $channel = ?): Gmagick
```
```
public oilpaintimage( float $radius ): Gmagick
```
```
public previousimage(): bool
```
```
public profileimage(string $name, string $profile): Gmagick
```
```
public quantizeimage(
int $numColors,
int $colorspace,
int $treeDepth,
bool $dither,
bool $measureError
): Gmagick
```
```
public quantizeimages(
int $numColors,
int $colorspace,
int $treeDepth,
bool $dither,
bool $measureError
): Gmagick
```
```
public queryfontmetrics(GmagickDraw $draw, string $text): array
```
```
public queryfonts(string $pattern = "*"): array
```
```
public queryformats(string $pattern = "*"): array
```
```
public radialblurimage(float $angle, int $channel = Gmagick::CHANNEL_DEFAULT): Gmagick
```
```
public raiseimage(
int $width,
int $height,
int $x,
int $y,
bool $raise
): Gmagick
```
```
public read(string $filename): Gmagick
```
```
public readimage(string $filename): Gmagick
```
```
public readimageblob(string $imageContents, string $filename = ?): Gmagick
```
```
public readimagefile(resource $fp, string $filename = ?): Gmagick
```
```
public reducenoiseimage(float $radius): Gmagick
```
```
public removeimage(): Gmagick
```
```
public removeimageprofile(string $name): string
```
```
public resampleimage(
float $xResolution,
float $yResolution,
int $filter,
float $blur
): Gmagick
```
```
public resizeimage(
int $width,
int $height,
int $filter,
float $blur,
bool $fit = false
): Gmagick
```
```
public rollimage(int $x, int $y): Gmagick
```
```
public rotateimage(mixed $color, float $degrees): Gmagick
```
```
public scaleimage(int $width, int $height, bool $fit = false): Gmagick
```
```
public separateimagechannel(int $channel): Gmagick
```
```
setCompressionQuality( int $quality = 75 ): Gmagick
```
```
public setfilename(string $filename): Gmagick
```
```
public setimagebackgroundcolor(GmagickPixel $color): Gmagick
```
```
public setimageblueprimary(float $x, float $y): Gmagick
```
```
public setimagebordercolor(GmagickPixel $color): Gmagick
```
```
public setimagechanneldepth(int $channel, int $depth): Gmagick
```
```
public setimagecolorspace(int $colorspace): Gmagick
```
```
public setimagecompose(int $composite): Gmagick
```
```
public setimagedelay(int $delay): Gmagick
```
```
public setimagedepth(int $depth): Gmagick
```
```
public setimagedispose(int $disposeType): Gmagick
```
```
public setimagefilename(string $filename): Gmagick
```
```
public setimageformat(string $imageFormat): Gmagick
```
```
public setimagegamma(float $gamma): Gmagick
```
```
public setimagegreenprimary(float $x, float $y): Gmagick
```
```
public setimageindex(int $index): Gmagick
```
```
public setimageinterlacescheme(int $interlace): Gmagick
```
```
public setimageiterations(int $iterations): Gmagick
```
```
public setimageprofile(string $name, string $profile): Gmagick
```
```
public setimageredprimary(float $x, float $y): Gmagick
```
```
public setimagerenderingintent(int $rendering_intent): Gmagick
```
```
public setimageresolution(float $xResolution, float $yResolution): Gmagick
```
```
public setimagescene(int $scene): Gmagick
```
```
public setimagetype(int $imgType): Gmagick
```
```
public setimageunits(int $resolution): Gmagick
```
```
public setimagewhitepoint(float $x, float $y): Gmagick
```
```
public setsamplingfactors(array $factors): Gmagick
```
```
public setsize(int $columns, int $rows): Gmagick
```
```
public shearimage(mixed $color, float $xShear, float $yShear): Gmagick
```
```
public solarizeimage(int $threshold): Gmagick
```
```
public spreadimage(float $radius): Gmagick
```
```
public stripimage(): Gmagick
```
```
public swirlimage(float $degrees): Gmagick
```
```
public thumbnailimage(int $width, int $height, bool $fit = false): Gmagick
```
```
public trimimage(float $fuzz): Gmagick
```
```
public writeimage(string $filename, bool $all_frames = false): Gmagick
```
} Table of Contents
-----------------
* [Gmagick::addimage](gmagick.addimage) — Adds new image to Gmagick object image list
* [Gmagick::addnoiseimage](gmagick.addnoiseimage) — Adds random noise to the image
* [Gmagick::annotateimage](gmagick.annotateimage) — Annotates an image with text
* [Gmagick::blurimage](gmagick.blurimage) — Adds blur filter to image
* [Gmagick::borderimage](gmagick.borderimage) — Surrounds the image with a border
* [Gmagick::charcoalimage](gmagick.charcoalimage) — Simulates a charcoal drawing
* [Gmagick::chopimage](gmagick.chopimage) — Removes a region of an image and trims
* [Gmagick::clear](gmagick.clear) — Clears all resources associated to Gmagick object
* [Gmagick::commentimage](gmagick.commentimage) — Adds a comment to your image
* [Gmagick::compositeimage](gmagick.compositeimage) — Composite one image onto another
* [Gmagick::\_\_construct](gmagick.construct) — The Gmagick constructor
* [Gmagick::cropimage](gmagick.cropimage) — Extracts a region of the image
* [Gmagick::cropthumbnailimage](gmagick.cropthumbnailimage) — Creates a crop thumbnail
* [Gmagick::current](gmagick.current) — The current purpose
* [Gmagick::cyclecolormapimage](gmagick.cyclecolormapimage) — Displaces an image's colormap
* [Gmagick::deconstructimages](gmagick.deconstructimages) — Returns certain pixel differences between images
* [Gmagick::despeckleimage](gmagick.despeckleimage) — The despeckleimage purpose
* [Gmagick::destroy](gmagick.destroy) — The destroy purpose
* [Gmagick::drawimage](gmagick.drawimage) — Renders the GmagickDraw object on the current image
* [Gmagick::edgeimage](gmagick.edgeimage) — Enhance edges within the image
* [Gmagick::embossimage](gmagick.embossimage) — Returns a grayscale image with a three-dimensional effect
* [Gmagick::enhanceimage](gmagick.enhanceimage) — Improves the quality of a noisy image
* [Gmagick::equalizeimage](gmagick.equalizeimage) — Equalizes the image histogram
* [Gmagick::flipimage](gmagick.flipimage) — Creates a vertical mirror image
* [Gmagick::flopimage](gmagick.flopimage) — Creates a horizontal mirror image
* [Gmagick::frameimage](gmagick.frameimage) — Adds a simulated three-dimensional border
* [Gmagick::gammaimage](gmagick.gammaimage) — Gamma-corrects an image
* [Gmagick::getcopyright](gmagick.getcopyright) — Returns the GraphicsMagick API copyright as a string
* [Gmagick::getfilename](gmagick.getfilename) — The filename associated with an image sequence
* [Gmagick::getimagebackgroundcolor](gmagick.getimagebackgroundcolor) — Returns the image background color
* [Gmagick::getimageblueprimary](gmagick.getimageblueprimary) — Returns the chromaticy blue primary point
* [Gmagick::getimagebordercolor](gmagick.getimagebordercolor) — Returns the image border color
* [Gmagick::getimagechanneldepth](gmagick.getimagechanneldepth) — Gets the depth for a particular image channel
* [Gmagick::getimagecolors](gmagick.getimagecolors) — Returns the color of the specified colormap index
* [Gmagick::getimagecolorspace](gmagick.getimagecolorspace) — Gets the image colorspace
* [Gmagick::getimagecompose](gmagick.getimagecompose) — Returns the composite operator associated with the image
* [Gmagick::getimagedelay](gmagick.getimagedelay) — Gets the image delay
* [Gmagick::getimagedepth](gmagick.getimagedepth) — Gets the depth of the image
* [Gmagick::getimagedispose](gmagick.getimagedispose) — Gets the image disposal method
* [Gmagick::getimageextrema](gmagick.getimageextrema) — Gets the extrema for the image
* [Gmagick::getimagefilename](gmagick.getimagefilename) — Returns the filename of a particular image in a sequence
* [Gmagick::getimageformat](gmagick.getimageformat) — Returns the format of a particular image in a sequence
* [Gmagick::getimagegamma](gmagick.getimagegamma) — Gets the image gamma
* [Gmagick::getimagegreenprimary](gmagick.getimagegreenprimary) — Returns the chromaticy green primary point
* [Gmagick::getimageheight](gmagick.getimageheight) — Returns the image height
* [Gmagick::getimagehistogram](gmagick.getimagehistogram) — Gets the image histogram
* [Gmagick::getimageindex](gmagick.getimageindex) — Gets the index of the current active image
* [Gmagick::getimageinterlacescheme](gmagick.getimageinterlacescheme) — Gets the image interlace scheme
* [Gmagick::getimageiterations](gmagick.getimageiterations) — Gets the image iterations
* [Gmagick::getimagematte](gmagick.getimagematte) — Check if the image has a matte channel
* [Gmagick::getimagemattecolor](gmagick.getimagemattecolor) — Returns the image matte color
* [Gmagick::getimageprofile](gmagick.getimageprofile) — Returns the named image profile
* [Gmagick::getimageredprimary](gmagick.getimageredprimary) — Returns the chromaticity red primary point
* [Gmagick::getimagerenderingintent](gmagick.getimagerenderingintent) — Gets the image rendering intent
* [Gmagick::getimageresolution](gmagick.getimageresolution) — Gets the image X and Y resolution
* [Gmagick::getimagescene](gmagick.getimagescene) — Gets the image scene
* [Gmagick::getimagesignature](gmagick.getimagesignature) — Generates an SHA-256 message digest
* [Gmagick::getimagetype](gmagick.getimagetype) — Gets the potential image type
* [Gmagick::getimageunits](gmagick.getimageunits) — Gets the image units of resolution
* [Gmagick::getimagewhitepoint](gmagick.getimagewhitepoint) — Returns the chromaticity white point
* [Gmagick::getimagewidth](gmagick.getimagewidth) — Returns the width of the image
* [Gmagick::getpackagename](gmagick.getpackagename) — Returns the GraphicsMagick package name
* [Gmagick::getquantumdepth](gmagick.getquantumdepth) — Returns the Gmagick quantum depth as a string
* [Gmagick::getreleasedate](gmagick.getreleasedate) — Returns the GraphicsMagick release date as a string
* [Gmagick::getsamplingfactors](gmagick.getsamplingfactors) — Gets the horizontal and vertical sampling factor
* [Gmagick::getsize](gmagick.getsize) — Returns the size associated with the Gmagick object
* [Gmagick::getversion](gmagick.getversion) — Returns the GraphicsMagick API version
* [Gmagick::hasnextimage](gmagick.hasnextimage) — Checks if the object has more images
* [Gmagick::haspreviousimage](gmagick.haspreviousimage) — Checks if the object has a previous image
* [Gmagick::implodeimage](gmagick.implodeimage) — Creates a new image as a copy
* [Gmagick::labelimage](gmagick.labelimage) — Adds a label to an image
* [Gmagick::levelimage](gmagick.levelimage) — Adjusts the levels of an image
* [Gmagick::magnifyimage](gmagick.magnifyimage) — Scales an image proportionally 2x
* [Gmagick::mapimage](gmagick.mapimage) — Replaces the colors of an image with the closest color from a reference image
* [Gmagick::medianfilterimage](gmagick.medianfilterimage) — Applies a digital filter
* [Gmagick::minifyimage](gmagick.minifyimage) — Scales an image proportionally to half its size
* [Gmagick::modulateimage](gmagick.modulateimage) — Control the brightness, saturation, and hue
* [Gmagick::motionblurimage](gmagick.motionblurimage) — Simulates motion blur
* [Gmagick::newimage](gmagick.newimage) — Creates a new image
* [Gmagick::nextimage](gmagick.nextimage) — Moves to the next image
* [Gmagick::normalizeimage](gmagick.normalizeimage) — Enhances the contrast of a color image
* [Gmagick::oilpaintimage](gmagick.oilpaintimage) — Simulates an oil painting
* [Gmagick::previousimage](gmagick.previousimage) — Move to the previous image in the object
* [Gmagick::profileimage](gmagick.profileimage) — Adds or removes a profile from an image
* [Gmagick::quantizeimage](gmagick.quantizeimage) — Analyzes the colors within a reference image
* [Gmagick::quantizeimages](gmagick.quantizeimages) — The quantizeimages purpose
* [Gmagick::queryfontmetrics](gmagick.queryfontmetrics) — Returns an array representing the font metrics
* [Gmagick::queryfonts](gmagick.queryfonts) — Returns the configured fonts
* [Gmagick::queryformats](gmagick.queryformats) — Returns formats supported by Gmagick
* [Gmagick::radialblurimage](gmagick.radialblurimage) — Radial blurs an image
* [Gmagick::raiseimage](gmagick.raiseimage) — Creates a simulated 3d button-like effect
* [Gmagick::read](gmagick.read) — Reads image from filename
* [Gmagick::readimage](gmagick.readimage) — Reads image from filename
* [Gmagick::readimageblob](gmagick.readimageblob) — Reads image from a binary string
* [Gmagick::readimagefile](gmagick.readimagefile) — The readimagefile purpose
* [Gmagick::reducenoiseimage](gmagick.reducenoiseimage) — Smooths the contours of an image
* [Gmagick::removeimage](gmagick.removeimage) — Removes an image from the image list
* [Gmagick::removeimageprofile](gmagick.removeimageprofile) — Removes the named image profile and returns it
* [Gmagick::resampleimage](gmagick.resampleimage) — Resample image to desired resolution
* [Gmagick::resizeimage](gmagick.resizeimage) — Scales an image
* [Gmagick::rollimage](gmagick.rollimage) — Offsets an image
* [Gmagick::rotateimage](gmagick.rotateimage) — Rotates an image
* [Gmagick::scaleimage](gmagick.scaleimage) — Scales the size of an image
* [Gmagick::separateimagechannel](gmagick.separateimagechannel) — Separates a channel from the image
* [Gmagick::setCompressionQuality](gmagick.setcompressionquality) — Sets the object's default compression quality
* [Gmagick::setfilename](gmagick.setfilename) — Sets the filename before you read or write the image
* [Gmagick::setimagebackgroundcolor](gmagick.setimagebackgroundcolor) — Sets the image background color
* [Gmagick::setimageblueprimary](gmagick.setimageblueprimary) — Sets the image chromaticity blue primary point
* [Gmagick::setimagebordercolor](gmagick.setimagebordercolor) — Sets the image border color
* [Gmagick::setimagechanneldepth](gmagick.setimagechanneldepth) — Sets the depth of a particular image channel
* [Gmagick::setimagecolorspace](gmagick.setimagecolorspace) — Sets the image colorspace
* [Gmagick::setimagecompose](gmagick.setimagecompose) — Sets the image composite operator
* [Gmagick::setimagedelay](gmagick.setimagedelay) — Sets the image delay
* [Gmagick::setimagedepth](gmagick.setimagedepth) — Sets the image depth
* [Gmagick::setimagedispose](gmagick.setimagedispose) — Sets the image disposal method
* [Gmagick::setimagefilename](gmagick.setimagefilename) — Sets the filename of a particular image in a sequence
* [Gmagick::setimageformat](gmagick.setimageformat) — Sets the format of a particular image
* [Gmagick::setimagegamma](gmagick.setimagegamma) — Sets the image gamma
* [Gmagick::setimagegreenprimary](gmagick.setimagegreenprimary) — Sets the image chromaticity green primary point
* [Gmagick::setimageindex](gmagick.setimageindex) — Set the iterator to the position in the image list specified with the index parameter
* [Gmagick::setimageinterlacescheme](gmagick.setimageinterlacescheme) — Sets the interlace scheme of the image
* [Gmagick::setimageiterations](gmagick.setimageiterations) — Sets the image iterations
* [Gmagick::setimageprofile](gmagick.setimageprofile) — Adds a named profile to the Gmagick object
* [Gmagick::setimageredprimary](gmagick.setimageredprimary) — Sets the image chromaticity red primary point
* [Gmagick::setimagerenderingintent](gmagick.setimagerenderingintent) — Sets the image rendering intent
* [Gmagick::setimageresolution](gmagick.setimageresolution) — Sets the image resolution
* [Gmagick::setimagescene](gmagick.setimagescene) — Sets the image scene
* [Gmagick::setimagetype](gmagick.setimagetype) — Sets the image type
* [Gmagick::setimageunits](gmagick.setimageunits) — Sets the image units of resolution
* [Gmagick::setimagewhitepoint](gmagick.setimagewhitepoint) — Sets the image chromaticity white point
* [Gmagick::setsamplingfactors](gmagick.setsamplingfactors) — Sets the image sampling factors
* [Gmagick::setsize](gmagick.setsize) — Sets the size of the Gmagick object
* [Gmagick::shearimage](gmagick.shearimage) — Creating a parallelogram
* [Gmagick::solarizeimage](gmagick.solarizeimage) — Applies a solarizing effect to the image
* [Gmagick::spreadimage](gmagick.spreadimage) — Randomly displaces each pixel in a block
* [Gmagick::stripimage](gmagick.stripimage) — Strips an image of all profiles and comments
* [Gmagick::swirlimage](gmagick.swirlimage) — Swirls the pixels about the center of the image
* [Gmagick::thumbnailimage](gmagick.thumbnailimage) — Changes the size of an image
* [Gmagick::trimimage](gmagick.trimimage) — Remove edges from the image
* [Gmagick::write](gmagick.write) — Alias of Gmagick::writeimage
* [Gmagick::writeimage](gmagick.writeimage) — Writes an image to the specified filename
| programming_docs |
php ob_list_handlers ob\_list\_handlers
==================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
ob\_list\_handlers — List all output handlers in use
### Description
```
ob_list_handlers(): array
```
Lists all output handlers in use.
### Parameters
This function has no parameters.
### Return Values
This will return an array with the output handlers in use (if any). If [output\_buffering](https://www.php.net/manual/en/outcontrol.configuration.php#ini.output-buffering) is enabled or an anonymous function was used with [ob\_start()](function.ob-start), **ob\_list\_handlers()** will return "default output handler".
### Examples
**Example #1 **ob\_list\_handlers()** example**
```
<?php
//using output_buffering=On
print_r(ob_list_handlers());
ob_end_flush();
ob_start("ob_gzhandler");
print_r(ob_list_handlers());
ob_end_flush();
// anonymous functions
ob_start(function($string) { return $string; });
print_r(ob_list_handlers());
ob_end_flush();
?>
```
The above example will output:
```
Array
(
[0] => default output handler
)
Array
(
[0] => ob_gzhandler
)
Array
(
[0] => Closure::__invoke
)
```
### 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\_get\_flush()](function.ob-get-flush) - Flush the output buffer, return it as a string and turn off output buffering
* [ob\_start()](function.ob-start) - Turn on output buffering
php Yaf_Route_Interface::assemble Yaf\_Route\_Interface::assemble
===============================
(Yaf >=2.3.0)
Yaf\_Route\_Interface::assemble — Assemble a request
### Description
```
abstract public Yaf_Route_Interface::assemble(array $info, array $query = ?): string
```
this method returns a url according to the argument info, and append query strings to the url according to the argument query.
a route should implement this method according to its own route rules, and do a reverse progress.
### Parameters
`info`
`query`
### Return Values
php get_current_user get\_current\_user
==================
(PHP 4, PHP 5, PHP 7, PHP 8)
get\_current\_user — Gets the name of the owner of the current PHP script
### Description
```
get_current_user(): string
```
Returns the name of the owner of the current PHP script.
### Parameters
This function has no parameters.
### Return Values
Returns the username as a string.
### Examples
**Example #1 **get\_current\_user()** example**
```
<?php
echo 'Current script owner: ' . get_current_user();
?>
```
The above example will output something similar to:
```
Current script owner: SYSTEM
```
### See Also
* [getmyuid()](function.getmyuid) - Gets PHP script owner's UID
* [getmygid()](function.getmygid) - Get PHP script owner's GID
* [getmypid()](function.getmypid) - Gets PHP's process ID
* [getmyinode()](function.getmyinode) - Gets the inode of the current script
* [getlastmod()](function.getlastmod) - Gets time of last page modification
php tidy::__construct tidy::\_\_construct
===================
(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.5.2)
tidy::\_\_construct — Constructs a new [tidy](class.tidy) object
### Description
public **tidy::\_\_construct**(
?string `$filename` = **`null`**,
array|string|null `$config` = **`null`**,
?string `$encoding` = **`null`**,
bool `$useIncludePath` = **`false`**
) Constructs a new [tidy](class.tidy) object.
### Parameters
`filename`
If the `filename` parameter is given, this function will also read that file and initialize the object with the file, acting like [tidy\_parse\_file()](tidy.parsefile).
`config`
The config `config` can be passed either as an array or as a string. If a string is passed, it is interpreted as the name of the configuration file, otherwise, it is interpreted as the options themselves.
For an explanation about each option, visit [» http://api.html-tidy.org/#quick-reference](http://api.html-tidy.org/#quick-reference).
`encoding`
The `encoding` parameter sets the encoding for input/output documents. The possible values for encoding are: `ascii`, `latin0`, `latin1`, `raw`, `utf8`, `iso2022`, `mac`, `win1252`, `ibm858`, `utf16`, `utf16le`, `utf16be`, `big5`, and `shiftjis`.
`useIncludePath`
Search for the file in the [include\_path](https://www.php.net/manual/en/ini.core.php#ini.include-path).
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `filename`, `config`, `encoding` and `useIncludePath` are nullable now. |
### Examples
**Example #1 **tidy::\_\_construct()** example**
```
<?php
$html = <<< HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><title>title</title></head>
<body>
<p>paragraph <bt />
text</p>
</body></html>
HTML;
$tidy = new tidy();
$tidy->ParseString($html);
$tidy->cleanRepair();
if ($tidy->errorBuffer) {
echo "The following errors were detected:\n";
echo $tidy->errorBuffer;
}
?>
```
The above example will output:
```
The following errors were detected:
line 8 column 14 - Error: <bt> is not recognized!
line 8 column 14 - Warning: discarding unexpected <bt>
```
### See Also
* [tidy::parseFile()](tidy.parsefile) - Parse markup in file or URI
* [tidy::parseString()](tidy.parsestring) - Parse a document stored in a string
php SNMP::getnext SNMP::getnext
=============
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
SNMP::getnext — Fetch an SNMP object which follows the given object id
### Description
```
public SNMP::getnext(array|string $objectId): mixed
```
Fetch an SNMP object that follows specified `objectId`.
### Parameters
If `objectId` is a string, then **SNMP::getnext()** 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
### 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");
$nsysdescr = $session->getnext("sysDescr.0");
echo "$nsysdescr\n";
$nsysdescr = $session->getnext(array("sysDescr.0"));
print_r($nsysdescr);
?>
```
The above example will output something similar to:
```
OID: NET-SNMP-MIB::netSnmpAgentOIDs.8
Array
(
[SNMPv2-MIB::sysObjectID.0] => OID: NET-SNMP-MIB::netSnmpAgentOIDs.8
)
```
**Example #2 Miltiple SNMP objects**
```
<?php
$session = new SNMP(SNMP::VERSION_1, "127.0.0.1", "public");
$results = $session->getnext(array("sysDescr.0", "sysName.0"));
print_r($results);
$session->close();
?>
```
The above example will output something similar to:
```
Array
(
[SNMPv2-MIB::sysObjectID.0] => OID: NET-SNMP-MIB::netSnmpAgentOIDs.8
[SNMPv2-MIB::sysLocation.0] => STRING: Nowhere
)
```
### See Also
* [SNMP::getErrno()](snmp.geterrno) - Get last error code
* [SNMP::getError()](snmp.geterror) - Get last error message
php array_multisort array\_multisort
================
(PHP 4, PHP 5, PHP 7, PHP 8)
array\_multisort — Sort multiple or multi-dimensional arrays
### Description
```
array_multisort(
array &$array1,
mixed $array1_sort_order = SORT_ASC,
mixed $array1_sort_flags = SORT_REGULAR,
mixed ...$rest
): bool
```
**array\_multisort()** can be used to sort several arrays at once, or a multi-dimensional array by one or more dimensions.
Associative (string) keys will be maintained, but numeric keys will be re-indexed.
>
> **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
`array1`
An array being sorted.
`array1_sort_order`
The order used to sort the previous array argument. Either **`SORT_ASC`** to sort ascendingly or **`SORT_DESC`** to sort descendingly.
This argument can be swapped with `array1_sort_flags` or omitted entirely, in which case **`SORT_ASC`** is assumed.
`array1_sort_flags`
Sort options for the previous array argument:
Sorting type flags:
* **`SORT_REGULAR`** - compare items normally (don't change types)
* **`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
This argument can be swapped with `array1_sort_order` or omitted entirely, in which case **`SORT_REGULAR`** is assumed.
`rest`
More arrays, optionally followed by sort order and flags. Only elements corresponding to equivalent elements in previous arrays are compared. In other words, the sort is lexicographical.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Sorting multiple arrays**
```
<?php
$ar1 = array(10, 100, 100, 0);
$ar2 = array(1, 3, 2, 4);
array_multisort($ar1, $ar2);
var_dump($ar1);
var_dump($ar2);
?>
```
In this example, after sorting, the first array will contain 0, 10, 100, 100. The second array will contain 4, 1, 2, 3. The entries in the second array corresponding to the identical entries in the first array (100 and 100) were sorted as well.
```
array(4) {
[0]=> int(0)
[1]=> int(10)
[2]=> int(100)
[3]=> int(100)
}
array(4) {
[0]=> int(4)
[1]=> int(1)
[2]=> int(2)
[3]=> int(3)
}
```
**Example #2 Sorting multi-dimensional array**
```
<?php
$ar = array(
array("10", 11, 100, 100, "a"),
array( 1, 2, "2", 3, 1)
);
array_multisort($ar[0], SORT_ASC, SORT_STRING,
$ar[1], SORT_NUMERIC, SORT_DESC);
var_dump($ar);
?>
```
In this example, after sorting, the first array will transform to "10", 100, 100, 11, "a" (it was sorted as strings in ascending order). The second will contain 1, 3, "2", 2, 1 (sorted as numbers, in descending order).
```
array(2) {
[0]=> array(5) {
[0]=> string(2) "10"
[1]=> int(100)
[2]=> int(100)
[3]=> int(11)
[4]=> string(1) "a"
}
[1]=> array(5) {
[0]=> int(1)
[1]=> int(3)
[2]=> string(1) "2"
[3]=> int(2)
[4]=> int(1)
}
}
```
**Example #3 Sorting database results**
For this example, each element in the data array represents one row in a table. This type of dataset is typical of database records.
Example data:
```
volume | edition
-------+--------
67 | 2
86 | 1
85 | 6
98 | 2
86 | 6
67 | 7
```
The data as an array, called data. This would usually, for example, be obtained by looping with [mysqli\_fetch\_assoc()](mysqli-result.fetch-assoc).
```
<?php
$data[] = array('volume' => 67, 'edition' => 2);
$data[] = array('volume' => 86, 'edition' => 1);
$data[] = array('volume' => 85, 'edition' => 6);
$data[] = array('volume' => 98, 'edition' => 2);
$data[] = array('volume' => 86, 'edition' => 6);
$data[] = array('volume' => 67, 'edition' => 7);
?>
```
In this example, we will order by volume descending, edition ascending.
We have an array of rows, but **array\_multisort()** requires an array of columns, so we use the below code to obtain the columns, then perform the sorting.
```
<?php
// Obtain a list of columns
foreach ($data as $key => $row) {
$volume[$key] = $row['volume'];
$edition[$key] = $row['edition'];
}
// you can use array_column() instead of the above code
$volume = array_column($data, 'volume');
$edition = array_column($data, 'edition');
// Sort the data with volume descending, edition ascending
// Add $data as the last parameter, to sort by the common key
array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $data);
?>
```
The dataset is now sorted, and will look like this:
```
volume | edition
-------+--------
98 | 2
86 | 1
86 | 6
85 | 6
67 | 2
67 | 7
```
**Example #4 Case insensitive sorting**
Both **`SORT_STRING`** and **`SORT_REGULAR`** are case sensitive, strings starting with a capital letter will come before strings starting with a lowercase letter.
To perform a case insensitive sort, force the sorting order to be determined by a lowercase copy of the original array.
```
<?php
$array = array('Alpha', 'atomic', 'Beta', 'bank');
$array_lowercase = array_map('strtolower', $array);
array_multisort($array_lowercase, SORT_ASC, SORT_STRING, $array);
print_r($array);
?>
```
The above example will output:
```
Array
(
[0] => Alpha
[1] => atomic
[2] => bank
[3] => Beta
)
```
### See Also
* [usort()](function.usort) - Sort an array by values using a user-defined comparison function
* The [comparison of array sorting functions](https://www.php.net/manual/en/array.sorting.php)
php SolrDisMaxQuery::__construct SolrDisMaxQuery::\_\_construct
==============================
(No version information available, might only be in Git)
SolrDisMaxQuery::\_\_construct — Class Constructor
### Description
public **SolrDisMaxQuery::\_\_construct**(string `$q` = ?) Class constructor initializes the object and sets the q parameter if passed
### Parameters
`q`
Search Query (q parameter)
### Return Values
### Errors/Exceptions
Emits [SolrIllegalArgumentException](class.solrillegalargumentexception) in case of an invalid parameter was passed.
### Examples
**Example #1 **SolrDisMaxQuery::\_\_construct()** example**
```
<?php
$dismaxQuery = new SolrDisMaxQuery('lucene');
echo $dismaxQuery;
?>
```
The above example will output:
```
q=lucene&defType=edismax
```
php shmop_close shmop\_close
============
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
shmop\_close — Close shared memory block
**Warning**This function has been *DEPRECATED* as of PHP 8.0.0. Relying on this function is highly discouraged.
### Description
```
shmop_close(Shmop $shmop): void
```
>
> **Note**:
>
>
> This function has no effect. Prior to PHP 8.0.0, this function was used to close the resource.
>
>
**shmop\_close()** is used to close a shared memory block.
### Parameters
`shmop`
The shared memory block resource created by [shmop\_open()](function.shmop-open)
### Return Values
No value is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `shmop` expects a [Shmop](class.shmop) instance now; previously, a resource was expected. |
### Examples
**Example #1 Closing shared memory block**
```
<?php
shmop_close($shm_id);
?>
```
This example will close shared memory block identified by `$shm_id`.
### See Also
* [shmop\_open()](function.shmop-open) - Create or open shared memory block
php DOMElement::getAttributeNS DOMElement::getAttributeNS
==========================
(PHP 5, PHP 7, PHP 8)
DOMElement::getAttributeNS — Returns value of attribute
### Description
```
public DOMElement::getAttributeNS(?string $namespace, string $localName): string
```
Gets the value of the attribute in namespace `namespace` with local name `localName` for the current node.
### Parameters
`namespace`
The namespace URI.
`localName`
The local name.
### Return Values
The value of the attribute, or an empty string if no attribute with the given `localName` and `namespace` is found.
### See Also
* [DOMElement::hasAttributeNS()](domelement.hasattributens) - Checks to see if attribute exists
* [DOMElement::setAttributeNS()](domelement.setattributens) - Adds new attribute
* [DOMElement::removeAttributeNS()](domelement.removeattributens) - Removes attribute
php ImagickDraw::pathCurveToAbsolute ImagickDraw::pathCurveToAbsolute
================================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::pathCurveToAbsolute — Draws a cubic Bezier curve
### Description
```
public ImagickDraw::pathCurveToAbsolute(
float $x1,
float $y1,
float $x2,
float $y2,
float $x,
float $y
): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Draws a cubic Bezier curve from the current point to (x,y) using (x1,y1) as the control point at the beginning of the curve and (x2,y2) as the control point at the end of the curve using absolute coordinates. At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier.
### Parameters
`x1`
x coordinate of the first control point
`y1`
y coordinate of the first control point
`x2`
x coordinate of the second control point
`y2`
y coordinate of the first control point
`x`
x coordinate of the curve end
`y`
y coordinate of the curve end
### Return Values
No value is returned.
php None Execution Operators
-------------------
PHP supports one execution operator: backticks (``). Note that these are not single-quotes! PHP will attempt to execute the contents of the backticks as a shell command; the output will be returned (i.e., it won't simply be dumped to output; it can be assigned to a variable). Use of the backtick operator is identical to [shell\_exec()](function.shell-exec).
```
<?php
$output = `ls -al`;
echo "<pre>$output</pre>";
?>
```
>
> **Note**:
>
>
> The backtick operator is disabled when [shell\_exec()](function.shell-exec) is disabled.
>
>
>
> **Note**:
>
>
> Unlike some other languages, backticks have no special meaning within double-quoted strings.
>
>
### See Also
* [Program Execution functions](https://www.php.net/manual/en/ref.exec.php)
* [popen()](function.popen)
* [proc\_open()](function.proc-open)
* [Using PHP from the commandline](https://www.php.net/manual/en/features.commandline.php)
php IntlTimeZone::getUnknown IntlTimeZone::getUnknown
========================
intltz\_get\_unknown
====================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlTimeZone::getUnknown -- intltz\_get\_unknown — Get the "unknown" time zone
### Description
Object-oriented style (method):
```
public static IntlTimeZone::getUnknown(): IntlTimeZone
```
Procedural style:
```
intltz_get_unknown(): IntlTimeZone
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
Returns [IntlTimeZone](class.intltimezone) or **`null`** on failure.
php strstr strstr
======
(PHP 4, PHP 5, PHP 7, PHP 8)
strstr — Find the first occurrence of a string
### Description
```
strstr(string $haystack, string $needle, bool $before_needle = false): string|false
```
Returns part of `haystack` string starting from and including the first occurrence of `needle` to the end of `haystack`.
>
> **Note**:
>
>
> This function is case-sensitive. For case-insensitive searches, use [stristr()](function.stristr).
>
>
>
> **Note**:
>
>
> If you only want to determine if a particular `needle` occurs within `haystack`, use the faster and less memory intensive function [strpos()](function.strpos) instead.
>
>
### Parameters
`haystack`
The input string.
`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`**, **strstr()** returns the part of the `haystack` before the first occurrence of the `needle` (excluding the needle).
### Return Values
Returns the portion of string, or **`false`** if `needle` is not found.
### 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 **strstr()** example**
```
<?php
$email = '[email protected]';
$domain = strstr($email, '@');
echo $domain; // prints @example.com
$user = strstr($email, '@', true);
echo $user; // prints name
?>
```
### See Also
* [stristr()](function.stristr) - Case-insensitive strstr
* [strrchr()](function.strrchr) - Find the last occurrence of a character in a string
* [strpos()](function.strpos) - Find the position of the first occurrence of a 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
| programming_docs |
php ArrayIterator::unserialize ArrayIterator::unserialize
==========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
ArrayIterator::unserialize — Unserialize
### Description
```
public ArrayIterator::unserialize(string $data): void
```
Unserialize.
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`data`
The serialized ArrayIterator object to be unserialized.
### Return Values
No value is returned.
### See Also
* [ArrayIterator::serialize()](arrayiterator.serialize) - Serialize
php Yaf_Request_Http::getPost Yaf\_Request\_Http::getPost
===========================
(Yaf >=1.0.0)
Yaf\_Request\_Http::getPost — Retrieve POST variable
### Description
```
public Yaf_Request_Http::getPost(string $name, string $default = ?): mixed
```
Retrieve POST variable
### Parameters
`name`
the variable name
`default`
if this parameter is provide, this will be returned if the varialbe can not be found
### Return Values
### See Also
* [Yaf\_Request\_Http::get()](yaf-request-http.get) - Retrieve variable from client
* [Yaf\_Request\_Http::getQuery()](yaf-request-http.getquery) - Fetch a query parameter
* [Yaf\_Request\_Http::getCookie()](yaf-request-http.getcookie) - Retrieve Cookie variable
* [Yaf\_Request\_Http::getRaw()](yaf-request-http.getraw) - Retrieve Raw request body
* [Yaf\_Request\_Abstract::getServer()](yaf-request-abstract.getserver) - Retrieve SERVER variable
* [Yaf\_Request\_Abstract::getParam()](yaf-request-abstract.getparam) - Retrieve calling parameter
php The EvFork class
The EvFork class
================
Introduction
------------
(PECL ev >= 0.2.0)
Fork watchers are called when a `fork()` was detected (usually because whoever signalled *libev* about it by calling [EvLoop::fork()](evloop.fork) ). The invocation is done before the event loop blocks next and before [EvCheck](class.evcheck) watchers are being called, and only in the child after the fork. Note, that if whoever calling [EvLoop::fork()](evloop.fork) calls it in the wrong process, the fork handlers will be invoked, too.
Class synopsis
--------------
class **EvFork** 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](evfork.construct)( [callable](language.types.callable) `$callback` , [mixed](language.types.declarations#language.types.declarations.mixed) `$data` = **`null`** , int `$priority` = 0 )
```
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
-----------------
* [EvFork::\_\_construct](evfork.construct) — Constructs the EvFork watcher object
* [EvFork::createStopped](evfork.createstopped) — Creates a stopped instance of EvFork watcher class
php PhpToken::__construct PhpToken::\_\_construct
=======================
(PHP 8)
PhpToken::\_\_construct — Returns a new PhpToken object
### Description
final public **PhpToken::\_\_construct**(
int `$id`,
string `$text`,
int `$line` = -1,
int `$pos` = -1
) Returns a new PhpToken object
### Parameters
`id`
One of the T\_\* constants (see [List of Parser Tokens](https://www.php.net/manual/en/tokens.php)), or an ASCII codepoint representing a single-char token.
`text`
The textual content of the token.
`line`
The starting line number (1-based) of the token.
`pos`
The starting position (0-based) in the tokenized string (the number of bytes).
### See Also
* [PhpToken::tokenize()](phptoken.tokenize) - Splits given source into PHP tokens, represented by PhpToken objects.
php Yaf_Config_Ini::__isset Yaf\_Config\_Ini::\_\_isset
===========================
(Yaf >=1.0.0)
Yaf\_Config\_Ini::\_\_isset — Determine if a key is exists
### Description
```
public Yaf_Config_Ini::__isset(string $name): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`name`
### Return Values
php ReflectionEnum::isBacked ReflectionEnum::isBacked
========================
(PHP 8 >= 8.1.0)
ReflectionEnum::isBacked — Determines if an Enum is a Backed Enum
### Description
```
public ReflectionEnum::isBacked(): bool
```
A Backed Enum is one that has a native backing scalar equivalent, either a string or an int. Not all Enums are backed.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the Enum has a backing scalar, **`false`** if not.
### Examples
**Example #1 **ReflectionEnum::isBacked()** example**
```
<?php
enum Suit
{
case Hearts;
case Diamonds;
case Clubs;
case Spades;
}
enum BackedSuit: string
{
case Hearts = 'H';
case Diamonds = 'D';
case Clubs = 'C';
case Spades = 'S';
}
var_dump((new ReflectionEnum(Suit::class))->isBacked());
var_dump((new ReflectionEnum(BackedSuit::class))->isBacked());
?>
```
The above example will output:
```
bool(false)
bool(true)
```
### See Also
* [Enumerations](https://www.php.net/manual/en/language.enumerations.php)
* [ReflectionEnum::getBackingType()](reflectionenum.getbackingtype) - Gets the backing type of an Enum, if any
php Yaf_Controller_Abstract::redirect Yaf\_Controller\_Abstract::redirect
===================================
(Yaf >=1.0.0)
Yaf\_Controller\_Abstract::redirect — Redirect to a URL
### Description
```
public Yaf_Controller_Abstract::redirect(string $url): bool
```
redirect to a URL by sending a 302 header
### Parameters
`url`
a location URL
### Return Values
bool
php Imagick::getImageLength Imagick::getImageLength
=======================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageLength — Returns the image length in bytes
### Description
```
public Imagick::getImageLength(): int
```
Returns the image length in bytes
### Parameters
This function has no parameters.
### Return Values
Returns an int containing the current image size.
### Examples
**Example #1 Using **Imagick::getImageLength()**:**
Getting image length in bytes
```
<?php
$image = new Imagick('test.jpg');
echo $image->getImageLength() . ' bytes';
?>
```
php wddx_packet_end wddx\_packet\_end
=================
(PHP 4, PHP 5, PHP 7)
wddx\_packet\_end — Ends a WDDX packet with the specified ID
**Warning**This function was *REMOVED* in PHP 7.4.0.
### Description
```
wddx_packet_end(resource $packet_id): string
```
Ends and returns the given WDDX packet.
### Parameters
`packet_id`
A WDDX packet, returned by [wddx\_packet\_start()](function.wddx-packet-start).
### Return Values
Returns the string containing the WDDX packet.
php Ds\Map::skip Ds\Map::skip
============
(PECL ds >= 1.0.0)
Ds\Map::skip — Returns the pair at a given positional index
### Description
```
public Ds\Map::skip(int $position): Ds\Pair
```
Returns the pair at a given zero-based `position`.
### Parameters
`position`
The zero-based positional index to return.
### Return Values
Returns the **Ds\Pair** at the given `position`.
### Errors/Exceptions
[OutOfRangeException](class.outofrangeexception) if the position is not valid.
### Examples
**Example #1 **Ds\Map::skip()** example**
```
<?php
$map = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]);
var_dump($map->skip(1));
?>
```
The above example will output something similar to:
```
object(Ds\Pair)#2 (2) {
["key"]=>
string(1) "b"
["value"]=>
int(2)
}
```
php fputcsv fputcsv
=======
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
fputcsv — Format line as CSV and write to file pointer
### Description
```
fputcsv(
resource $stream,
array $fields,
string $separator = ",",
string $enclosure = "\"",
string $escape = "\\",
string $eol = "\n"
): int|false
```
**fputcsv()** formats a line (passed as a `fields` array) as CSV and writes it (terminated by a newline) to the specified file `stream`.
### Parameters
`stream`
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)).
`fields`
An array of strings.
`separator`
The optional `separator` parameter sets the field delimiter (one single-byte character only).
`enclosure`
The optional `enclosure` parameter sets the field enclosure (one single-byte character only).
`escape`
The optional `escape` parameter sets the escape character (at most one single-byte character). An empty string (`""`) disables the proprietary escape mechanism.
`eol`
The optional `eol` parameter sets a custom End of Line sequence.
>
> **Note**:
>
>
> If an `enclosure` character is contained in a field, it will be escaped by doubling it, unless it is immediately preceded by an `escape`.
>
>
### Return Values
Returns the length of the written string or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | The optional `eol` parameter has been added. |
| 7.4.0 | The `escape` parameter now also accepts an empty string to disable the proprietary escape mechanism. |
### Examples
**Example #1 **fputcsv()** example**
```
<?php
$list = array (
array('aaa', 'bbb', 'ccc', 'dddd'),
array('123', '456', '789'),
array('"aaa"', '"bbb"')
);
$fp = fopen('file.csv', 'w');
foreach ($list as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
?>
```
The above example will write the following to `file.csv`:
```
aaa,bbb,ccc,dddd
123,456,789
"""aaa""","""bbb"""
```
### 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
* [fgetcsv()](function.fgetcsv) - Gets line from file pointer and parse for CSV fields
php IntlChar::charType IntlChar::charType
==================
(PHP 7, PHP 8)
IntlChar::charType — Get the general category value for a code point
### Description
```
public static IntlChar::charType(int|string $codepoint): ?int
```
Returns the general category value for the code point.
### 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 the general category type, which may be one of the following constants:
* **`IntlChar::CHAR_CATEGORY_UNASSIGNED`**
* **`IntlChar::CHAR_CATEGORY_GENERAL_OTHER_TYPES`**
* **`IntlChar::CHAR_CATEGORY_UPPERCASE_LETTER`**
* **`IntlChar::CHAR_CATEGORY_LOWERCASE_LETTER`**
* **`IntlChar::CHAR_CATEGORY_TITLECASE_LETTER`**
* **`IntlChar::CHAR_CATEGORY_MODIFIER_LETTER`**
* **`IntlChar::CHAR_CATEGORY_OTHER_LETTER`**
* **`IntlChar::CHAR_CATEGORY_NON_SPACING_MARK`**
* **`IntlChar::CHAR_CATEGORY_ENCLOSING_MARK`**
* **`IntlChar::CHAR_CATEGORY_COMBINING_SPACING_MARK`**
* **`IntlChar::CHAR_CATEGORY_DECIMAL_DIGIT_NUMBER`**
* **`IntlChar::CHAR_CATEGORY_LETTER_NUMBER`**
* **`IntlChar::CHAR_CATEGORY_OTHER_NUMBER`**
* **`IntlChar::CHAR_CATEGORY_SPACE_SEPARATOR`**
* **`IntlChar::CHAR_CATEGORY_LINE_SEPARATOR`**
* **`IntlChar::CHAR_CATEGORY_PARAGRAPH_SEPARATOR`**
* **`IntlChar::CHAR_CATEGORY_CONTROL_CHAR`**
* **`IntlChar::CHAR_CATEGORY_FORMAT_CHAR`**
* **`IntlChar::CHAR_CATEGORY_PRIVATE_USE_CHAR`**
* **`IntlChar::CHAR_CATEGORY_SURROGATE`**
* **`IntlChar::CHAR_CATEGORY_DASH_PUNCTUATION`**
* **`IntlChar::CHAR_CATEGORY_START_PUNCTUATION`**
* **`IntlChar::CHAR_CATEGORY_END_PUNCTUATION`**
* **`IntlChar::CHAR_CATEGORY_CONNECTOR_PUNCTUATION`**
* **`IntlChar::CHAR_CATEGORY_OTHER_PUNCTUATION`**
* **`IntlChar::CHAR_CATEGORY_MATH_SYMBOL`**
* **`IntlChar::CHAR_CATEGORY_CURRENCY_SYMBOL`**
* **`IntlChar::CHAR_CATEGORY_MODIFIER_SYMBOL`**
* **`IntlChar::CHAR_CATEGORY_OTHER_SYMBOL`**
* **`IntlChar::CHAR_CATEGORY_INITIAL_PUNCTUATION`**
* **`IntlChar::CHAR_CATEGORY_FINAL_PUNCTUATION`**
* **`IntlChar::CHAR_CATEGORY_CHAR_CATEGORY_COUNT`**
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::charType("A") === IntlChar::CHAR_CATEGORY_UPPERCASE_LETTER);
var_dump(IntlChar::charType(".") === IntlChar::CHAR_CATEGORY_OTHER_PUNCTUATION);
var_dump(IntlChar::charType("\t") === IntlChar::CHAR_CATEGORY_CONTROL_CHAR);
var_dump(IntlChar::charType("\u{2603}") === IntlChar::CHAR_CATEGORY_OTHER_SYMBOL);
var_dump(IntlChar::charType("multiple chars") === null);
?>
```
The above example will output:
```
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
```
php APCUIterator::key APCUIterator::key
=================
(PECL apcu >= 5.0.0)
APCUIterator::key — Get iterator key
### Description
```
public APCUIterator::key(): string
```
Gets the current iterator key.
### Parameters
This function has no parameters.
### Return Values
Returns the key on success, or **`false`** upon failure.
### See Also
* [APCUIterator::current()](apcuiterator.current) - Get current item
* [Iterator::key()](iterator.key) - Return the key of the current element
php EventBuffer::write EventBuffer::write
==================
(PECL event >= 1.6.0)
EventBuffer::write — Write contents of the buffer to a file or socket
### Description
```
public EventBuffer::write( mixed $fd , int $howmuch = ?): int
```
Write contents of the buffer to a file descriptor. The buffer will be drained after the bytes have been successfully written.
### Parameters
`fd` Socket resource, stream or numeric file descriptor associated normally associated with a socket.
`howmuch` The maximum number of bytes to write.
### Return Values
Returns the number of bytes written, or **`false`** on error.
### See Also
* [EventBuffer::read()](eventbuffer.read) - Read data from an evbuffer and drain the bytes read
php SolrQuery::getGroupSortFields SolrQuery::getGroupSortFields
=============================
(PECL solr >= 2.2.0)
SolrQuery::getGroupSortFields — Returns the group.sort value
### Description
```
public SolrQuery::getGroupSortFields(): array
```
Returns the group.sort value
### Parameters
This function has no parameters.
### Return Values
### See Also
* [SolrQuery::addGroupSortField()](solrquery.addgroupsortfield) - Add a group sort field (group.sort parameter)
php fprintf fprintf
=======
(PHP 5, PHP 7, PHP 8)
fprintf — Write a formatted string to a stream
### Description
```
fprintf(resource $stream, string $format, mixed ...$values): int
```
Write a string produced according to `format` to the stream resource specified by `stream`.
### Parameters
`stream`
A file system pointer resource that is typically created using [fopen()](function.fopen).
`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
Returns the length of the string written.
### Examples
**Example #1 **fprintf()**: zero-padded integers**
```
<?php
if (!($fp = fopen('date.txt', 'w'))) {
return;
}
fprintf($fp, "%04d-%02d-%02d", $year, $month, $day);
// will write the formatted ISO date to date.txt
?>
```
**Example #2 **fprintf()**: formatting currency**
```
<?php
if (!($fp = fopen('currency.txt', 'w'))) {
return;
}
$money1 = 68.75;
$money2 = 54.35;
$money = $money1 + $money2;
// echo $money will output "123.1";
$len = fprintf($fp, '%01.2f', $money);
// will write "123.10" to currency.txt
echo "wrote $len bytes to currency.txt";
// use the return value of fprintf to determine how many bytes we wrote
?>
```
### See Also
* [printf()](function.printf) - Output a formatted string
* [sprintf()](function.sprintf) - Return a formatted string
* [vprintf()](function.vprintf) - Output a formatted string
* [vsprintf()](function.vsprintf) - Return 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 odbc_field_scale odbc\_field\_scale
==================
(PHP 4, PHP 5, PHP 7, PHP 8)
odbc\_field\_scale — Get the scale of a field
### Description
```
odbc_field_scale(resource $statement, int $field): int|false
```
Gets the scale of the field referenced by number in the given result identifier.
### Parameters
`statement`
The result identifier.
`field`
The field number. Field numbering starts at 1.
### Return Values
Returns the field scale as a integer, or **`false`** on error.
php iconv_mime_decode iconv\_mime\_decode
===================
(PHP 5, PHP 7, PHP 8)
iconv\_mime\_decode — Decodes a `MIME` header field
### Description
```
iconv_mime_decode(string $string, int $mode = 0, ?string $encoding = null): string|false
```
Decodes a `MIME` header field.
### Parameters
`string`
The encoded header, as a string.
`mode`
`mode` determines the behaviour in the event **iconv\_mime\_decode()** encounters a malformed `MIME` header field. You can specify any combination of the following bitmasks.
**Bitmasks acceptable to **iconv\_mime\_decode()****| Value | Constant | Description |
| --- | --- | --- |
| 1 | ICONV\_MIME\_DECODE\_STRICT | If set, the given header is decoded in full conformance with the standards defined in [» RFC2047](http://www.faqs.org/rfcs/rfc2047). This option is disabled by default because there are a lot of broken mail user agents that don't follow the specification and don't produce correct `MIME` headers. |
| 2 | ICONV\_MIME\_DECODE\_CONTINUE\_ON\_ERROR | If set, [iconv\_mime\_decode\_headers()](function.iconv-mime-decode-headers) attempts to ignore any grammatical errors and continue to process a given header. |
`encoding`
The optional `encoding` parameter specifies the character set to represent the result by. If omitted or **`null`**, [iconv.internal\_encoding](https://www.php.net/manual/en/iconv.configuration.php) will be used.
### Return Values
Returns a decoded `MIME` field on success, or **`false`** if an error occurs during the decoding.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `encoding` is nullable now. |
### Examples
**Example #1 **iconv\_mime\_decode()** example**
```
<?php
// This yields "Subject: Prüfung Prüfung"
echo iconv_mime_decode("Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=",
0, "ISO-8859-1");
?>
```
### See Also
* [iconv\_mime\_decode\_headers()](function.iconv-mime-decode-headers) - Decodes multiple MIME header fields at once
* [mb\_decode\_mimeheader()](function.mb-decode-mimeheader) - Decode string in MIME header field
* [imap\_mime\_header\_decode()](function.imap-mime-header-decode) - Decode MIME header elements
* [imap\_base64()](function.imap-base64) - Decode BASE64 encoded text
* [imap\_qprint()](function.imap-qprint) - Convert a quoted-printable string to an 8 bit string
php SplFileObject::fgetcsv SplFileObject::fgetcsv
======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::fgetcsv — Gets line from file and parse as CSV fields
### Description
```
public SplFileObject::fgetcsv(string $separator = ",", string $enclosure = "\"", string $escape = "\\"): array|false
```
Gets a line from the file which is in CSV format and returns an array containing the fields read.
>
> **Note**:
>
>
> The locale settings are taken into account by this function. If `LC_CTYPE` is e.g. `en_US.UTF-8`, files in one-byte encodings may be read wrongly by this function.
>
>
### Parameters
`separator`
The field delimiter (one single-byte character only). Defaults as a comma or the value set using [SplFileObject::setCsvControl()](splfileobject.setcsvcontrol).
`enclosure`
The field enclosure character (one single-byte character only). Defaults as a double quotation mark or the value set using [SplFileObject::setCsvControl()](splfileobject.setcsvcontrol).
`escape`
The escape character (at most one single-byte character). Defaults as a backslash (`\`) or the value set using [SplFileObject::setCsvControl()](splfileobject.setcsvcontrol). An empty string (`""`) disables the proprietary escape mechanism.
> **Note**: Usually an `enclosure` character is escpaped inside a field by doubling it; however, the `escape` character can be used as an alternative. So for the default parameter values `""` and `\"` have the same meaning. Other than allowing to escape the `enclosure` character the `escape` character has no special meaning; it isn't even meant to escape itself.
>
>
### Return Values
Returns an indexed array containing the fields read, or **`false`** on error.
>
> **Note**:
>
>
> A blank line in a CSV file will be returned as an array comprising a single **`null`** field unless using **`SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE`**, in which case empty lines are skipped.
>
>
### Changelog
| Version | Description |
| --- | --- |
| 7.4.0 | The `escape` parameter now also accepts an empty string to disable the proprietary escape mechanism. |
### Examples
**Example #1 **SplFileObject::fgetcsv()** example**
```
<?php
$file = new SplFileObject("data.csv");
while (!$file->eof()) {
var_dump($file->fgetcsv());
}
?>
```
**Example #2 **`SplFileObject::READ_CSV`** example**
```
<?php
$file = new SplFileObject("animals.csv");
$file->setFlags(SplFileObject::READ_CSV);
foreach ($file as $row) {
list($animal, $class, $legs) = $row;
printf("A %s is a %s with %d legs\n", $animal, $class, $legs);
}
?>
```
Contents of animals.csv
```
crocodile,reptile,4
dolphin,mammal,0
duck,bird,2
koala,mammal,4
salmon,fish,0
```
The above example will output something similar to:
```
A crocodile is a reptile with 4 legs
A dolphin is a mammal with 0 legs
A duck is a bird with 2 legs
A koala is a mammal with 4 legs
A salmon is a fish with 0 legs
```
### See Also
* [SplFileObject::setCsvControl()](splfileobject.setcsvcontrol) - Set the delimiter, enclosure and escape character for CSV
* [SplFileObject::setFlags()](splfileobject.setflags) - Sets flags for the SplFileObject
* [SplFileObject::READ\_CSV](class.splfileobject#splfileobject.constants.read-csv)
* [SplFileObject::current()](splfileobject.current) - Retrieve current line of file
php XMLWriter::startDtdElement XMLWriter::startDtdElement
==========================
xmlwriter\_start\_dtd\_element
==============================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::startDtdElement -- xmlwriter\_start\_dtd\_element — Create start DTD element
### Description
Object-oriented style
```
public XMLWriter::startDtdElement(string $qualifiedName): bool
```
Procedural style
```
xmlwriter_start_dtd_element(XMLWriter $writer, string $qualifiedName): bool
```
Starts a DTD 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).
`qualifiedName`
The qualified name of the document type to create.
### 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::endDtdElement()](xmlwriter.enddtdelement) - End current DTD element
* [XMLWriter::writeDtdElement()](xmlwriter.writedtdelement) - Write full DTD element tag
php SolrClient::commit SolrClient::commit
==================
(PECL solr >= 0.9.2)
SolrClient::commit — Finalizes all add/deletes made to the index
### Description
```
public SolrClient::commit(bool $softCommit = false, bool $waitSearcher = true, bool $expungeDeletes = false): SolrUpdateResponse
```
This method finalizes all add/deletes made to the index.
### Parameters
`softCommit`
This will refresh the 'view' of the index in a more performant manner, but without "on-disk" guarantees. (Solr4.0+)
A soft commit is much faster since it only makes index changes visible and does not fsync index files or write a new index descriptor. If the JVM crashes or there is a loss of power, changes that occurred after the last hard commit will be lost. Search collections that have near-real-time requirements (that want index changes to be quickly visible to searches) will want to soft commit often but hard commit less frequently.
`waitSearcher`
block until a new searcher is opened and registered as the main query searcher, making the changes visible.
`expungeDeletes`
Merge segments with deletes away. (Solr1.4+)
### Return Values
Returns a [SolrUpdateResponse](class.solrupdateresponse) object on success 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.
### Changelog
| Version | Description |
| --- | --- |
| PECL solr 1.1.0, 2.0.0 | $maxSegments removed |
| PECL solr 2.0.0b | API Changed: SolrClient::commit ([ int $maxSegments = 0 [, bool $softCommit = false [, bool $waitSearcher = true[, bool $expungeDeletes = false ]]] ) |
| PECL solr 0.9.2 | Signature: SolrClient::commit ([ int $maxSegments = 1 [, bool $waitFlush = true [, bool $waitSearcher = true ]]] ). $waitFlush: Block until index changes are flushed to disk. |
### Notes
**Warning** PECL Solr >= 2.0 only supports Solr Server >= 4.0
### See Also
* [SolrClient::optimize()](solrclient.optimize) - Defragments the index
* [SolrClient::rollback()](solrclient.rollback) - Rollbacks all add/deletes made to the index since the last commit
php streamWrapper::dir_closedir streamWrapper::dir\_closedir
============================
(PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8)
streamWrapper::dir\_closedir — Close directory handle
### Description
```
public streamWrapper::dir_closedir(): bool
```
This method is called in response to [closedir()](function.closedir).
Any resources which were locked, or allocated, during opening and use of the directory stream should be released.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [closedir()](function.closedir) - Close directory handle
* [streamWrapper::dir\_opendir()](streamwrapper.dir-opendir) - Open directory handle
php shm_put_var shm\_put\_var
=============
(PHP 4, PHP 5, PHP 7, PHP 8)
shm\_put\_var — Inserts or updates a variable in shared memory
### Description
```
shm_put_var(SysvSharedMemory $shm, int $key, mixed $value): bool
```
**shm\_put\_var()** inserts or updates the `value` with the given `key`.
Warnings (**`E_WARNING`** level) will be issued if `shm` is not a valid SysV shared memory index or if there was not enough shared memory remaining to complete your request.
### Parameters
`shm`
A shared memory segment obtained from [shm\_attach()](function.shm-attach).
`key`
The variable key.
`value`
The variable. All [variable types](https://www.php.net/manual/en/language.types.php) that [serialize()](function.serialize) supports may be used: generally this means all types except for resources and some internal objects that cannot be serialized.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `shm` expects a [SysvSharedMemory](class.sysvsharedmemory) instance now; previously, a resource was expected. |
### See Also
* [shm\_get\_var()](function.shm-get-var) - Returns a variable from shared memory
* [shm\_has\_var()](function.shm-has-var) - Check whether a specific entry exists
php imap_mail_move imap\_mail\_move
================
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_mail\_move — Move specified messages to a mailbox
### Description
```
imap_mail_move(
IMAP\Connection $imap,
string $message_nums,
string $mailbox,
int $flags = 0
): bool
```
Moves mail messages specified by `message_nums` to the specified `mailbox`. Note that the mail messages are actually *copied* to the `mailbox`, and the original messages are flagged for deletion. That implies that the messages in `mailbox` are assigned new UIDs.
### Parameters
`imap`
An [IMAP\Connection](class.imap-connection) instance.
`message_nums`
`message_nums` is a range not just message numbers (as described in [» RFC2060](http://www.faqs.org/rfcs/rfc2060)).
`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.
`flags`
`flags` is a bitmask and may contain the single option:
* **`CP_UID`** - the sequence numbers contain UIDS
### 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
>
> **Note**:
>
>
> **imap\_mail\_move()** will flag the original mail with a delete flag, to successfully delete it a call to the [imap\_expunge()](function.imap-expunge) function must be made.
>
>
### See Also
* [imap\_mail\_copy()](function.imap-mail-copy) - Copy specified messages to a mailbox
php Ds\Vector::toArray Ds\Vector::toArray
==================
(PECL ds >= 1.0.0)
Ds\Vector::toArray — Converts the vector to an array
### Description
```
public Ds\Vector::toArray(): array
```
Converts the vector 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 vector.
### Examples
**Example #1 **Ds\Vector::toArray()** example**
```
<?php
$vector = new \Ds\Vector([1, 2, 3]);
var_dump($vector->toArray());
?>
```
The above example will output something similar to:
```
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
```
php The IntlGregorianCalendar class
The IntlGregorianCalendar class
===============================
Introduction
------------
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
Class synopsis
--------------
class **IntlGregorianCalendar** extends [IntlCalendar](class.intlcalendar) { /\* Inherited constants \*/ public const int [IntlCalendar::FIELD\_ERA](class.intlcalendar#intlcalendar.constants.field-era);
public const int [IntlCalendar::FIELD\_YEAR](class.intlcalendar#intlcalendar.constants.field-year);
public const int [IntlCalendar::FIELD\_MONTH](class.intlcalendar#intlcalendar.constants.field-month);
public const int [IntlCalendar::FIELD\_WEEK\_OF\_YEAR](class.intlcalendar#intlcalendar.constants.field-week-of-year);
public const int [IntlCalendar::FIELD\_WEEK\_OF\_MONTH](class.intlcalendar#intlcalendar.constants.field-week-of-month);
public const int [IntlCalendar::FIELD\_DATE](class.intlcalendar#intlcalendar.constants.field-date);
public const int [IntlCalendar::FIELD\_DAY\_OF\_YEAR](class.intlcalendar#intlcalendar.constants.field-day-of-year);
public const int [IntlCalendar::FIELD\_DAY\_OF\_WEEK](class.intlcalendar#intlcalendar.constants.field-day-of-week);
public const int [IntlCalendar::FIELD\_DAY\_OF\_WEEK\_IN\_MONTH](class.intlcalendar#intlcalendar.constants.field-day-of-week-in-month);
public const int [IntlCalendar::FIELD\_AM\_PM](class.intlcalendar#intlcalendar.constants.field-am-pm);
public const int [IntlCalendar::FIELD\_HOUR](class.intlcalendar#intlcalendar.constants.field-hour);
public const int [IntlCalendar::FIELD\_HOUR\_OF\_DAY](class.intlcalendar#intlcalendar.constants.field-hour-of-day);
public const int [IntlCalendar::FIELD\_MINUTE](class.intlcalendar#intlcalendar.constants.field-minute);
public const int [IntlCalendar::FIELD\_SECOND](class.intlcalendar#intlcalendar.constants.field-second);
public const int [IntlCalendar::FIELD\_MILLISECOND](class.intlcalendar#intlcalendar.constants.field-millisecond);
public const int [IntlCalendar::FIELD\_ZONE\_OFFSET](class.intlcalendar#intlcalendar.constants.field-zone-offset);
public const int [IntlCalendar::FIELD\_DST\_OFFSET](class.intlcalendar#intlcalendar.constants.field-dst-offset);
public const int [IntlCalendar::FIELD\_YEAR\_WOY](class.intlcalendar#intlcalendar.constants.field-year-woy);
public const int [IntlCalendar::FIELD\_DOW\_LOCAL](class.intlcalendar#intlcalendar.constants.field-dow-local);
public const int [IntlCalendar::FIELD\_EXTENDED\_YEAR](class.intlcalendar#intlcalendar.constants.field-extended-year);
public const int [IntlCalendar::FIELD\_JULIAN\_DAY](class.intlcalendar#intlcalendar.constants.field-julian-day);
public const int [IntlCalendar::FIELD\_MILLISECONDS\_IN\_DAY](class.intlcalendar#intlcalendar.constants.field-milliseconds-in-day);
public const int [IntlCalendar::FIELD\_IS\_LEAP\_MONTH](class.intlcalendar#intlcalendar.constants.field-is-leap-month);
public const int [IntlCalendar::FIELD\_FIELD\_COUNT](class.intlcalendar#intlcalendar.constants.field-field-count);
public const int [IntlCalendar::FIELD\_DAY\_OF\_MONTH](class.intlcalendar#intlcalendar.constants.field-day-of-month);
public const int [IntlCalendar::DOW\_SUNDAY](class.intlcalendar#intlcalendar.constants.dow-sunday);
public const int [IntlCalendar::DOW\_MONDAY](class.intlcalendar#intlcalendar.constants.dow-monday);
public const int [IntlCalendar::DOW\_TUESDAY](class.intlcalendar#intlcalendar.constants.dow-tuesday);
public const int [IntlCalendar::DOW\_WEDNESDAY](class.intlcalendar#intlcalendar.constants.dow-wednesday);
public const int [IntlCalendar::DOW\_THURSDAY](class.intlcalendar#intlcalendar.constants.dow-thursday);
public const int [IntlCalendar::DOW\_FRIDAY](class.intlcalendar#intlcalendar.constants.dow-friday);
public const int [IntlCalendar::DOW\_SATURDAY](class.intlcalendar#intlcalendar.constants.dow-saturday);
public const int [IntlCalendar::DOW\_TYPE\_WEEKDAY](class.intlcalendar#intlcalendar.constants.dow-type-weekday);
public const int [IntlCalendar::DOW\_TYPE\_WEEKEND](class.intlcalendar#intlcalendar.constants.dow-type-weekend);
public const int [IntlCalendar::DOW\_TYPE\_WEEKEND\_OFFSET](class.intlcalendar#intlcalendar.constants.dow-type-weekend-offset);
public const int [IntlCalendar::DOW\_TYPE\_WEEKEND\_CEASE](class.intlcalendar#intlcalendar.constants.dow-type-weekend-cease);
public const int [IntlCalendar::WALLTIME\_FIRST](class.intlcalendar#intlcalendar.constants.walltime-first);
public const int [IntlCalendar::WALLTIME\_LAST](class.intlcalendar#intlcalendar.constants.walltime-last);
public const int [IntlCalendar::WALLTIME\_NEXT\_VALID](class.intlcalendar#intlcalendar.constants.walltime-next-valid); /\* Methods \*/ public [\_\_construct](intlgregoriancalendar.construct)([IntlTimeZone](class.intltimezone) `$tz` = ?, string `$locale` = ?)
public [\_\_construct](intlgregoriancalendar.construct)(int `$timeZoneOrYear`, int `$localeOrMonth`, int `$dayOfMonth`)
public [\_\_construct](intlgregoriancalendar.construct)(
int `$timeZoneOrYear`,
int `$localeOrMonth`,
int `$dayOfMonth`,
int `$hour`,
int `$minute`,
int `$second` = ?
)
```
public getGregorianChange(): float
```
```
public isLeapYear(int $year): bool
```
```
public setGregorianChange(float $timestamp): bool
```
/\* Inherited methods \*/
```
public IntlCalendar::add(int $field, int $value): bool
```
```
public IntlCalendar::after(IntlCalendar $other): bool
```
```
public IntlCalendar::before(IntlCalendar $other): bool
```
```
public IntlCalendar::clear(?int $field = null): bool
```
```
public static IntlCalendar::createInstance(IntlTimeZone|DateTimeZone|string|null $timezone = null, ?string $locale = null): ?IntlCalendar
```
```
public IntlCalendar::equals(IntlCalendar $other): bool
```
```
public IntlCalendar::fieldDifference(float $timestamp, int $field): int|false
```
```
public static IntlCalendar::fromDateTime(DateTime|string $datetime, ?string $locale = null): ?IntlCalendar
```
```
public IntlCalendar::get(int $field): int|false
```
```
public IntlCalendar::getActualMaximum(int $field): int|false
```
```
public IntlCalendar::getActualMinimum(int $field): int|false
```
```
public static IntlCalendar::getAvailableLocales(): array
```
```
public IntlCalendar::getDayOfWeekType(int $dayOfWeek): int|false
```
```
public IntlCalendar::getErrorCode(): int|false
```
```
public IntlCalendar::getErrorMessage(): string|false
```
```
public IntlCalendar::getFirstDayOfWeek(): int|false
```
```
public IntlCalendar::getGreatestMinimum(int $field): int|false
```
```
public static IntlCalendar::getKeywordValuesForLocale(string $keyword, string $locale, bool $onlyCommon): IntlIterator|false
```
```
public IntlCalendar::getLeastMaximum(int $field): int|false
```
```
public IntlCalendar::getLocale(int $type): string|false
```
```
public IntlCalendar::getMaximum(int $field): int|false
```
```
public IntlCalendar::getMinimalDaysInFirstWeek(): int|false
```
```
public IntlCalendar::getMinimum(int $field): int|false
```
```
public static IntlCalendar::getNow(): float
```
```
public IntlCalendar::getRepeatedWallTimeOption(): int
```
```
public IntlCalendar::getSkippedWallTimeOption(): int
```
```
public IntlCalendar::getTime(): float|false
```
```
public IntlCalendar::getTimeZone(): IntlTimeZone|false
```
```
public IntlCalendar::getType(): string
```
```
public IntlCalendar::getWeekendTransition(int $dayOfWeek): int|false
```
```
public IntlCalendar::inDaylightTime(): bool
```
```
public IntlCalendar::isEquivalentTo(IntlCalendar $other): bool
```
```
public IntlCalendar::isLenient(): bool
```
```
public IntlCalendar::isSet(int $field): bool
```
```
public IntlCalendar::isWeekend(?float $timestamp = null): bool
```
```
public IntlCalendar::roll(int $field, int|bool $value): bool
```
```
public IntlCalendar::set(int $field, int $value): bool
```
```
public IntlCalendar::set(
int $year,
int $month,
int $dayOfMonth = NULL,
int $hour = NULL,
int $minute = NULL,
int $second = NULL
): bool
```
```
public IntlCalendar::setFirstDayOfWeek(int $dayOfWeek): bool
```
```
public IntlCalendar::setLenient(bool $lenient): bool
```
```
public IntlCalendar::setMinimalDaysInFirstWeek(int $days): bool
```
```
public IntlCalendar::setRepeatedWallTimeOption(int $option): bool
```
```
public IntlCalendar::setSkippedWallTimeOption(int $option): bool
```
```
public IntlCalendar::setTime(float $timestamp): bool
```
```
public IntlCalendar::setTimeZone(IntlTimeZone|DateTimeZone|string|null $timezone): bool
```
```
public IntlCalendar::toDateTime(): DateTime|false
```
} Table of Contents
-----------------
* [IntlGregorianCalendar::\_\_construct](intlgregoriancalendar.construct) — Create the Gregorian Calendar class
* [IntlGregorianCalendar::getGregorianChange](intlgregoriancalendar.getgregorianchange) — Get the Gregorian Calendar change date
* [IntlGregorianCalendar::isLeapYear](intlgregoriancalendar.isleapyear) — Determine if the given year is a leap year
* [IntlGregorianCalendar::setGregorianChange](intlgregoriancalendar.setgregorianchange) — Set the Gregorian Calendar the change date
| programming_docs |
php tidyNode::isText tidyNode::isText
================
(PHP 5, PHP 7, PHP 8)
tidyNode::isText — Checks if a node represents text (no markup)
### Description
```
public tidyNode::isText(): bool
```
Tells if the node represents a text (without any markup).
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the node represent a text, **`false`** otherwise.
### Examples
**Example #1 Extract text from a mixed HTML document**
```
<?php
$html = <<< HTML
<html><head>
<?php echo '<title>title</title>'; ?>
<#
/* JSTE code */
alert('Hello World');
#>
</head>
<body>
<?php
// PHP code
echo 'hello world!';
?>
<%
/* ASP code */
response.write("Hello World!")
%>
<!-- Comments -->
Hello World
</body></html>
Outside HTML
HTML;
$tidy = tidy_parse_string($html);
$num = 0;
get_nodes($tidy->html());
function get_nodes($node) {
// check if the current node is of requested type
if($node->isText()) {
echo "\n\n# text node #" . ++$GLOBALS['num'] . "\n";
echo $node->value;
}
// check if the current node has childrens
if($node->hasChildren()) {
foreach($node->child as $child) {
get_nodes($child);
}
}
}
?>
```
The above example will output:
```
# text node #1
Hello World
# text node #2
Outside HTML
```
php DirectoryIterator::isWritable DirectoryIterator::isWritable
=============================
(PHP 5, PHP 7, PHP 8)
DirectoryIterator::isWritable — Determine if current DirectoryIterator item can be written to
### Description
```
public DirectoryIterator::isWritable(): bool
```
Determines if the current [DirectoryIterator](class.directoryiterator) item is writable.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the file/directory is writable, otherwise **`false`**
### Examples
**Example #1 **DirectoryIterator::isWritable()** example**
This example lists the files and directories which can be opened for writing in the directory containing the script.
```
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
foreach ($iterator as $fileinfo) {
if ($fileinfo->isWritable()) {
echo $fileinfo->getFilename() . "\n";
}
}
?>
```
The above example will output something similar to:
```
apples.txt
bananas.html
pears
```
### See Also
* [DirectoryIterator::getPerms()](directoryiterator.getperms) - Get the permissions of current DirectoryIterator item
* [DirectoryIterator::isExecutable()](directoryiterator.isexecutable) - Determine if current DirectoryIterator item is executable
* [DirectoryIterator::isReadable()](directoryiterator.isreadable) - Determine if current DirectoryIterator item can be read
php IntlChar::getNumericValue IntlChar::getNumericValue
=========================
(PHP 7, PHP 8)
IntlChar::getNumericValue — Get the numeric value for a Unicode code point
### Description
```
public static IntlChar::getNumericValue(int|string $codepoint): ?float
```
Gets the numeric value for a Unicode code point as defined in the Unicode Character Database.
For characters without any numeric values in the Unicode Character Database, this function will return **`IntlChar::NO_NUMERIC_VALUE`**.
### 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
Numeric value of `codepoint`, or **`IntlChar::NO_NUMERIC_VALUE`** if none is defined. This constant was added in PHP 7.0.6, prior to this version the literal value (float)`-123456789` may be used instead. Returns **`null`** on failure.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::getNumericValue("4"));
var_dump(IntlChar::getNumericValue("x"));
var_dump(IntlChar::getNumericValue("\u{216C}"));
?>
```
The above example will output:
```
float(4)
float(-123456789)
float(50)
```
php The JsonSerializable interface
The JsonSerializable interface
==============================
Introduction
------------
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
Objects implementing **JsonSerializable** can customize their JSON representation when encoded with [json\_encode()](function.json-encode).
Interface synopsis
------------------
interface **JsonSerializable** { /\* Methods \*/
```
public jsonSerialize(): mixed
```
} Table of Contents
-----------------
* [JsonSerializable::jsonSerialize](jsonserializable.jsonserialize) — Specify data which should be serialized to JSON
php None Declaring sub-namespaces
------------------------
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
Much like directories and files, PHP namespaces also contain the ability to specify a hierarchy of namespace names. Thus, a namespace name can be defined with sub-levels:
**Example #1 Declaring a single namespace with hierarchy**
```
<?php
namespace MyProject\Sub\Level;
const CONNECT_OK = 1;
class Connection { /* ... */ }
function connect() { /* ... */ }
?>
```
The above example creates constant `MyProject\Sub\Level\CONNECT_OK`, class `MyProject\Sub\Level\Connection` and function `MyProject\Sub\Level\connect`.
php The Componere\Patch class
The Componere\Patch class
=========================
Introduction
------------
(Componere 2 >= 2.1.0)
The Patch class allows the programmer to change the type of an instance at runtime without registering a new Definition
When a Patch is destroyed it is reverted, so that instances that were patched during the lifetime of the Patch are restored to their formal type.
Class synopsis
--------------
final class **Componere\Patch** extends [Componere\Abstract\Definition](class.componere-abstract-definition) { /\* Constructors \*/ public [\_\_construct](componere-patch.construct)(object `$instance`)
public [\_\_construct](componere-patch.construct)(object `$instance`, array `$interfaces`) /\* Methods \*/
```
public apply(): void
```
```
public revert(): void
```
```
public isApplied(): bool
```
```
public derive(object $instance): Patch
```
```
public getClosure(string $name): Closure
```
```
public getClosures(): array
```
/\* Inherited methods \*/
```
public Componere\Abstract\Definition::addInterface(string $interface): Definition
```
```
public Componere\Abstract\Definition::addMethod(string $name, Componere\Method $method): Definition
```
```
public Componere\Abstract\Definition::addTrait(string $trait): Definition
```
```
public Componere\Abstract\Definition::getReflector(): ReflectionClass
```
} Table of Contents
-----------------
* [Componere\Patch::\_\_construct](componere-patch.construct) — Patch Construction
* [Componere\Patch::apply](componere-patch.apply) — Application
* [Componere\Patch::revert](componere-patch.revert) — Reversal
* [Componere\Patch::isApplied](componere-patch.isapplied) — State Detection
* [Componere\Patch::derive](componere-patch.derive) — Patch Derivation
* [Componere\Patch::getClosure](componere-patch.getclosure) — Get Closure
* [Componere\Patch::getClosures](componere-patch.getclosures) — Get Closures
php RarEntry::isDirectory RarEntry::isDirectory
=====================
(PECL rar >= 2.0.0)
RarEntry::isDirectory — Test whether an entry represents a directory
### Description
```
public RarEntry::isDirectory(): bool
```
Tests whether the current entry is a directory.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if this entry is a directory and **`false`** otherwise.
### Notes
This function is only available starting with version 2.0.0, but one can also test whether an entry is a directory by checking the entry attributes, like this (only works for files compressed in RAR for Windows or Unix):
```
<?php
//...
//Open file, get entry and store in variable $e...
//...
$isDirectory = (bool) ((($e->getHostOs() == RAR_HOST_WIN32) && ($e->getAttr() & 0x10)) ||
(($e->getHostOs() == RAR_HOST_UNIX) && (($e->getAttr() & 0xf000) == 0x4000)));
?>
```
php xml_set_character_data_handler xml\_set\_character\_data\_handler
==================================
(PHP 4, PHP 5, PHP 7, PHP 8)
xml\_set\_character\_data\_handler — Set up character data handler
### Description
```
xml_set_character_data_handler(XMLParser $parser, callable $handler): bool
```
Sets the character data handler function for the XML parser `parser`.
### Parameters
`parser`
A reference to the XML parser to set up character data handler function.
`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 two parameters:
```
handler(XMLParser $parser, string $data)
```
`parser`
The first parameter, parser, is a reference to the XML parser calling the handler. `data`
The second parameter, `data`, contains the character data as a string. Character data handler is called for every piece of a text in the XML document. It can be called multiple times inside each fragment (e.g. for non-ASCII strings).
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. |
php SplDoublyLinkedList::valid SplDoublyLinkedList::valid
==========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplDoublyLinkedList::valid — Check whether the doubly linked list contains more nodes
### Description
```
public SplDoublyLinkedList::valid(): bool
```
Checks if the doubly linked list contains any more nodes.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the doubly linked list contains any more nodes, **`false`** otherwise.
php mcrypt_generic_init mcrypt\_generic\_init
=====================
(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)
mcrypt\_generic\_init — This function initializes all buffers needed for encryption
**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_generic_init(resource $td, string $key, string $iv): int
```
You need to call this function before every call to [mcrypt\_generic()](function.mcrypt-generic) or [mdecrypt\_generic()](function.mdecrypt-generic).
### Parameters
`td`
The encryption descriptor.
`key`
The maximum length of the key should be the one obtained by calling [mcrypt\_enc\_get\_key\_size()](function.mcrypt-enc-get-key-size) and every value smaller than this is legal.
`iv`
The IV should normally have the size of the algorithms block size, but you must obtain the size by calling [mcrypt\_enc\_get\_iv\_size()](function.mcrypt-enc-get-iv-size). IV is ignored in ECB. IV MUST exist in CFB, CBC, STREAM, nOFB and OFB modes. It needs to be random and unique (but not secret). The same IV must be used for encryption/decryption. If you do not want to use it you should set it to zeros, but this is not recommended.
### Return Values
The function returns a negative value on error: -3 when the key length was incorrect, -4 when there was a memory allocation problem and any other return value is an unknown error. If an error occurs a warning will be displayed accordingly. **`false`** is returned if incorrect parameters were passed.
### See Also
* [mcrypt\_module\_open()](function.mcrypt-module-open) - Opens the module of the algorithm and the mode to be used
php Gmagick::getfilename Gmagick::getfilename
====================
(PECL gmagick >= Unknown)
Gmagick::getfilename — The filename associated with an image sequence
### Description
```
public Gmagick::getfilename(): string
```
Returns the filename associated with an image sequence.
### Parameters
This function has no parameters.
### Return Values
Returns a string on success.
### Errors/Exceptions
Throws an **GmagickException** on error.
php stats_cdf_noncentral_t stats\_cdf\_noncentral\_t
=========================
(PECL stats >= 1.0.0)
stats\_cdf\_noncentral\_t — Calculates any one parameter of the non-central t-distribution give values for the others
### Description
```
stats_cdf_noncentral_t(
float $par1,
float $par2,
float $par3,
int $which
): float
```
Returns the cumulative distribution function, its inverse, or one of its parameters, of the non-central t-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, nu, and mu denotes cumulative distribution function, the value of the random variable, the degrees of freedom and the non-centrality parameter of the distribution, respectively.
**Return value and parameters**| `which` | Return value | `par1` | `par2` | `par3` |
| --- | --- | --- | --- | --- |
| 1 | CDF | x | nu | mu |
| 2 | x | CDF | nu | mu |
| 3 | nu | x | CDF | mu |
| 4 | mu | x | CDF | nu |
### 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, nu, or mu, determined by `which`.
php fbird_num_params fbird\_num\_params
==================
(PHP 5, PHP 7 < 7.4.0)
fbird\_num\_params — Alias of [ibase\_num\_params()](function.ibase-num-params)
### Description
This function is an alias of: [ibase\_num\_params()](function.ibase-num-params).
### See Also
* [fbird\_prepare()](function.fbird-prepare) - Alias of ibase\_prepare
* [fbird\_param\_info()](function.fbird-param-info) - Alias of ibase\_param\_info
php The Yaf_Action_Abstract class
The Yaf\_Action\_Abstract class
===============================
Introduction
------------
(Yaf >=1.0.0)
A action can be defined in a separate file in Yaf(see [Yaf\_Controller\_Abstract](class.yaf-controller-abstract)). that is a action method can also be a **Yaf\_Action\_Abstract** class.
Since there should be a entry point which can be called by Yaf, you must implement the abstract method [Yaf\_Action\_Abstract::execute()](yaf-action-abstract.execute) in your custom action class.
Class synopsis
--------------
class **Yaf\_Action\_Abstract** extends [Yaf\_Controller\_Abstract](class.yaf-controller-abstract) { /\* Properties \*/ protected [$\_controller](class.yaf-action-abstract#yaf-action-abstract.props.controller); /\* Methods \*/
```
abstract publicexecute(mixed ...$args): mixed
```
```
publicgetController(): Yaf_Controller_Abstract
```
```
public getControllerName(): string
```
/\* Inherited methods \*/
```
protected Yaf_Controller_Abstract::display(string $tpl, array $parameters = ?): bool
```
```
public Yaf_Controller_Abstract::forward(string $action, array $paramters = ?): bool
```
```
public Yaf_Controller_Abstract::getInvokeArg(string $name): void
```
```
public Yaf_Controller_Abstract::getInvokeArgs(): void
```
```
public Yaf_Controller_Abstract::getModuleName(): string
```
```
public Yaf_Controller_Abstract::getName(): string
```
```
public Yaf_Controller_Abstract::getRequest(): Yaf_Request_Abstract
```
```
public Yaf_Controller_Abstract::getResponse(): Yaf_Response_Abstract
```
```
public Yaf_Controller_Abstract::getView(): Yaf_View_Interface
```
```
public Yaf_Controller_Abstract::getViewpath(): string
```
```
public Yaf_Controller_Abstract::init(): void
```
```
public Yaf_Controller_Abstract::initView(array $options = ?): void
```
```
public Yaf_Controller_Abstract::redirect(string $url): bool
```
```
protected Yaf_Controller_Abstract::render(string $tpl, array $parameters = ?): string
```
```
public Yaf_Controller_Abstract::setViewpath(string $view_directory): void
```
} Properties
----------
\_module \_name \_request \_response \_invoke\_args \_view \_controller Table of Contents
-----------------
* [Yaf\_Action\_Abstract::execute](yaf-action-abstract.execute) — Action entry point
* [Yaf\_Action\_Abstract::getController](yaf-action-abstract.getcontroller) — Retrieve controller object
* [Yaf\_Action\_Abstract::getControllerName](yaf-controller-abstract.getcontrollername) — Get controller name
php array_fill array\_fill
===========
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
array\_fill — Fill an array with values
### Description
```
array_fill(int $start_index, int $count, mixed $value): array
```
Fills an array with `count` entries of the value of the `value` parameter, keys starting at the `start_index` parameter.
### Parameters
`start_index`
The first index of the returned array.
If `start_index` is negative, the first index of the returned array will be `start_index` and the following indices will start from zero prior to PHP 8.0.0; as of PHP 8.0.0, negative keys are incremented normally (see [example](function.array-fill#function.array-fill.example.negative-start-index)).
`count`
Number of elements to insert. Must be greater than or equal to zero, and less than or equal to `2147483647`.
`value`
Value to use for filling
### Return Values
Returns the filled array
### Errors/Exceptions
Throws a [ValueError](class.valueerror) if `count` is out of range.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | **array\_fill()** now throws a [ValueError](class.valueerror) if `count` is out of range; previously **`E_WARNING`** was raised, and the function returned **`false`**. |
### Examples
**Example #1 **array\_fill()** example**
```
<?php
$a = array_fill(5, 6, 'banana');
print_r($a);
?>
```
The above example will output:
```
Array
(
[5] => banana
[6] => banana
[7] => banana
[8] => banana
[9] => banana
[10] => banana
)
```
**Example #2 **array\_fill()** example with a negative start index**
```
<?php
$a = array_fill(-2, 4, 'pear');
print_r($a);
?>
```
Output of the above example in PHP 7:
```
Array
(
[-2] => pear
[0] => pear
[1] => pear
[2] => pear
)
```
Output of the above example in PHP 8:
```
Array
(
[-2] => pear
[-1] => pear
[0] => pear
[1] => pear
)
```
Note that index `-1` is not present prior to PHP 8.0.0.
### Notes
See also the [Arrays](language.types.array) section of manual for a detailed explanation of negative keys.
### See Also
* [array\_fill\_keys()](function.array-fill-keys) - Fill an array with values, specifying keys
* [str\_repeat()](function.str-repeat) - Repeat a string
* [range()](function.range) - Create an array containing a range of elements
php Imagick::setImageDispose Imagick::setImageDispose
========================
(PECL imagick 2, PECL imagick 3)
Imagick::setImageDispose — Sets the image disposal method
### Description
```
public Imagick::setImageDispose(int $dispose): bool
```
Sets the image disposal method.
### Parameters
`dispose`
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
php Phar::interceptFileFuncs Phar::interceptFileFuncs
========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
Phar::interceptFileFuncs — Instructs phar to intercept fopen, file\_get\_contents, opendir, and all of the stat-related functions
### Description
```
final public static Phar::interceptFileFuncs(): void
```
instructs phar to intercept [fopen()](function.fopen), [readfile()](function.readfile), [file\_get\_contents()](function.file-get-contents), [opendir()](function.opendir), and all of the stat-related functions. If any of these functions is called from within a phar archive with a relative path, the call is modified to access a file within the phar archive. Absolute paths are assumed to be attempts to load external files from the filesystem.
This function makes it possible to run PHP applications designed to run off of a hard disk as a phar application.
### Parameters
No parameters.
### Return Values
### Examples
**Example #1 A **Phar::interceptFileFuncs()** example**
```
<?php
Phar::interceptFileFuncs();
include 'phar://' . __FILE__ . '/file.php';
?>
```
Assuming that this phar is at `/path/to/myphar.phar` and it contains `file.php` and `file2.txt`, if `file.php` contains this code:
**Example #2 A **Phar::interceptFileFuncs()** example**
```
<?php
echo file_get_contents('file2.txt');
?>
```
Normally PHP would search the current directory for `file2.txt`, which would translate as the directory of file.php, or the current directory of a command-line user. **Phar::interceptFileFuncs()** instructs PHP to consider the current directory to be `phar:///path/to/myphar.phar/` and so opens `phar:///path/to/myphar.phar/file2.txt` in the above example code.
| programming_docs |
php RarException::setUsingExceptions RarException::setUsingExceptions
================================
(PECL rar >= 2.0.0)
RarException::setUsingExceptions — Activate and deactivate error handling with exceptions
### Description
```
public static RarException::setUsingExceptions(bool $using_exceptions): void
```
If and only if the argument is **`true`**, then, instead of emitting warnings and returning a special value indicating error when the UnRAR library encounters an error, an exception of type [RarException](class.rarexception) will be thrown.
Exceptions will also be thrown for the following errors, which occur outside the library (their error code will be -1):
* attempting some operations on a closed [RarArchive](class.rararchive) object or a [RarEntry](class.rarentry) object relative to the first;
* attempting to get an entry that does not exist with [RarArchive::getEntry()](rararchive.getentry).
### Parameters
`using_exceptions`
Should be **`true`** to activate exception throwing, **`false`** to deactivate (the default).
### Return Values
No value is returned.
### Examples
**Example #1 **RarException::setUsingExceptions()** example**
```
<?php
var_dump(RarException::isUsingExceptions());
$arch = RarArchive::open("does_not_exist.rar");
var_dump($arch);
RarException::setUsingExceptions(true);
var_dump(RarException::isUsingExceptions());
$arch = RarArchive::open("does_not_exist.rar");
var_dump($arch); //not reached
?>
```
The above example will output something similar to:
```
bool(false)
Warning: RarArchive::open(): Failed to open does_not_exist.rar: ERAR_EOPEN (file open error) in C:\php_rar\trunk\tests\test.php on line 3
bool(false)
bool(true)
Fatal error: Uncaught exception 'RarException' with message 'unRAR internal error: Failed to open does_not_exist.rar: ERAR_EOPEN (file open error)' in C:\php_rar\trunk\tests\test.php:8
Stack trace:
#0 C:\php_rar\trunk\tests\test.php(8): RarArchive::open('does_not_exist....')
#1 {main}
thrown in C:\php_rar\trunk\tests\test.php on line 8
```
### See Also
* [RarException::isUsingExceptions()](rarexception.isusingexceptions) - Check whether error handling with exceptions is in use
php FiberError
FiberError
==========
Introduction
------------
(PHP 8 >= 8.1.0)
**FiberError** is thrown when an invalid operation is performed on a [Fiber](class.fiber).
Class synopsis
--------------
final class **FiberError** extends [Error](class.error) { /\* Inherited properties \*/ protected string [$message](class.error#error.props.message) = "";
private string [$string](class.error#error.props.string) = "";
protected int [$code](class.error#error.props.code);
protected string [$file](class.error#error.props.file) = "";
protected int [$line](class.error#error.props.line);
private array [$trace](class.error#error.props.trace) = [];
private ?[Throwable](class.throwable) [$previous](class.error#error.props.previous) = null; /\* Methods \*/ public [\_\_construct](fibererror.construct)() /\* Inherited methods \*/
```
final public Error::getMessage(): string
```
```
final public Error::getPrevious(): ?Throwable
```
```
final public Error::getCode(): int
```
```
final public Error::getFile(): string
```
```
final public Error::getLine(): int
```
```
final public Error::getTrace(): array
```
```
final public Error::getTraceAsString(): string
```
```
public Error::__toString(): string
```
```
private Error::__clone(): void
```
} Table of Contents
-----------------
* [FiberError::\_\_construct](fibererror.construct) — Constructor to disallow direct instantiation
php Yaf_Route_Simple::route Yaf\_Route\_Simple::route
=========================
(Yaf >=1.0.0)
Yaf\_Route\_Simple::route — Route a request
### Description
```
public Yaf_Route_Simple::route(Yaf_Request_Abstract $request): bool
```
see [Yaf\_Route\_Simple::\_\_construct()](yaf-route-simple.construct)
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`request`
### Return Values
always be **`true`**
### 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 ArrayObject::__construct ArrayObject::\_\_construct
==========================
(PHP 5, PHP 7, PHP 8)
ArrayObject::\_\_construct — Construct a new array object
### Description
public **ArrayObject::\_\_construct**(array|object `$array` = [], int `$flags` = 0, string `$iteratorClass` = ArrayIterator::class) This constructs a new array object.
### Parameters
`array`
The `array` parameter accepts an array or an Object.
`flags`
Flags to control the behaviour of the [ArrayObject](class.arrayobject) object. See [ArrayObject::setFlags()](arrayobject.setflags).
`iteratorClass`
Specify the class that will be used for iteration of the [ArrayObject](class.arrayobject) object. The class must implement [ArrayIterator](class.arrayiterator).
### Examples
**Example #1 **ArrayObject::\_\_construct()** example**
```
<?php
$array = array('1' => 'one',
'2' => 'two',
'3' => 'three');
$arrayobject = new ArrayObject($array);
var_dump($arrayobject);
?>
```
The above example will output:
```
object(ArrayObject)#1 (3) {
[1]=>
string(3) "one"
[2]=>
string(3) "two"
[3]=>
string(5) "three"
}
```
### See Also
* [ArrayObject::setflags()](arrayobject.setflags) - Sets the behavior flags
php QuickHashIntStringHash::update QuickHashIntStringHash::update
==============================
(PECL quickhash >= Unknown)
QuickHashIntStringHash::update — This method updates an entry in the hash with a new value
### Description
```
public QuickHashIntStringHash::update(int $key, string $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 QuickHashIntStringHash::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 for the entry. If a non-string is passed, it will be converted to a string automatically if possible.
### 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 **QuickHashIntStringHash::update()** example**
```
<?php
$hash->add( 161803398, "--" );
$hash->add( 314159265, "a lot" );
echo $hash->get( 161803398 ), "\n";
echo $hash->get( 314159265 ), "\n";
var_dump( $hash->update( 314159265, "a lot plus one" ) );
var_dump( $hash->update( 314159999, "a lot plus one" ) );
echo $hash->get( 161803398 ), "\n";
echo $hash->get( 314159265 ), "\n";
?>
```
The above example will output something similar to:
```
--
a lot
bool(true)
bool(false)
--
a lot plus one
```
php Ds\Map::copy Ds\Map::copy
============
(PECL ds >= 1.0.0)
Ds\Map::copy — Returns a shallow copy of the map
### Description
```
public Ds\Map::copy(): Ds\Map
```
Returns a shallow copy of the map.
### Parameters
This function has no parameters.
### Return Values
Returns a shallow copy of the map.
### Examples
**Example #1 **Ds\Map::copy()** example**
```
<?php
$map = new \Ds\Map([
"a" => 1,
"b" => 2,
"c" => 3,
]);
print_r($map->copy());
?>
```
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 socket_addrinfo_lookup socket\_addrinfo\_lookup
========================
(PHP 7 >= 7.2.0, PHP 8)
socket\_addrinfo\_lookup — Get array with contents of getaddrinfo about the given hostname
### Description
```
socket_addrinfo_lookup(string $host, ?string $service = null, array $hints = []): array|false
```
Lookup different ways we can connect to `host`. The returned array contains a set of [AddressInfo](class.addressinfo) instances that we can bind to using [socket\_addrinfo\_bind()](function.socket-addrinfo-bind).
### Parameters
`host`
Hostname to search.
`service`
The service to connect to. If service is a numeric string, it designates the port. Otherwise it designates a network service name, which is mapped to a port by the operating system.
`hints`
Hints provide criteria for selecting addresses returned. You may specify the hints as defined by getaddrinfo.
### Return Values
Returns an array of [AddressInfo](class.addressinfo) instances that can be used with the other socket\_addrinfo functions. On failure, **`false`** is returned.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | On success, this function returns a array of [AddressInfo](class.addressinfo) instances now; previously, an array of resources was returned. |
| 8.0.0 | `service` is nullable now. |
### See Also
* [socket\_addrinfo\_bind()](function.socket-addrinfo-bind) - Create and bind to a socket from a given addrinfo
* [socket\_addrinfo\_connect()](function.socket-addrinfo-connect) - Create and connect to a socket from a given addrinfo
* [socket\_addrinfo\_explain()](function.socket-addrinfo-explain) - Get information about addrinfo
php SVMModel::save SVMModel::save
==============
(PECL svm >= 0.1.0)
SVMModel::save — Save a model to a file
### Description
```
public SVMModel::save(string $filename): bool
```
Save the model data to a file, for later use.
### Parameters
`filename`
The file to save the model to.
### Return Values
Throws SVMException on error. Returns true on success.
### See Also
* [SVMModel::load()](svmmodel.load) - Load a saved SVM Model
php ZookeeperConfig::set ZookeeperConfig::set
====================
(PECL zookeeper >= 0.6.0, ZooKeeper >= 3.5.0)
ZookeeperConfig::set — Change ZK cluster ensemble membership and roles of ensemble peers
### Description
```
public ZookeeperConfig::set(string $members, int $version = -1, array &$stat = null): void
```
### Parameters
`members`
Comma separated list of new membership (e.g., contents of a membership configuration file) - for use only with a non-incremental reconfiguration.
`version`
The expected version of the node. The function will fail if the actual version of the node does not match the expected version. If -1 is used the version check will not take place.
`stat`
If not NULL, will hold the value of stat for the path on return.
### Return Values
No value is returned.
### Errors/Exceptions
This method emits [ZookeeperException](class.zookeeperexception) and it's derivatives when parameters count or types are wrong or fail to save value to node.
### Examples
**Example #1 **ZookeeperConfig::set()** example**
Reconfig.
```
<?php
$client = new Zookeeper();
$client->connect('localhost:2181');
$client->addAuth('digest', 'timandes:timandes');
$zkConfig = $client->getConfig();
$zkConfig->set("server.1=localhost:2888:3888:participant;0.0.0.0:2181");
?>
```
### See Also
* [ZookeeperConfig::get()](zookeeperconfig.get) - Gets the last committed configuration of the ZooKeeper cluster as it is known to the server to which the client is connected, synchronously
* [ZookeeperConfig::add()](zookeeperconfig.add) - Add servers to the ensemble
* [ZookeeperConfig::remove()](zookeeperconfig.remove) - Remove servers from the ensemble
* [ZookeeperException](class.zookeeperexception)
php SolrQuery::getFacetQueries SolrQuery::getFacetQueries
==========================
(PECL solr >= 0.9.2)
SolrQuery::getFacetQueries — Returns all the facet queries
### Description
```
public SolrQuery::getFacetQueries(): array
```
Returns all the facet queries
### Parameters
This function has no parameters.
### Return Values
Returns an array on success and **`null`** if not set.
php The Stomp class
The Stomp class
===============
Introduction
------------
(PECL stomp >= 0.1.0)
Represents a connection between PHP and a Stomp compliant Message Broker.
Class synopsis
--------------
class **Stomp** { /\* Methods \*/ public [\_\_construct](stomp.construct)(
string `$broker` = ini\_get("stomp.default\_broker\_uri"),
string `$username` = ?,
string `$password` = ?,
array `$headers` = ?
)
```
public abort(string $transaction_id, array $headers = ?): bool
```
```
stomp_abort(resource $link, string $transaction_id, array $headers = ?): bool
```
```
public ack(mixed $msg, array $headers = ?): bool
```
```
stomp_ack(resource $link, mixed $msg, array $headers = ?): bool
```
```
public begin(string $transaction_id, array $headers = ?): bool
```
```
stomp_begin(resource $link, string $transaction_id, array $headers = ?): bool
```
```
public commit(string $transaction_id, array $headers = ?): bool
```
```
stomp_commit(resource $link, string $transaction_id, array $headers = ?): bool
```
```
stomp_connect(
string $broker = ini_get("stomp.default_broker_uri"),
string $username = ?,
string $password = ?,
array $headers = ?
): resource
```
```
stomp_close(resource $link): bool
```
```
public error(): string
```
```
stomp_error(resource $link): string
```
```
public getReadTimeout(): array
```
```
stomp_get_read_timeout(resource $link): array
```
```
public getSessionId(): string|false
```
```
stomp_get_session_id(resource $link): string|false
```
```
public hasFrame(): bool
```
```
stomp_has_frame(resource $link): bool
```
```
public readFrame(string $class_name = "stompFrame"): stompframe
```
```
stomp_read_frame(resource $link): array
```
```
public send(string $destination, mixed $msg, array $headers = ?): bool
```
```
stomp_send(
resource $link,
string $destination,
mixed $msg,
array $headers = ?
): bool
```
```
public setReadTimeout(int $seconds, int $microseconds = ?): void
```
```
stomp_set_read_timeout(resource $link, int $seconds, int $microseconds = ?): void
```
```
public subscribe(string $destination, array $headers = ?): bool
```
```
stomp_subscribe(resource $link, string $destination, array $headers = ?): bool
```
```
public unsubscribe(string $destination, array $headers = ?): bool
```
```
stomp_unsubscribe(resource $link, string $destination, array $headers = ?): bool
```
public [\_\_destruct](stomp.destruct)() } Table of Contents
-----------------
* [Stomp::abort](stomp.abort) — Rolls back a transaction in progress
* [Stomp::ack](stomp.ack) — Acknowledges consumption of a message
* [Stomp::begin](stomp.begin) — Starts a transaction
* [Stomp::commit](stomp.commit) — Commits a transaction in progress
* [Stomp::\_\_construct](stomp.construct) — Opens a connection
* [Stomp::\_\_destruct](stomp.destruct) — Closes stomp connection
* [Stomp::error](stomp.error) — Gets the last stomp error
* [Stomp::getReadTimeout](stomp.getreadtimeout) — Gets read timeout
* [Stomp::getSessionId](stomp.getsessionid) — Gets the current stomp session ID
* [Stomp::hasFrame](stomp.hasframe) — Indicates whether or not there is a frame ready to read
* [Stomp::readFrame](stomp.readframe) — Reads the next frame
* [Stomp::send](stomp.send) — Sends a message
* [Stomp::setReadTimeout](stomp.setreadtimeout) — Sets read timeout
* [Stomp::subscribe](stomp.subscribe) — Registers to listen to a given destination
* [Stomp::unsubscribe](stomp.unsubscribe) — Removes an existing subscription
php curl_multi_add_handle curl\_multi\_add\_handle
========================
(PHP 5, PHP 7, PHP 8)
curl\_multi\_add\_handle — Add a normal cURL handle to a cURL multi handle
### Description
```
curl_multi_add_handle(CurlMultiHandle $multi_handle, CurlHandle $handle): int
```
Adds the `handle` handle to the multi handle `multi_handle`
### Parameters
`multi_handle` A cURL multi handle returned by [curl\_multi\_init()](function.curl-multi-init).
`handle` A cURL handle returned by [curl\_init()](function.curl-init).
### Return Values
Returns 0 on success, or one of the **`CURLM_XXX`** errors code.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `multi_handle` expects a [CurlMultiHandle](class.curlmultihandle) instance now; previously, a resource was expected. |
| 8.0.0 | `handle` expects a [CurlHandle](class.curlhandle) instance now; previously, a resource was expected. |
### Examples
**Example #1 **curl\_multi\_add\_handle()** 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 all the handles
curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);
?>
```
### See Also
* [curl\_multi\_remove\_handle()](function.curl-multi-remove-handle) - Remove a multi handle from a set of cURL handles
* [curl\_multi\_init()](function.curl-multi-init) - Returns a new cURL multi handle
* [curl\_init()](function.curl-init) - Initialize a cURL session
php Yaf_Route_Map::route Yaf\_Route\_Map::route
======================
(Yaf >=1.0.0)
Yaf\_Route\_Map::route — The route purpose
### Description
```
public Yaf_Route_Map::route(Yaf_Request_Abstract $request): bool
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`request`
### Return Values
php SoapClient::__soapCall SoapClient::\_\_soapCall
========================
(PHP 5, PHP 7, PHP 8)
SoapClient::\_\_soapCall — Calls a SOAP function
### Description
```
public SoapClient::__soapCall(
string $name,
array $args,
?array $options = null,
SoapHeader|array|null $inputHeaders = null,
array &$outputHeaders = null
): mixed
```
This is a low level API function that is used to make a SOAP call. Usually, in WSDL mode, SOAP functions can be called as methods of the [SoapClient](class.soapclient) object. This method is useful in non-WSDL mode when `soapaction` is unknown, `uri` differs from the default or when sending and/or receiving SOAP Headers.
On error, a call to a SOAP function can cause PHP to throw exceptions or return a [SoapFault](class.soapfault) object if exceptions are disabled. To check if the function call failed to catch the SoapFault exceptions, check the result with [is\_soap\_fault()](function.is-soap-fault).
### Parameters
`name`
The name of the SOAP function to call.
`args`
An array of the arguments to pass to the function. This can be either an ordered or an associative array. Note that most SOAP servers require parameter names to be provided, in which case this must be an associative array.
`options`
An associative array of options to pass to the client.
The `location` option is the URL of the remote Web service.
The `uri` option is the target namespace of the SOAP service.
The `soapaction` option is the action to call.
`inputHeaders`
An array of headers to be sent along with the SOAP request.
`outputHeaders`
If supplied, this array will be filled with the headers from the SOAP response.
### Return Values
SOAP functions may return one, or multiple values. If only one value is returned by the SOAP function, the return value will be a scalar. If multiple values are returned, an associative array of named output parameters is returned instead.
On error, if the [SoapClient](class.soapclient) object was constructed with the `exceptions` option set to **`false`**, a [SoapFault](class.soapfault) object will be returned.
### Examples
**Example #1 **SoapClient::\_\_soapCall()** example**
```
<?php
$client = new SoapClient("some.wsdl");
$client->SomeFunction($a, $b, $c);
$client->__soapCall("SomeFunction", array($a, $b, $c));
$client->__soapCall("SomeFunction", array($a, $b, $c), NULL,
new SoapHeader(), $output_headers);
$client = new SoapClient(null, array('location' => "http://localhost/soap.php",
'uri' => "http://test-uri/"));
$client->SomeFunction($a, $b, $c);
$client->__soapCall("SomeFunction", array($a, $b, $c));
$client->__soapCall("SomeFunction", array($a, $b, $c),
array('soapaction' => 'some_action',
'uri' => 'some_uri'));
?>
```
### See Also
* [SoapClient::\_\_construct()](soapclient.construct) - SoapClient constructor
* [SoapParam::\_\_construct()](soapparam.construct) - SoapParam constructor
* [SoapVar::\_\_construct()](soapvar.construct) - SoapVar constructor
* [SoapHeader::\_\_construct()](soapheader.construct) - SoapHeader constructor
* [SoapFault::\_\_construct()](soapfault.construct) - SoapFault constructor
* [is\_soap\_fault()](function.is-soap-fault) - Checks if a SOAP call has failed
| programming_docs |
php GearmanClient::clone GearmanClient::clone
====================
(PECL gearman >= 0.5.0)
GearmanClient::clone — Create a copy of a [GearmanClient](class.gearmanclient) object
### Description
```
public GearmanClient::clone(): GearmanClient
```
Creates a copy of a [GearmanClient](class.gearmanclient) object.
### Parameters
This function has no parameters.
### Return Values
A [GearmanClient](class.gearmanclient) on success, **`false`** on failure.
php SolrDocument::getInputDocument SolrDocument::getInputDocument
==============================
(PECL solr >= 0.9.2)
SolrDocument::getInputDocument — Returns a SolrInputDocument equivalent of the object
### Description
```
public SolrDocument::getInputDocument(): SolrInputDocument
```
Returns a SolrInputDocument equivalent of the object. This is useful if one wishes to resubmit/update a document retrieved from a query.
### Parameters
This function has no parameters.
### Return Values
Returns a SolrInputDocument on success and **`null`** on failure.
php Ds\PriorityQueue::isEmpty Ds\PriorityQueue::isEmpty
=========================
(PECL ds >= 1.0.0)
Ds\PriorityQueue::isEmpty — Returns whether the queue is empty
### Description
```
public Ds\PriorityQueue::isEmpty(): bool
```
Returns whether the queue is empty.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the queue is empty, **`false`** otherwise.
### Examples
**Example #1 **Ds\PriorityQueue::isEmpty()** example**
```
<?php
$a = new \Ds\PriorityQueue();
$b = new \Ds\PriorityQueue();
$a->push("a", 5);
$a->push("b", 15);
$a->push("c", 10);
var_dump($a->isEmpty());
var_dump($b->isEmpty());
?>
```
The above example will output something similar to:
```
bool(false)
bool(true)
```
php socket_strerror socket\_strerror
================
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
socket\_strerror — Return a string describing a socket error
### Description
```
socket_strerror(int $error_code): string
```
**socket\_strerror()** takes as its `error_code` parameter a socket error code as returned by [socket\_last\_error()](function.socket-last-error) and returns the corresponding explanatory text.
>
> **Note**:
>
>
> Although the error messages generated by the socket extension are in English, the system messages retrieved with this function will appear depending on the current locale (**`LC_MESSAGES`**).
>
>
### Parameters
`error_code`
A valid socket error number, likely produced by [socket\_last\_error()](function.socket-last-error).
### Return Values
Returns the error message associated with the `error_code` parameter.
### Examples
**Example #1 **socket\_strerror()** example**
```
<?php
if (false == ($socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) {
echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n";
}
if (false == (@socket_bind($socket, '127.0.0.1', 80))) {
echo "socket_bind() failed: reason: " . socket_strerror(socket_last_error($socket)) . "\n";
}
?>
```
The expected output from the above example (assuming the script is not run with root privileges):
```
socket_bind() failed: reason: Permission denied
```
### See Also
* [socket\_accept()](function.socket-accept) - Accepts a connection on a socket
* [socket\_bind()](function.socket-bind) - Binds a name to a socket
* [socket\_connect()](function.socket-connect) - Initiates a connection on a socket
* [socket\_listen()](function.socket-listen) - Listens for a connection on a socket
* [socket\_create()](function.socket-create) - Create a socket (endpoint for communication)
php SplFileInfo::getFileInfo SplFileInfo::getFileInfo
========================
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
SplFileInfo::getFileInfo — Gets an SplFileInfo object for the file
### Description
```
public SplFileInfo::getFileInfo(?string $class = null): SplFileInfo
```
This method gets an [SplFileInfo](class.splfileinfo) object for the referenced file.
### Parameters
`class`
Name of an [SplFileInfo](class.splfileinfo) derived class to use.
### Return Values
An [SplFileInfo](class.splfileinfo) object created for the file.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `class` is now nullable. |
### See Also
* [SplFileInfo::setInfoClass()](splfileinfo.setinfoclass) - Sets the class used with SplFileInfo::getFileInfo and SplFileInfo::getPathInfo
php date_create_immutable date\_create\_immutable
=======================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
date\_create\_immutable — Alias of [DateTimeImmutable::\_\_construct()](datetimeimmutable.construct)
### Description
This function is an alias of: [DateTimeImmutable::\_\_construct()](datetimeimmutable.construct)
php IntlCalendar::getType IntlCalendar::getType
=====================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::getType — Get the calendar type
### Description
Object-oriented style
```
public IntlCalendar::getType(): string
```
Procedural style
```
intlcal_get_type(IntlCalendar $calendar): string
```
A string describing the type of this calendar. This is one of the [valid values](intlcalendar.getkeywordvaluesforlocale) for the calendar keyword value `'calendar'`.
### Parameters
`calendar`
An [IntlCalendar](class.intlcalendar) instance.
### Return Values
A string representing the calendar type, such as `'gregorian'`, `'islamic'`, etc.
### Examples
**Example #1 **IntlCalendar::getType()****
```
<?php
ini_set('date.timezone', 'Europe/Lisbon');
ini_set('intl.default_locale', 'en_US');
$cal = IntlCalendar::createInstance(NULL, '@calendar=ethiopic-amete-alem');
var_dump($cal->getType());
$cal = new IntlGregorianCalendar();
var_dump($cal->getType());
```
The above example will output:
```
string(19) "ethiopic-amete-alem"
string(9) "gregorian"
```
php ssh2_sftp_chmod ssh2\_sftp\_chmod
=================
(PECL ssh2 >= 0.12)
ssh2\_sftp\_chmod — Changes file mode
### Description
```
ssh2_sftp_chmod(resource $sftp, string $filename, int $mode): bool
```
Attempts to change the mode of the specified file to that given in `mode`.
### Parameters
`sftp`
An SSH2 SFTP resource opened by [ssh2\_sftp()](function.ssh2-sftp).
`filename`
Path to the file.
`mode`
Permissions on the file. See the [chmod()](function.chmod) for more details on this parameter.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 Changing the mode of a file on a remote server**
```
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$sftp = ssh2_sftp($connection);
ssh2_sftp_chmod($sftp, '/somedir/somefile', 0755);
?>
```
### See Also
* [chmod()](function.chmod) - Changes file mode
* [ssh2\_sftp()](function.ssh2-sftp) - Initialize SFTP subsystem
* [ssh2\_connect()](function.ssh2-connect) - Connect to an SSH server
php SolrDocumentField::__construct SolrDocumentField::\_\_construct
================================
(PECL solr >= 0.9.2)
SolrDocumentField::\_\_construct — Constructor
### Description
public **SolrDocumentField::\_\_construct**() Constructor.
### Parameters
This function has no parameters.
### Return Values
None.
php Imagick::reduceNoiseImage Imagick::reduceNoiseImage
=========================
(PECL imagick 2, PECL imagick 3)
Imagick::reduceNoiseImage — Smooths the contours of an image
**Warning**This function has been *DEPRECATED* as of Imagick 3.4.4. Relying on this function is highly discouraged.
### Description
```
public Imagick::reduceNoiseImage(float $radius): bool
```
Smooths the contours of an image while still preserving edge information. The algorithm works by replacing each pixel with its neighbor closest in value. A neighbor is defined by radius. Use a radius of 0 and Imagick::reduceNoiseImage() selects a suitable radius for you.
### Parameters
`radius`
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::reduceNoiseImage()****
```
<?php
function reduceNoiseImage($imagePath, $reduceNoise) {
$imagick = new \Imagick(realpath($imagePath));
@$imagick->reduceNoiseImage($reduceNoise);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php SolrQuery::setFacetDateHardEnd SolrQuery::setFacetDateHardEnd
==============================
(PECL solr >= 0.9.2)
SolrQuery::setFacetDateHardEnd — Maps to facet.date.hardend
### Description
```
public SolrQuery::setFacetDateHardEnd(bool $value, string $field_override = ?): SolrQuery
```
Maps to facet.date.hardend
### Parameters
`value`
See facet.date.hardend
`field_override`
The name of the field
### Return Values
Returns the current SolrQuery object, if the return value is used.
php imap_status imap\_status
============
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_status — Returns status information on a mailbox
### Description
```
imap_status(IMAP\Connection $imap, string $mailbox, int $flags): stdClass|false
```
Gets status information about the given `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.
`flags`
Valid flags are:
* **`SA_MESSAGES`** - set $status->messages to the number of messages in the mailbox
* **`SA_RECENT`** - set $status->recent to the number of recent messages in the mailbox
* **`SA_UNSEEN`** - set $status->unseen to the number of unseen (new) messages in the mailbox
* **`SA_UIDNEXT`** - set $status->uidnext to the next uid to be used in the mailbox
* **`SA_UIDVALIDITY`** - set $status->uidvalidity to a constant that changes when uids for the mailbox may no longer be valid
* **`SA_ALL`** - set all of the above
### Return Values
This function returns an object containing status information, or **`false`** on failure. The object has the following properties: `messages`, `recent`, `unseen`, `uidnext`, and `uidvalidity`.
`flags` is also set, which contains a bitmask which can be checked against any of the above constants.
### 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\_status()** example**
```
<?php
$mbox = imap_open("{imap.example.com}", "username", "password", OP_HALFOPEN)
or die("can't connect: " . imap_last_error());
$status = imap_status($mbox, "{imap.example.org}INBOX", SA_ALL);
if ($status) {
echo "Messages: " . $status->messages . "<br />\n";
echo "Recent: " . $status->recent . "<br />\n";
echo "Unseen: " . $status->unseen . "<br />\n";
echo "UIDnext: " . $status->uidnext . "<br />\n";
echo "UIDvalidity:" . $status->uidvalidity . "<br />\n";
} else {
echo "imap_status failed: " . imap_last_error() . "\n";
}
imap_close($mbox);
?>
```
php The Parle\Lexer class
The Parle\Lexer class
=====================
Introduction
------------
(PECL parle >= 0.5.1)
Single state lexer class. Lexemes can be defined on the fly. If the particular lexer instance is meant to be used with [Parle\Parser](class.parle-parser), the token IDs need to be taken from there. Otherwise, arbitrary token IDs can be supplied. This lexer can give a certain performance advantage over [Parle\RLexer](class.parle-rlexer), if no multiple states are required. Note, that [Parle\RParser](class.parle-rparser) is not compatible with this lexer.
Class synopsis
--------------
class **Parle\Lexer** { /\* Constants \*/ const int [ICASE](class.parle-lexer#parle-lexer.constants.flag-regex-icase) = 1;
const int [DOT\_NOT\_LF](class.parle-lexer#parle-lexer.constants.flag-regex-dot-not-lf) = 2;
const int [DOT\_NOT\_CRLF](class.parle-lexer#parle-lexer.constants.flag-regex-dot-not-cr-lf) = 4;
const int [SKIP\_WS](class.parle-lexer#parle-lexer.constants.flag-regex-skip-ws) = 8;
const int [MATCH\_ZERO\_LEN](class.parle-lexer#parle-lexer.constants.flag-regex-match-zero-len) = 16; /\* Properties \*/
public bool [$bol](class.parle-lexer#parle-lexer.props.bol) = **`false`**;
public int [$flags](class.parle-lexer#parle-lexer.props.flags) = 0;
public int [$state](class.parle-lexer#parle-lexer.props.state) = 0;
public int [$marker](class.parle-lexer#parle-lexer.props.marker) = 0;
public int [$cursor](class.parle-lexer#parle-lexer.props.cursor) = 0; /\* Methods \*/
```
public advance(): void
```
```
public build(): void
```
```
public callout(int $id, callable $callback): void
```
```
public consume(string $data): void
```
```
public dump(): void
```
```
public getToken(): Parle\Token
```
```
public insertMacro(string $name, string $regex): void
```
```
public push(string $regex, int $id): void
```
```
public reset(int $pos): void
```
} Predefined Constants
--------------------
**`Parle\Lexer::ICASE`** **`Parle\Lexer::DOT_NOT_LF`** **`Parle\Lexer::DOT_NOT_CRLF`** **`Parle\Lexer::SKIP_WS`** **`Parle\Lexer::MATCH_ZERO_LEN`** Properties
----------
bol Start of input flag.
flags Lexer flags.
state Current lexer state, readonly.
marker Position of the latest token match, readonly.
cursor Current input offset, readonly.
Table of Contents
-----------------
* [Parle\Lexer::advance](parle-lexer.advance) — Process next lexer rule
* [Parle\Lexer::build](parle-lexer.build) — Finalize the lexer rule set
* [Parle\Lexer::callout](parle-lexer.callout) — Define token callback
* [Parle\Lexer::consume](parle-lexer.consume) — Pass the data for processing
* [Parle\Lexer::dump](parle-lexer.dump) — Dump the state machine
* [Parle\Lexer::getToken](parle-lexer.gettoken) — Retrieve the current token
* [Parle\Lexer::insertMacro](parle-lexer.insertmacro) — Insert regex macro
* [Parle\Lexer::push](parle-lexer.push) — Add a lexer rule
* [Parle\Lexer::reset](parle-lexer.reset) — Reset lexer
php OAuth::getAccessToken OAuth::getAccessToken
=====================
(PECL OAuth >= 0.99.1)
OAuth::getAccessToken — Fetch an access token
### Description
```
public OAuth::getAccessToken(
string $access_token_url,
string $auth_session_handle = ?,
string $verifier_token = ?,
string $http_method = ?
): array
```
Fetch an access token, secret and any additional response parameters from the service provider.
### Parameters
`access_token_url`
URL to the access token API.
`auth_session_handle`
Authorization session handle, this parameter does not have any citation in the core OAuth 1.0 specification but may be implemented by large providers. [» See ScalableOAuth](http://oauth.pbwiki.com/ScalableOAuth/) for more information.
`verifier_token`
For service providers which support 1.0a, a `verifier_token` must be passed while exchanging the request token for the access token. If the `verifier_token` is present in `$_GET` or `$_POST` it is passed automatically and the caller does not need to specify a `verifier_token` (usually if the access token is exchanged at the oauth\_callback URL). [» See ScalableOAuth](http://oauth.pbwiki.com/ScalableOAuth/) for more information.
`http_method`
HTTP method to use, e.g. `GET` or `POST`.
### Return Values
Returns an array containing the parsed OAuth response on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| PECL oauth 1.0.0 | Previously returned **`null`** on failure, instead of **`false`**. |
| PECL oauth 0.99.9 | The `verifier_token` parameter was added |
### Examples
**Example #1 **OAuth::getAccessToken()** example**
```
<?php
try {
$oauth = new OAuth(OAUTH_CONSUMER_KEY,OAUTH_CONSUMER_SECRET);
$oauth->setToken($request_token,$request_token_secret);
$access_token_info = $oauth->getAccessToken("https://example.com/oauth/access_token");
if(!empty($access_token_info)) {
print_r($access_token_info);
} else {
print "Failed fetching access token, response was: " . $oauth->getLastResponse();
}
} catch(OAuthException $E) {
echo "Response: ". $E->lastResponse . "\n";
}
?>
```
The above example will output something similar to:
```
Array
(
[oauth_token] => some_token
[oauth_token_secret] => some_token_secret
)
```
### See Also
* [OAuth::getLastResponse()](oauth.getlastresponse) - Get the last response
* [OAuth::getLastResponseInfo()](oauth.getlastresponseinfo) - Get HTTP information about the last response
* [OAuth::setToken()](oauth.settoken) - Sets the token and secret
php sodium_crypto_aead_chacha20poly1305_ietf_encrypt sodium\_crypto\_aead\_chacha20poly1305\_ietf\_encrypt
=====================================================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_aead\_chacha20poly1305\_ietf\_encrypt — Encrypt a message
### Description
```
sodium_crypto_aead_chacha20poly1305_ietf_encrypt(
string $message,
string $additional_data,
string $nonce,
string $key
): string
```
Encrypt then authenticate with ChaCha20-Poly1305 (IETF variant).
The IETF variant uses 96-bit nonces and 32-bit internal counters, instead of 64-bit for both.
### Parameters
`message`
The plaintext message to encrypt.
`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 ciphertext and tag on success, or **`false`** on failure.
php GearmanClient::setData GearmanClient::setData
======================
(PECL gearman <= 0.5.0)
GearmanClient::setData — Set application data (deprecated)
### Description
```
public GearmanClient::setData(string $data): bool
```
Sets some arbitrary application data that can later be retrieved by [GearmanClient::data()](gearmanclient.data).
>
> **Note**:
>
>
> This method has been replaced by **GearmanCient::setContext()** in the 0.6.0 release of the Gearman extension.
>
>
### Parameters
`data`
### Return Values
Always returns **`true`**.
### See Also
* [GearmanClient::data()](gearmanclient.data) - Get the application data (deprecated)
php XSLTProcessor::getSecurityPrefs XSLTProcessor::getSecurityPrefs
===============================
(PHP >= 5.4.0, PHP 7, PHP 8)
XSLTProcessor::getSecurityPrefs — Get security preferences
### Description
```
public XSLTProcessor::getSecurityPrefs(): int
```
Gets the security preferences.
### Parameters
This function has no parameters.
### Return Values
A bitmask consisting of **`XSL_SECPREF_READ_FILE`**, **`XSL_SECPREF_WRITE_FILE`**, **`XSL_SECPREF_CREATE_DIRECTORY`**, **`XSL_SECPREF_READ_NETWORK`**, **`XSL_SECPREF_WRITE_NETWORK`**.
php oauth_get_sbs oauth\_get\_sbs
===============
(PECL OAuth >=0.99.7)
oauth\_get\_sbs — Generate a Signature Base String
### Description
```
oauth_get_sbs(string $http_method, string $uri, array $request_parameters = ?): string
```
Generates a Signature Base String according to pecl/oauth.
### Parameters
`http_method`
The HTTP method.
`uri`
URI to encode.
`request_parameters`
Array of request parameters.
### Return Values
Returns a Signature Base String.
| programming_docs |
php simplexml_import_dom simplexml\_import\_dom
======================
(PHP 5, PHP 7, PHP 8)
simplexml\_import\_dom — Get a `SimpleXMLElement` object from a DOM node
### Description
```
simplexml_import_dom(SimpleXMLElement|DOMNode $node, ?string $class_name = SimpleXMLElement::class): ?SimpleXMLElement
```
This function takes a node of a [DOM](https://www.php.net/manual/en/book.dom.php) document and makes it into a SimpleXML node. This new object can then be used as a native SimpleXML element.
### Parameters
`node`
A [DOM](https://www.php.net/manual/en/book.dom.php) Element node
`class_name`
You may use this optional parameter so that **simplexml\_import\_dom()** will return an object of the specified class. That class should extend the [SimpleXMLElement](class.simplexmlelement) class.
### Return Values
Returns a [SimpleXMLElement](class.simplexmlelement) or **`null`** on failure.
### Examples
**Example #1 Importing DOM**
```
<?php
$dom = new DOMDocument;
$dom->loadXML('<books><book><title>blah</title></book></books>');
if (!$dom) {
echo 'Error while parsing the document';
exit;
}
$s = simplexml_import_dom($dom);
echo $s->book[0]->title;
?>
```
The above example will output:
```
blah
```
### See Also
* [dom\_import\_simplexml()](function.dom-import-simplexml) - Gets a DOMElement object from a SimpleXMLElement object
* [Basic SimpleXML usage](https://www.php.net/manual/en/simplexml.examples-basic.php)
php mb_ereg_search_init mb\_ereg\_search\_init
======================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
mb\_ereg\_search\_init — Setup string and regular expression for a multibyte regular expression match
### Description
```
mb_ereg_search_init(string $string, ?string $pattern = null, ?string $options = null): bool
```
**mb\_ereg\_search\_init()** sets `string` and `pattern` for a multibyte regular expression. These values are used for [mb\_ereg\_search()](function.mb-ereg-search), [mb\_ereg\_search\_pos()](function.mb-ereg-search-pos), and [mb\_ereg\_search\_regs()](function.mb-ereg-search-regs).
### Parameters
`string`
The search string.
`pattern`
The search pattern.
`options`
The search option. See [mb\_regex\_set\_options()](function.mb-regex-set-options) for explanation.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `pattern` and `options` are 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\_search\_regs()](function.mb-ereg-search-regs) - Returns the matched part of a multibyte regular expression
php ibase_db_info ibase\_db\_info
===============
(PHP 5, PHP 7 < 7.4.0)
ibase\_db\_info — Request statistics about a database
### Description
```
ibase_db_info(
resource $service_handle,
string $db,
int $action,
int $argument = 0
): string
```
**Warning**This function is currently not documented; only its argument list is available.
php eio_init eio\_init
=========
(PECL eio = 1.0.0)
eio\_init — (Re-)initialize Eio
### Description
```
eio_init(): void
```
**eio\_init()** (re-)initializes Eio. It allocates memory for internal structures of libeio and Eio itself. You may call **eio\_init()** before using Eio functions. Otherwise it will be called internally first time you invoke an Eio function in a process.
>
> **Note**:
>
>
> This function was removed in version 3.0.0RC1 of the eio extension for PHP version 8 and higher.
>
>
### Parameters
This function has no parameters.
### Return Values
No value is returned.
php Imagick::animateImages Imagick::animateImages
======================
(PECL imagick 2 >= 2.3.0, PECL imagick 3)
Imagick::animateImages — Animates an image or images
### Description
```
public Imagick::animateImages(string $x_server): bool
```
This method animates the image onto a local or remote X server. This method is not available on Windows. This method is available if Imagick has been compiled against ImageMagick version 6.3.6 or newer.
### Parameters
`x_server`
X server address
### Return Values
Returns **`true`** on success.
### See Also
* [Imagick::displayImage()](imagick.displayimage) - Displays an image
php ImagickDraw::pathCurveToSmoothRelative ImagickDraw::pathCurveToSmoothRelative
======================================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::pathCurveToSmoothRelative — Draws a cubic Bezier curve
### Description
```
public ImagickDraw::pathCurveToSmoothRelative(
float $x2,
float $y2,
float $x,
float $y
): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Draws a cubic Bezier curve from the current point to (x,y) using relative coordinates. The first control point is assumed to be the reflection of the second control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not an DrawPathCurveToAbsolute, DrawPathCurveToRelative, DrawPathCurveToSmoothAbsolute or DrawPathCurveToSmoothRelative, assume the first control point is coincident with the current point.) (x2,y2) is the second control point (i.e., the control point at the end of the curve). At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier.
### Parameters
`x2`
x coordinate of the second control point
`y2`
y coordinate of the second control point
`x`
x coordinate of the ending point
`y`
y coordinate of the ending point
### Return Values
No value is returned.
php None Void
----
void is a return-only type declaration indicating the function does not return a value, but the function may still terminate. Therefore, it cannot be part of a [union type](language.types.type-system#language.types.type-system.composite.union) declaration. Available as of PHP 7.1.0.
> **Note**: Even if a function has a return type of void it will still return a value, this value is always **`null`**.
>
>
php SimpleXMLElement::asXML SimpleXMLElement::asXML
=======================
(PHP 5, PHP 7, PHP 8)
SimpleXMLElement::asXML — Return a well-formed XML string based on SimpleXML element
### Description
```
public SimpleXMLElement::asXML(?string $filename = null): string|bool
```
The `asXML` method formats the parent object's data in XML version 1.0.
### Parameters
`filename`
If a string value is provided, the function writes the data to the file rather than returning it.
### Return Values
If the `filename` isn't specified, this function returns a string on success and **`false`** on error. If the parameter is specified, it returns **`true`** if the file was written successfully and **`false`** otherwise.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `filename` is nullable now. |
### Examples
**Example #1 Get XML**
```
<?php
$string = <<<XML
<a>
<b>
<c>text</c>
<c>stuff</c>
</b>
<d>
<c>code</c>
</d>
</a>
XML;
$xml = new SimpleXMLElement($string);
echo $xml->asXML();
?>
```
The above example will output:
```
<?xml version="1.0"?>
<a>
<b>
<c>text</c>
<c>stuff</c>
</b>
<d>
<c>code</c>
</d>
</a>
```
`asXML` also works on Xpath results:
**Example #2 Using asXML() on [SimpleXMLElement::xpath()](simplexmlelement.xpath) results**
```
<?php
// Continued from example XML above.
/* Search for <a><b><c> */
$result = $xml->xpath('/a/b/c');
foreach ($result as $node) {
echo $node->asXML();
}
?>
```
The above example will output:
```
<c>text</c><c>stuff</c>
```
### See Also
* [SimpleXMLElement::\_\_toString()](simplexmlelement.tostring) - Returns the string content
* [Basic SimpleXML usage](https://www.php.net/manual/en/simplexml.examples-basic.php)
php Ds\Vector::reversed Ds\Vector::reversed
===================
(PECL ds >= 1.0.0)
Ds\Vector::reversed — Returns a reversed copy
### Description
```
public Ds\Vector::reversed(): Ds\Vector
```
Returns a reversed copy of the vector.
### Parameters
This function has no parameters.
### Return Values
A reversed copy of the vector.
>
> **Note**:
>
>
> The current instance is not affected.
>
>
### Examples
**Example #1 **Ds\Vector::reversed()** example**
```
<?php
$vector = new \Ds\Vector(["a", "b", "c"]);
print_r($vector->reversed());
print_r($vector);
?>
```
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 Gmagick::radialblurimage Gmagick::radialblurimage
========================
(PECL gmagick >= Unknown)
Gmagick::radialblurimage — Radial blurs an image
### Description
```
public Gmagick::radialblurimage(float $angle, int $channel = Gmagick::CHANNEL_DEFAULT): Gmagick
```
Radial blurs an image.
### Parameters
`angle`
The angle of the blur in degrees.
`channel`
Related channel.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php XMLWriter::writeAttributeNs XMLWriter::writeAttributeNs
===========================
xmlwriter\_write\_attribute\_ns
===============================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::writeAttributeNs -- xmlwriter\_write\_attribute\_ns — Write full namespaced attribute
### Description
Object-oriented style
```
public XMLWriter::writeAttributeNs(
?string $prefix,
string $name,
?string $namespace,
string $value
): bool
```
Procedural style
```
xmlwriter_write_attribute_ns(
XMLWriter $writer,
?string $prefix,
string $name,
?string $namespace,
string $value
): bool
```
Writes a full 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. If `prefix` is **`null`**, the namespace will be omitted.
`name`
The attribute name.
`namespace`
The namespace URI. If `namespace` is **`null`**, the namespace declaration will be omitted.
`value`
The attribute value.
### 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::writeAttribute()](xmlwriter.writeattribute) - Write full attribute
* [XMLWriter::startAttribute()](xmlwriter.startattribute) - Create start attribute
* [XMLWriter::startAttributeNs()](xmlwriter.startattributens) - Create start namespaced attribute
* [XMLWriter::endAttribute()](xmlwriter.endattribute) - End attribute
php DirectoryIterator::getPerms DirectoryIterator::getPerms
===========================
(PHP 5, PHP 7, PHP 8)
DirectoryIterator::getPerms — Get the permissions of current DirectoryIterator item
### Description
```
public DirectoryIterator::getPerms(): int
```
Get the permissions of the current [DirectoryIterator](class.directoryiterator) item.
### Parameters
This function has no parameters.
### Return Values
Returns the permissions of the file, as a decimal int.
### Examples
**Example #1 **DirectoryIterator::getPerms()** example**
```
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
foreach ($iterator as $fileinfo) {
if (!$fileinfo->isDot()) {
$octal_perms = substr(sprintf('%o', $fileinfo->getPerms()), -4);
echo $fileinfo->getFilename() . " " . $octal_perms . "\n";
}
}
?>
```
The above example will output something similar to:
```
apple.jpg 0644
banana.jpg 0644
index.php 0744
pear.jpg 0644
```
### See Also
* [DirectoryIterator::isExecutable()](directoryiterator.isexecutable) - Determine if current DirectoryIterator item is executable
* [DirectoryIterator::isReadable()](directoryiterator.isreadable) - Determine if current DirectoryIterator item can be read
* [DirectoryIterator::isWritable()](directoryiterator.iswritable) - Determine if current DirectoryIterator item can be written to
php imap_createmailbox imap\_createmailbox
===================
(PHP 4, PHP 5, PHP 7, PHP 8)
imap\_createmailbox — Create a new mailbox
### Description
```
imap_createmailbox(IMAP\Connection $imap, string $mailbox): bool
```
Creates a new mailbox specified by `mailbox`.
### Parameters
`imap`
An [IMAP\Connection](class.imap-connection) instance.
`mailbox`
The mailbox name, see [imap\_open()](function.imap-open) for more information. Names containing international characters should be encoded by [imap\_utf7\_encode()](function.imap-utf7-encode)
**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.
### 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\_createmailbox()** example**
```
<?php
$mbox = imap_open("{imap.example.org}", "username", "password", OP_HALFOPEN)
or die("can't connect: " . imap_last_error());
$name1 = "phpnewbox";
$name2 = imap_utf7_encode("phpnewböx"); // phpnewb&w7Y-x
$newname = $name1;
echo "Newname will be '$name1'<br />\n";
// we will now create a new mailbox "phptestbox" in your inbox folder,
// check its status after creation and finally remove it to restore
// your inbox to its initial state
if (@imap_createmailbox($mbox, imap_utf7_encode("{imap.example.org}INBOX.$newname"))) {
$status = @imap_status($mbox, "{imap.example.org}INBOX.$newname", SA_ALL);
if ($status) {
echo "your new mailbox '$name1' has the following status:<br />\n";
echo "Messages: " . $status->messages . "<br />\n";
echo "Recent: " . $status->recent . "<br />\n";
echo "Unseen: " . $status->unseen . "<br />\n";
echo "UIDnext: " . $status->uidnext . "<br />\n";
echo "UIDvalidity:" . $status->uidvalidity . "<br />\n";
if (imap_renamemailbox($mbox, "{imap.example.org}INBOX.$newname", "{imap.example.org}INBOX.$name2")) {
echo "renamed new mailbox from '$name1' to '$name2'<br />\n";
$newname = $name2;
} else {
echo "imap_renamemailbox on new mailbox failed: " . imap_last_error() . "<br />\n";
}
} else {
echo "imap_status on new mailbox failed: " . imap_last_error() . "<br />\n";
}
if (@imap_deletemailbox($mbox, "{imap.example.org}INBOX.$newname")) {
echo "new mailbox removed to restore initial state<br />\n";
} else {
echo "imap_deletemailbox on new mailbox failed: " . implode("<br />\n", imap_errors()) . "<br />\n";
}
} else {
echo "could not create new mailbox: " . implode("<br />\n", imap_errors()) . "<br />\n";
}
imap_close($mbox);
?>
```
### See Also
* [imap\_renamemailbox()](function.imap-renamemailbox) - Rename an old mailbox to new mailbox
* [imap\_deletemailbox()](function.imap-deletemailbox) - Delete a mailbox
php expm1 expm1
=====
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
expm1 — Returns exp(number) - 1, computed in a way that is accurate even when the value of number is close to zero
### Description
```
expm1(float $num): float
```
**expm1()** returns the equivalent to 'exp(`num`) - 1' computed in a way that is accurate even if the value of `num` is near zero, a case where 'exp (`num`) - 1' would be inaccurate due to subtraction of two numbers that are nearly equal.
### Parameters
`num`
The argument to process
### Return Values
'e' to the power of `num` minus one
### See Also
* [log1p()](function.log1p) - Returns log(1 + number), computed in a way that is accurate even when the value of number is close to zero
* [exp()](function.exp) - Calculates the exponent of e
php ParentIterator::next ParentIterator::next
====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
ParentIterator::next — Move the iterator forward
### Description
```
public ParentIterator::next(): void
```
Moves the iterator 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.
php MessageFormatter::getLocale MessageFormatter::getLocale
===========================
msgfmt\_get\_locale
===================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
MessageFormatter::getLocale -- msgfmt\_get\_locale — Get the locale for which the formatter was created
### Description
Object-oriented style
```
public MessageFormatter::getLocale(): string
```
Procedural style
```
msgfmt_get_locale(MessageFormatter $formatter): string
```
Get the locale for which the formatter was created.
### Parameters
`formatter`
The formatter resource
### Return Values
The locale name
### Examples
**Example #1 **msgfmt\_get\_locale()** example**
```
<?php
$fmt = msgfmt_create('en_US', "Number {0,number}");
echo msgfmt_get_locale($fmt);
?>
```
**Example #2 OO example**
```
<?php
$fmt = new MessageFormatter('en_US', "Number {0,number}");
echo $fmt->getLocale();
?>
```
The above example will output:
```
en_US
```
### See Also
* [msgfmt\_create()](messageformatter.create) - Constructs a new Message Formatter
php png2wbmp png2wbmp
========
(PHP 4 >= 4.0.5, PHP 5, PHP 7)
png2wbmp — Convert PNG image file to WBMP image file
**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
```
png2wbmp(
string $pngname,
string $wbmpname,
int $dest_height,
int $dest_width,
int $threshold
): bool
```
Converts a PNG file into a WBMP file.
### Parameters
`pngname`
Path to PNG file.
`wbmpname`
Path to destination WBMP file.
`dest_height`
Destination image height.
`dest_width`
Destination image width.
`threshold`
Threshold value, between 0 and 8 (inclusive).
### Return Values
Returns **`true`** on success or **`false`** on failure.
**Caution**However, if libgd fails to output the image, this function returns **`true`**.
### Examples
**Example #1 **png2wbmp()** example**
```
<?php
// Path to the target png
$path = './test.png';
// Get the image sizes
$image = getimagesize($path);
// Convert image
png2wbmp($path, './test.wbmp', $image[1], $image[0], 7);
?>
```
### See Also
* [jpeg2wbmp()](function.jpeg2wbmp) - Convert JPEG image file to WBMP image file
php timezone_abbreviations_list timezone\_abbreviations\_list
=============================
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
timezone\_abbreviations\_list — Alias of [DateTimeZone::listAbbreviations()](datetimezone.listabbreviations)
### Description
This function is an alias of: [DateTimeZone::listAbbreviations()](datetimezone.listabbreviations)
| programming_docs |
php IntlChar::toupper IntlChar::toupper
=================
(PHP 7, PHP 8)
IntlChar::toupper — Make Unicode character uppercase
### Description
```
public static IntlChar::toupper(int|string $codepoint): int|string|null
```
The given character is mapped to its uppercase equivalent. If the character has no uppercase equivalent, the character itself is returned.
### 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 the Simple\_Uppercase\_Mapping of the code point, if any; otherwise the code point itself.
The return type is int unless the code point was passed as a UTF-8 string, in which case a string is returned. Returns **`null`** on failure.
### Examples
**Example #1 Testing different code points**
```
<?php
var_dump(IntlChar::toupper("A"));
var_dump(IntlChar::toupper("a"));
var_dump(IntlChar::toupper("Φ"));
var_dump(IntlChar::toupper("φ"));
var_dump(IntlChar::toupper("1"));
var_dump(IntlChar::toupper(ord("A")));
var_dump(IntlChar::toupper(ord("a")));
?>
```
The above example will output:
```
string(1) "A"
string(1) "A"
string(2) "Φ"
string(2) "Φ"
string(1) "1"
int(65)
int(65)
```
### See Also
* [IntlChar::tolower()](intlchar.tolower) - Make Unicode character lowercase
* [IntlChar::totitle()](intlchar.totitle) - Make Unicode character titlecase
* [mb\_strtoupper()](function.mb-strtoupper) - Make a string uppercase
php EventBufferEvent::writeBuffer EventBufferEvent::writeBuffer
=============================
(PECL event >= 1.2.6-beta)
EventBufferEvent::writeBuffer — Adds contents of the entire buffer to a buffer event's output buffer
### Description
```
public EventBufferEvent::writeBuffer( EventBuffer $buf ): bool
```
Adds contents of the entire buffer to a buffer event's output buffer
### Parameters
`buf` Source [EventBuffer](class.eventbuffer) object.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [EventBufferEvent::write()](eventbufferevent.write) - Adds data to a buffer event's output buffer
php mysqli_result::$current_field mysqli\_result::$current\_field
===============================
mysqli\_field\_tell
===================
(PHP 5, PHP 7, PHP 8)
mysqli\_result::$current\_field -- mysqli\_field\_tell — Get current field offset of a result pointer
### Description
Object-oriented style
int [$mysqli\_result->current\_field](mysqli-result.current-field); Procedural style
```
mysqli_field_tell(mysqli_result $result): int
```
Returns the position of the field cursor used for the last [mysqli\_fetch\_field()](mysqli-result.fetch-field) call. This value can be used as an argument to [mysqli\_field\_seek()](mysqli-result.field-seek).
### 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 current offset of field cursor.
### 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 all columns */
while ($finfo = $result->fetch_field()) {
/* get fieldpointer offset */
$currentfield = $result->current_field;
printf("Column %d:\n", $currentfield);
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 all fields */
while ($finfo = mysqli_fetch_field($result)) {
/* get fieldpointer offset */
$currentfield = mysqli_field_tell($result);
printf("Column %d:\n", $currentfield);
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:
```
Column 1:
Name: Name
Table: Country
max. Len: 11
Flags: 1
Type: 254
Column 2:
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
* [mysqli\_field\_seek()](mysqli-result.field-seek) - Set result pointer to a specified field offset
php Memcached::replace Memcached::replace
==================
(PECL memcached >= 0.1.0)
Memcached::replace — Replace the item under an existing key
### Description
```
public Memcached::replace(string $key, mixed $value, int $expiration = ?): bool
```
**Memcached::replace()** is similar to [Memcached::set()](memcached.set), but the operation fails if the `key` does not exist on the server.
### Parameters
`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. The [Memcached::getResultCode()](memcached.getresultcode) will return **`Memcached::RES_NOTSTORED`** if the key does not exist.
### See Also
* [Memcached::replaceByKey()](memcached.replacebykey) - Replace the item under an existing key on a specific server
* [Memcached::set()](memcached.set) - Store an item
* [Memcached::add()](memcached.add) - Add an item under a new key
php Ds\Deque::insert Ds\Deque::insert
================
(PECL ds >= 1.0.0)
Ds\Deque::insert — Inserts values at a given index
### Description
```
public Ds\Deque::insert(int $index, mixed ...$values): void
```
Inserts values into the deque at a given index.
### Parameters
`index`
The index at which to insert. `0 <= index <= count`
>
> **Note**:
>
>
> You can insert at the index equal to the number of values.
>
>
`values`
The value or values to insert.
### Return Values
No value is returned.
### Errors/Exceptions
[OutOfRangeException](class.outofrangeexception) if the index is not valid.
### Examples
**Example #1 **Ds\Deque::insert()** example**
```
<?php
$deque = new \Ds\Deque();
$deque->insert(0, "e"); // [e]
$deque->insert(1, "f"); // [e, f]
$deque->insert(2, "g"); // [e, f, g]
$deque->insert(0, "a", "b"); // [a, b, e, f, g]
$deque->insert(2, ...["c", "d"]); // [a, b, c, d, e, f, g]
var_dump($deque);
?>
```
The above example will output something similar to:
```
object(Ds\Deque)#1 (7) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
[3]=>
string(1) "d"
[4]=>
string(1) "e"
[5]=>
string(1) "f"
[6]=>
string(1) "g"
}
```
php date date
====
(PHP 4, PHP 5, PHP 7, PHP 8)
date — Format a Unix timestamp
### Description
```
date(string $format, ?int $timestamp = null): string
```
Returns a string formatted according to the given format string using the given integer `timestamp` (Unix timestamp) or the current time if no timestamp is given. In other words, `timestamp` is optional and defaults to the value of [time()](function.time).
**Warning** Unix timestamps do not handle timezones. Use the [DateTimeImmutable](class.datetimeimmutable) class, and its [DateTimeInterface::format()](datetime.format) formatting method to format date/time information with a timezone attached.
### Parameters
`format`
Format accepted by [DateTimeInterface::format()](datetime.format).
`timestamp`
The optional `timestamp` parameter is an int Unix timestamp that defaults to the current local time if `timestamp` is omitted or **`null`**. In other words, it defaults to the value of [time()](function.time).
### Return Values
Returns a formatted date string. If a non-numeric value is used for `timestamp`, **`false`** is returned and an **`E_WARNING`** level error is emitted.
### Errors/Exceptions
Every call to a date/time function will generate a **`E_WARNING`** if the time zone is not valid. See also [date\_default\_timezone\_set()](function.date-default-timezone-set)
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `timestamp` is nullable now. |
### Examples
**Example #1 **date()** examples**
```
<?php
// set the default timezone to use.
date_default_timezone_set('UTC');
// Prints something like: Monday
echo date("l");
// Prints something like: Monday 8th of August 2005 03:12:46 PM
echo date('l jS \of F Y h:i:s A');
// Prints: July 1, 2000 is on a Saturday
echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000));
/* use the constants in the format parameter */
// prints something like: Wed, 25 Sep 2013 15:28:57 -0700
echo date(DATE_RFC2822);
// prints something like: 2000-07-01T00:00:00+00:00
echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000));
?>
```
You can prevent a recognized character in the format string from being expanded by escaping it with a preceding backslash. If the character with a backslash is already a special sequence, you may need to also escape the backslash.
**Example #2 Escaping characters in **date()****
```
<?php
// prints something like: Wednesday the 15th
echo date('l \t\h\e jS');
?>
```
It is possible to use **date()** and [mktime()](function.mktime) together to find dates in the future or the past.
**Example #3 **date()** and [mktime()](function.mktime) example**
```
<?php
$tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y"));
$lastmonth = mktime(0, 0, 0, date("m")-1, date("d"), date("Y"));
$nextyear = mktime(0, 0, 0, date("m"), date("d"), date("Y")+1);
?>
```
>
> **Note**:
>
>
> This can be more reliable than simply adding or subtracting the number of seconds in a day or month to a timestamp because of daylight saving time.
>
>
Some examples of **date()** formatting. Note that you should escape any other characters, as any which currently have a special meaning will produce undesirable results, and other characters may be assigned meaning in future PHP versions. When escaping, be sure to use single quotes to prevent characters like \n from becoming newlines.
**Example #4 **date()** Formatting**
```
<?php
// Assuming today is March 10th, 2001, 5:16:18 pm, and that we are in the
// Mountain Standard Time (MST) Time Zone
$today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm
$today = date("m.d.y"); // 03.10.01
$today = date("j, n, Y"); // 10, 3, 2001
$today = date("Ymd"); // 20010310
$today = date('h-i-s, j-m-y, it is w Day'); // 05-16-18, 10-03-01, 1631 1618 6 Satpm01
$today = date('\i\t \i\s \t\h\e jS \d\a\y.'); // it is the 10th day.
$today = date("D M j G:i:s T Y"); // Sat Mar 10 17:16:18 MST 2001
$today = date('H:m:s \m \i\s\ \m\o\n\t\h'); // 17:03:18 m is month
$today = date("H:i:s"); // 17:16:18
$today = date("Y-m-d H:i:s"); // 2001-03-10 17:16:18 (the MySQL DATETIME format)
?>
```
To format dates in other languages, [IntlDateFormatter::format()](intldateformatter.format) can be used instead of **date()**.
### Notes
>
> **Note**:
>
>
> To generate a timestamp from a string representation of the date, you may be able to use [strtotime()](function.strtotime). Additionally, some databases have functions to convert their date formats into timestamps (such as MySQL's [» UNIX\_TIMESTAMP](http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html) function).
>
>
**Tip** Timestamp of the start of the request is available in [$\_SERVER['REQUEST\_TIME']](reserved.variables.server).
### See Also
* [DateTimeImmutable::\_\_construct()](datetimeimmutable.construct) - Returns new DateTimeImmutable object
* [DateTimeInterface::format()](datetime.format) - Returns date formatted according to given format
* [gmdate()](function.gmdate) - Format a GMT/UTC date/time
* [idate()](function.idate) - Format a local time/date part as integer
* [getdate()](function.getdate) - Get date/time information
* [getlastmod()](function.getlastmod) - Gets time of last page modification
* [mktime()](function.mktime) - Get Unix timestamp for a date
* [IntlDateFormatter::format()](intldateformatter.format) - Format the date/time value as a string
* [time()](function.time) - Return current Unix timestamp
* [Predefined DateTime Constants](class.datetimeinterface#datetimeinterface.constants.types)
php Gmagick::removeimageprofile Gmagick::removeimageprofile
===========================
(PECL gmagick >= Unknown)
Gmagick::removeimageprofile — Removes the named image profile and returns it
### Description
```
public Gmagick::removeimageprofile(string $name): string
```
Removes the named image profile and returns it.
### Parameters
`name`
Name of profile to return: ICC, IPTC, or generic profile.
### Return Values
The named profile.
### Errors/Exceptions
Throws an **GmagickException** on error.
php Parle\Parser::validate Parle\Parser::validate
======================
(PECL parle >= 0.5.1)
Parle\Parser::validate — Validate input
### Description
```
public Parle\Parser::validate(string $data, Parle\Lexer $lexer): bool
```
Validate an input string. The string is parsed internally, thus this method is useful for the quick input validation.
### Parameters
`data`
String to be validated.
`lexer`
A lexer object containing the lexing rules prepared for the particular grammar.
### Return Values
Returns bool witnessing whether the input chimes or not with the defined rules.
php SyncSemaphore::lock SyncSemaphore::lock
===================
(PECL sync >= 1.0.0)
SyncSemaphore::lock — Decreases the count of the semaphore or waits
### Description
```
public SyncSemaphore::lock(int $wait = -1): bool
```
Decreases the count of a [SyncSemaphore](class.syncsemaphore) object or waits until the semaphore becomes non-zero.
### Parameters
`wait`
The number of milliseconds to wait for the semaphore. A value of -1 is infinite.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **SyncSemaphore::lock()** example**
```
<?php
$semaphore = new SyncSemaphore("LimitedResource_2clients", 2);
if (!$semaphore->lock(3000))
{
echo "Unable to lock semaphore.";
exit();
}
/* ... */
$semaphore->unlock();
?>
```
### See Also
* [SyncSemaphore::unlock()](syncsemaphore.unlock) - Increases the count of the semaphore
php Yaf_Application::getLastErrorNo Yaf\_Application::getLastErrorNo
================================
(Yaf >=2.1.2)
Yaf\_Application::getLastErrorNo — Get code of last occurred error
### Description
```
public Yaf_Application::getLastErrorNo(): int
```
### Parameters
This function has no parameters.
### Return Values
### Examples
**Example #1 **Yaf\_Application::getLastErrorNo()**example**
```
<?php
function error_handler($errno, $errstr, $errfile, $errline) {
var_dump(Yaf_Application::app()->getLastErrorNo());
var_dump(Yaf_Application::app()->getLastErrorNo() == YAF_ERR_NOTFOUND_CONTROLLER);
}
$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(516)
bool(true)
```
php sha1_file sha1\_file
==========
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
sha1\_file — Calculate the sha1 hash of a file
### Description
```
sha1_file(string $filename, bool $binary = false): string|false
```
Calculates the sha1 hash of the file specified by `filename` using the [» US Secure Hash Algorithm 1](http://www.faqs.org/rfcs/rfc3174), and returns that hash. The hash is a 40-character hexadecimal number.
### Parameters
`filename`
The filename of the file to hash.
`binary`
When **`true`**, returns the digest in raw binary format with a length of 20.
### Return Values
Returns a string on success, **`false`** otherwise.
### Examples
**Example #1 **sha1\_file()** example**
```
<?php
foreach(glob('/home/Kalle/myproject/*.php') as $ent)
{
if(is_dir($ent))
{
continue;
}
echo $ent . ' (SHA1: ' . sha1_file($ent) . ')', PHP_EOL;
}
?>
```
### See Also
* [sha1()](function.sha1) - Calculate the sha1 hash of a string
* [md5\_file()](function.md5-file) - Calculates the md5 hash of a given file
* [crc32()](function.crc32) - Calculates the crc32 polynomial of a string
php socket_getopt socket\_getopt
==============
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
socket\_getopt — Alias of [socket\_get\_option()](function.socket-get-option)
### Description
This function is an alias of: [socket\_get\_option()](function.socket-get-option).
php SolrInputDocument::deleteField SolrInputDocument::deleteField
==============================
(PECL solr >= 0.9.2)
SolrInputDocument::deleteField — Removes a field from the document
### Description
```
public SolrInputDocument::deleteField(string $fieldName): bool
```
Removes a field from the document.
### Parameters
`fieldName`
The name of the field.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php The SyncEvent class
The SyncEvent class
===================
Introduction
------------
(PECL sync >= 1.0.0)
A cross-platform, native implementation of named and unnamed event objects. Both automatic and manual event objects are supported.
An event object waits, without polling, for the object to be fired/set. One instance waits on the event object while another instance fires/sets the event. Event objects are useful wherever a long-running process would otherwise poll a resource (e.g. checking to see if uploaded data needs to be processed).
Class synopsis
--------------
class **SyncEvent** { /\* Methods \*/
```
public __construct(string $name = ?, bool $manual = false, bool $prefire = false)
```
```
public fire(): bool
```
```
public reset(): bool
```
```
public wait(int $wait = -1): bool
```
} Table of Contents
-----------------
* [SyncEvent::\_\_construct](syncevent.construct) — Constructs a new SyncEvent object
* [SyncEvent::fire](syncevent.fire) — Fires/sets the event
* [SyncEvent::reset](syncevent.reset) — Resets a manual event
* [SyncEvent::wait](syncevent.wait) — Waits for the event to be fired/set
| programming_docs |
php VarnishAdmin::isRunning VarnishAdmin::isRunning
=======================
(PECL varnish >= 0.3)
VarnishAdmin::isRunning — Check if the varnish slave process is currently running
### Description
```
public VarnishAdmin::isRunning(): bool
```
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php pg_options pg\_options
===========
(PHP 4, PHP 5, PHP 7, PHP 8)
pg\_options — Get the options associated with the connection
### Description
```
pg_options(?PgSql\Connection $connection = null): string
```
**pg\_options()** will return a string containing the options specified on the given PostgreSQL `connection` instance.
### 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 `connection` options.
### 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\_options()** example**
```
<?php
$pgsql_conn = pg_connect("dbname=mark host=localhost");
echo pg_options($pgsql_conn);
?>
```
### See Also
* [pg\_connect()](function.pg-connect) - Open a PostgreSQL connection
php Componere\Value::isProtected Componere\Value::isProtected
============================
(Componere 2 >= 2.1.0)
Componere\Value::isProtected — Accessibility Detection
### Description
```
public Componere\Value::isProtected(): bool
```
php Zookeeper::setDeterministicConnOrder Zookeeper::setDeterministicConnOrder
====================================
(PECL zookeeper >= 0.1.0)
Zookeeper::setDeterministicConnOrder — Enable/disable quorum endpoint order randomization
### Description
```
public static Zookeeper::setDeterministicConnOrder(bool $yesOrNo): bool
```
If passed a true value, will make the client connect to quorum peers in the order as specified in the zookeeper\_init() call. A false value causes zookeeper\_init() to permute the peer endpoints which is good for more even client connection distribution among the quorum peers. ZooKeeper C Client uses false by default.
### Parameters
`yesOrNo`
Disable/enable quorum endpoint order randomization.
### 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.
### See Also
* [Zookeeper::\_\_construct()](zookeeper.construct) - Create a handle to used communicate with zookeeper
* [Zookeeper::connect()](zookeeper.connect) - Create a handle to used communicate with zookeeper
* [ZookeeperException](class.zookeeperexception)
php tidy_error_count tidy\_error\_count
==================
(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.5.2)
tidy\_error\_count — Returns the Number of Tidy errors encountered for specified document
### Description
```
tidy_error_count(tidy $tidy): int
```
Returns the number of Tidy errors encountered for the specified document.
### Parameters
`tidy`
The [Tidy](class.tidy) object.
### Return Values
Returns the number of errors.
### Examples
**Example #1 **tidy\_error\_count()** example**
```
<?php
$html = '<p>test</i>
<bogustag>bogus</bogustag>';
$tidy = tidy_parse_string($html);
echo tidy_error_count($tidy) . "\n"; //1
echo $tidy->errorBuffer;
?>
```
The above example will output:
```
1
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 1 column 8 - Warning: discarding unexpected </i>
line 2 column 1 - Error: <bogustag> is not recognized!
line 2 column 1 - Warning: discarding unexpected <bogustag>
line 2 column 16 - Warning: discarding unexpected </bogustag>
line 1 column 1 - Warning: inserting missing 'title' element
```
### See Also
* [tidy\_access\_count()](function.tidy-access-count) - Returns the Number of Tidy accessibility warnings encountered for specified document
* [tidy\_warning\_count()](function.tidy-warning-count) - Returns the Number of Tidy warnings encountered for specified document
php odbc_pconnect odbc\_pconnect
==============
(PHP 4, PHP 5, PHP 7, PHP 8)
odbc\_pconnect — Open a persistent database connection
### Description
```
odbc_pconnect(
string $dsn,
string $user,
string $password,
int $cursor_option = SQL_CUR_USE_DRIVER
): resource|false
```
Opens a persistent database connection.
This function is much like [odbc\_connect()](function.odbc-connect), except that the connection is not really closed when the script has finished. Future requests for a connection with the same `dsn`, `user`, `password` combination (via [odbc\_connect()](function.odbc-connect) and **odbc\_pconnect()**) can reuse the persistent connection.
### Parameters
See [odbc\_connect()](function.odbc-connect) for details.
### Return Values
Returns an ODBC connection, or **`false`** on failure. error.
### Notes
> **Note**: Persistent connections have no effect if PHP is used as a CGI program.
>
>
### See Also
* [odbc\_connect()](function.odbc-connect) - Connect to a datasource
* [Persistent Database Connections](https://www.php.net/manual/en/features.persistent-connections.php)
php The ReflectionException class
The ReflectionException class
=============================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
The ReflectionException class.
Class synopsis
--------------
class **ReflectionException** 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 None NULL
----
The null type is PHP's unit type, i.e. it has only one value: **`null`**.
Undefined, and [unset()](function.unset) variables will resolve to the value **`null`**.
### Syntax
There is only one value of type null, and that is the case-insensitive constant **`null`**.
```
<?php
$var = NULL;
?>
```
### Casting to **`null`**
**Warning**This feature has been *DEPRECATED* as of PHP 7.2.0, and *REMOVED* as of PHP 8.0.0. Relying on this feature is highly discouraged.
Casting a variable to null using `(unset) $var` will *not* remove the variable or unset its value. It will only return a **`null`** value.
### See Also
* [is\_null()](function.is-null)
* [unset()](function.unset)
php fdf_set_flags fdf\_set\_flags
===============
(PHP 4 >= 4.0.2, PHP 5 < 5.3.0, PECL fdf SVN)
fdf\_set\_flags — Sets a flag of a field
### Description
```
fdf_set_flags(
resource $fdf_document,
string $fieldname,
int $whichFlags,
int $newFlags
): bool
```
Sets certain flags of 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.
`whichFlags`
`newFlags`
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [fdf\_set\_opt()](function.fdf-set-opt) - Sets an option of a field
php ImagickDraw::setFontFamily ImagickDraw::setFontFamily
==========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::setFontFamily — Sets the font family to use when annotating with text
### Description
```
public ImagickDraw::setFontFamily(string $font_family): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Sets the font family to use when annotating with text.
### Parameters
`font_family`
the font family
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **ImagickDraw::setFontFamily()** example**
```
<?php
function setFontFamily($fillColor, $strokeColor, $backgroundColor) {
$draw = new \ImagickDraw();
$strokeColor = new \ImagickPixel($strokeColor);
$fillColor = new \ImagickPixel($fillColor);
$draw->setStrokeColor($strokeColor);
$draw->setFillColor($fillColor);
$draw->setStrokeWidth(2);
$draw->setFontSize(48);
$draw->setFontFamily("Times");
$draw->annotation(50, 50, "Lorem Ipsum!");
$draw->setFontFamily("AvantGarde");
$draw->annotation(50, 100, "Lorem Ipsum!");
$draw->setFontFamily("NewCenturySchlbk");
$draw->annotation(50, 150, "Lorem Ipsum!");
$draw->setFontFamily("Palatino");
$draw->annotation(50, 200, "Lorem Ipsum!");
$imagick = new \Imagick();
$imagick->newImage(450, 250, $backgroundColor);
$imagick->setImageFormat("png");
$imagick->drawImage($draw);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>
```
php method_exists method\_exists
==============
(PHP 4, PHP 5, PHP 7, PHP 8)
method\_exists — Checks if the class method exists
### Description
```
method_exists(object|string $object_or_class, string $method): bool
```
Checks if the class method exists in the given `object_or_class`.
### Parameters
`object_or_class`
An object instance or a class name
`method`
The method name
### Return Values
Returns **`true`** if the method given by `method` has been defined for the given `object_or_class`, **`false`** otherwise.
### Examples
**Example #1 **method\_exists()** example**
```
<?php
$directory = new Directory('.');
var_dump(method_exists($directory,'read'));
?>
```
The above example will output:
```
bool(true)
```
**Example #2 Static **method\_exists()** example**
```
<?php
var_dump(method_exists('Directory','read'));
?>
```
The above example will output:
```
bool(true)
```
### Notes
>
> **Note**:
>
>
> Using this function will use any registered [autoloaders](language.oop5.autoload) if the class is not already known.
>
>
>
### See Also
* [function\_exists()](function.function-exists) - Return true if the given function has been defined
* [is\_callable()](function.is-callable) - Verify that a value can be called as a function from the current scope.
* [class\_exists()](function.class-exists) - Checks if the class has been defined
php mysqli_result::$field_count mysqli\_result::$field\_count
=============================
mysqli\_num\_fields
===================
(PHP 5, PHP 7, PHP 8)
mysqli\_result::$field\_count -- mysqli\_num\_fields — Gets the number of fields in the result set
### Description
Object-oriented style
int [$mysqli\_result->field\_count](mysqli-result.field-count); Procedural style
```
mysqli_num_fields(mysqli_result $result): int
```
Returns the number of fields 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).
### Return Values
An int representing the number of fields.
### 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 Name, CountryCode, District, Population FROM City ORDER BY ID LIMIT 1");
/* Get the number of fields in the result set */
$field_cnt = $result->field_count;
printf("Result set has %d fields.\n", $field_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 Name, CountryCode, District, Population FROM City ORDER BY ID LIMIT 1");
/* Get the number of fields in the result set */
$field_cnt = mysqli_num_fields($result);
printf("Result set has %d fields.\n", $field_cnt);
```
The above examples will output:
```
Result set has 4 fields.
```
### See Also
* [mysqli\_fetch\_field()](mysqli-result.fetch-field) - Returns the next field in the result set
php Gmagick::setimageunits Gmagick::setimageunits
======================
(PECL gmagick >= Unknown)
Gmagick::setimageunits — Sets the image units of resolution
### Description
```
public Gmagick::setimageunits(int $resolution): Gmagick
```
Sets the image units of resolution.
### Parameters
`resolution`
One of the [Resolution](https://www.php.net/manual/en/gmagick.constants.php#gmagick.constants.resolution) constant (`Gmagick::RESOLUTION_*`).
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php GearmanClient::context GearmanClient::context
======================
(PECL gearman >= 0.6.0)
GearmanClient::context — Get the application context
### Description
```
public GearmanClient::context(): string
```
Get the application context previously set with [GearmanClient::setContext()](gearmanclient.setcontext).
### Parameters
This function has no parameters.
### Return Values
The same context data structure set with [GearmanClient::setContext()](gearmanclient.setcontext)
### See Also
* [GearmanClient::setContext()](gearmanclient.setcontext) - Set application context
php SolrQuery::setStats SolrQuery::setStats
===================
(PECL solr >= 0.9.2)
SolrQuery::setStats — Enables or disables the Stats component
### Description
```
public SolrQuery::setStats(bool $flag): SolrQuery
```
Enables or disables the Stats component.
### Parameters
`flag`
**`true`** turns on the stats component and **`false`** disables it.
### Return Values
Returns the current SolrQuery object, if the return value is used.
php Imagick::autoLevelImage Imagick::autoLevelImage
=======================
(PECL imagick 3 >= 3.3.0)
Imagick::autoLevelImage — Description
### Description
```
public Imagick::autoLevelImage(int $channel = Imagick::CHANNEL_DEFAULT): bool
```
Adjusts the levels of a particular image channel by scaling the minimum and maximum values to the full quantum range.
### Parameters
`channel`
Which channel should the auto-levelling should be done on.
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::autoLevelImage()****
```
<?php
function autoLevelImage($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->autoLevelImage();
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php Ds\Sequence::unshift Ds\Sequence::unshift
====================
(PECL ds >= 1.0.0)
Ds\Sequence::unshift — Adds values to the front of the sequence
### Description
```
abstract public Ds\Sequence::unshift(mixed $values = ?): void
```
Adds values to the front of the sequence, moving all the current values forward to make room for the new values.
### Parameters
`values`
The values to add to the front of the sequence.
>
> **Note**:
>
>
> Multiple values will be added in the same order that they are passed.
>
>
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Sequence::unshift()** example**
```
<?php
$sequence = new \Ds\Vector([1, 2, 3]);
$sequence->unshift("a");
$sequence->unshift("b", "c");
print_r($sequence);
?>
```
The above example will output something similar to:
```
Ds\Vector Object
(
[0] => b
[1] => c
[2] => a
[3] => 1
[4] => 2
[5] => 3
)
```
php tidy::body tidy::body
==========
tidy\_get\_body
===============
(PHP 5, PHP 7, PHP 8, PECL tidy 0.5.2-1.0)
tidy::body -- tidy\_get\_body — Returns a [tidyNode](class.tidynode) object starting from the <body> tag of the tidy parse tree
### Description
Object-oriented style
```
public tidy::body(): ?tidyNode
```
Procedural style
```
tidy_get_body(tidy $tidy): ?tidyNode
```
Returns a [tidyNode](class.tidynode) object starting from the <body> tag of the tidy parse tree.
### Parameters
`tidy`
The [Tidy](class.tidy) object.
### Return Values
Returns a [tidyNode](class.tidynode) object starting from the <body> tag of the tidy parse tree.
### Examples
**Example #1 **tidy::getBody()** example**
```
<?php
$html = '
<html>
<head>
<title>test</title>
</head>
<body>
<p>paragraph</p>
</body>
</html>';
$tidy = tidy_parse_string($html);
$body = $tidy->Body();
echo $body->value;
?>
```
The above example will output:
```
<body>
<p>paragraph</p>
</body>
```
### See Also
* [tidy::head()](tidy.head) - Returns a tidyNode object starting from the <head> tag of the tidy parse tree
* [tidy::html()](tidy.html) - Returns a tidyNode object starting from the <html> tag of the tidy parse tree
php pathinfo pathinfo
========
(PHP 4 >= 4.0.3, PHP 5, PHP 7, PHP 8)
pathinfo — Returns information about a file path
### Description
```
pathinfo(string $path, int $flags = PATHINFO_ALL): array|string
```
**pathinfo()** returns information about `path`: either an associative array or a string, depending on `flags`.
>
> **Note**:
>
>
> For information on retrieving the current path info, read the section on [predefined reserved variables](language.variables.predefined).
>
>
>
> **Note**:
>
>
> **pathinfo()** operates naively on the input string, and is not aware of the actual filesystem, or path components such as "`..`".
>
>
**Caution** **pathinfo()** is locale aware, so for it to parse a path containing multibyte characters correctly, the matching locale must be set using the [setlocale()](function.setlocale) function.
### Parameters
`path`
The path to be parsed.
`flags`
If present, specifies a specific element to be returned; one of **`PATHINFO_DIRNAME`**, **`PATHINFO_BASENAME`**, **`PATHINFO_EXTENSION`** or **`PATHINFO_FILENAME`**.
If `flags` is not specified, returns all available elements.
### Return Values
If the `flags` parameter is not passed, an associative array containing the following elements is returned: `dirname`, `basename`, `extension` (if any), and `filename`.
>
> **Note**:
>
>
> If the `path` has more than one extension, **`PATHINFO_EXTENSION`** returns only the last one and **`PATHINFO_FILENAME`** only strips the last one. (see first example below).
>
>
>
> **Note**:
>
>
> If the `path` does not have an extension, no `extension` element will be returned (see second example below).
>
>
>
> **Note**:
>
>
> If the `basename` of the `path` starts with a dot, the following characters are interpreted as `extension`, and the `filename` is empty (see third example below).
>
>
If `flags` is present, returns a string containing the requested element.
### Examples
**Example #1 **pathinfo()** Example**
```
<?php
$path_parts = pathinfo('/www/htdocs/inc/lib.inc.php');
echo $path_parts['dirname'], "\n";
echo $path_parts['basename'], "\n";
echo $path_parts['extension'], "\n";
echo $path_parts['filename'], "\n";
?>
```
The above example will output:
```
/www/htdocs/inc
lib.inc.php
php
lib.inc
```
**Example #2 **pathinfo()** example showing difference between null and no extension**
```
<?php
$path_parts = pathinfo('/path/emptyextension.');
var_dump($path_parts['extension']);
$path_parts = pathinfo('/path/noextension');
var_dump($path_parts['extension']);
?>
```
The above example will output something similar to:
```
string(0) ""
Notice: Undefined index: extension in test.php on line 6
NULL
```
**Example #3 **pathinfo()** example for a dot-file**
```
<?php
print_r(pathinfo('/some/path/.test'));
?>
```
The above example will output something similar to:
```
Array
(
[dirname] => /some/path
[basename] => .test
[extension] => test
[filename] =>
)
```
### See Also
* [dirname()](function.dirname) - Returns a parent directory's path
* [basename()](function.basename) - Returns trailing name component of path
* [parse\_url()](function.parse-url) - Parse a URL and return its components
* [realpath()](function.realpath) - Returns canonicalized absolute pathname
| programming_docs |
php radius_demangle_mppe_key radius\_demangle\_mppe\_key
===========================
(PECL radius >= 1.2.0)
radius\_demangle\_mppe\_key — Derives mppe-keys from mangled data
### Description
```
radius_demangle_mppe_key(resource $radius_handle, string $mangled): string
```
When using MPPE with MS-CHAPv2, the send- and recv-keys are mangled (see [» RFC 2548](http://www.faqs.org/rfcs/rfc2548)), however this function is useless, because I don't think that there is or will be a PPTP-MPPE implementation in PHP.
### Parameters
`radius_handle`
The RADIUS resource.
`mangled`
The mangled data to demangle
### Return Values
Returns the demangled string, or **`false`** on error.
php file_get_contents file\_get\_contents
===================
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
file\_get\_contents — Reads entire file into a string
### Description
```
file_get_contents(
string $filename,
bool $use_include_path = false,
?resource $context = null,
int $offset = 0,
?int $length = null
): string|false
```
This function is similar to [file()](function.file), except that **file\_get\_contents()** returns the file in a string, starting at the specified `offset` up to `length` bytes. On failure, **file\_get\_contents()** will return **`false`**.
**file\_get\_contents()** is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by your OS to enhance performance.
>
> **Note**:
>
>
> If you're opening a URI with special characters, such as spaces, you need to encode the URI with [urlencode()](function.urlencode).
>
>
### Parameters
`filename`
Name of the file to read.
`use_include_path`
>
> **Note**:
>
>
> The **`FILE_USE_INCLUDE_PATH`** constant can be used to trigger [include path](https://www.php.net/manual/en/ini.core.php#ini.include-path) search. This is not possible if [strict typing](language.types.declarations#language.types.declarations.strict) is enabled, since **`FILE_USE_INCLUDE_PATH`** is an int. Use **`true`** instead.
>
>
`context`
A valid context resource created with [stream\_context\_create()](function.stream-context-create). If you don't need to use a custom context, you can skip this parameter by **`null`**.
`offset`
The offset where the reading starts on the original stream. Negative offsets count from the end of the stream.
Seeking (`offset`) is not supported with remote files. Attempting to seek on non-local files may work with small offsets, but this is unpredictable because it works on the buffered stream.
`length`
Maximum length of data read. The default is to read until end of file is reached. Note that this parameter is applied to the stream processed by the filters.
### Return Values
The function returns the read data 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
An **`E_WARNING`** level error is generated if `filename` cannot be found, `length` is less than zero, or if seeking to the specified `offset` in the stream fails.
When **file\_get\_contents()** is called on a directory, an **`E_WARNING`** level error is generated on Windows, and as of PHP 7.4 on other operating systems as well.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `length` is nullable now. |
| 7.1.0 | Support for negative `offset`s has been added. |
### Examples
**Example #1 Get and output the source of the homepage of a website**
```
<?php
$homepage = file_get_contents('http://www.example.com/');
echo $homepage;
?>
```
**Example #2 Searching within the include\_path**
```
<?php
// If strict types are enabled i.e. declare(strict_types=1);
$file = file_get_contents('./people.txt', true);
// Otherwise
$file = file_get_contents('./people.txt', FILE_USE_INCLUDE_PATH);
?>
```
**Example #3 Reading a section of a file**
```
<?php
// Read 14 characters starting from the 21st character
$section = file_get_contents('./people.txt', FALSE, NULL, 20, 14);
var_dump($section);
?>
```
The above example will output something similar to:
```
string(14) "lle Bjori Ro"
```
**Example #4 Using stream contexts**
```
<?php
// Create a stream
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n"
)
);
$context = stream_context_create($opts);
// Open the file using the HTTP headers set above
$file = file_get_contents('http://www.example.com/', false, $context);
?>
```
### Notes
> **Note**: This function is binary-safe.
>
>
**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.
**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.
### See Also
* [file()](function.file) - Reads entire file into an array
* [fgets()](function.fgets) - Gets line from file pointer
* [fread()](function.fread) - Binary-safe file read
* [readfile()](function.readfile) - Outputs a file
* [file\_put\_contents()](function.file-put-contents) - Write data to a file
* [stream\_get\_contents()](function.stream-get-contents) - Reads remainder of a stream into a string
* [stream\_context\_create()](function.stream-context-create) - Creates a stream context
* [$http\_response\_header](reserved.variables.httpresponseheader)
php SolrQuery::getFacetLimit SolrQuery::getFacetLimit
========================
(PECL solr >= 0.9.2)
SolrQuery::getFacetLimit — Returns the maximum number of constraint counts that should be returned for the facet fields
### Description
```
public SolrQuery::getFacetLimit(string $field_override = ?): int
```
Returns the maximum number of constraint counts that should be returned for the facet fields. This method 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 posix_setgid posix\_setgid
=============
(PHP 4, PHP 5, PHP 7, PHP 8)
posix\_setgid — Set the GID of the current process
### Description
```
posix_setgid(int $group_id): bool
```
Set the real 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. The appropriate order of function calls is **posix\_setgid()** first, [posix\_setuid()](function.posix-setuid) last.
>
> **Note**:
>
>
> If the caller is a super user, this will also set the effective group id.
>
>
### Parameters
`group_id`
The group id.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **posix\_setgid()** example**
This example will print out the effective group id, once it is changed.
```
<?php
echo 'My real group id is '.posix_getgid(); //20
posix_setgid(40);
echo 'My real group id is '.posix_getgid(); //40
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
php QuickHashIntStringHash::saveToFile QuickHashIntStringHash::saveToFile
==================================
(PECL quickhash >= Unknown)
QuickHashIntStringHash::saveToFile — This method stores an in-memory hash to disk
### Description
```
public QuickHashIntStringHash::saveToFile(string $filename): void
```
This method stores an existing hash to a file on disk, in the same format that loadFromFile() can read.
### Parameters
`filename`
The filename of the file to store the hash in.
### Return Values
No value is returned.
### Examples
**Example #1 **QuickHashIntStringHash::saveToFile()** example**
```
<?php
$hash = new QuickHashIntStringHash( 1024 );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 4, "forty three" ) );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 4, "fifty two" ) );
$hash->saveToFile( '/tmp/test.string.hash' );
?>
```
php SyncEvent::fire SyncEvent::fire
===============
(PECL sync >= 1.0.0)
SyncEvent::fire — Fires/sets the event
### Description
```
public SyncEvent::fire(): bool
```
Fires/sets a [SyncEvent](class.syncevent) object. Lets multiple threads through that are waiting if the event object was created with a manual value of **`true`**.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **SyncEvent::fire()** example**
```
<?php
// In a web application:
$event = new SyncEvent("GetAppReport");
$event->fire();
// In a cron job:
$event = new SyncEvent("GetAppReport");
$event->wait();
?>
```
### See Also
* [SyncEvent::reset()](syncevent.reset) - Resets a manual event
* [SyncEvent::wait()](syncevent.wait) - Waits for the event to be fired/set
php sodium_crypto_box sodium\_crypto\_box
===================
(PHP 7 >= 7.2.0, PHP 8)
sodium\_crypto\_box — Authenticated public-key encryption
### Description
```
sodium_crypto_box(string $message, string $nonce, string $key_pair): string
```
Encrypt a message using asymmetric (public key) cryptography.
The algorithm used by functions prefixed with **sodium\_crypto\_box()** are Elliptic Curve Diffie-Hellman over the Montgomery curve, Curve25519; usually abbreviated as X25519.
### Parameters
`message`
The message to be encrypted.
`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 X25519 secret key and the recipient's X25519 public key.
### Return Values
Returns the encrypted message (ciphertext plus authentication tag). The ciphertext will be 16 bytes longer than the plaintext, and a raw binary string. See [sodium\_bin2base64()](function.sodium-bin2base64) for safe encoding for storage.
php openssl_pkey_get_private openssl\_pkey\_get\_private
===========================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
openssl\_pkey\_get\_private — Get a private key
### Description
```
openssl_pkey_get_private(OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $private_key, ?string $passphrase = null): OpenSSLAsymmetricKey|false
```
**openssl\_pkey\_get\_private()** parses `private_key` and prepares it for use by other functions.
### Parameters
`private_key`
`private_key` can be one of the following:
1. a string having the format file://path/to/file.pem. The named file must contain a PEM encoded certificate/private key (it may contain both).
2. A PEM formatted private key.
`passphrase`
The optional parameter `passphrase` must be used if the specified key is encrypted (protected by a passphrase).
### Return Values
Returns an [OpenSSLAsymmetricKey](class.opensslasymmetrickey) instance on success, or **`false`** on error.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | On success, this function returns an [OpenSSLAsymmetricKey](class.opensslasymmetrickey) instance now; previously, a [resource](language.types.resource) of type `OpenSSL key` was returned. |
| 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. |
| 8.0.0 | `passphrase` is nullable now. |
php CachingIterator::hasNext CachingIterator::hasNext
========================
(PHP 5, PHP 7, PHP 8)
CachingIterator::hasNext — Check whether the inner iterator has a valid next element
### Description
```
public CachingIterator::hasNext(): bool
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
php opcache_invalidate opcache\_invalidate
===================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL ZendOpcache >= 7.0.0)
opcache\_invalidate — Invalidates a cached script
### Description
```
opcache_invalidate(string $filename, bool $force = false): bool
```
This function invalidates a particular script from the opcode cache. If `force` is unset or **`false`**, the script will only be invalidated if the modification time of the script is newer than the cached opcodes. This function only invalidates in-memory cache and not file cache.
### Parameters
`filename`
The path to the script being invalidated.
`force`
If set to **`true`**, the script will be invalidated regardless of whether invalidation is necessary.
### Return Values
Returns **`true`** if the opcode cache for `filename` was invalidated or if there was nothing to invalidate, or **`false`** if the opcode cache is disabled.
### See Also
* [opcache\_compile\_file()](function.opcache-compile-file) - Compiles and caches a PHP script without executing it
* [opcache\_reset()](function.opcache-reset) - Resets the contents of the opcode cache
php SplObjectStorage::next SplObjectStorage::next
======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplObjectStorage::next — Move to the next entry
### Description
```
public SplObjectStorage::next(): void
```
Moves the iterator to the next object in the storage.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Examples
**Example #1 **SplObjectStorage::next()** 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)
var_dump($index);
var_dump($object);
$s->next();
}
?>
```
The above example will output something similar to:
```
int(0)
object(stdClass)#2 (0) {
}
int(1)
object(stdClass)#3 (0) {
}
```
### See Also
* [SPLObjectStorage::rewind()](splobjectstorage.rewind) - Rewind the iterator to the first storage element
php The PriorityQueue class
The PriorityQueue class
=======================
Introduction
------------
(No version information available, might only be in Git)
A PriorityQueue is very similar to a Queue. Values are pushed into the queue with an assigned priority, and the value with the highest priority will always be at the front of the queue.
Implemented using a max heap.
>
> **Note**:
>
>
> "First in, first out" ordering is preserved for values with the same priority.
>
>
>
> **Note**:
>
>
> Iterating over a PriorityQueue is destructive, equivalent to successive pop operations until the queue is empty.
>
>
Class synopsis
--------------
class **Ds\PriorityQueue** implements **Ds\Collection** { /\* Constants \*/ const int [MIN\_CAPACITY](class.ds-priorityqueue#ds-priorityqueue.constants.min-capacity) = 8; /\* Methods \*/
```
public allocate(int $capacity): void
```
```
public capacity(): int
```
```
public clear(): void
```
```
public copy(): Ds\PriorityQueue
```
```
public isEmpty(): bool
```
```
public peek(): mixed
```
```
public pop(): mixed
```
```
public push(mixed $value, int $priority): void
```
```
public toArray(): array
```
} Predefined Constants
--------------------
**`Ds\PriorityQueue::MIN_CAPACITY`** Table of Contents
-----------------
* [Ds\PriorityQueue::allocate](ds-priorityqueue.allocate) — Allocates enough memory for a required capacity
* [Ds\PriorityQueue::capacity](ds-priorityqueue.capacity) — Returns the current capacity
* [Ds\PriorityQueue::clear](ds-priorityqueue.clear) — Removes all values
* [Ds\PriorityQueue::\_\_construct](ds-priorityqueue.construct) — Creates a new instance
* [Ds\PriorityQueue::copy](ds-priorityqueue.copy) — Returns a shallow copy of the queue
* [Ds\PriorityQueue::count](ds-priorityqueue.count) — Returns the number of values in the queue
* [Ds\PriorityQueue::isEmpty](ds-priorityqueue.isempty) — Returns whether the queue is empty
* [Ds\PriorityQueue::jsonSerialize](ds-priorityqueue.jsonserialize) — Returns a representation that can be converted to JSON
* [Ds\PriorityQueue::peek](ds-priorityqueue.peek) — Returns the value at the front of the queue
* [Ds\PriorityQueue::pop](ds-priorityqueue.pop) — Removes and returns the value with the highest priority
* [Ds\PriorityQueue::push](ds-priorityqueue.push) — Pushes values into the queue
* [Ds\PriorityQueue::toArray](ds-priorityqueue.toarray) — Converts the queue to an array
php PharData::addFile PharData::addFile
=================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
PharData::addFile — Add a file from the filesystem to the tar/zip archive
### Description
```
public PharData::addFile(string $filename, ?string $localName = null): void
```
With this method, any file or URL can be added to the tar/zip archive. If the optional second parameter `localname` is specified, 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 **PharData::addFile()** example**
```
<?php
try {
$a = new PharData('/path/to/my.tar');
$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**: **PharData::addFile()**, [PharData::addFromString()](phardata.addfromstring) and [PharData::offsetSet()](phardata.offsetset) save a new phar archive each time they are called. If performance is a concern, [PharData::buildFromDirectory()](phardata.buildfromdirectory) or [PharData::buildFromIterator()](phardata.buildfromiterator) should be used instead.
>
>
### See Also
* [PharData::offsetSet()](phardata.offsetset) - Set the contents of a file within the tar/zip to those of an external file or string
* [Phar::addFile()](phar.addfile) - Add a file from the filesystem to the phar archive
* [PharData::addFromString()](phardata.addfromstring) - Add a file from the filesystem to the tar/zip archive
* [PharData::addEmptyDir()](phardata.addemptydir) - Add an empty directory to the tar/zip archive
| programming_docs |
php Gmagick::getimageheight Gmagick::getimageheight
=======================
(PECL gmagick >= Unknown)
Gmagick::getimageheight — Returns the image height
### Description
```
public Gmagick::getimageheight(): int
```
Returns the image height
### Parameters
This function has no parameters.
### Return Values
Returns the image height in pixels.
### Errors/Exceptions
Throws an **GmagickException** on error.
php SolrQuery::getTermsSort SolrQuery::getTermsSort
=======================
(PECL solr >= 0.9.2)
SolrQuery::getTermsSort — Returns an integer indicating how terms are sorted
### Description
```
public SolrQuery::getTermsSort(): int
```
SolrQuery::TERMS\_SORT\_INDEX indicates that the terms are returned by index order. SolrQuery::TERMS\_SORT\_COUNT implies that the terms are sorted by term frequency (highest count first)
### Parameters
This function has no parameters.
### Return Values
Returns an integer on success and **`null`** if not set.
php Parle\RParser::right Parle\RParser::right
====================
(PECL parle >= 0.7.0)
Parle\RParser::right — Declare a token with right-associativity
### Description
```
public Parle\RParser::right(string $tok): void
```
Declare a terminal with right associativity.
### Parameters
`tok`
Token name.
### Return Values
No value is returned.
php socket_set_block socket\_set\_block
==================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
socket\_set\_block — Sets blocking mode on a socket
### Description
```
socket_set_block(Socket $socket): bool
```
The **socket\_set\_block()** function removes the **`O_NONBLOCK`** flag on the socket specified by the `socket` parameter.
When an operation (e.g. receive, send, connect, accept, ...) is performed on a blocking socket, the script will pause its execution until it receives a signal or it can perform the operation.
### Parameters
`socket`
A [Socket](class.socket) instance created with [socket\_create()](function.socket-create) or [socket\_accept()](function.socket-accept).
### 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\_block()** example**
```
<?php
$socket = socket_create_listen(1223);
socket_set_block($socket);
socket_accept($socket);
?>
```
This example creates a listening socket on all interfaces on port 1223 and sets the socket to **`O_BLOCK`** mode. [socket\_accept()](function.socket-accept) will hang until there is a connection to accept.
### See Also
* [socket\_set\_nonblock()](function.socket-set-nonblock) - Sets nonblocking mode for file descriptor fd
* [socket\_set\_option()](function.socket-set-option) - Sets socket options for the socket
php fbird_commit fbird\_commit
=============
(PHP 5, PHP 7 < 7.4.0)
fbird\_commit — Alias of [ibase\_commit()](function.ibase-commit)
### Description
This function is an alias of: [ibase\_commit()](function.ibase-commit).
php SolrQuery::setTimeAllowed SolrQuery::setTimeAllowed
=========================
(PECL solr >= 0.9.2)
SolrQuery::setTimeAllowed — The time allowed for search to finish
### Description
```
public SolrQuery::setTimeAllowed(int $timeAllowed): SolrQuery
```
The time allowed for a search to finish. This value only applies to the search and not to requests in general. Time is in milliseconds. Values less than or equal to zero implies no time restriction. Partial results may be returned, if there are any.
### Parameters
`timeAllowed`
The time allowed for a search to finish.
### Return Values
Returns the current SolrQuery object, if the return value is used.
php Gmagick::writeimage Gmagick::writeimage
===================
(PECL gmagick >= Unknown)
Gmagick::writeimage — Writes an image to the specified filename
### Description
```
public Gmagick::writeimage(string $filename, bool $all_frames = false): Gmagick
```
Writes an image to the specified filename. If the filename parameter is **`null`**, the image is written to the filename set by [Gmagick::readimage()](gmagick.readimage) or [Gmagick::setimagefilename()](gmagick.setimagefilename).
### Parameters
`filename`
The image filename.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php Zookeeper::getState Zookeeper::getState
===================
(PECL zookeeper >= 0.1.0)
Zookeeper::getState — Get the state of the zookeeper connection
### Description
```
public Zookeeper::getState(): int
```
### Parameters
This function has no parameters.
### Return Values
Returns the state of zookeeper connection on success, and false on failure.
### Errors/Exceptions
This method emits PHP error/warning when it fails to get state of zookeeper connection.
**Caution** Since version 0.3.0, this method emits [ZookeeperException](class.zookeeperexception) and it's derivatives.
### See Also
* [Zookeeper::\_\_construct()](zookeeper.construct) - Create a handle to used communicate with zookeeper
* [Zookeeper::connect()](zookeeper.connect) - Create a handle to used communicate with zookeeper
* [Zookeeper::getClientId()](zookeeper.getclientid) - Return the client session id, only valid if the connections is currently connected (ie. last watcher state is ZOO\_CONNECTED\_STATE)
* [ZooKeeper States](class.zookeeper#zookeeper.class.constants.states)
* [ZookeeperException](class.zookeeperexception)
php dba_sync dba\_sync
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
dba\_sync — Synchronize database
### Description
```
dba_sync(resource $dba): bool
```
**dba\_sync()** synchronizes the database. This will probably trigger a physical write to the disk, if supported.
### Parameters
`dba`
The database handler, returned by [dba\_open()](function.dba-open) or [dba\_popen()](function.dba-popen).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [dba\_optimize()](function.dba-optimize) - Optimize database
php headers_list headers\_list
=============
(PHP 5, PHP 7, PHP 8)
headers\_list — Returns a list of response headers sent (or ready to send)
### Description
```
headers_list(): array
```
**headers\_list()** will return a list of headers to be sent to the browser / client. To determine whether or not these headers have been sent yet, use [headers\_sent()](function.headers-sent).
### Parameters
This function has no parameters.
### Return Values
Returns a numerically indexed array of headers.
### Examples
**Example #1 Example using **headers\_list()****
```
<?php
/* setcookie() will add a response header on its own */
setcookie('foo', 'bar');
/* Define a custom response header
This will be ignored by most clients */
header("Example-Test: foo");
/* Specify plain text content in our response */
header('Content-Type: text/plain; charset=UTF-8');
/* What headers are going to be sent? */
var_dump(headers_list());
?>
```
The above example will output something similar to:
```
array(3) {
[0]=>
string(19) "Set-Cookie: foo=bar"
[1]=>
string(17) "Example-Test: foo"
[2]=>
string(39) "Content-Type: text/plain; charset=UTF-8"
}
```
### Notes
>
> **Note**:
>
>
> Headers will only be accessible and output when a SAPI that supports them is in use.
>
>
### See Also
* [headers\_sent()](function.headers-sent) - Checks if or where headers have been sent
* [header()](function.header) - Send a raw HTTP header
* [setcookie()](function.setcookie) - Send a cookie
* [apache\_response\_headers()](function.apache-response-headers) - Fetch all HTTP response headers
* [http\_response\_code()](function.http-response-code) - Get or Set the HTTP response code
php Yaf_Config_Ini::valid Yaf\_Config\_Ini::valid
=======================
(Yaf >=1.0.0)
Yaf\_Config\_Ini::valid — The valid purpose
### Description
```
public Yaf_Config_Ini::valid(): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php ReflectionExtension::isPersistent ReflectionExtension::isPersistent
=================================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
ReflectionExtension::isPersistent — Returns whether this extension is persistent
### Description
```
public ReflectionExtension::isPersistent(): 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 [`extension`](https://www.php.net/manual/en/ini.core.php#ini.extension), **`false`** otherwise.
### See Also
* [ReflectionExtension::isTemporary()](reflectionextension.istemporary) - Returns whether this extension is temporary
php ldap_mod_add_ext ldap\_mod\_add\_ext
===================
(PHP 7 >= 7.3.0, PHP 8)
ldap\_mod\_add\_ext — Add attribute values to current attributes
### Description
```
ldap_mod_add_ext(
LDAP\Connection $ldap,
string $dn,
array $entry,
?array $controls = null
): LDAP\Result|false
```
Does the same thing as [ldap\_mod\_add()](function.ldap-mod-add) but returns an [LDAP\Result](class.ldap-result) instance to be parsed with [ldap\_parse\_result()](function.ldap-parse-result).
### Parameters
See [ldap\_mod\_add()](function.ldap-mod-add)
### Return Values
Returns an [LDAP\Result](class.ldap-result) instance, 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 | Returns an [LDAP\Result](class.ldap-result) instance now; previously, a [resource](language.types.resource) was returned. |
| 8.0.0 | `controls` is nullable now; previously, it defaulted to `[]`. |
| 7.3.0 | Support for `controls` added |
### See Also
* [ldap\_mod\_add()](function.ldap-mod-add) - Add attribute values to current attributes
* [ldap\_parse\_result()](function.ldap-parse-result) - Extract information from result
php shm_remove_var shm\_remove\_var
================
(PHP 4, PHP 5, PHP 7, PHP 8)
shm\_remove\_var — Removes a variable from shared memory
### Description
```
shm_remove_var(SysvSharedMemory $shm, int $key): bool
```
Removes a variable with a given `key` and frees the occupied memory.
### Parameters
`shm`
A shared memory segment obtained from [shm\_attach()](function.shm-attach).
`key`
The variable key.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `shm` expects a [SysvSharedMemory](class.sysvsharedmemory) instance now; previously, a resource was expected. |
### See Also
* [shm\_remove()](function.shm-remove) - Removes shared memory from Unix systems
php Imagick::smushImages Imagick::smushImages
====================
(PECL imagick 3 >= 3.3.0)
Imagick::smushImages — Description
### Description
```
public Imagick::smushImages(bool $stack, int $offset): Imagick
```
Takes all images from the current image pointer to the end of the image list and smushs them to each other top-to-bottom if the stack parameter is true, otherwise left-to-right.
### Parameters
`stack`
`offset`
### Return Values
The new smushed image.
### Examples
**Example #1 **Imagick::smushImages()****
```
<?php
function smushImages($imagePath, $imagePath2) {
$imagick = new \Imagick(realpath($imagePath));
$imagick2 = new \Imagick(realpath($imagePath2));
$imagick->addimage($imagick2);
$smushed = $imagick->smushImages(false, 50);
$smushed->setImageFormat('jpg');
header("Content-Type: image/jpg");
echo $smushed->getImageBlob();
}
?>
```
php LimitIterator::current LimitIterator::current
======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
LimitIterator::current — Get current element
### Description
```
public LimitIterator::current(): mixed
```
Gets the current element of the inner [Iterator](class.iterator).
### Parameters
This function has no parameters.
### Return Values
Returns the current element or **`null`** if there is none.
### See Also
* [LimitIterator::key()](limititerator.key) - Get current key
* [LimitIterator::next()](limititerator.next) - Move the iterator forward
* [LimitIterator::rewind()](limititerator.rewind) - Rewind the iterator to the specified starting offset
* [LimitIterator::seek()](limititerator.seek) - Seek to the given position
* [LimitIterator::valid()](limititerator.valid) - Check whether the current element is valid
php UConverter::setDestinationEncoding UConverter::setDestinationEncoding
==================================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
UConverter::setDestinationEncoding — Set the destination encoding
### Description
```
public UConverter::setDestinationEncoding(string $encoding): bool
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`encoding`
### Return Values
php IntlBreakIterator::createLineInstance IntlBreakIterator::createLineInstance
=====================================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlBreakIterator::createLineInstance — Create break iterator for logically possible line breaks
### Description
```
public static IntlBreakIterator::createLineInstance(?string $locale = null): ?IntlBreakIterator
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`locale`
### Return Values
php The RecursiveDirectoryIterator class
The RecursiveDirectoryIterator class
====================================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
The **RecursiveDirectoryIterator** provides an interface for iterating recursively over filesystem directories.
Class synopsis
--------------
class **RecursiveDirectoryIterator** extends [FilesystemIterator](class.filesystemiterator) implements [RecursiveIterator](class.recursiveiterator) { /\* 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](recursivedirectoryiterator.construct)(string `$directory`, int `$flags` = FilesystemIterator::KEY\_AS\_PATHNAME | FilesystemIterator::CURRENT\_AS\_FILEINFO)
```
public getChildren(): RecursiveDirectoryIterator
```
```
public getSubPath(): string
```
```
public getSubPathname(): string
```
```
public hasChildren(bool $allowLinks = false): bool
```
```
public key(): string
```
```
public next(): void
```
```
public rewind(): void
```
/\* Inherited methods \*/
```
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
-----------------
* [RecursiveDirectoryIterator::\_\_construct](recursivedirectoryiterator.construct) — Constructs a RecursiveDirectoryIterator
* [RecursiveDirectoryIterator::getChildren](recursivedirectoryiterator.getchildren) — Returns an iterator for the current entry if it is a directory
* [RecursiveDirectoryIterator::getSubPath](recursivedirectoryiterator.getsubpath) — Get sub path
* [RecursiveDirectoryIterator::getSubPathname](recursivedirectoryiterator.getsubpathname) — Get sub path and name
* [RecursiveDirectoryIterator::hasChildren](recursivedirectoryiterator.haschildren) — Returns whether current entry is a directory and not '.' or '..'
* [RecursiveDirectoryIterator::key](recursivedirectoryiterator.key) — Return path and filename of current dir entry
* [RecursiveDirectoryIterator::next](recursivedirectoryiterator.next) — Move to next entry
* [RecursiveDirectoryIterator::rewind](recursivedirectoryiterator.rewind) — Rewind dir back to the start
| programming_docs |
php EventHttp::setAllowedMethods EventHttp::setAllowedMethods
============================
(PECL event >= 1.4.0-beta)
EventHttp::setAllowedMethods — Sets the what HTTP methods are supported in requests accepted by this server, and passed to user callbacks
### Description
```
public EventHttp::setAllowedMethods( int $methods ): void
```
Sets the what HTTP methods are supported in requests accepted by this server, and passed to user callbacks
If not supported they will generate a `"405 Method not
allowed"` response.
By default this includes the following methods: `GET` , `POST` , `HEAD` , `PUT` , `DELETE` . See `EventHttpRequest::CMD_*` constants.
### Parameters
`methods` A bit mask of [`EventHttpRequest::CMD_*` constants](class.eventhttprequest#eventhttprequest.constants) .
### Return Values
No value is returned.
php mb_decode_numericentity mb\_decode\_numericentity
=========================
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
mb\_decode\_numericentity — Decode HTML numeric string reference to character
### Description
```
mb_decode_numericentity(string $string, array $map, ?string $encoding = null): string
```
Convert numeric string reference of string `string` in a specified block to character.
### Parameters
`string`
The string being decoded.
`map`
`map` is an array that specifies the code area to convert.
`encoding`
The `encoding` parameter is the character encoding. If it is omitted or **`null`**, the internal character encoding value will be used.
`is_hex`
This parameter is not used.
### Return Values
The converted string.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `encoding` is nullable now. |
### Examples
**Example #1 `map` example**
```
<?php
$convmap = array (
int start_code1, int end_code1, int offset1, int mask1,
int start_code2, int end_code2, int offset2, int mask2,
........
int start_codeN, int end_codeN, int offsetN, int maskN );
// Specify Unicode value for start_codeN and end_codeN
// Add offsetN to value and take bit-wise 'AND' with maskN,
// then convert value to numeric string reference.
?>
```
**Example #2 `map` example escapes JavaScript string**
```
<?php
function escape_javascript_string($str) {
$map = [
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,0,0, // 49
0,0,0,0,0,0,0,0,1,1,
1,1,1,1,1,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,1,1,1,1,1,1,0,0,0, // 99
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1, // 149
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1, // 199
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1, // 249
1,1,1,1,1,1,1, // 255
];
// Char encoding is UTF-8
$mblen = mb_strlen($str, 'UTF-8');
$utf32 = bin2hex(mb_convert_encoding($str, 'UTF-32', 'UTF-8'));
for ($i=0, $encoded=''; $i < $mblen; $i++) {
$u = substr($utf32, $i*8, 8);
$v = base_convert($u, 16, 10);
if ($v < 256 && $map[$v]) {
$encoded .= '\\x'.substr($u, 6,2);
} else if ($v == 2028) {
$encoded .= '\\u2028';
} else if ($v == 2029) {
$encoded .= '\\u2029';
} else {
$encoded .= mb_convert_encoding(hex2bin($u), 'UTF-8', 'UTF-32');
}
}
return $encoded;
}
// Test data
$convmap = [ 0x0, 0xffff, 0, 0xffff ];
$msg = '';
for ($i=0; $i < 1000; $i++) {
// chr() cannot generate correct UTF-8 data larger value than 128, use mb_decode_numericentity().
$msg .= mb_decode_numericentity('&#'.$i.';', $convmap, 'UTF-8');
}
// var_dump($msg);
var_dump(escape_javascript_string($msg));
```
### See Also
* [mb\_encode\_numericentity()](function.mb-encode-numericentity) - Encode character to HTML numeric string reference
php posix_getgrgid posix\_getgrgid
===============
(PHP 4, PHP 5, PHP 7, PHP 8)
posix\_getgrgid — Return info about a group by group id
### Description
```
posix_getgrgid(int $group_id): array|false
```
Gets information about a group provided its id.
### Parameters
`group_id`
The group id.
### Return Values
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. |
| 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, should be the same as the `group_id` parameter used when calling the function, and hence redundant. |
| members | This consists of an array of string's for all the members in the group. |
The function returns **`false`** on failure. ### Examples
**Example #1 Example use of **posix\_getgrgid()****
```
<?php
$groupid = posix_getegid();
$groupinfo = posix_getgrgid($groupid);
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\_getgrnam()](function.posix-getgrnam) - Return info about a group by name
* [filegroup()](function.filegroup) - Gets file group
* [stat()](function.stat) - Gives information about a file
* POSIX man page GETGRNAM(3)
php curl_share_strerror curl\_share\_strerror
=====================
(PHP 7 >= 7.1.0, PHP 8)
curl\_share\_strerror — Return string describing the given error code
### Description
```
curl_share_strerror(int $error_code): ?string
```
Returns a text error message describing the given error code.
### Parameters
`error_code`
One of the [» cURL error codes](http://curl.haxx.se/libcurl/c/libcurl-errors.html) constants.
### Return Values
Returns error description or **`null`** for invalid error code.
### See Also
* [curl\_share\_errno()](function.curl-share-errno) - Return the last share curl error number
* [curl\_strerror()](function.curl-strerror) - Return string describing the given error code
php Phar::getSignature Phar::getSignature
==================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
Phar::getSignature — Return MD5/SHA1/SHA256/SHA512/OpenSSL signature of a Phar archive
### Description
```
public Phar::getSignature(): array|false
```
Returns the verification signature of a phar archive in a hexadecimal string.
### Parameters
### Return Values
Array with the opened archive's signature in `hash` key and `MD5`, `SHA-1`, `SHA-256`, `SHA-512`, or `OpenSSL` in `hash_type`. This signature is a hash calculated on the entire phar's contents, and may be used to verify the integrity of the archive. A valid signature is absolutely required of all executable phar archives if the [phar.require\_hash](https://www.php.net/manual/en/phar.configuration.php#ini.phar.require-hash) INI variable is set to true. If there is no signature, the function returns **`false`**.
php Imagick::writeImages Imagick::writeImages
====================
(PECL imagick 2 >= 2.3.0, PECL imagick 3)
Imagick::writeImages — Writes an image or image sequence
### Description
```
public Imagick::writeImages(string $filename, bool $adjoin): bool
```
Writes an image or image sequence.
### Parameters
`filename`
`adjoin`
### Return Values
Returns **`true`** on success.
php Gmagick::removeimage Gmagick::removeimage
====================
(PECL gmagick >= Unknown)
Gmagick::removeimage — Removes an image from the image list
### Description
```
public Gmagick::removeimage(): Gmagick
```
Removes an image from the image list.
### Parameters
This function has no parameters.
### Return Values
The [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php Ds\Vector::filter Ds\Vector::filter
=================
(PECL ds >= 1.0.0)
Ds\Vector::filter — Creates a new vector using a [callable](language.types.callable) to determine which values to include
### Description
```
public Ds\Vector::filter(callable $callback = ?): Ds\Vector
```
Creates a new vector 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 vector 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\Vector::filter()** example using callback function**
```
<?php
$vector = new \Ds\Vector([1, 2, 3, 4, 5]);
var_dump($vector->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\Vector::filter()** example without a callback function**
```
<?php
$vector = new \Ds\Vector([0, 1, 'a', true, false]);
var_dump($vector->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 Imagick::getImageIterations Imagick::getImageIterations
===========================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageIterations — Gets the image iterations
### Description
```
public Imagick::getImageIterations(): int
```
Gets the image iterations.
### Parameters
This function has no parameters.
### Return Values
Returns the image iterations as an integer.
### Errors/Exceptions
Throws ImagickException on error.
php QuickHashIntStringHash::saveToString QuickHashIntStringHash::saveToString
====================================
(PECL quickhash >= Unknown)
QuickHashIntStringHash::saveToString — This method returns a serialized version of the hash
### Description
```
public QuickHashIntStringHash::saveToString(): string
```
This method returns a serialized version of the hash in the same format that [QuickHashIntStringHash::loadFromString()](quickhashintstringhash.loadfromstring) can read.
### Parameters
This function has no parameters.
### Return Values
This method returns a string containing a serialized format of the hash. Each element is stored as a four byte value in the Endianness that the current system uses.
### Examples
**Example #1 **QuickHashIntStringHash::saveToString()** example**
```
<?php
$hash = new QuickHashIntStringHash( 1024 );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 4, "thirty four" ) );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 5, "fifty five" ) );
var_dump( $hash->saveToString() );
?>
```
php $_SESSION $\_SESSION
==========
(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)
$\_SESSION — Session variables
### Description
An associative array containing session variables available to the current script. See the [Session functions](https://www.php.net/manual/en/ref.session.php) documentation for more information on how this is used.
### 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
* [session\_start()](function.session-start) - Start new or resume existing session
php stats_variance stats\_variance
===============
(PECL stats >= 1.0.0)
stats\_variance — Returns the variance
### Description
```
stats_variance(array $a, bool $sample = false): float
```
Returns the variance 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 variance on success; **`false`** on failure.
php Ds\Set::allocate Ds\Set::allocate
================
(PECL ds >= 1.0.0)
Ds\Set::allocate — Allocates enough memory for a required capacity
### Description
```
public Ds\Set::allocate(int $capacity): void
```
Allocates enough memory for a required capacity.
### Parameters
`capacity`
The number of values for which capacity should be allocated.
>
> **Note**:
>
>
> Capacity will stay the same if this value is less than or equal to the current capacity.
>
>
>
> **Note**:
>
>
> Capacity will always be rounded up to the nearest power of 2.
>
>
### Return Values
No value is returned.
### Examples
**Example #1 **Ds\Set::allocate()** example**
```
<?php
$set = new \Ds\Set();
var_dump($set->capacity());
$set->allocate(100);
var_dump($set->capacity());
?>
```
The above example will output something similar to:
```
int(16)
int(128)
```
php IntlDateFormatter::getPattern IntlDateFormatter::getPattern
=============================
datefmt\_get\_pattern
=====================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
IntlDateFormatter::getPattern -- datefmt\_get\_pattern — Get the pattern used for the IntlDateFormatter
### Description
Object-oriented style
```
public IntlDateFormatter::getPattern(): string|false
```
Procedural style
```
datefmt_get_pattern(IntlDateFormatter $formatter): string|false
```
Get pattern used by the formatter.
### Parameters
`formatter`
The formatter resource.
### Return Values
The pattern string being used to format/parse, or **`false`** on failure.
### Examples
**Example #1 **datefmt\_get\_pattern()** example**
```
<?php
$fmt = datefmt_create(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN,
'MM/dd/yyyy'
);
echo 'pattern of the formatter is : ' . datefmt_get_pattern($fmt);
echo 'First Formatted output with pattern is ' . datefmt_format($fmt, 0);
datefmt_set_pattern($fmt,'yyyymmdd hh:mm:ss z');
echo 'Now pattern of the formatter is : ' . datefmt_get_pattern($fmt);
echo 'Second Formatted output with pattern is ' . datefmt_format($fmt, 0);
?>
```
**Example #2 OO example**
```
<?php
$fmt = new IntlDateFormatter(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN,
'MM/dd/yyyy'
);
echo 'pattern of the formatter is : ' . $fmt->getPattern();
echo 'First Formatted output is ' . $fmt->format(0);
$fmt->setPattern('yyyymmdd hh:mm:ss z');
echo 'Now pattern of the formatter is : ' . $fmt->getPattern();
echo 'Second Formatted output is ' . $fmt->format(0);
?>
```
The above example will output:
```
pattern of the formatter is : MM/dd/yyyy
First Formatted output is 12/31/1969
Now pattern of the formatter is : yyyymmdd hh:mm:ss z
Second Formatted output is 19690031 04:00:00 PST
```
### See Also
* [datefmt\_set\_pattern()](intldateformatter.setpattern) - Set the pattern used for the IntlDateFormatter
* [datefmt\_create()](intldateformatter.create) - Create a date formatter
php imagecolordeallocate imagecolordeallocate
====================
(PHP 4, PHP 5, PHP 7, PHP 8)
imagecolordeallocate — De-allocate a color for an image
### Description
```
imagecolordeallocate(GdImage $image, int $color): bool
```
De-allocates a color previously allocated with [imagecolorallocate()](function.imagecolorallocate) or [imagecolorallocatealpha()](function.imagecolorallocatealpha).
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`color`
The color identifier.
### 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 Using **imagecolordeallocate()****
```
<?php
$white = imagecolorallocate($im, 255, 255, 255);
imagecolordeallocate($im, $white);
?>
```
### See Also
* [imagecolorallocate()](function.imagecolorallocate) - Allocate a color for an image
* [imagecolorallocatealpha()](function.imagecolorallocatealpha) - Allocate a color for an image
php Imagick::convolveImage Imagick::convolveImage
======================
(PECL imagick 2, PECL imagick 3)
Imagick::convolveImage — Applies a custom convolution kernel to the image
### Description
```
public Imagick::convolveImage(array $kernel, int $channel = Imagick::CHANNEL_DEFAULT): bool
```
Applies a custom convolution kernel to the image.
### Parameters
`kernel`
The convolution kernel
`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::convolveImage()****
```
<?php
function convolveImage($imagePath, $bias, $kernelMatrix) {
$imagick = new \Imagick(realpath($imagePath));
//$edgeFindingKernel = [-1, -1, -1, -1, 8, -1, -1, -1, -1,];
$imagick->setImageBias($bias * \Imagick::getQuantum());
$imagick->convolveImage($kernelMatrix);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php quoted_printable_decode quoted\_printable\_decode
=========================
(PHP 4, PHP 5, PHP 7, PHP 8)
quoted\_printable\_decode — Convert a quoted-printable string to an 8 bit string
### Description
```
quoted_printable_decode(string $string): string
```
This function returns an 8-bit binary string corresponding to the decoded quoted printable string (according to [» RFC2045](http://www.faqs.org/rfcs/rfc2045), section 6.7, not [» RFC2821](http://www.faqs.org/rfcs/rfc2821), section 4.5.2, so additional periods are not stripped from the beginning of line).
This function is similar to [imap\_qprint()](function.imap-qprint), except this one does not require the IMAP module to work.
### Parameters
`string`
The input string.
### Return Values
Returns the 8-bit binary string.
### Examples
**Example #1 **quoted\_printable\_decode()** example**
```
<?php
$encoded = quoted_printable_encode('Möchten Sie ein paar Äpfel?');
var_dump($encoded);
var_dump(quoted_printable_decode($encoded));
?>
```
The above example will output:
```
string(37) "M=C3=B6chten Sie ein paar =C3=84pfel?"
string(29) "Möchten Sie ein paar Äpfel?"
```
### See Also
* [quoted\_printable\_encode()](function.quoted-printable-encode) - Convert a 8 bit string to a quoted-printable string
| programming_docs |
php ftp_raw ftp\_raw
========
(PHP 5, PHP 7, PHP 8)
ftp\_raw — Sends an arbitrary command to an FTP server
### Description
```
ftp_raw(FTP\Connection $ftp, string $command): ?array
```
Sends an arbitrary `command` to the FTP server.
### Parameters
`ftp`
An [FTP\Connection](class.ftp-connection) instance.
`command`
The command to execute.
### Return Values
Returns the server's response as an array of strings, or **`null`** on failure. No parsing is performed on the response string, nor does **ftp\_raw()** determine if the command succeeded.
### 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 Using **ftp\_raw()** to login to an FTP server manually.**
```
<?php
$ftp = ftp_connect("ftp.example.com");
/* This is the same as:
ftp_login($ftp, "joeblow", "secret"); */
ftp_raw($ftp, "USER joeblow");
ftp_raw($ftp, "PASS secret");
?>
```
### See Also
* [ftp\_exec()](function.ftp-exec) - Requests execution of a command on the FTP server
php cli_set_process_title cli\_set\_process\_title
========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
cli\_set\_process\_title — Sets the process title
### Description
```
cli_set_process_title(string $title): bool
```
Sets the process title visible in tools such as **top** and **ps**. This function is available only in [CLI](https://www.php.net/manual/en/features.commandline.php) mode.
### Parameters
`title`
The new title.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
An **`E_WARNING`** will be generated if the operating system is unsupported.
### Examples
**Example #1 **cli\_set\_process\_title()** example**
```
<?php
$title = "My Amazing PHP Script";
$pid = getmypid(); // you can use this to see your process title in ps
if (!cli_set_process_title($title)) {
echo "Unable to set process title for PID $pid...\n";
exit(1);
} else {
echo "The process title '$title' for PID $pid has been set for your process!\n";
sleep(5);
}
?>
```
### See Also
* [cli\_get\_process\_title()](function.cli-get-process-title) - Returns the current process title
* **setproctitle()**
php EventBufferEvent::sslError EventBufferEvent::sslError
==========================
(PECL event >= 1.2.6-beta)
EventBufferEvent::sslError — Returns most recent OpenSSL error reported on the buffer event
### Description
```
public EventBufferEvent::sslError(): string
```
Returns most recent OpenSSL error reported on the buffer event.
>
> **Note**:
>
>
> This function is available only if `Event` is compiled with OpenSSL support.
>
>
### Parameters
This function has no parameters.
### Return Values
Returns OpenSSL error string reported on the buffer event, or **`false`**, if there is no more error to return.
### Examples
**Example #1 **EventBufferEvent::sslError()** example**
```
<?php
// This callback is invoked when some even occurs on the event listener,
// e.g. connection closed, or an error occurred
function ssl_event_cb($bev, $events, $ctx) {
if ($events & EventBufferEvent::ERROR) {
// Fetch errors from the SSL error stack
while ($err = $bev->sslError()) {
fprintf(STDERR, "Bufferevent error %s.\n", $err);
}
}
if ($events & (EventBufferEvent::EOF | EventBufferEvent::ERROR)) {
$bev->free();
}
}
?>
```
### See Also
* [EventBufferEvent::sslRenegotiate()](eventbufferevent.sslrenegotiate) - Tells a bufferevent to begin SSL renegotiation
php DOMChildNode::remove DOMChildNode::remove
====================
(PHP 8)
DOMChildNode::remove — Removes the node
### Description
```
public DOMChildNode::remove(): void
```
Removes the node.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### See Also
* [DOMChildNode::after()](domchildnode.after) - Adds nodes after the node
* [DOMChildNode::before()](domchildnode.before) - Adds nodes before the node
* [DOMChildNode::replaceWith()](domchildnode.replacewith) - Replaces the node with new nodes
* [DOMNode::removeChild()](domnode.removechild) - Removes child from list of children
php gmp_add gmp\_add
========
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
gmp\_add — Add numbers
### Description
```
gmp_add(GMP|int|string $num1, GMP|int|string $num2): GMP
```
Add two numbers.
### Parameters
`num1`
The first summand (augent).
A [GMP](class.gmp) object, an int or a numeric string.
`num2`
The second summand (addend).
A [GMP](class.gmp) object, an int or a numeric string.
### Return Values
A GMP number representing the sum of the arguments.
### Examples
**Example #1 **gmp\_add()** example**
```
<?php
$sum = gmp_add("123456789012345", "76543210987655");
echo gmp_strval($sum) . "\n";
?>
```
The above example will output:
```
200000000000000
```
php pg_lo_read_all pg\_lo\_read\_all
=================
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg\_lo\_read\_all — Reads an entire large object and send straight to browser
### Description
```
pg_lo_read_all(PgSql\Lob $lob): int
```
**pg\_lo\_read\_all()** reads a large object and passes it straight through to the browser after sending all pending headers. Mainly intended for sending binary data like images or sound.
To use the large object interface, it is necessary to enclose it within a transaction block.
>
> **Note**:
>
>
> This function used to be called **pg\_loreadall()**.
>
>
### Parameters
`lob`
An [PgSql\Lob](class.pgsql-lob) instance, returned by [pg\_lo\_open()](function.pg-lo-open).
### Return Values
Number of bytes read.
### 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. |
### Examples
**Example #1 **pg\_lo\_read\_all()** example**
```
<?php
header('Content-type: image/jpeg');
$image_oid = 189762345;
$database = pg_connect("dbname=jacarta");
pg_query($database, "begin");
$handle = pg_lo_open($database, $image_oid, "r");
pg_lo_read_all($handle);
pg_query($database, "commit");
?>
```
### See Also
* [pg\_lo\_read()](function.pg-lo-read) - Read a large object
php imagecreatefromgd imagecreatefromgd
=================
(PHP 4 >= 4.0.7, PHP 5, PHP 7, PHP 8)
imagecreatefromgd — Create a new image from GD file or URL
### Description
```
imagecreatefromgd(string $filename): GdImage|false
```
Create a new image from GD file or URL.
**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 GD file.
### 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 **imagecreatefromgd()** example**
```
<?php
// Load the gd image
$im = @imagecreatefromgd('./test.gd');
// Test if the image was loaded
if(!$im)
{
die('Unable to load gd image!');
}
// Do image operations here
// Save the image
imagegd($im, './test_updated.gd');
imagedestroy($im);
?>
```
### Notes
**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.
php geoip_region_name_by_code geoip\_region\_name\_by\_code
=============================
(PECL geoip >= 1.0.4)
geoip\_region\_name\_by\_code — Returns the region name for some country and region code combo
### Description
```
geoip_region_name_by_code(string $country_code, string $region_code): string
```
The **geoip\_region\_name\_by\_code()** function will return the region name corresponding to a country and region code combo.
In the United States, the region code corresponds to the two-letter abbreviation of each state. In Canada, the region code corresponds to the two-letter province or territory code as attributed by Canada Post.
For the rest of the world, GeoIP uses FIPS 10-4 codes to represent regions. You can check [» http://www.maxmind.com/app/fips10\_4](http://www.maxmind.com/app/fips10_4) for a detailed list of FIPS 10-4 codes.
This function is always available if using GeoIP Library version 1.4.1 or newer. The data is taken directly from the GeoIP Library and not from any database.
### Parameters
`country_code`
The two-letter country code (see [geoip\_country\_code\_by\_name()](function.geoip-country-code-by-name))
`region_code`
The two-letter (or digit) region code (see [geoip\_region\_by\_name()](function.geoip-region-by-name))
### Return Values
Returns the region name on success, or **`false`** if the country and region code combo cannot be found.
### Examples
**Example #1 A **geoip\_region\_name\_by\_code()** example using region code for US/Canada**
This will print the region name for country CA (Canada), region QC (Quebec).
```
<?php
$region = geoip_region_name_by_code('CA', 'QC');
if ($region) {
echo 'Region name for CA/QC is: ' . $region;
}
?>
```
The above example will output:
```
Region name for CA/QC is: Quebec
```
**Example #2 A **geoip\_region\_name\_by\_code()** example using FIPS codes**
This will print the region name for country JP (Japan), region 01.
```
<?php
$region = geoip_region_name_by_code('JP', '01');
if ($region) {
echo 'Region name for JP/01 is: ' . $region;
}
?>
```
The above example will output:
```
Region name for JP/01 is: Aichi
```
php ResourceBundle::getLocales ResourceBundle::getLocales
==========================
resourcebundle\_locales
=======================
(PHP 5 >= 5.3.2, PHP 7, PHP 8, PECL intl >= 2.0.0)
ResourceBundle::getLocales -- resourcebundle\_locales — Get supported locales
### Description
Object-oriented style
```
public static ResourceBundle::getLocales(string $bundle): array|false
```
Procedural style
```
resourcebundle_locales(string $bundle): array|false
```
Get available locales from ResourceBundle name.
### Parameters
`bundle`
Path of ResourceBundle for which to get available locales, or empty string for default locales list.
### Return Values
Returns the list of locales supported by the bundle, or **`false`** on failure.
### Examples
**Example #1 **resourcebundle\_locales()** example**
```
<?php
$bundle = "/user/share/data/myapp";
echo join(PHP_EOL, resourcebundle_locales($bundle));
?>
```
The above example will output something similar to:
```
es
root
```
**Example #2 OO example**
```
<?php
$bundle = "/usr/share/data/myapp";
$r = new ResourceBundle( 'es', $bundle);
echo join("\n", $r->getLocales($bundle));
?>
```
The above example will output something similar to:
```
es
root
```
### See Also
* [resourcebundle\_get()](resourcebundle.get) - Get data from the bundle
php mhash mhash
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
mhash — Computes hash
**Warning**This function has been *DEPRECATED* as of PHP 8.1.0. Relying on this function is highly discouraged.
### Description
```
mhash(int $algo, string $data, ?string $key = null): string|false
```
**mhash()** applies a hash function specified by `algo` to the `data`.
### Parameters
`algo`
The hash ID. One of the **`MHASH_hashname`** constants.
`data`
The user input, as a string.
`key`
If specified, the function will return the resulting HMAC instead. HMAC is keyed hashing for message authentication, or simply a message digest that depends on the specified key. Not all algorithms supported in mhash can be used in HMAC mode.
### Return Values
Returns the resulting hash (also called digest) or HMAC as a string, or **`false`** on error.
### 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. |
| 8.0.0 | `key` is now nullable. |
php XMLWriter::endCdata XMLWriter::endCdata
===================
xmlwriter\_end\_cdata
=====================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL xmlwriter >= 0.1.0)
XMLWriter::endCdata -- xmlwriter\_end\_cdata — End current CDATA
### Description
Object-oriented style
```
public XMLWriter::endCdata(): bool
```
Procedural style
```
xmlwriter_end_cdata(XMLWriter $writer): bool
```
Ends the current CDATA section.
### 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::startCdata()](xmlwriter.startcdata) - Create start CDATA tag
* [XMLWriter::writeCdata()](xmlwriter.writecdata) - Write full CDATA tag
php The FilesystemIterator class
The FilesystemIterator class
============================
Introduction
------------
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
The Filesystem iterator
Class synopsis
--------------
class **FilesystemIterator** extends [DirectoryIterator](class.directoryiterator) { /\* Constants \*/ public const int [CURRENT\_MODE\_MASK](class.filesystemiterator#filesystemiterator.constants.current-mode-mask);
public const int [CURRENT\_AS\_PATHNAME](class.filesystemiterator#filesystemiterator.constants.current-as-pathname);
public const int [CURRENT\_AS\_FILEINFO](class.filesystemiterator#filesystemiterator.constants.current-as-fileinfo);
public const int [CURRENT\_AS\_SELF](class.filesystemiterator#filesystemiterator.constants.current-as-self);
public const int [KEY\_MODE\_MASK](class.filesystemiterator#filesystemiterator.constants.key-mode-mask);
public const int [KEY\_AS\_PATHNAME](class.filesystemiterator#filesystemiterator.constants.key-as-pathname);
public const int [FOLLOW\_SYMLINKS](class.filesystemiterator#filesystemiterator.constants.follow-symlinks);
public const int [KEY\_AS\_FILENAME](class.filesystemiterator#filesystemiterator.constants.key-as-filename);
public const int [NEW\_CURRENT\_AND\_KEY](class.filesystemiterator#filesystemiterator.constants.new-current-and-key);
public const int [OTHER\_MODE\_MASK](class.filesystemiterator#filesystemiterator.constants.other-mode-mask);
public const int [SKIP\_DOTS](class.filesystemiterator#filesystemiterator.constants.skip-dots);
public const int [UNIX\_PATHS](class.filesystemiterator#filesystemiterator.constants.unix-paths); /\* Methods \*/ public [\_\_construct](filesystemiterator.construct)(string `$directory`, int `$flags` = FilesystemIterator::KEY\_AS\_PATHNAME | FilesystemIterator::CURRENT\_AS\_FILEINFO | FilesystemIterator::SKIP\_DOTS)
```
public current(): string|SplFileInfo|FilesystemIterator
```
```
public getFlags(): int
```
```
public key(): string
```
```
public next(): void
```
```
public rewind(): void
```
```
public setFlags(int $flags): void
```
/\* Inherited methods \*/
```
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
```
} Predefined Constants
--------------------
**`FilesystemIterator::CURRENT_AS_PATHNAME`** Makes [FilesystemIterator::current()](filesystemiterator.current) return the pathname.
**`FilesystemIterator::CURRENT_AS_FILEINFO`** Makes [FilesystemIterator::current()](filesystemiterator.current) return an [SplFileInfo](class.splfileinfo) instance.
**`FilesystemIterator::CURRENT_AS_SELF`** Makes [FilesystemIterator::current()](filesystemiterator.current) return $this (the FilesystemIterator).
**`FilesystemIterator::CURRENT_MODE_MASK`** Masks [FilesystemIterator::current()](filesystemiterator.current)
**`FilesystemIterator::KEY_AS_PATHNAME`** Makes [FilesystemIterator::key()](filesystemiterator.key) return the pathname.
**`FilesystemIterator::KEY_AS_FILENAME`** Makes [FilesystemIterator::key()](filesystemiterator.key) return the filename.
**`FilesystemIterator::FOLLOW_SYMLINKS`** Makes [RecursiveDirectoryIterator::hasChildren()](recursivedirectoryiterator.haschildren) follow symlinks.
**`FilesystemIterator::KEY_MODE_MASK`** Masks [FilesystemIterator::key()](filesystemiterator.key)
**`FilesystemIterator::NEW_CURRENT_AND_KEY`** Same as `FilesystemIterator::KEY_AS_FILENAME | FilesystemIterator::CURRENT_AS_FILEINFO`.
**`FilesystemIterator::OTHER_MODE_MASK`** Mask used for [FilesystemIterator::getFlags()](filesystemiterator.getflags) and [FilesystemIterator::setFlags()](filesystemiterator.setflags).
**`FilesystemIterator::SKIP_DOTS`** Skips dot files (`.` and `..`).
**`FilesystemIterator::UNIX_PATHS`** Makes paths use Unix-style forward slash irrespective of system default. Note that the `path` that is passed to the constructor is not modified.
Table of Contents
-----------------
* [FilesystemIterator::\_\_construct](filesystemiterator.construct) — Constructs a new filesystem iterator
* [FilesystemIterator::current](filesystemiterator.current) — The current file
* [FilesystemIterator::getFlags](filesystemiterator.getflags) — Get the handling flags
* [FilesystemIterator::key](filesystemiterator.key) — Retrieve the key for the current file
* [FilesystemIterator::next](filesystemiterator.next) — Move to the next file
* [FilesystemIterator::rewind](filesystemiterator.rewind) — Rewinds back to the beginning
* [FilesystemIterator::setFlags](filesystemiterator.setflags) — Sets handling flags
| programming_docs |
php array array
=====
(PHP 4, PHP 5, PHP 7, PHP 8)
array — Create an array
### Description
```
array(mixed ...$values): array
```
Creates an array. Read the section on the [array type](language.types.array) for more information on what an array is.
### Parameters
`values`
Syntax "index => values", separated by commas, define index and values. index may be of type string or integer. When index is omitted, an integer index is automatically generated, starting at 0. If index is an integer, next generated index will be the biggest integer index + 1. Note that when two identical index are defined, the last overwrite the first.
Having a trailing comma after the last defined array entry, while unusual, is a valid syntax.
### Return Values
Returns an array of the parameters. The parameters can be given an index with the `=>` operator. Read the section on the [array type](language.types.array) for more information on what an array is.
### Examples
The following example demonstrates how to create a two-dimensional array, how to specify keys for associative arrays, and how to skip-and-continue numeric indices in normal arrays.
**Example #1 **array()** example**
```
<?php
$fruits = array (
"fruits" => array("a" => "orange", "b" => "banana", "c" => "apple"),
"numbers" => array(1, 2, 3, 4, 5, 6),
"holes" => array("first", 5 => "second", "third")
);
?>
```
**Example #2 Automatic index with **array()****
```
<?php
$array = array(1, 1, 1, 1, 1, 8 => 1, 4 => 1, 19, 3 => 13);
print_r($array);
?>
```
The above example will output:
```
Array
(
[0] => 1
[1] => 1
[2] => 1
[3] => 13
[4] => 1
[8] => 1
[9] => 19
)
```
Note that index '3' is defined twice, and keep its final value of 13. Index 4 is defined after index 8, and next generated index (value 19) is 9, since biggest index was 8.
This example creates a 1-based array.
**Example #3 1-based index with **array()****
```
<?php
$firstquarter = array(1 => 'January', 'February', 'March');
print_r($firstquarter);
?>
```
The above example will output:
```
Array
(
[1] => January
[2] => February
[3] => March
)
```
As in Perl, you can access a value from the array inside double quotes. However, with PHP you'll need to enclose your array between curly braces.
**Example #4 Accessing an array inside double quotes**
```
<?php
$foo = array('bar' => 'baz');
echo "Hello {$foo['bar']}!"; // Hello baz!
?>
```
### Notes
>
> **Note**:
>
>
> **array()** is a language construct used to represent literal arrays, and not a regular function.
>
>
### See Also
* [array\_pad()](function.array-pad) - Pad array to the specified length with a value
* [list()](function.list) - Assign variables as if they were an array
* [count()](function.count) - Counts all elements in an array or in a Countable object
* [range()](function.range) - Create an array containing a range of elements
* [foreach](control-structures.foreach)
* The [array](language.types.array) type
php ImagickDraw::pathLineToRelative ImagickDraw::pathLineToRelative
===============================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::pathLineToRelative — Draws a line path
### Description
```
public ImagickDraw::pathLineToRelative(float $x, float $y): bool
```
**Warning**This function is currently not documented; only its argument list is available.
Draws a line path from the current point to the given coordinate using relative coordinates. The coordinate then becomes the new current point.
### Parameters
`x`
starting x coordinate
`y`
starting y coordinate
### Return Values
No value is returned.
php Imagick::getImageChannelDistortion Imagick::getImageChannelDistortion
==================================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageChannelDistortion — Compares image channels of an image to a reconstructed image
### Description
```
public Imagick::getImageChannelDistortion(Imagick $reference, int $channel, int $metric): float
```
Compares one or more image channels of an image to a reconstructed image and returns the specified distortion metric.
### Parameters
`reference`
Imagick object to compare to.
`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).
`metric`
One of the [metric type constants](https://www.php.net/manual/en/imagick.constants.php#imagick.constants.metric).
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
php Imagick::profileImage Imagick::profileImage
=====================
(PECL imagick 2, PECL imagick 3)
Imagick::profileImage — Adds or removes a profile from an image
### Description
```
public Imagick::profileImage(string $name, string $profile): bool
```
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`
`profile`
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
php SoapClient::__call SoapClient::\_\_call
====================
(PHP 5, PHP 7, PHP 8)
SoapClient::\_\_call — Calls a SOAP function (deprecated)
### Description
```
public SoapClient::__call(string $name, array $args): mixed
```
Calling this method directly is deprecated. Usually, SOAP functions can be called as methods of the [SoapClient](class.soapclient) object; in situations where this is not possible or additional options are needed, use [SoapClient::\_\_soapCall()](soapclient.soapcall).
### Parameters
`name`
The name of the SOAP function to call.
`args`
An array of the arguments to pass to the function. This can be either an ordered or an associative array. Note that most SOAP servers require parameter names to be provided, in which case this must be an associative array.
### Return Values
SOAP functions may return one, or multiple values. If only one value is returned by the SOAP function, the return value will be a scalar. If multiple values are returned, an associative array of named output parameters is returned instead.
On error, if the [SoapClient](class.soapclient) object was constructed with the `exceptions` option set to **`false`**, a [SoapFault](class.soapfault) object will be returned.
php Ds\Hashable::hash Ds\Hashable::hash
=================
(PECL ds >= 1.0.0)
Ds\Hashable::hash — Returns a scalar value to be used as a hash value
### Description
```
abstract public Ds\Hashable::hash(): mixed
```
Returns a scalar value to be used as the hash value of the objects.
While the hash value does not define equality, all objects that are equal according to [Ds\Hashable::equals()](ds-hashable.equals) must have the same hash value. Hash values of equal objects don't have to be unique, for example you could just return **`true`** for all objects and nothing would break - the only implication would be that hash tables then turn into linked lists because all your objects will be hashed to the same bucket. It's therefore very important that you pick a good hash value, such as an ID or email address.
This method allows objects to be used as keys in structures such as **Ds\Map** and **Ds\Set**, or any other lookup structure that honors this interface.
**Caution** Do not pick a value that might change within the object, such as a public property. Hash table lookups would fail because the hash has changed.
**Caution** All objects that are equal must have the same hash value.
### Parameters
This function has no parameters.
### Return Values
A scalar value to be used as this object's hash value.
### Examples
**Example #1 **Ds\Hashable::hash()** example**
```
<?php
class HashableObject implements \Ds\Hashable
{
private $name;
private $email;
public function __construct($name, $email)
{
$this->name = $name;
$this->email = $email;
}
/**
* Should return the same value for all equal objects, but doesn't have to
* be unique. This value will not be used to determine equality.
*/
public function hash()
{
return $this->email;
}
/**
* This determines equality, usually during a hash table lookup to determine
* if the bucket's key matches the lookup key. The hash has to be equal if
* the objects are equal, otherwise this determination wouldn't be reached.
*/
public function equals($obj): bool
{
return $this->name === $obj->name
&& $this->email === $obj->email;
}
}
?>
```
php Yaf_Config_Simple::__isset Yaf\_Config\_Simple::\_\_isset
==============================
(Yaf >=1.0.0)
Yaf\_Config\_Simple::\_\_isset — The \_\_isset purpose
### Description
```
public Yaf_Config_Simple::__isset(string $name): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`name`
### Return Values
php eio_link eio\_link
=========
(PECL eio >= 0.0.1dev)
eio\_link — Create a hardlink for file
### Description
```
eio_link(
string $path,
string $new_path,
int $pri = EIO_PRI_DEFAULT,
callable $callback = NULL,
mixed $data = NULL
): resource
```
**eio\_link()** creates a hardlink `new_path` for a file specified by `path`.
### Parameters
`path`
Source file path.
`new_path`
Target 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
### Examples
**Example #1 **eio\_link()** example**
```
<?php
$filename = dirname(__FILE__)."/symlink.dat";
touch($filename);
$link = dirname(__FILE__)."/symlink.link";
$hardlink = dirname(__FILE__)."/hardlink.link";
function my_hardlink_cb($data, $result) {
global $link, $filename;
var_dump(file_exists($data) && !is_link($data));
@unlink($data);
eio_symlink($filename, $link, EIO_PRI_DEFAULT, "my_symlink_cb", $link);
}
function my_symlink_cb($data, $result) {
global $link, $filename;
var_dump(file_exists($data) && is_link($data));
if (!eio_readlink($data, EIO_PRI_DEFAULT, "my_readlink_cb", NULL)) {
@unlink($link);
@unlink($filename);
}
}
function my_readlink_cb($data, $result) {
global $filename, $link;
var_dump($result);
@unlink($link);
@unlink($filename);
}
eio_link($filename, $hardlink, EIO_PRI_DEFAULT, "my_hardlink_cb", $hardlink);
eio_event_loop();
?>
```
The above example will output something similar to:
```
bool(true)
bool(true)
string(%d) "%ssymlink.dat"
```
### See Also
* [eio\_symlink()](function.eio-symlink) - Create a symbolic link
php SplObjectStorage::valid SplObjectStorage::valid
=======================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplObjectStorage::valid — Returns if the current iterator entry is valid
### Description
```
public SplObjectStorage::valid(): bool
```
Returns if the current iterator entry is valid.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** if the iterator entry is valid, **`false`** otherwise.
### Examples
**Example #1 **SplObjectStorage::valid()** example**
```
<?php
$s = new SplObjectStorage();
$o1 = new StdClass;
$o2 = new StdClass;
$s->attach($o1, "d1");
$s->attach($o2, "d2");
$s->rewind();
while($s->valid()) {
echo $s->key()."\n";
$s->next();
}
?>
```
The above example will output something similar to:
```
0
1
```
### See Also
* [SplObjectStorage::current()](splobjectstorage.current) - Returns the current storage entry
* [SplObjectStorage::getInfo()](splobjectstorage.getinfo) - Returns the data associated with the current iterator entry
php IntlDateFormatter::format IntlDateFormatter::format
=========================
datefmt\_format
===============
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
IntlDateFormatter::format -- datefmt\_format — Format the date/time value as a string
### Description
Object-oriented style
```
public IntlDateFormatter::format(IntlCalendar|DateTimeInterface|array|string|int|float $datetime): string|false
```
Procedural style
```
datefmt_format(IntlDateFormatter $formatter, IntlCalendar|DateTimeInterface|array|string|int|float $datetime): string|false
```
Formats the time value as a string.
### Parameters
`formatter`
The date formatter resource.
`datetime`
Value to format. This may be a [DateTimeInterface](class.datetimeinterface) object, an [IntlCalendar](class.intlcalendar) object, a numeric type representing a (possibly fractional) number of seconds since epoch or an array in the format output by [localtime()](function.localtime).
If a [DateTime](class.datetime) or an [IntlCalendar](class.intlcalendar) object is passed, its timezone is not considered. The object will be formatted using the formaterʼs configured timezone. If one wants to use the timezone of the object to be formatted, [IntlDateFormatter::setTimeZone()](intldateformatter.settimezone) must be called before with the objectʼs timezone. Alternatively, the static function [IntlDateFormatter::formatObject()](intldateformatter.formatobject) may be used instead.
### Return Values
The formatted string or, if an error occurred, **`false`**.
### Changelog
| Version | Description |
| --- | --- |
| 7.1.5 | Support for providing general [DateTimeInterface](class.datetimeinterface) objects to the `datetime` parameter was added. Formerly, only proper [DateTime](class.datetime) objects were supported. |
| PECL 3.0.0 | Support for providing [IntlCalendar](class.intlcalendar) objects to the `datetime` parameter was added. |
### Examples
**Example #1 **datefmt\_format()** example**
```
<?php
$fmt = datefmt_create(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'First Formatted output is ' . datefmt_format($fmt, 0);
$fmt = datefmt_create(
'de-DE',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'Second Formatted output is ' . datefmt_format($fmt, 0);
$fmt = datefmt_create(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN,
'MM/dd/yyyy'
);
echo 'First Formatted output with pattern is ' . datefmt_format($fmt, 0);
$fmt = datefmt_create(
'de-DE',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN,
'MM/dd/yyyy'
);
echo "Second Formatted output with pattern is " . datefmt_format($fmt, 0);
?>
```
**Example #2 OO example**
```
<?php
$fmt = new IntlDateFormatter(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'First Formatted output is ' . $fmt->format(0);
$fmt = new IntlDateFormatter(
'de-DE',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'Second Formatted output is ' . $fmt->format(0);
$fmt = new IntlDateFormatter(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN,
'MM/dd/yyyy'
);
echo 'First Formatted output with pattern is ' . $fmt->format(0);
$fmt = new IntlDateFormatter(
'de-DE',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN,
'MM/dd/yyyy'
);
echo 'Second Formatted output with pattern is ' . $fmt->format(0);
?>
```
The above example will output:
```
First Formatted output is Wednesday, December 31, 1969 4:00:00 PM PT
Second Formatted output is Mittwoch, 31. Dezember 1969 16:00 Uhr GMT-08:00
First Formatted output with pattern is 12/31/1969
Second Formatted output with pattern is 12/31/1969
```
**Example #3 With [IntlCalendar](class.intlcalendar) object**
```
<?php
$tz = reset(iterator_to_array(IntlTimeZone::createEnumeration('FR')));
$formatter = IntlDateFormatter::create(
'fr_FR',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
$tz,
IntlDateFormatter::GREGORIAN
);
$cal = IntlCalendar::createInstance($tz, '@calendar=islamic-civil');
$cal->set(IntlCalendar::FIELD_MONTH, 8); //9th month, Ramadan
$cal->set(IntlCalendar::FIELD_DAY_OF_MONTH, 1); //1st day
$cal->clear(IntlCalendar::FIELD_HOUR_OF_DAY);
$cal->clear(IntlCalendar::FIELD_MINUTE);
$cal->clear(IntlCalendar::FIELD_SECOND);
$cal->clear(IntlCalendar::FIELD_MILLISECOND);
echo "In this islamic year, Ramadan started/will start on:\n\t",
$formatter->format($cal), "\n";
//Itʼs the formatterʼs timezone that is used:
$formatter->setTimeZone('Asia/Tokyo');
echo "After changing timezone:\n\t",
$formatter->format($cal), "\n";
```
The above example will output:
```
In this islamic year, Ramadan started/will start on:
mardi 9 juillet 2013 19:00:00 heure avancée d’Europe centrale
After changing timezone:
mercredi 10 juillet 2013 02:00:00 heure normale du Japon
```
### See Also
* [datefmt\_create()](intldateformatter.create) - Create a date formatter
* [datefmt\_parse()](intldateformatter.parse) - Parse string to a timestamp value
* [datefmt\_get\_error\_code()](intldateformatter.geterrorcode) - Get the error code from last operation
* [datefmt\_get\_error\_message()](intldateformatter.geterrormessage) - Get the error text from the last operation
* [datefmt\_format\_object()](intldateformatter.formatobject) - Formats an object
php RecursiveCachingIterator::hasChildren RecursiveCachingIterator::hasChildren
=====================================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
RecursiveCachingIterator::hasChildren — Check whether the current element of the inner iterator has children
### Description
```
public RecursiveCachingIterator::hasChildren(): bool
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the inner iterator has children, otherwise **`false`**
php EvTimer::createStopped EvTimer::createStopped
======================
(PECL ev >= 0.2.0)
EvTimer::createStopped — Creates EvTimer stopped watcher object
### Description
```
final public static EvTimer::createStopped(
float $after ,
float $repeat ,
callable $callback ,
mixed $data = null ,
int $priority = 0
): EvTimer
```
Creates EvTimer stopped watcher object. Unlike [EvTimer::\_\_construct()](evtimer.construct) , this method doesn't start the watcher automatically.
### Parameters
`after` Configures the timer to trigger after `after` seconds.
`repeat` If repeat is **`0.0`** , then it will automatically be stopped once the timeout is reached. If it is positive, then the timer will automatically be configured to trigger again every repeat seconds later, until stopped manually.
`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 EvTimer watcher object on success.
### Examples
**Example #1 Monotor changes of /var/log/messages. Avoid missing updates by means of one second delay**
```
<?php
$timer = EvTimer::createStopped(0., 1.02, function ($w) {
$w->stop();
$stat = $w->data;
// 1 second after the most recent change of the file
printf("Current size: %ld\n", $stat->attr()['size']);
});
$stat = new EvStat("/var/log/messages", 0., function () use ($timer) {
// Reset timer watcher
$timer->again();
});
$timer->data = $stat;
Ev::run();
?>
```
### See Also
* [EvTimer::\_\_construct()](evtimer.construct) - Constructs an EvTimer watcher object
* [EvPeriodic](class.evperiodic)
| programming_docs |
php ImagickDraw::getClipPath ImagickDraw::getClipPath
========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::getClipPath — Obtains the current clipping path ID
### Description
```
public ImagickDraw::getClipPath(): string
```
**Warning**This function is currently not documented; only its argument list is available.
Obtains the current clipping path ID.
### Return Values
Returns a string containing the clip path ID or false if no clip path exists.
php boolval boolval
=======
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
boolval — Get the boolean value of a variable
### Description
```
boolval(mixed $value): bool
```
Returns the bool value of `value`.
### Parameters
`value`
The scalar value being converted to a bool.
### Return Values
The bool value of `value`.
### Examples
**Example #1 **boolval()** examples**
```
<?php
echo '0: '.(boolval(0) ? 'true' : 'false')."\n";
echo '42: '.(boolval(42) ? 'true' : 'false')."\n";
echo '0.0: '.(boolval(0.0) ? 'true' : 'false')."\n";
echo '4.2: '.(boolval(4.2) ? 'true' : 'false')."\n";
echo '"": '.(boolval("") ? 'true' : 'false')."\n";
echo '"string": '.(boolval("string") ? 'true' : 'false')."\n";
echo '"0": '.(boolval("0") ? 'true' : 'false')."\n";
echo '"1": '.(boolval("1") ? 'true' : 'false')."\n";
echo '[1, 2]: '.(boolval([1, 2]) ? 'true' : 'false')."\n";
echo '[]: '.(boolval([]) ? 'true' : 'false')."\n";
echo 'stdClass: '.(boolval(new stdClass) ? 'true' : 'false')."\n";
?>
```
The above example will output:
```
0: false
42: true
0.0: false
4.2: true
"": false
"string": true
"0": false
"1": true
[1, 2]: true
[]: false
stdClass: true
```
### See Also
* [floatval()](function.floatval) - Get float value of a variable
* [intval()](function.intval) - Get the integer value of a variable
* [strval()](function.strval) - Get string value of a variable
* [settype()](function.settype) - Set the type of a variable
* [is\_bool()](function.is-bool) - Finds out whether a variable is a boolean
* [Type juggling](language.types.type-juggling)
php xml_get_current_column_number xml\_get\_current\_column\_number
=================================
(PHP 4, PHP 5, PHP 7, PHP 8)
xml\_get\_current\_column\_number — Get current column number for an XML parser
### Description
```
xml_get_current_column_number(XMLParser $parser): int
```
Gets the current column number of the given XML parser.
### Parameters
`parser`
A reference to the XML parser to get column number from.
### Return Values
This function returns **`false`** if `parser` does not refer to a valid parser, or else it returns which column on the current line (as given by [xml\_get\_current\_line\_number()](function.xml-get-current-line-number)) the parser is currently at.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `parser` expects an [XMLParser](class.xmlparser) instance now; previously, a resource was expected. |
### See Also
* [xml\_get\_current\_byte\_index()](function.xml-get-current-byte-index) - Get current byte index 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::threads SolrClient::threads
===================
(PECL solr >= 0.9.2)
SolrClient::threads — Checks the threads status
### Description
```
public SolrClient::threads(): void
```
Checks the threads status
### Parameters
This function has no parameters.
### Return Values
Returns a SolrGenericResponse object.
### Errors/Exceptions
Throws [SolrClientException](class.solrclientexception) if the client failed, or there was a connection issue.
throws [SolrServerException](class.solrserverexception) if the Solr Server failed to process the request.
php The EventHttpRequest class
The EventHttpRequest class
==========================
Introduction
------------
(PECL event >= 1.4.0-beta)
Represents an HTTP request.
Class synopsis
--------------
class **EventHttpRequest** { /\* Constants \*/ const int [CMD\_GET](class.eventhttprequest#eventhttprequest.constants.cmd-get) = 1;
const int [CMD\_POST](class.eventhttprequest#eventhttprequest.constants.cmd-post) = 2;
const int [CMD\_HEAD](class.eventhttprequest#eventhttprequest.constants.cmd-head) = 4;
const int [CMD\_PUT](class.eventhttprequest#eventhttprequest.constants.cmd-put) = 8;
const int [CMD\_DELETE](class.eventhttprequest#eventhttprequest.constants.cmd-delete) = 16;
const int [CMD\_OPTIONS](class.eventhttprequest#eventhttprequest.constants.cmd-options) = 32;
const int [CMD\_TRACE](class.eventhttprequest#eventhttprequest.constants.cmd-trace) = 64;
const int [CMD\_CONNECT](class.eventhttprequest#eventhttprequest.constants.cmd-connect) = 128;
const int [CMD\_PATCH](class.eventhttprequest#eventhttprequest.constants.cmd-patch) = 256;
const int [INPUT\_HEADER](class.eventhttprequest#eventhttprequest.constants.input-header) = 1;
const int [OUTPUT\_HEADER](class.eventhttprequest#eventhttprequest.constants.output-header) = 2; /\* Methods \*/
```
public addHeader( string $key , string $value , int $type ): bool
```
```
public cancel(): void
```
```
public clearHeaders(): void
```
```
public closeConnection(): void
```
```
public __construct( callable $callback , mixed $data = null )
```
```
public findHeader( string $key , string $type ): void
```
```
public free(): void
```
```
public closeConnection(): EventBufferEvent
```
```
public getCommand(): void
```
```
public closeConnection(): EventHttpConnection
```
```
public getHost(): string
```
```
public getInputBuffer(): EventBuffer
```
```
public getInputHeaders(): array
```
```
public getOutputBuffer(): EventBuffer
```
```
public getOutputHeaders(): void
```
```
public getResponseCode(): int
```
```
public getUri(): string
```
```
public removeHeader( string $key , string $type ): void
```
```
public sendError( int $error , string $reason = null ): void
```
```
public sendReply( int $code , string $reason , EventBuffer $buf = ?): void
```
```
public sendReplyChunk( EventBuffer $buf ): void
```
```
public sendReplyEnd(): void
```
```
public sendReplyStart( int $code , string $reason ): void
```
} Predefined Constants
--------------------
**`EventHttpRequest::CMD_GET`** GET method(command)
**`EventHttpRequest::CMD_POST`** POST method(command)
**`EventHttpRequest::CMD_HEAD`** HEAD method(command)
**`EventHttpRequest::CMD_PUT`** PUT method(command)
**`EventHttpRequest::CMD_DELETE`** DELETE command(method)
**`EventHttpRequest::CMD_OPTIONS`** OPTIONS method(command)
**`EventHttpRequest::CMD_TRACE`** TRACE method(command)
**`EventHttpRequest::CMD_CONNECT`** CONNECT method(command)
**`EventHttpRequest::CMD_PATCH`** PATCH method(command)
**`EventHttpRequest::INPUT_HEADER`** Request input header type.
**`EventHttpRequest::OUTPUT_HEADER`** Request output header type.
Table of Contents
-----------------
* [EventHttpRequest::addHeader](eventhttprequest.addheader) — Adds an HTTP header to the headers of the request
* [EventHttpRequest::cancel](eventhttprequest.cancel) — Cancels a pending HTTP request
* [EventHttpRequest::clearHeaders](eventhttprequest.clearheaders) — Removes all output headers from the header list of the request
* [EventHttpRequest::closeConnection](eventhttprequest.closeconnection) — Closes associated HTTP connection
* [EventHttpRequest::\_\_construct](eventhttprequest.construct) — Constructs EventHttpRequest object
* [EventHttpRequest::findHeader](eventhttprequest.findheader) — Finds the value belonging a header
* [EventHttpRequest::free](eventhttprequest.free) — Frees the object and removes associated events
* [EventHttpRequest::getBufferEvent](eventhttprequest.getbufferevent) — Returns EventBufferEvent object
* [EventHttpRequest::getCommand](eventhttprequest.getcommand) — Returns the request command(method)
* [EventHttpRequest::getConnection](eventhttprequest.getconnection) — Returns EventHttpConnection object
* [EventHttpRequest::getHost](eventhttprequest.gethost) — Returns the request host
* [EventHttpRequest::getInputBuffer](eventhttprequest.getinputbuffer) — Returns the input buffer
* [EventHttpRequest::getInputHeaders](eventhttprequest.getinputheaders) — Returns associative array of the input headers
* [EventHttpRequest::getOutputBuffer](eventhttprequest.getoutputbuffer) — Returns the output buffer of the request
* [EventHttpRequest::getOutputHeaders](eventhttprequest.getoutputheaders) — Returns associative array of the output headers
* [EventHttpRequest::getResponseCode](eventhttprequest.getresponsecode) — Returns the response code
* [EventHttpRequest::getUri](eventhttprequest.geturi) — Returns the request URI
* [EventHttpRequest::removeHeader](eventhttprequest.removeheader) — Removes an HTTP header from the headers of the request
* [EventHttpRequest::sendError](eventhttprequest.senderror) — Send an HTML error message to the client
* [EventHttpRequest::sendReply](eventhttprequest.sendreply) — Send an HTML reply to the client
* [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
* [EventHttpRequest::sendReplyStart](eventhttprequest.sendreplystart) — Initiate a chunked reply
php ZipArchive::replaceFile ZipArchive::replaceFile
=======================
(PHP >= 8.0.0, PECL zip >= 1.18.0)
ZipArchive::replaceFile — Replace file in ZIP archive with a given path
### Description
```
public ZipArchive::replaceFile(
string $filepath,
int $index,
int $start = 0,
int $length = 0,
int $flags = 0
): bool
```
Replace file in ZIP archive with a given path.
> **Note**: For maximum portability, it is recommended to always use forward slashes (`/`) as directory separator in ZIP filenames.
>
>
### Parameters
`filepath`
The path to the file to add.
`index`
The index of the file to be replaced, its name is unchanged.
`start`
For partial copy, start position.
`length`
For partial copy, length to be copied, if 0 or -1 the whole file (starting from `start`) is used.
`flags`
Bitmask consisting of **`ZipArchive::FL_ENC_GUESS`**, **`ZipArchive::FL_ENC_UTF_8`**, **`ZipArchive::FL_ENC_CP437`**. The behaviour of these constants is described on the [ZIP constants](https://www.php.net/manual/en/zip.constants.php) page.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
This example opens a ZIP file archive test.zip and replaces index 1 entry with /path/to/index.txt.
**Example #1 Open and replace**
```
<?php
$zip = new ZipArchive;
if ($zip->open('test.zip') === TRUE) {
$zip->replaceFile('/path/to/index.txt', 1);
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
```
### See Also
* [ZipArchive::addFile()](ziparchive.addfile) - Adds a file to a ZIP archive from the given path
php CURLFile::setPostFilename CURLFile::setPostFilename
=========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
CURLFile::setPostFilename — Set file name for POST
### Description
```
public CURLFile::setPostFilename(string $posted_filename): void
```
### Parameters
`posted_filename`
Filename to be used in POST data.
### Return Values
No value is returned.
php finfo::__construct finfo::\_\_construct
====================
(PHP >= 5.3.0, PHP 7, PHP 8, PECL fileinfo >= 0.1.0)
finfo::\_\_construct — Alias of [finfo\_open()](function.finfo-open)
### Description
public **finfo::\_\_construct**(int `$flags` = **`FILEINFO_NONE`**, ?string `$magic_database` = **`null`**) This function is an alias of: [finfo\_open()](function.finfo-open)
### Changelog
| Version | Description |
| --- | --- |
| 8.0.3 | `magic_database` is nullable now. |
php DOMXPath::__construct DOMXPath::\_\_construct
=======================
(PHP 5, PHP 7, PHP 8)
DOMXPath::\_\_construct — Creates a new [DOMXPath](class.domxpath) object
### Description
public **DOMXPath::\_\_construct**([DOMDocument](class.domdocument) `$document`, bool `$registerNodeNS` = **`true`**) Creates a new [DOMXPath](class.domxpath) object.
### Parameters
`document`
The [DOMDocument](class.domdocument) associated with the [DOMXPath](class.domxpath).
php ZipArchive::getNameIndex ZipArchive::getNameIndex
========================
(PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL zip >= 1.5.0)
ZipArchive::getNameIndex — Returns the name of an entry using its index
### Description
```
public ZipArchive::getNameIndex(int $index, int $flags = 0): string|false
```
Returns the name of an entry using its index.
### Parameters
`index`
Index of the entry.
`flags`
If flags is set to **`ZipArchive::FL_UNCHANGED`**, the original unchanged name is returned.
### Return Values
Returns the name on success or **`false`** on failure.
### Examples
**Example #1 **ZipArchive::getNameIndex()** example**
```
<?php
if ($zip->open('test.zip') == TRUE) {
for ($i = 0; $i < $zip->numFiles; $i++) {
$filename = $zip->getNameIndex($i);
// ...
}
}
?>
```
php Componere\Value::setProtected Componere\Value::setProtected
=============================
(Componere 2 >= 2.1.0)
Componere\Value::setProtected — Accessibility Modification
### Description
```
public Componere\Value::setProtected(): Value
```
### Return Values
The current Value
### Exceptions
**Warning** Shall throw [RuntimeException](class.runtimeexception) if access level was previously set
php SolrQuery::setFacetOffset SolrQuery::setFacetOffset
=========================
(PECL solr >= 0.9.2)
SolrQuery::setFacetOffset — Sets the offset into the list of constraints to allow for pagination
### Description
```
public SolrQuery::setFacetOffset(int $offset, string $field_override = ?): SolrQuery
```
Sets the offset into the list of constraints to allow for pagination.
### Parameters
`offset`
The offset
`field_override`
The name of the field.
### Return Values
Returns the current SolrQuery object, if the return value is used.
php mysqli::$error mysqli::$error
==============
mysqli\_error
=============
(PHP 5, PHP 7, PHP 8)
mysqli::$error -- mysqli\_error — Returns a string description of the last error
### Description
Object-oriented style
string [$mysqli->error](mysqli.error); Procedural style
```
mysqli_error(mysqli $mysql): string
```
Returns the last error message for the most recent MySQLi function call that can succeed or fail.
### Parameters
`mysql`
Procedural style only: A [mysqli](class.mysqli) object returned by [mysqli\_connect()](function.mysqli-connect) or [mysqli\_init()](mysqli.init)
### Return Values
A string that describes the error. An empty string if no error occurred.
### Examples
**Example #1 $mysqli->error 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();
}
if (!$mysqli->query("SET a=1")) {
printf("Error message: %s\n", $mysqli->error);
}
/* 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();
}
if (!mysqli_query($link, "SET a=1")) {
printf("Error message: %s\n", mysqli_error($link));
}
/* close connection */
mysqli_close($link);
?>
```
The above examples will output:
```
Error message: Unknown system variable 'a'
```
### See Also
* [mysqli\_connect\_errno()](mysqli.connect-errno) - Returns the error code from last connect call
* [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\_sqlstate()](mysqli.sqlstate) - Returns the SQLSTATE error from previous MySQL operation
php SolrInputDocument::fieldExists SolrInputDocument::fieldExists
==============================
(PECL solr >= 0.9.2)
SolrInputDocument::fieldExists — Checks if a field exists
### Description
```
public SolrInputDocument::fieldExists(string $fieldName): bool
```
Checks if a field exists
### Parameters
`fieldName`
Name of the field.
### Return Values
Returns **`true`** if the field was found and **`false`** if it was not found.
php Imagick::setImageGreenPrimary Imagick::setImageGreenPrimary
=============================
(PECL imagick 2, PECL imagick 3)
Imagick::setImageGreenPrimary — Sets the image chromaticity green primary point
### Description
```
public Imagick::setImageGreenPrimary(float $x, float $y): bool
```
Sets the image chromaticity green primary point.
### Parameters
`x`
`y`
### Return Values
Returns **`true`** on success.
### Errors/Exceptions
Throws ImagickException on error.
php None Reading Attributes with the Reflection API
------------------------------------------
To access attributes from classes, methods, functions, parameters, properties and class constants, the Reflection API provides the method **getAttributes()** on each of the corresponding Reflection objects. This method returns an array of [ReflectionAttribute](class.reflectionattribute) instances that can be queried for attribute name, arguments and to instantiate an instance of the represented attribute.
This separation of reflected attribute representation from actual instance increases control of the programmer to handle errors regarding missing attribute classes, mistyped or missing arguments. Only after calling [ReflectionAttribute::newInstance()](reflectionattribute.newinstance), objects of the attribute class are instantiated and the correct matching of arguments is validated, not earlier.
**Example #1 Reading Attributes using Reflection API**
```
<?php
#[Attribute]
class MyAttribute
{
public $value;
public function __construct($value)
{
$this->value = $value;
}
}
#[MyAttribute(value: 1234)]
class Thing
{
}
function dumpAttributeData($reflection) {
$attributes = $reflection->getAttributes();
foreach ($attributes as $attribute) {
var_dump($attribute->getName());
var_dump($attribute->getArguments());
var_dump($attribute->newInstance());
}
}
dumpAttributeData(new ReflectionClass(Thing::class));
/*
string(11) "MyAttribute"
array(1) {
["value"]=>
int(1234)
}
object(MyAttribute)#3 (1) {
["value"]=>
int(1234)
}
*/
```
Instead of iterating all attributes on the reflection instance, only those of a particular attribute class can be retrieved by passing the searched attribute class name as argument.
**Example #2 Reading Specific Attributes using Reflection API**
```
<?php
function dumpMyAttributeData($reflection) {
$attributes = $reflection->getAttributes(MyAttribute::class);
foreach ($attributes as $attribute) {
var_dump($attribute->getName());
var_dump($attribute->getArguments());
var_dump($attribute->newInstance());
}
}
dumpMyAttributeData(new ReflectionClass(Thing::class));
```
php Locale::getScript Locale::getScript
=================
locale\_get\_script
===================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
Locale::getScript -- locale\_get\_script — Gets the script for the input locale
### Description
Object-oriented style
```
public static Locale::getScript(string $locale): ?string
```
Procedural style
```
locale_get_script(string $locale): ?string
```
Gets the script for the input locale.
### Parameters
`locale`
The locale to extract the script code from
### Return Values
The script subtag for the locale or **`null`** if not present
### Examples
**Example #1 **locale\_get\_script()** example**
```
<?php
echo locale_get_script('sr-Cyrl');
?>
```
**Example #2 OO example**
```
<?php
echo Locale::getScript('sr-Cyrl');
?>
```
The above example will output:
```
Cyrl
```
### See Also
* [locale\_get\_primary\_language()](locale.getprimarylanguage) - Gets the primary language for the input locale
* [locale\_get\_region()](locale.getregion) - Gets the region for the input locale
* [locale\_get\_all\_variants()](locale.getallvariants) - Gets the variants for the input locale
| programming_docs |
php SplFileInfo::getType SplFileInfo::getType
====================
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
SplFileInfo::getType — Gets file type
### Description
```
public SplFileInfo::getType(): string|false
```
Returns the type of the file referenced.
### Parameters
This function has no parameters.
### Return Values
A string representing the type of the entry. May be one of `file`, `link`, `dir`, `block`, `fifo`, `char`, `socket`, or `unknown`, or **`false`** on failure.
### Errors/Exceptions
Throws a [RuntimeException](class.runtimeexception) on error.
### Examples
**Example #1 **SplFileInfo::getType()** example**
```
<?php
$info = new SplFileInfo(__FILE__);
echo $info->getType().PHP_EOL;
$info = new SplFileInfo(dirname(__FILE__));
echo $info->getType();
?>
```
The above example will output something similar to:
```
file
dir
```
php Gmagick::nextimage Gmagick::nextimage
==================
(PECL gmagick >= Unknown)
Gmagick::nextimage — Moves to the next image
### Description
```
public Gmagick::nextimage(): bool
```
Associates the next image in the image list with an [Gmagick](class.gmagick) object.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
Throws an **GmagickException** on error.
php Locale::parseLocale Locale::parseLocale
===================
locale\_parse
=============
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
Locale::parseLocale -- locale\_parse — Returns a key-value array of locale ID subtag elements
### Description
Object-oriented style
```
public static Locale::parseLocale(string $locale): ?array
```
Procedural style
```
locale_parse(string $locale): ?array
```
Returns a key-value array of locale ID subtag elements.
### Parameters
`locale`
The locale to extract the subtag array from. Note: The 'variant' and 'private' subtags can take maximum 15 values whereas 'extlang' can take maximum 3 values.
### Return Values
Returns an array containing a list of key-value pairs, where the keys identify the particular locale ID subtags, and the values are the associated subtag values. The array will be ordered as the locale id subtags e.g. in the locale id if variants are '-varX-varY-varZ' then the returned array will have variant0=>varX , variant1=>varY , variant2=>varZ
Returns **`null`** when the length of `locale` exceeds **`INTL_MAX_LOCALE_LEN`**.
### Examples
**Example #1 **locale\_parse()** example**
```
<?php
$arr = locale_parse('sl-Latn-IT-nedis');
if ($arr) {
foreach ($arr as $key => $value) {
echo "$key : $value , ";
}
}
?>
```
**Example #2 OO example**
```
<?php
$arr = Locale::parseLocale('sl-Latn-IT-nedis');
if ($arr) {
foreach ($arr as $key => $value) {
echo "$key : $value , ";
}
}
?>
```
The above example will output:
```
language : sl , script : Latn , region : IT , variant0 : NEDIS ,
```
### See Also
* [locale\_compose()](locale.composelocale) - Returns a correctly ordered and delimited locale ID
php Imagick::adaptiveThresholdImage Imagick::adaptiveThresholdImage
===============================
(PECL imagick 2, PECL imagick 3)
Imagick::adaptiveThresholdImage — Selects a threshold for each pixel based on a range of intensity
### Description
```
public Imagick::adaptiveThresholdImage(int $width, int $height, int $offset): bool
```
Selects an individual threshold for each pixel based on the range of intensity values in its local neighborhood. This allows for thresholding of an image whose global intensity histogram doesn't contain distinctive peaks.
### Parameters
`width`
Width of the local neighborhood.
`height`
Height of the local neighborhood.
`offset`
The mean offset
### Return Values
Returns **`true`** on success.
### Examples
**Example #1 **Imagick::adaptiveThresholdImage()****
```
<?php
function adaptiveThresholdImage($imagePath, $width, $height, $adaptiveOffset) {
$imagick = new \Imagick(realpath($imagePath));
$adaptiveOffsetQuantum = intval($adaptiveOffset * \Imagick::getQuantum());
$imagick->adaptiveThresholdImage($width, $height, $adaptiveOffsetQuantum);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
```
php SolrInputDocument::merge SolrInputDocument::merge
========================
(PECL solr >= 0.9.2)
SolrInputDocument::merge — Merges one input document into another
### Description
```
public SolrInputDocument::merge(SolrInputDocument $sourceDoc, bool $overwrite = true): bool
```
Merges one input document into another.
### Parameters
`sourceDoc`
The source document.
`overwrite`
If this is **`true`** it will replace matching fields in the destination document.
### Return Values
Returns **`true`** on success or **`false`** on failure. In the future, this will be modified to return the number of fields in the new document.
php ImagickDraw::setTextInterwordSpacing ImagickDraw::setTextInterwordSpacing
====================================
(PECL imagick 2 >= 2.3.0, PECL imagick 3)
ImagickDraw::setTextInterwordSpacing — Description
### Description
```
public ImagickDraw::setTextInterwordSpacing(float $spacing): bool
```
Sets the text interword spacing.
### Parameters
`spacing`
### Return Values
Returns **`true`** on success.
php Exception::__clone Exception::\_\_clone
====================
(PHP 5, PHP 7, PHP 8)
Exception::\_\_clone — Clone the exception
### Description
```
private Exception::__clone(): void
```
Tries to clone the Exception, which results in Fatal error.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### Errors/Exceptions
Exceptions are *not* clonable.
### Changelog
| Version | Description |
| --- | --- |
| 8.1.0 | **Exception::\_\_clone()** is no longer final. |
php hash_update_file hash\_update\_file
==================
(PHP 5 >= 5.1.2, PHP 7, PHP 8, PECL hash >= 1.1)
hash\_update\_file — Pump data into an active hashing context from a file
### Description
```
hash_update_file(HashContext $context, string $filename, ?resource $stream_context = null): bool
```
### Parameters
`context`
Hashing context returned by [hash\_init()](function.hash-init).
`filename`
URL describing location of file to be hashed; Supports fopen wrappers.
`stream_context`
Stream context as returned by [stream\_context\_create()](function.stream-context-create).
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `stream_context` is now nullable. |
| 7.2.0 | Accept [HashContext](class.hashcontext) instead of resource. |
### 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\_update\_stream()](function.hash-update-stream) - Pump data into an active hashing context from an open stream
* [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 preg_replace_callback preg\_replace\_callback
=======================
(PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8)
preg\_replace\_callback — Perform a regular expression search and replace using a callback
### Description
```
preg_replace_callback(
string|array $pattern,
callable $callback,
string|array $subject,
int $limit = -1,
int &$count = null,
int $flags = 0
): string|array|null
```
The behavior of this function is almost identical to [preg\_replace()](function.preg-replace), except for the fact that instead of `replacement` parameter, one should specify a `callback`.
### Parameters
`pattern`
The pattern to search for. It can be either a string or an array with strings.
`callback`
A callback that will be called and passed an array of matched elements in the `subject` string. The callback should return the replacement string. This is the callback signature:
```
handler(array $matches): string
```
You'll often need the `callback` function for a **preg\_replace\_callback()** in just one place. In this case you can use an [anonymous function](functions.anonymous) to declare the callback within the call to **preg\_replace\_callback()**. By doing it this way you have all information for the call in one place and do not clutter the function namespace with a callback function's name not used anywhere else.
**Example #1 **preg\_replace\_callback()** and anonymous function**
```
<?php
/* a unix-style command line filter to convert uppercase
* letters at the beginning of paragraphs to lowercase */
$fp = fopen("php://stdin", "r") or die("can't read stdin");
while (!feof($fp)) {
$line = fgets($fp);
$line = preg_replace_callback(
'|<p>\s*\w|',
function ($matches) {
return strtolower($matches[0]);
},
$line
);
echo $line;
}
fclose($fp);
?>
```
`subject`
The string or an array with strings to search and replace.
`limit`
The maximum possible replacements for each pattern in each `subject` string. Defaults to `-1` (no limit).
`count`
If specified, this variable will be filled with the number of replacements done.
`flags`
`flags` can be a combination of the **`PREG_OFFSET_CAPTURE`** and **`PREG_UNMATCHED_AS_NULL`** flags, which influence the format of the matches array. See the description in [preg\_match()](function.preg-match) for more details.
### Return Values
**preg\_replace\_callback()** returns an array if the `subject` parameter is an array, or a string otherwise. On errors the return value is **`null`**
If matches are found, the new subject will be returned, otherwise `subject` will be returned unchanged.
### Errors/Exceptions
If the regex pattern passed does not compile to a valid regex, an **`E_WARNING`** is emitted.
### Changelog
| Version | Description |
| --- | --- |
| 7.4.0 | The `flags` parameter was added. |
### Examples
**Example #2 **preg\_replace\_callback()** example**
```
<?php
// this text was used in 2002
// we want to get this up to date for 2003
$text = "April fools day is 04/01/2002\n";
$text.= "Last christmas was 12/24/2001\n";
// the callback function
function next_year($matches)
{
// as usual: $matches[0] is the complete match
// $matches[1] the match for the first subpattern
// enclosed in '(...)' and so on
return $matches[1].($matches[2]+1);
}
echo preg_replace_callback(
"|(\d{2}/\d{2}/)(\d{4})|",
"next_year",
$text);
?>
```
The above example will output:
```
April fools day is 04/01/2003
Last christmas was 12/24/2002
```
**Example #3 **preg\_replace\_callback()** using recursive structure to handle encapsulated BB code**
```
<?php
$input = "plain [indent] deep [indent] deeper [/indent] deep [/indent] plain";
function parseTagsRecursive($input)
{
$regex = '#\[indent]((?:[^[]|\[(?!/?indent])|(?R))+)\[/indent]#';
if (is_array($input)) {
$input = '<div style="margin-left: 10px">'.$input[1].'</div>';
}
return preg_replace_callback($regex, 'parseTagsRecursive', $input);
}
$output = parseTagsRecursive($input);
echo $output;
?>
```
### See Also
* [PCRE Patterns](https://www.php.net/manual/en/pcre.pattern.php)
* [preg\_replace\_callback\_array()](function.preg-replace-callback-array) - Perform a regular expression search and replace using callbacks
* [preg\_quote()](function.preg-quote) - Quote regular expression characters
* [preg\_replace()](function.preg-replace) - Perform a regular expression search and replace
* [preg\_last\_error()](function.preg-last-error) - Returns the error code of the last PCRE regex execution
* [Anonymous functions](functions.anonymous)
php SolrQuery::setFacetLimit SolrQuery::setFacetLimit
========================
(PECL solr >= 0.9.2)
SolrQuery::setFacetLimit — Maps to facet.limit
### Description
```
public SolrQuery::setFacetLimit(int $limit, string $field_override = ?): SolrQuery
```
Maps to facet.limit. Sets the maximum number of constraint counts that should be returned for the facet fields.
### Parameters
`limit`
The maximum number of constraint counts
`field_override`
The name of the field.
### Return Values
Returns the current SolrQuery object, if the return value is used.
php ReflectionReference::getId ReflectionReference::getId
==========================
(PHP 7 >= 7.4.0, PHP 8)
ReflectionReference::getId — Get unique ID of a reference
### Description
```
public ReflectionReference::getId(): string
```
Returns an ID which is unique for the reference for the lifetime of that reference. This ID can be used to compare references for equality, or to maintain a map of known references.
### Parameters
This function has no parameters.
### Return Values
Returns a string of unspecified format.
### Examples
**Example #1 Basic **ReflectionReference::getId()** usage**
```
<?php
$val1 = 'foo';
$val2 = 'bar';
$arr = [&$val1, &$val2, &$val1];
$rr1 = ReflectionReference::fromArrayElement($arr, 0);
$rr2 = ReflectionReference::fromArrayElement($arr, 1);
$rr3 = ReflectionReference::fromArrayElement($arr, 2);
var_dump($rr1->getId() === $rr2->getId());
var_dump($rr1->getId() === $rr3->getId());
?>
```
The above example will output:
```
bool(false)
bool(true)
```
php Ds\Map::merge Ds\Map::merge
=============
(PECL ds >= 1.0.0)
Ds\Map::merge — Returns the result of adding all given associations
### Description
```
public Ds\Map::merge(mixed $values): Ds\Map
```
Returns the result of associating all keys of a given [traversable](class.traversable) object or array with their corresponding values, combined with the current instance.
>
> **Note**:
>
>
> Values of the current instance will be overwritten by those provided where keys are equal.
>
>
### Parameters
`values`
A [traversable](class.traversable) object or an array.
### Return Values
The result of associating all keys of a given [traversable](class.traversable) object or array with their corresponding values, combined with the current instance.
>
> **Note**:
>
>
> The current instance won't be affected.
>
>
### Examples
**Example #1 **Ds\Map::merge()** example**
```
<?php
$map = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]);
print_r($map->merge(["a" => 10, "e" => 50]));
?>
```
The above example will output something similar to:
```
Ds\Map Object
(
[0] => Ds\Pair Object
(
[key] => a
[value] => 10
)
[1] => Ds\Pair Object
(
[key] => b
[value] => 2
)
[2] => Ds\Pair Object
(
[key] => c
[value] => 3
)
[3] => Ds\Pair Object
(
[key] => e
[value] => 50
)
)
```
php SplFileObject::fwrite SplFileObject::fwrite
=====================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
SplFileObject::fwrite — Write to file
### Description
```
public SplFileObject::fwrite(string $data, int $length = 0): int|false
```
Writes the contents of `string` to the file
### Parameters
`data`
The string to be written to the file.
`length`
If the `length` argument is given, writing will stop after `length` bytes have been written or the end of `string` is reached, whichever comes first.
### Return Values
Returns the number of bytes written, or **`false`** on error.
### Changelog
| Version | Description |
| --- | --- |
| 7.4.0 | The function now returns **`false`** instead of zero on failure. |
### Examples
**Example #1 **SplFileObject::fwrite()** example**
```
<?php
$file = new SplFileObject("fwrite.txt", "w");
$written = $file->fwrite("12345");
echo "Wrote $written bytes to file";
?>
```
The above example will output something similar to:
```
Wrote 5 bytes to file
```
### See Also
* [fwrite()](function.fwrite) - Binary-safe file write
php DOMElement::removeAttribute DOMElement::removeAttribute
===========================
(PHP 5, PHP 7, PHP 8)
DOMElement::removeAttribute — Removes attribute
### Description
```
public DOMElement::removeAttribute(string $qualifiedName): bool
```
Removes attribute named `qualifiedName` from the element.
### Parameters
`qualifiedName`
The name of the attribute.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Errors/Exceptions
**`DOM_NO_MODIFICATION_ALLOWED_ERR`**
Raised if the node is readonly.
### See Also
* [DOMElement::hasAttribute()](domelement.hasattribute) - Checks to see if attribute exists
* [DOMElement::getAttribute()](domelement.getattribute) - Returns value of attribute
* [DOMElement::setAttribute()](domelement.setattribute) - Adds new or modifies existing attribute
php ftp_exec ftp\_exec
=========
(PHP 4 >= 4.0.3, PHP 5, PHP 7, PHP 8)
ftp\_exec — Requests execution of a command on the FTP server
### Description
```
ftp_exec(FTP\Connection $ftp, string $command): bool
```
Sends a SITE EXEC `command` request to the FTP server.
### Parameters
`ftp`
An [FTP\Connection](class.ftp-connection) instance.
`command`
The command to execute.
### Return Values
Returns **`true`** if the command was successful (server sent response code: `200`); otherwise returns **`false`**.
### 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\_exec()** example**
```
<?php
// variable initialization
$command = 'ls -al >files.txt';
// 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);
// execute command
if (ftp_exec($ftp, $command)) {
echo "$command executed successfully\n";
} else {
echo "could not execute $command\n";
}
// close the connection
ftp_close($ftp);
?>
```
### See Also
* [ftp\_raw()](function.ftp-raw) - Sends an arbitrary command to an FTP server
php Yaf_Session::del Yaf\_Session::del
=================
(Yaf >=1.0.0)
Yaf\_Session::del — The del purpose
### Description
```
public Yaf_Session::del(string $name): void
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`name`
### Return Values
php imagecolortransparent imagecolortransparent
=====================
(PHP 4, PHP 5, PHP 7, PHP 8)
imagecolortransparent — Define a color as transparent
### Description
```
imagecolortransparent(GdImage $image, ?int $color = null): int
```
Gets or sets the transparent color in the given `image`.
### Parameters
`image`
A [GdImage](class.gdimage) object, returned by one of the image creation functions, such as [imagecreatetruecolor()](function.imagecreatetruecolor).
`color`
A color identifier created with [imagecolorallocate()](function.imagecolorallocate).
### Return Values
The identifier of the new (or current, if none is specified) transparent color is returned. If `color` is **`null`**, and the image has no transparent color, the returned identifier will be `-1`.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `image` expects a [GdImage](class.gdimage) instance now; previously, a resource was expected. |
| 8.0.0 | `color` is now nullable. |
### Examples
**Example #1 **imagecolortransparent()** example**
```
<?php
// Create a 55x30 image
$im = imagecreatetruecolor(55, 30);
$red = imagecolorallocate($im, 255, 0, 0);
$black = imagecolorallocate($im, 0, 0, 0);
// Make the background transparent
imagecolortransparent($im, $black);
// Draw a red rectangle
imagefilledrectangle($im, 4, 4, 50, 25, $red);
// Save the image
imagepng($im, './imagecolortransparent.png');
imagedestroy($im);
?>
```
The above example will output something similar to:
### Notes
>
> **Note**:
>
>
> Transparency is copied only with [imagecopymerge()](function.imagecopymerge) and true color images, not with [imagecopy()](function.imagecopy) or pallete images.
>
>
>
> **Note**:
>
>
> The transparent color is a property of the image, transparency is not a property of the color. Once you have set a color to be the transparent color, any regions of the image in that color that were drawn previously will be transparent.
>
>
| programming_docs |
php SolrQuery::getGroupMain SolrQuery::getGroupMain
=======================
(PECL solr >= 2.2.0)
SolrQuery::getGroupMain — Returns the group.main value
### Description
```
public SolrQuery::getGroupMain(): bool
```
Returns the group.main value
### Parameters
This function has no parameters.
### Return Values
### See Also
* [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
php deflate_add deflate\_add
============
(PHP 7, PHP 8)
deflate\_add — Incrementally deflate data
### Description
```
deflate_add(DeflateContext $context, string $data, int $flush_mode = ZLIB_SYNC_FLUSH): string|false
```
Incrementally deflates data in the specified context.
### Parameters
`context`
A context created with [deflate\_init()](function.deflate-init).
`data`
A chunk of data to compress.
`flush_mode`
One of **`ZLIB_BLOCK`**, **`ZLIB_NO_FLUSH`**, **`ZLIB_PARTIAL_FLUSH`**, **`ZLIB_SYNC_FLUSH`** (default), **`ZLIB_FULL_FLUSH`**, **`ZLIB_FINISH`**. Normally you will want to set **`ZLIB_NO_FLUSH`** to maximize compression, and **`ZLIB_FINISH`** to terminate with the last chunk of data. See the [» zlib manual](http://www.zlib.net/manual.html) for a detailed description of these constants.
### Return Values
Returns a chunk of compressed data, or **`false`** on failure.
### Errors/Exceptions
If invalid arguments are given, an error of level **`E_WARNING`** is generated.
### Changelog
| Version | Description |
| --- | --- |
| 8.0.0 | `context` expects a [DeflateContext](class.deflatecontext) instance now; previously, a resource was expected. |
### See Also
* [deflate\_init()](function.deflate-init) - Initialize an incremental deflate context
php ImagickDraw::getFontFamily ImagickDraw::getFontFamily
==========================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::getFontFamily — Returns the font family
### Description
```
public ImagickDraw::getFontFamily(): string
```
**Warning**This function is currently not documented; only its argument list is available.
Returns the font family to use when annotating with text.
### Return Values
Returns the font family currently selected or false if font family is not set.
php Imagick::mergeImageLayers Imagick::mergeImageLayers
=========================
(PECL imagick 2 >= 2.1.0, PECL imagick 3)
Imagick::mergeImageLayers — Merges image layers
### Description
```
public Imagick::mergeImageLayers(int $layer_method): Imagick
```
Merges image layers into one. This method is useful when working with image formats that use multiple layers such as PSD. The merging is controlled using the `layer_method` which defines how the layers are merged. This method is available if Imagick has been compiled against ImageMagick version 6.3.7 or newer.
### Parameters
`layer_method`
One of the **`Imagick::LAYERMETHOD_*`** constants
### Return Values
Returns an Imagick object containing the merged image.
### Errors/Exceptions
Throws ImagickException on error.
### Examples
**Example #1 **Imagick::mergeImageLayers()****
```
<?php
function mergeImageLayers($layerMethodType, $imagePath1, $imagePath2) {
$imagick = new \Imagick(realpath($imagePath));
$imagick2 = new \Imagick(realpath($imagePath2));
$imagick->addImage($imagick2);
$imagick->setImageFormat('png');
$result = $imagick->mergeImageLayers($layerMethodType);
header("Content-Type: image/png");
echo $result->getImageBlob();
}
?>
```
### See Also
* [Imagick::flattenImages()](imagick.flattenimages) - Merges a sequence of images
php SplObjectStorage::setInfo SplObjectStorage::setInfo
=========================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplObjectStorage::setInfo — Sets the data associated with the current iterator entry
### Description
```
public SplObjectStorage::setInfo(mixed $info): void
```
Associates data, or info, with the object currently pointed to by the iterator.
### Parameters
`info`
The data to associate with the current iterator entry.
### Return Values
No value is returned.
### Examples
**Example #1 **SplObjectStorage::setInfo()** example**
```
<?php
$s = new SplObjectStorage();
$o1 = new StdClass;
$o2 = new StdClass;
$s->attach($o1, "d1");
$s->attach($o2, "d2");
$s->rewind();
while($s->valid()) {
$s->setInfo("new");
$s->next();
}
var_dump($s[$o1]);
var_dump($s[$o2]);
?>
```
The above example will output something similar to:
```
string(3) "new"
string(3) "new"
```
### 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::getInfo()](splobjectstorage.getinfo) - Returns the data associated with the current iterator entry
php Imagick::getImageMatteColor Imagick::getImageMatteColor
===========================
(PECL imagick 2, PECL imagick 3)
Imagick::getImageMatteColor — Returns the image matte color
**Warning**This function has been *DEPRECATED* as of Imagick 3.4.4. Relying on this function is highly discouraged.
### Description
```
public Imagick::getImageMatteColor(): ImagickPixel
```
Returns the image matte color.
### Parameters
This function has no parameters.
### Return Values
Returns ImagickPixel object on success.
### Errors/Exceptions
Throws ImagickException on error.
php Componere\Value::setStatic Componere\Value::setStatic
==========================
(Componere 2 >= 2.1.0)
Componere\Value::setStatic — Accessibility Modification
### Description
```
public Componere\Value::setStatic(): Value
```
### Return Values
The current Value
php runkit7_method_add runkit7\_method\_add
====================
(PECL runkit7 >= Unknown)
runkit7\_method\_add — Dynamically adds a new method to a given class
### Description
```
runkit7_method_add(
string $class_name,
string $method_name,
string $argument_list,
string $code,
int $flags = RUNKIT7_ACC_PUBLIC,
string $doc_comment = null,
string $return_type = ?,
bool $is_strict = ?
): bool
```
```
runkit7_method_add(
string $class_name,
string $method_name,
Closure $closure,
int $flags = RUNKIT7_ACC_PUBLIC,
string $doc_comment = null,
string $return_type = ?,
bool $is_strict = ?
): bool
```
### Parameters
`class_name`
The class to which this method will be added
`method_name`
The name of the method to add
`argument_list`
Comma-delimited list of arguments for the newly-created method
`code`
The code to be evaluated when `method_name` is called
`closure`
A [closure](class.closure) that defines the method.
`flags`
The type of method to create, can be **`RUNKIT7_ACC_PUBLIC`**, **`RUNKIT7_ACC_PROTECTED`** or **`RUNKIT7_ACC_PRIVATE`** optionally combined via bitwise OR with **`RUNKIT7_ACC_STATIC`**
`doc_comment`
The doc comment of the method.
`return_type`
The return type of the method.
`is_strict`
Whether the method behaves 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 **runkit7\_method\_add()** example**
```
<?php
class Example {
function foo() {
echo "foo!\n";
}
}
// create an Example object
$e = new Example();
// Add a new public method
runkit7_method_add(
'Example',
'add',
'$num1, $num2',
'return $num1 + $num2;',
RUNKIT7_ACC_PUBLIC
);
// add 12 + 4
echo $e->add(12, 4);
?>
```
The above example will output:
```
16
```
### See Also
* [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\_remove()](function.runkit7-method-remove) - Dynamically removes the given method
* [runkit7\_method\_rename()](function.runkit7-method-rename) - Dynamically changes the name of the given method
* [runkit7\_function\_add()](function.runkit7-function-add) - Add a new function, similar to create\_function
php Gmagick::getimageunits Gmagick::getimageunits
======================
(PECL gmagick >= Unknown)
Gmagick::getimageunits — Gets the image units of resolution
### Description
```
public Gmagick::getimageunits(): int
```
Gets the image units of resolution.
### Parameters
This function has no parameters.
### Return Values
Returns the image units of resolution.
php stripos stripos
=======
(PHP 5, PHP 7, PHP 8)
stripos — Find the position of the first occurrence of a case-insensitive substring in a string
### Description
```
stripos(string $haystack, string $needle, int $offset = 0): int|false
```
Find the numeric position of the first occurrence of `needle` in the `haystack` string.
Unlike the [strpos()](function.strpos), **stripos()** is case-insensitive.
### Parameters
`haystack`
The string to search in.
`needle`
Note that the `needle` may be a string of one or more characters.
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.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. |
| 7.1.0 | Support for negative `offset`s has been added. |
### Examples
**Example #1 **stripos()** examples**
```
<?php
$findme = 'a';
$mystring1 = 'xyz';
$mystring2 = 'ABC';
$pos1 = stripos($mystring1, $findme);
$pos2 = stripos($mystring2, $findme);
// Nope, 'a' is certainly not in 'xyz'
if ($pos1 === false) {
echo "The string '$findme' was not found in the string '$mystring1'";
}
// Note our use of ===. Simply == would not work as expected
// because the position of 'a' is the 0th (first) character.
if ($pos2 !== false) {
echo "We found '$findme' in '$mystring2' at position $pos2";
}
?>
```
### Notes
> **Note**: This function is binary-safe.
>
>
### See Also
* [mb\_stripos()](function.mb-stripos) - Finds position of first occurrence of a string within another, case insensitive
* [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
* [strpos()](function.strpos) - Find the position of the first occurrence of a 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
* [stristr()](function.stristr) - Case-insensitive strstr
* [substr()](function.substr) - Return part of a string
* [str\_ireplace()](function.str-ireplace) - Case-insensitive version of str\_replace
php The LDAP\Connection class
The LDAP\Connection class
=========================
Introduction
------------
(PHP 8 >= 8.1.0)
A fully opaque class which replaces a `ldap` resource as of PHP 8.1.0.
Class synopsis
--------------
final class **LDAP\Connection** { }
php EventHttp::__construct EventHttp::\_\_construct
========================
(PECL event >= 1.2.6-beta)
EventHttp::\_\_construct — Constructs EventHttp object(the HTTP server)
### Description
```
public EventHttp::__construct( EventBase $base , EventSslContext $ctx = null )
```
Constructs the HTTP server object.
### Parameters
`base` Associated event base.
`ctx` [EventSslContext](class.eventsslcontext) class object. Turns plain HTTP server into HTTPS server. It means that if `ctx` is configured correctly, then the underlying buffer events will be based on OpenSSL sockets. Thus, all traffic will pass through the SSL or TLS.
>
> **Note**:
>
>
> This parameter is available only if `Event` is compiled with OpenSSL support and only with `Libevent
> 2.1.0-alpha` and higher.
>
>
### Return Values
Returns [EventHttp](class.eventhttp) object.
### Changelog
| Version | Description |
| --- | --- |
| PECL event 1.9.0 | OpenSSL support (`ctx`) added. |
### Examples
**Example #1 Simple HTTP server**
```
<?php
/*
* Simple HTTP server.
*
* To test it:
* 1) Run it on a port of your choice, e.g.:
* $ php examples/http.php 8010
* 2) In another terminal connect to some address on this port
* and make GET or POST request(others are turned off here), e.g.:
* $ nc -t 127.0.0.1 8010
* POST /about HTTP/1.0
* Content-Type: text/plain
* Content-Length: 4
* Connection: close
* (press Enter)
*
* It will output
* a=12
* HTTP/1.0 200 OK
* Content-Type: text/html; charset=ISO-8859-1
* Connection: close
*
* $ nc -t 127.0.0.1 8010
* GET /dump HTTP/1.0
* Content-Type: text/plain
* Content-Encoding: UTF-8
* Connection: close
* (press Enter)
*
* It will output:
* HTTP/1.0 200 OK
* Content-Type: text/html; charset=ISO-8859-1
* Connection: close
* (press Enter)
*
* $ nc -t 127.0.0.1 8010
* GET /unknown HTTP/1.0
* Connection: close
*
* It will output:
* HTTP/1.0 200 OK
* Content-Type: text/html; charset=ISO-8859-1
* Connection: close
*
* 3) See what the server outputs on the previous terminal window.
*/
function _http_dump($req, $data) {
static $counter = 0;
static $max_requests = 2;
if (++$counter >= $max_requests) {
echo "Counter reached max requests $max_requests. Exiting\n";
exit();
}
echo __METHOD__, " called\n";
echo "request:"; var_dump($req);
echo "data:"; var_dump($data);
echo "\n===== DUMP =====\n";
echo "Command:", $req->getCommand(), PHP_EOL;
echo "URI:", $req->getUri(), PHP_EOL;
echo "Input headers:"; var_dump($req->getInputHeaders());
echo "Output headers:"; var_dump($req->getOutputHeaders());
echo "\n >> Sending reply ...";
$req->sendReply(200, "OK");
echo "OK\n";
echo "\n >> Reading input buffer ...\n";
$buf = $req->getInputBuffer();
while ($s = $buf->readLine(EventBuffer::EOL_ANY)) {
echo $s, PHP_EOL;
}
echo "No more data in the buffer\n";
}
function _http_about($req) {
echo __METHOD__, PHP_EOL;
echo "URI: ", $req->getUri(), PHP_EOL;
echo "\n >> Sending reply ...";
$req->sendReply(200, "OK");
echo "OK\n";
}
function _http_default($req, $data) {
echo __METHOD__, PHP_EOL;
echo "URI: ", $req->getUri(), PHP_EOL;
echo "\n >> Sending reply ...";
$req->sendReply(200, "OK");
echo "OK\n";
}
$port = 8010;
if ($argc > 1) {
$port = (int) $argv[1];
}
if ($port <= 0 || $port > 65535) {
exit("Invalid port");
}
$base = new EventBase();
$http = new EventHttp($base);
$http->setAllowedMethods(EventHttpRequest::CMD_GET | EventHttpRequest::CMD_POST);
$http->setCallback("/dump", "_http_dump", array(4, 8));
$http->setCallback("/about", "_http_about");
$http->setDefaultCallback("_http_default", "custom data value");
$http->bind("0.0.0.0", 8010);
$base->loop();
?>
```
The above example will output something similar to:
```
a=12
HTTP/1.0 200 OK
Content-Type: text/html; charset=ISO-8859-1
Connection: close
HTTP/1.0 200 OK
Content-Type: text/html; charset=ISO-8859-1
Connection: close
(press Enter)
HTTP/1.0 200 OK
Content-Type: text/html; charset=ISO-8859-1
Connection: close
```
php ReflectionZendExtension::getAuthor ReflectionZendExtension::getAuthor
==================================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
ReflectionZendExtension::getAuthor — Gets author
### Description
```
public ReflectionZendExtension::getAuthor(): string
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php Gmagick::clear Gmagick::clear
==============
(PECL gmagick >= Unknown)
Gmagick::clear — Clears all resources associated to Gmagick object
### Description
```
public Gmagick::clear(): Gmagick
```
Clears all resources associated to [Gmagick](class.gmagick) object.
### Parameters
This function has no parameters.
### Return Values
The cleared [Gmagick](class.gmagick) object.
### Errors/Exceptions
Throws an **GmagickException** on error.
php ibase_fetch_row ibase\_fetch\_row
=================
(PHP 5, PHP 7 < 7.4.0)
ibase\_fetch\_row — Fetch a row from an InterBase database
### Description
```
ibase_fetch_row(resource $result_identifier, int $fetch_flag = 0): array
```
**ibase\_fetch\_row()** fetches one row of data from the given result set.
Subsequent calls to **ibase\_fetch\_row()** return the next row in the result set, or **`false`** if there are no more rows.
### Parameters
`result_identifier`
An InterBase result identifier.
`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 array that corresponds to the fetched row, or **`false`** if there are no more rows. Each result column is stored in an array offset, starting at offset 0.
### See Also
* [ibase\_fetch\_assoc()](function.ibase-fetch-assoc) - Fetch a result row from a query as an associative array
* [ibase\_fetch\_object()](function.ibase-fetch-object) - Get an object from a InterBase database
php mysqli_sql_exception::getSqlState mysqli\_sql\_exception::getSqlState
===================================
(PHP 8 >= 8.1.2)
mysqli\_sql\_exception::getSqlState — Returns the SQLSTATE error code
### Description
```
public mysqli_sql_exception::getSqlState(): string
```
Returns a string containing the SQLSTATE error code for the last error. The error code consists of five characters. 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).
>
> **Note**:
>
>
> Note that not all MySQL errors are yet mapped to SQLSTATE's. The value `HY000` (general error) is used for unmapped errors.
>
>
### Parameters
This function has no parameters.
### Return Values
Returns a string containing the SQLSTATE error code for the last error. The error code consists of five characters.
| programming_docs |
php SyncMutex::lock SyncMutex::lock
===============
(PECL sync >= 1.0.0)
SyncMutex::lock — Waits for an exclusive lock
### Description
```
public SyncMutex::lock(int $wait = -1): bool
```
Obtains an exclusive lock on a [SyncMutex](class.syncmutex) object. If the lock is already acquired, then this increments an internal counter.
### Parameters
`wait`
The number of milliseconds to wait for the exclusive lock. A value of -1 is infinite.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **SyncMutex::lock()** example**
```
<?php
$mutex = new SyncMutex("UniqueName");
if (!$mutex->lock(3000))
{
echo "Unable to lock mutex.";
exit();
}
/* ... */
$mutex->unlock();
?>
```
### See Also
* [SyncMutex::unlock()](syncmutex.unlock) - Unlocks the mutex
php stats_rand_phrase_to_seeds stats\_rand\_phrase\_to\_seeds
==============================
(PECL stats >= 1.0.0)
stats\_rand\_phrase\_to\_seeds — Generate two seeds for the RGN random number generator
### Description
```
stats_rand_phrase_to_seeds(string $phrase): array
```
Generate two seeds for the random number generator from a `phrase`.
### Parameters
`phrase`
The input phrase
### Return Values
Returns an array of two integers.
php tidy::getOptDoc tidy::getOptDoc
===============
tidy\_get\_opt\_doc
===================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
tidy::getOptDoc -- tidy\_get\_opt\_doc — Returns the documentation for the given option name
### Description
Object-oriented style
```
public tidy::getOptDoc(string $option): string|false
```
Procedural style
```
tidy_get_opt_doc(tidy $tidy, string $option): string|false
```
**tidy\_get\_opt\_doc()** returns the documentation for the given option name.
>
> **Note**:
>
>
> You need at least libtidy from 25 April, 2005 for this function be available.
>
>
### Parameters
`tidy`
The [Tidy](class.tidy) object.
`option`
The option name
### Return Values
Returns a string if the option exists and has documentation available, or **`false`** otherwise.
### Examples
**Example #1 Print all options along with their documentation and default value**
```
<?php
$tidy = new tidy;
$config = $tidy->getConfig();
ksort($config);
foreach ($config as $opt => $val) {
if (!$doc = $tidy->getOptDoc($opt))
$doc = 'no documentation available!';
$val = ($tidy->getOpt($opt) === true) ? 'true' : $val;
$val = ($tidy->getOpt($opt) === false) ? 'false' : $val;
echo "<p><b>$opt</b> (default: '$val')<br />".
"$doc</p><hr />\n";
}
?>
```
### See Also
* [tidy::getconfig()](tidy.getconfig) - Get current Tidy configuration
* [tidy::getopt()](tidy.getopt) - Returns the value of the specified configuration option for the tidy document
php ImagickDraw::resetVectorGraphics ImagickDraw::resetVectorGraphics
================================
(PECL imagick 2, PECL imagick 3)
ImagickDraw::resetVectorGraphics — Description
### Description
```
public ImagickDraw::resetVectorGraphics(): bool
```
Resets the vector graphics.
### Parameters
This function has no parameters.
### Return Values
Returns **`true`** on success.
php ReflectionMethod::isStatic ReflectionMethod::isStatic
==========================
(PHP 5, PHP 7, PHP 8)
ReflectionMethod::isStatic — Checks if method is static
### Description
```
public ReflectionMethod::isStatic(): bool
```
Checks if the method is static.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the method is static, otherwise **`false`**
### See Also
* [ReflectionMethod::isFinal()](reflectionmethod.isfinal) - Checks if method is final
php fbird_gen_id fbird\_gen\_id
==============
(PHP 5, PHP 7 < 7.4.0)
fbird\_gen\_id — Alias of [ibase\_gen\_id()](function.ibase-gen-id)
### Description
This function is an alias of: [ibase\_gen\_id()](function.ibase-gen-id).
php IntlTimeZone::fromDateTimeZone IntlTimeZone::fromDateTimeZone
==============================
intltz\_from\_date\_time\_zone
==============================
(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlTimeZone::fromDateTimeZone -- intltz\_from\_date\_time\_zone — Create a timezone object from [DateTimeZone](class.datetimezone)
### Description
Object-oriented style (method):
```
public static IntlTimeZone::fromDateTimeZone(DateTimeZone $timezone): ?IntlTimeZone
```
Procedural style:
```
intltz_from_date_time_zone(DateTimeZone $timezone): ?IntlTimeZone
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
`timezone`
### Return Values
php NumberFormatter::setAttribute NumberFormatter::setAttribute
=============================
numfmt\_set\_attribute
======================
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
NumberFormatter::setAttribute -- numfmt\_set\_attribute — Set an attribute
### Description
Object-oriented style
```
public NumberFormatter::setAttribute(int $attribute, int|float $value): bool
```
Procedural style
```
numfmt_set_attribute(NumberFormatter $formatter, int $attribute, int|float $value): bool
```
Set a numeric attribute associated with the formatter. An example of a numeric attribute is the number of integer digits the formatter will produce.
### Parameters
`formatter`
[NumberFormatter](class.numberformatter) object.
`attribute`
Attribute specifier - one of the [numeric attribute](class.numberformatter#intl.numberformatter-constants.unumberformatattribute) constants.
`value`
The attribute value.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### Examples
**Example #1 **numfmt\_set\_attribute()** example**
```
<?php
$fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL );
echo "Digits: ".numfmt_get_attribute($fmt, NumberFormatter::MAX_FRACTION_DIGITS)."\n";
echo numfmt_format($fmt, 1234567.891234567890000)."\n";
numfmt_set_attribute($fmt, NumberFormatter::MAX_FRACTION_DIGITS, 2);
echo "Digits: ".numfmt_get_attribute($fmt, NumberFormatter::MAX_FRACTION_DIGITS)."\n";
echo numfmt_format($fmt, 1234567.891234567890000)."\n";
?>
```
**Example #2 OO example**
```
<?php
$fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL );
echo "Digits: ".$fmt->getAttribute(NumberFormatter::MAX_FRACTION_DIGITS)."\n";
echo $fmt->format(1234567.891234567890000)."\n";
$fmt->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, 2);
echo "Digits: ".$fmt->getAttribute(NumberFormatter::MAX_FRACTION_DIGITS)."\n";
echo $fmt->format(1234567.891234567890000)."\n";
?>
```
The above example will output:
```
Digits: 3
1.234.567,891
Digits: 2
1.234.567,89
```
### See Also
* [numfmt\_get\_error\_code()](numberformatter.geterrorcode) - Get formatter's last error code
* [numfmt\_get\_attribute()](numberformatter.getattribute) - Get an attribute
* [numfmt\_set\_text\_attribute()](numberformatter.settextattribute) - Set a text attribute
php Componere\Definition::getClosure Componere\Definition::getClosure
================================
(Componere 2 >= 2.1.0)
Componere\Definition::getClosure — Get Closure
### Description
```
public Componere\Definition::getClosure(string $name): Closure
```
Shall return a Closure for the method specified by name
### Parameters
`name`
The case insensitive name of the method
### Return Values
A Closure bound to the correct scope
### Exceptions
**Warning** Shall throw [RuntimeException](class.runtimeexception) if Definition was registered
**Warning** Shall throw [RuntimeException](class.runtimeexception) if `name` could not be found
php sqlsrv_rows_affected sqlsrv\_rows\_affected
======================
(No version information available, might only be in Git)
sqlsrv\_rows\_affected — Returns the number of rows modified by the last INSERT, UPDATE, or DELETE query executed
### Description
```
sqlsrv_rows_affected(resource $stmt): int|false
```
Returns the number of rows modified by the last INSERT, UPDATE, or DELETE query executed. For information about the number of rows returned by a SELECT query, see [sqlsrv\_num\_rows()](function.sqlsrv-num-rows).
### Parameters
`stmt`
The executed statement resource for which the number of affected rows is returned.
### Return Values
Returns the number of rows affected by the last INSERT, UPDATE, or DELETE query. If no rows were affected, 0 is returned. If the number of affected rows cannot be determined, -1 is returned. If an error occurred, **`false`** is returned.
### Examples
**Example #1 **sqlsrv\_rows\_affected()** 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 = "UPDATE Table_1 SET data = ? WHERE id = ?";
$params = array("updated data", 1);
$stmt = sqlsrv_query( $conn, $sql, $params);
$rows_affected = sqlsrv_rows_affected( $stmt);
if( $rows_affected === false) {
die( print_r( sqlsrv_errors(), true));
} elseif( $rows_affected == -1) {
echo "No information available.<br />";
} else {
echo $rows_affected." rows were updated.<br />";
}
?>
```
### See Also
* [sqlsrv\_num\_rows()](function.sqlsrv-num-rows) - Retrieves the number of rows in a result set
php RecursiveFilterIterator::hasChildren RecursiveFilterIterator::hasChildren
====================================
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
RecursiveFilterIterator::hasChildren — Check whether the inner iterator's current element has children
### Description
```
public RecursiveFilterIterator::hasChildren(): bool
```
Check whether the inner iterator's current element has children.
### Parameters
This function has no parameters.
### Return Values
**`true`** if the inner iterator has children, otherwise **`false`**
### See Also
* [RecursiveFilterIterator::getChildren()](recursivefilteriterator.getchildren) - Return the inner iterator's children contained in a RecursiveFilterIterator
* [RecursiveIterator::hasChildren()](recursiveiterator.haschildren) - Returns if an iterator can be created for the current entry
php IntlChar::enumCharNames IntlChar::enumCharNames
=======================
(PHP 7, PHP 8)
IntlChar::enumCharNames — Enumerate all assigned Unicode characters within a range
### Description
```
public static IntlChar::enumCharNames(
int|string $start,
int|string $end,
callable $callback,
int $type = IntlChar::UNICODE_CHAR_NAME
): ?bool
```
Enumerate all assigned Unicode characters between the start and limit code points (start inclusive, limit exclusive) and call a function for each, passing the code point value and the character name.
For Unicode 1.0 names, only those are enumerated that differ from the modern names.
### Parameters
`start`
The first code point in the enumeration range.
`end`
One more than the last code point in the enumeration range (the first one after the range).
`callback`
The function that is to be called for each character name. The following three arguments will be passed into it:
* int `$codepoint` - The numeric code point value
* int `$nameChoice` - The same value as the `type` parameter below
* string `$name` - The name of the character
`type`
Selector for which kind of names to enumerate. 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
Returns **`null`** on success or **`false`** on failure.
### Examples
**Example #1 Enumerating over a sample range of code points**
```
<?php
IntlChar::enumCharNames(0x2600, 0x2610, function($codepoint, $nameChoice, $name) {
printf("U+%04x %s\n", $codepoint, $name);
});
?>
```
The above example will output:
```
U+2600 BLACK SUN WITH RAYS
U+2601 CLOUD
U+2602 UMBRELLA
U+2603 SNOWMAN
U+2604 COMET
U+2605 BLACK STAR
U+2606 WHITE STAR
U+2607 LIGHTNING
U+2608 THUNDERSTORM
U+2609 SUN
U+260a ASCENDING NODE
U+260b DESCENDING NODE
U+260c CONJUNCTION
U+260d OPPOSITION
U+260e BLACK TELEPHONE
U+260f WHITE TELEPHONE
```
### See Also
* [IntlChar::charName()](intlchar.charname) - Retrieve the name of a Unicode character
* [IntlChar::charFromName()](intlchar.charfromname) - Find Unicode character by name and return its code point value
php Error::getFile Error::getFile
==============
(PHP 7, PHP 8)
Error::getFile — Gets the file in which the error occurred
### Description
```
final public Error::getFile(): string
```
Get the name of the file the error occurred.
### Parameters
This function has no parameters.
### Return Values
Returns the filename in which the error occurred.
### Examples
**Example #1 **Error::getFile()** example**
```
<?php
try {
throw new Error;
} catch(Error $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 IntlBreakIterator::first IntlBreakIterator::first
========================
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
IntlBreakIterator::first — Set position to the first character in the text
### Description
```
public IntlBreakIterator::first(): int
```
**Warning**This function is currently not documented; only its argument list is available.
### Parameters
This function has no parameters.
### Return Values
php eio_rmdir eio\_rmdir
==========
(PECL eio >= 0.0.1dev)
eio\_rmdir — Remove a directory
### Description
```
eio_rmdir(
string $path,
int $pri = EIO_PRI_DEFAULT,
callable $callback = NULL,
mixed $data = NULL
): resource
```
**eio\_rmdir()** removes a directory.
### Parameters
`path`
Directory 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\_rmdir()** returns request resource on success, or **`false`** on failure.
### Examples
**Example #1 **eio\_rmdir()** example**
```
<?php
$temp_dirname = "eio-temp-dir";
mkdir($temp_dirname);
function my_rmdir_callback($data, $result) {
if ($result == 0 && !file_exists($data)) {
echo "eio_rmdir_ok";
} else if (file_exists($data)) {
rmdir($data);
}
}
eio_rmdir($temp_dirname, EIO_PRI_DEFAULT, "my_rmdir_callback", $temp_dirname);
eio_event_loop();
?>
```
The above example will output something similar to:
```
eio_rmdir_ok
```
### See Also
* [eio\_mkdir()](function.eio-mkdir) - Create directory
php Memcached::setMulti Memcached::setMulti
===================
(PECL memcached >= 0.1.0)
Memcached::setMulti — Store multiple items
### Description
```
public Memcached::setMulti(array $items, int $expiration = ?): bool
```
**Memcached::setMulti()** is similar to [Memcached::set()](memcached.set), but instead of a single key/value item, it works on multiple items specified in `items`. The `expiration` time applies to all the items at once.
### Parameters
`items`
An array of key/value pairs to store on the server.
`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::setMulti()** example**
```
<?php
$m = new Memcached();
$m->addServer('localhost', 11211);
$items = array(
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3'
);
$m->setMulti($items, time() + 300);
?>
```
### See Also
* [Memcached::setMultiByKey()](memcached.setmultibykey) - Store multiple items on a specific server
* [Memcached::set()](memcached.set) - Store an item
php Error::getPrevious Error::getPrevious
==================
(PHP 7, PHP 8)
Error::getPrevious — Returns previous Throwable
### Description
```
final public Error::getPrevious(): ?Throwable
```
Returns previous Throwable (the third parameter of [Error::\_\_construct()](error.construct)).
### Parameters
This function has no parameters.
### Return Values
Returns the previous [Throwable](class.throwable) if available or **`null`** otherwise.
### Examples
**Example #1 **Error::getPrevious()** example**
Looping over, and printing out, error trace.
```
<?php
class MyCustomError extends Error {}
function doStuff() {
try {
throw new InvalidArgumentError("You are doing it wrong!", 112);
} catch(Error $e) {
throw new MyCustomError("Something happened", 911, $e);
}
}
try {
doStuff();
} catch(Error $e) {
do {
printf("%s:%d %s (%d) [%s]\n", $e->getFile(), $e->getLine(), $e->getMessage(), $e->getCode(), get_class($e));
} while($e = $e->getPrevious());
}
?>
```
The above example will output something similar to:
```
/home/bjori/ex.php:8 Something happened (911) [MyCustomError]
/home/bjori/ex.php:6 You are doing it wrong! (112) [InvalidArgumentError]
```
### See Also
* [Throwable::getPrevious()](throwable.getprevious) - Returns the previous Throwable
php strripos strripos
========
(PHP 5, PHP 7, PHP 8)
strripos — Find the position of the last occurrence of a case-insensitive substring in a string
### Description
```
strripos(string $haystack, string $needle, int $offset = 0): int|false
```
Find the numeric position of the last occurrence of `needle` in the `haystack` string.
Unlike the [strrpos()](function.strrpos), **strripos()** is case-insensitive.
### 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 beginnning 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.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 A simple **strripos()** example**
```
<?php
$haystack = 'ababcd';
$needle = 'aB';
$pos = strripos($haystack, $needle);
if ($pos === false) {
echo "Sorry, we did not find ($needle) in ($haystack)";
} else {
echo "Congratulations!\n";
echo "We found the last ($needle) in ($haystack) at position ($pos)";
}
?>
```
The above example will output:
```
Congratulations!
We found the last (aB) in (ababcd) at position (2)
```
### 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
* [strrpos()](function.strrpos) - Find the position of the last occurrence of a substring in a string
* [strrchr()](function.strrchr) - Find the last occurrence of a character in a string
* [stristr()](function.stristr) - Case-insensitive strstr
* [substr()](function.substr) - Return part of a string
| programming_docs |
php QuickHashStringIntHash::set QuickHashStringIntHash::set
===========================
(No version information available, might only be in Git)
QuickHashStringIntHash::set — This method updates an entry in the hash with a new value, or adds a new one if the entry doesn't exist
### Description
```
public QuickHashStringIntHash::set(string $key, int $value): int
```
This method tries to update an entry with a new value. In case the entry did not yet exist, it will instead add a new entry. It returns whether the entry was added or update. If there are duplicate keys, only the first found element will get an updated value. Use QuickHashStringIntHash::CHECK\_FOR\_DUPES during hash creation to prevent duplicate keys from being part of the hash.
### Parameters
`key`
The key of the entry to add or update.
`value`
The value of the entry to add. If a non-string is passed, it will be converted to a string automatically if possible.
### Return Values
2 if the entry was found and updated, 1 if the entry was newly added or 0 if there was an error.
### Examples
**Example #1 **QuickHashStringIntHash::set()** example**
```
<?php
$hash = new QuickHashStringIntHash( 1024 );
echo "Set->Add\n";
var_dump( $hash->get( "forty six thousand six hundred ninety two" ) );
var_dump( $hash->set( "forty six thousand six hundred ninety two", 16091 ) );
var_dump( $hash->get( "forty six thousand six hundred ninety two" ) );
echo "Set->Update\n";
var_dump( $hash->set( "forty six thousand six hundred ninety two", 29906 ) );
var_dump( $hash->get( "forty six thousand six hundred ninety two" ) );
?>
```
The above example will output something similar to:
```
Set->Add
bool(false)
int(2)
int(16091)
Set->Update
int(1)
int(29906)
```
php The ReflectionParameter class
The ReflectionParameter class
=============================
Introduction
------------
(PHP 5, PHP 7, PHP 8)
The **ReflectionParameter** class retrieves information about function's or method's parameters.
To introspect function parameters, first create an instance of the [ReflectionFunction](class.reflectionfunction) or [ReflectionMethod](class.reflectionmethod) classes and then use their [ReflectionFunctionAbstract::getParameters()](reflectionfunctionabstract.getparameters) method to retrieve an array of parameters.
Class synopsis
--------------
class **ReflectionParameter** implements [Reflector](class.reflector) { /\* Properties \*/ public string [$name](class.reflectionparameter#reflectionparameter.props.name); /\* Methods \*/ public [\_\_construct](reflectionparameter.construct)(string|array|object `$function`, int|string `$param`)
```
public allowsNull(): bool
```
```
public canBePassedByValue(): bool
```
```
private __clone(): void
```
```
public static export(string $function, string $parameter, bool $return = ?): string
```
```
public getAttributes(?string $name = null, int $flags = 0): array
```
```
public getClass(): ?ReflectionClass
```
```
public getDeclaringClass(): ?ReflectionClass
```
```
public getDeclaringFunction(): ReflectionFunctionAbstract
```
```
public getDefaultValue(): mixed
```
```
public getDefaultValueConstantName(): ?string
```
```
public getName(): string
```
```
public getPosition(): int
```
```
public getType(): ?ReflectionType
```
```
public hasType(): bool
```
```
public isArray(): bool
```
```
public isCallable(): bool
```
```
public isDefaultValueAvailable(): bool
```
```
public isDefaultValueConstant(): bool
```
```
public isOptional(): bool
```
```
public isPassedByReference(): bool
```
```
public isVariadic(): bool
```
```
public __toString(): string
```
} Properties
----------
name Name of the parameter. Read-only, throws [ReflectionException](class.reflectionexception) in attempt to write.
Table of Contents
-----------------
* [ReflectionParameter::allowsNull](reflectionparameter.allowsnull) — Checks if null is allowed
* [ReflectionParameter::canBePassedByValue](reflectionparameter.canbepassedbyvalue) — Returns whether this parameter can be passed by value
* [ReflectionParameter::\_\_clone](reflectionparameter.clone) — Clone
* [ReflectionParameter::\_\_construct](reflectionparameter.construct) — Construct
* [ReflectionParameter::export](reflectionparameter.export) — Exports
* [ReflectionParameter::getAttributes](reflectionparameter.getattributes) — Gets Attributes
* [ReflectionParameter::getClass](reflectionparameter.getclass) — Get a ReflectionClass object for the parameter being reflected or null
* [ReflectionParameter::getDeclaringClass](reflectionparameter.getdeclaringclass) — Gets declaring class
* [ReflectionParameter::getDeclaringFunction](reflectionparameter.getdeclaringfunction) — Gets declaring function
* [ReflectionParameter::getDefaultValue](reflectionparameter.getdefaultvalue) — Gets default parameter value
* [ReflectionParameter::getDefaultValueConstantName](reflectionparameter.getdefaultvalueconstantname) — Returns the default value's constant name if default value is constant or null
* [ReflectionParameter::getName](reflectionparameter.getname) — Gets parameter name
* [ReflectionParameter::getPosition](reflectionparameter.getposition) — Gets parameter position
* [ReflectionParameter::getType](reflectionparameter.gettype) — Gets a parameter's type
* [ReflectionParameter::hasType](reflectionparameter.hastype) — Checks if parameter has a type
* [ReflectionParameter::isArray](reflectionparameter.isarray) — Checks if parameter expects an array
* [ReflectionParameter::isCallable](reflectionparameter.iscallable) — Returns whether parameter MUST be callable
* [ReflectionParameter::isDefaultValueAvailable](reflectionparameter.isdefaultvalueavailable) — Checks if a default value is available
* [ReflectionParameter::isDefaultValueConstant](reflectionparameter.isdefaultvalueconstant) — Returns whether the default value of this parameter is a constant
* [ReflectionParameter::isOptional](reflectionparameter.isoptional) — Checks if optional
* [ReflectionParameter::isPassedByReference](reflectionparameter.ispassedbyreference) — Checks if passed by reference
* [ReflectionParameter::isVariadic](reflectionparameter.isvariadic) — Checks if the parameter is variadic
* [ReflectionParameter::\_\_toString](reflectionparameter.tostring) — To string
php Stomp::error Stomp::error
============
stomp\_error
============
(PECL stomp >= 0.1.0)
Stomp::error -- stomp\_error — Gets the last stomp error
### Description
Object-oriented style (method):
```
public Stomp::error(): string
```
Procedural style:
```
stomp_error(resource $link): string
```
Gets the last stomp error.
### Parameters
`link`
Procedural style only: The stomp link identifier returned by [stomp\_connect()](stomp.construct).
### Return Values
Returns an error string or **`false`** if no error occurred.
### 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->error());
if (!$stomp->abort('unknown-transaction', array('receipt' => 'foo'))) {
var_dump($stomp->error());
}
/* close connection */
unset($stomp);
?>
```
The above example will output something similar to:
```
bool(false)
string(43) "Invalid transaction id: unknown-transaction"
```
**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_error($link));
if (!stomp_abort($link, 'unknown-transaction', array('receipt' => 'foo'))) {
var_dump(stomp_error($link));
}
/* close connection */
stomp_close($link);
?>
```
The above example will output something similar to:
```
bool(false)
string(43) "Invalid transaction id: unknown-transaction"
```
php Worker::getStacked Worker::getStacked
==================
(PECL pthreads >= 2.0.0)
Worker::getStacked — Gets the remaining stack size
### Description
```
public Worker::getStacked(): int
```
Returns the number of tasks left on the stack
### Parameters
This function has no parameters.
### Return Values
Returns the number of tasks currently waiting to be executed by the worker
### Examples
**Example #1 A basic example of **Worker::getStacked****
```
<?php
$worker = new Worker();
for ($i = 0; $i < 5; ++$i) {
$worker->stack(new class extends Threaded {});
}
echo "There are {$worker->getStacked()} stacked tasks\n";
```
The above example will output:
```
There are 5 stacked tasks
```
php get_browser get\_browser
============
(PHP 4, PHP 5, PHP 7, PHP 8)
get\_browser — Tells what the user's browser is capable of
### Description
```
get_browser(?string $user_agent = null, bool $return_array = false): object|array|false
```
Attempts to determine the capabilities of the user's browser, by looking up the browser's information in the browscap.ini file.
### Parameters
`user_agent`
The User Agent to be analyzed. By default, the value of HTTP User-Agent header is used; however, you can alter this (i.e., look up another browser's info) by passing this parameter.
You can bypass this parameter with a **`null`** value.
`return_array`
If set to **`true`**, this function will return an array instead of an object.
### Return Values
The information is returned in an object or an array which will contain various data elements representing, for instance, the browser's major and minor version numbers and ID string; **`true`**/**`false`** values for features such as frames, JavaScript, and cookies; and so forth.
The `cookies` value simply means that the browser itself is capable of accepting cookies and does not mean the user has enabled the browser to accept cookies or not. The only way to test if cookies are accepted is to set one with [setcookie()](function.setcookie), reload, and check for the value.
Returns **`false`** when no information can be retrieved, such as when the [browscap](https://www.php.net/manual/en/misc.configuration.php#ini.browscap) configuration setting in php.ini has not been set.
### Examples
**Example #1 Listing all information about the users browser**
```
<?php
echo $_SERVER['HTTP_USER_AGENT'] . "\n\n";
$browser = get_browser(null, true);
print_r($browser);
?>
```
The above example will output something similar to:
```
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040803 Firefox/0.9.3
Array
(
[browser_name_regex] => ^mozilla/5\.0 (windows; .; windows nt 5\.1; .*rv:.*) gecko/.* firefox/0\.9.*$
[browser_name_pattern] => Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:*) Gecko/* Firefox/0.9*
[parent] => Firefox 0.9
[platform] => WinXP
[browser] => Firefox
[version] => 0.9
[majorver] => 0
[minorver] => 9
[cssversion] => 2
[frames] => 1
[iframes] => 1
[tables] => 1
[cookies] => 1
[backgroundsounds] =>
[vbscript] =>
[javascript] => 1
[javaapplets] => 1
[activexcontrols] =>
[cdf] =>
[aol] =>
[beta] => 1
[win16] =>
[crawler] =>
[stripper] =>
[wap] =>
[netclr] =>
)
```
### Notes
>
> **Note**:
>
>
> In order for this to work, your [browscap](https://www.php.net/manual/en/misc.configuration.php#ini.browscap) configuration setting in php.ini must point to the correct location of the browscap.ini file on your system.
>
> browscap.ini is not bundled with PHP, but you may find an up-to-date [» php\_browscap.ini](http://browscap.org/) file here.
>
> While browscap.ini contains information on many browsers, it relies on user updates to keep the database current. The format of the file is fairly self-explanatory.
>
>
php posix_ttyname posix\_ttyname
==============
(PHP 4, PHP 5, PHP 7, PHP 8)
posix\_ttyname — Determine terminal device name
### Description
```
posix_ttyname(resource|int $file_descriptor): string|false
```
Returns a string for the absolute path to the current terminal device that is open on the file descriptor `file_descriptor`.
### Parameters
`fd`
The file descriptor, which is expected to be either a file resource or an int. An int will be assumed to be a file descriptor that can be passed directly to the underlying system call.
In almost all cases, you will want to provide a file resource.
### Return Values
On success, returns a string of the absolute path of the `file_descriptor`. On failure, returns **`false`**
php ReflectionClass::getNamespaceName ReflectionClass::getNamespaceName
=================================
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
ReflectionClass::getNamespaceName — Gets namespace name
### Description
```
public ReflectionClass::getNamespaceName(): string
```
Gets the namespace name.
### Parameters
This function has no parameters.
### Return Values
The namespace name.
### Examples
**Example #1 **ReflectionClass::getNamespaceName()** example**
```
<?php
namespace A\B;
class Foo { }
$class = new \ReflectionClass('stdClass');
var_dump($class->inNamespace());
var_dump($class->getName());
var_dump($class->getNamespaceName());
var_dump($class->getShortName());
$class = new \ReflectionClass('A\\B\\Foo');
var_dump($class->inNamespace());
var_dump($class->getName());
var_dump($class->getNamespaceName());
var_dump($class->getShortName());
?>
```
The above example will output:
```
bool(false)
string(8) "stdClass"
string(0) ""
string(8) "stdClass"
bool(true)
string(7) "A\B\Foo"
string(3) "A\B"
string(3) "Foo"
```
### See Also
* [ReflectionClass::getParentClass()](reflectionclass.getparentclass) - Gets parent class
* [namespaces](https://www.php.net/manual/en/language.namespaces.php)
php sqlsrv_get_field sqlsrv\_get\_field
==================
(No version information available, might only be in Git)
sqlsrv\_get\_field — Gets field data from the currently selected row
### Description
```
sqlsrv_get_field(resource $stmt, int $fieldIndex, int $getAsType = ?): mixed
```
Gets field data from the currently selected row. Fields must be accessed in order. Field indices start at 0.
### Parameters
`stmt`
A statement resource returned by [sqlsrv\_query()](function.sqlsrv-query) or [sqlsrv\_execute()](function.sqlsrv-execute).
`fieldIndex`
The index of the field to be retrieved. Field indices start at 0. Fields must be accessed in order. i.e. If you access field index 1, then field index 0 will not be available.
`getAsType`
The PHP data type for the returned field data. If this parameter is not set, the field data will be returned as its default PHP data type. For information about default PHP data types, see [» Default PHP Data Types](http://msdn.microsoft.com/en-us/library/cc296193.aspx) in the Microsoft SQLSRV documentation.
### Return Values
Returns data from the specified field on success. Returns **`false`** otherwise.
### Examples
**Example #1 **sqlsrv\_get\_field()** example**
The following example demonstrates how to retrieve a row with [sqlsrv\_fetch()](function.sqlsrv-fetch) and get the row fields with **sqlsrv\_get\_field()**.
```
<?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 Name, Comment
FROM Table_1
WHERE ReviewID=1";
$stmt = sqlsrv_query( $conn, $sql);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
// Make the first (and in this case, only) row of the result set available for reading.
if( sqlsrv_fetch( $stmt ) === false) {
die( print_r( sqlsrv_errors(), true));
}
// Get the row fields. Field indices start at 0 and must be retrieved in order.
// Retrieving row fields by name is not supported by sqlsrv_get_field.
$name = sqlsrv_get_field( $stmt, 0);
echo "$name: ";
$comment = sqlsrv_get_field( $stmt, 1);
echo $comment;
?>
```
### See Also
* [sqlsrv\_fetch()](function.sqlsrv-fetch) - Makes the next row in a result set available for reading
* [sqlsrv\_fetch\_array()](function.sqlsrv-fetch-array) - Returns a row as an array
* [sqlsrv\_fetch\_object()](function.sqlsrv-fetch-object) - Retrieves the next row of data in a result set as an object
php EvLoop::suspend EvLoop::suspend
===============
(PECL ev >= 0.2.0)
EvLoop::suspend — Suspend the loop
### Description
```
public EvLoop::suspend(): void
```
**EvLoop::suspend()** and [EvLoop::resume()](evloop.resume) methods suspend and resume a loop correspondingly.
### Parameters
This function has no parameters.
### Return Values
No value is returned.
### See Also
* [EvLoop::resume()](evloop.resume) - Resume previously suspended default event loop
* [Ev::suspend()](ev.suspend) - Suspend the default event loop
php streamWrapper::stream_truncate streamWrapper::stream\_truncate
===============================
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
streamWrapper::stream\_truncate — Truncate stream
### Description
```
public streamWrapper::stream_truncate(int $new_size): bool
```
Will respond to truncation, e.g., through [ftruncate()](function.ftruncate).
### Parameters
`new_size`
The new size.
### Return Values
Returns **`true`** on success or **`false`** on failure.
### See Also
* [ftruncate()](function.ftruncate) - Truncates a file to a given length
php urlencode urlencode
=========
(PHP 4, PHP 5, PHP 7, PHP 8)
urlencode — URL-encodes string
### Description
```
urlencode(string $string): string
```
This function is convenient when encoding a string to be used in a query part of a URL, as a convenient way to pass variables to the next page.
### Parameters
`string`
The string 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 and spaces encoded as plus (`+`) signs. It is encoded the same way that the posted data from a WWW form is encoded, that is the same way as in `application/x-www-form-urlencoded` media type. This differs from the [» RFC 3986](http://www.faqs.org/rfcs/rfc3986) encoding (see [rawurlencode()](function.rawurlencode)) in that for historical reasons, spaces are encoded as plus (+) signs.
### Examples
**Example #1 **urlencode()** example**
```
<?php
echo '<a href="mycgi?foo=', urlencode($userinput), '">';
?>
```
**Example #2 **urlencode()** and [htmlentities()](function.htmlentities) example**
```
<?php
$query_string = 'foo=' . urlencode($foo) . '&bar=' . urlencode($bar);
echo '<a href="mycgi?' . htmlentities($query_string) . '">';
?>
```
### Notes
>
> **Note**:
>
>
> Be careful about variables that may match HTML entities. Things like &, © and £ are parsed by the browser and the actual entity is used instead of the desired variable name. This is an obvious hassle that the W3C has been telling people about for years. The reference is here: [» http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.2](http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.2).
>
> PHP supports changing the argument separator to the W3C-suggested semi-colon through the arg\_separator .ini directive. Unfortunately most user agents do not send form data in this semi-colon separated format. A more portable way around this is to use & instead of & as the separator. You don't need to change PHP's arg\_separator for this. Leave it as &, but simply encode your URLs using [htmlentities()](function.htmlentities) or [htmlspecialchars()](function.htmlspecialchars).
>
>
### See Also
* [urldecode()](function.urldecode) - Decodes URL-encoded string
* [htmlentities()](function.htmlentities) - Convert all applicable characters to HTML entities
* [rawurlencode()](function.rawurlencode) - URL-encode according to RFC 3986
* [rawurldecode()](function.rawurldecode) - Decode URL-encoded strings
* [» RFC 3986](http://www.faqs.org/rfcs/rfc3986)
| programming_docs |
Subsets and Splits