php8.5
Home/ Manual/ stream / functions/ stream_get_wrappers

stream_get_wrappers

PHP function Edit on GitHub ✎

(PHP 5, PHP 7, PHP 8)

Retrieve list of registered streams

Description

stream_get_wrappers(): array

Retrieve list of registered streams available on the running system.

Parameters Parameters

Return Values

Returns an indexed array containing the name of all stream wrappers available on the running system.

Examples

stream_get_wrappers() example

php
<?php
print_r(stream_get_wrappers());
?>

The above example will output something similar to:

output
Array
(
    [0] => php
    [1] => file
    [2] => http
    [3] => ftp
    [4] => compress.bzip2
    [5] => compress.zlib
)

Checking for the existence of a stream wrapper

php
<?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

Source: reference/stream/functions/stream-get-wrappers.xml · from the official PHP manual (php/doc-en)