Dirk Harriman Banner Image

 

PHP Notes - Quick Reference


PHP Tags

When PHP parses a file, it looks for opening and closing tags, which are

<?php // CODE GOES HERE ?>


Flow Control


If - Else - ElseIf

// STANDARD IF ELSE if (condition) { // PROCESS THIS } elseif { // PROCESS THIS } else if { // PROCESS THIS } else { // PROCESS THIS }


Switch

switch ($i) { case 0: echo "i equals 0"; break; case 1: echo "i equals 1"; break; case 2: echo "i equals 2"; break; }


For Next

for (expr1; expr2; expr3) statement /* ALL OF THE FOLLOWING WILL PRINT 1 TO 10 */ /* 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++);


While - Do

while ($i <= 10) { echo $i++; /* THE PRINTED VALUE WOULD BE $i BEFORE THE INCREMENT (post-increment) */ }


Do - While

$i = 0; do { echo $i; } while ($i > 0);


For - Each

foreach (array_expression as $value) statement foreach (array_expression as $key => $value) statement $arr = array(1, 2, 3, 4); foreach ($arr as $value) { $value = $value * 2; } unset($value); // BREAK THE REFERENCE WITH THE LAST ELEMENT $arr = array(1, 2, 3, 4); foreach ($arr as $key => $value) { $value = $value * 2; } unset($value); // BREAK THE REFERENCE WITH THE LAST ELEMENT


break

break ends execution of the current for:


break accepts an optional numeric argument which tells it how many nested enclosing structures are to be broken out of.

$i = 0; while (++$i) { switch ($i) { case 5: echo "At 5<br/>"; break 1; /* EXIT ONLY THE SWITCH. */ case 10: echo "At 10; quitting<br/>"; break 2; /* EXIT THE SWITCH AND THE WHILE. */ default: break; } }


Echo Output

echo "Hello World"; echo "This spans multiple lines. The newlines will be output as well"; echo "This spans\nmultiple lines. The newlines will be\noutput as well."; echo "Escaping characters is done \"Like this\"."; // YOU CAN USE VARIABLES INSIDE OF AN ECHO STATEMENT $foo = "foobar"; $bar = "barbaz"; echo "foo is $foo"; // foo is foobar // YOU CAN ALSO USE ARRAYS $baz = array("value" => "foo"); echo "this is {$baz['value']} !"; // this is foo ! // USING SINGLE QUOTES WILL PRINT THE VARIABLE NAME, NOT THE VALUE echo 'foo is $foo'; // foo is $foo // IF YOU ARE NOT USING ANY OTHER CHARACTERS, YOU CAN JUST ECHO VARIABLES echo $foo; // foobar echo $foo,$bar; // foobarbarbaz // SOME PEOPLE PREFER PASSING MULTIPLE PARAMETERS TO ECHO OVER CONCATENATION. echo 'This ', 'string ', 'was ', 'made ', 'with multiple parameters.', chr(10); echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\n"; echo <<<END This uses the "here document" syntax to output multiple lines with $variable interpolation. Note that the here document terminator must appear on a line with just a semicolon. no extra whitespace! END; // BECAUSE ECHO DOES NOT BEHAVE LIKE A FUNCTION, 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 BEHAVES LIKE A FUNCTION, SO // IT MAY BE USED IN THIS CONTEXT. echo $some_var ? 'true': 'false'; // changing the statement around


Print Output

int print ( string $arg )

print is not actually a real function (it is a language construct) so you are not required to use parentheses with its argument list.

print("Hello World"); print "print() also works without parentheses."; print "This spans multiple lines. The newlines will be output as well"; print "This spans\nmultiple lines. The newlines will be\noutput as well."; print "escaping characters is done \"Like this\"."; // YOU CAN USE VARIABLES INSIDE A PRINT STATEMENT $foo = "foobar"; $bar = "barbaz"; print "foo is $foo"; // foo is foobar // YOU CAN ALSO USE ARRAYS $bar = array("value" => "foo"); print "this is {$bar['value']} !"; // this is foo ! // USING SINGLE QUOTES WILL PRINT THE VARIABLE NAME, NOT THE VALUE print 'foo is $foo'; // foo is $foo // IF YOU ARE NOT USING ANY OTHER CHARACTERS, YOU CAN JUST PRINT VARIABLES print $foo; // foobar print <<<END This uses the "here document" syntax to output multiple lines with $variable interpolation. Note that the here document terminator must appear on a line with just a semicolon no extra whitespace! END;


Printf - Formatted Output

int printf ( string $format [, mixed $args [, mixed $... ]] )

Produces output according to format.

$num = 5; $location = 'tree'; $format = 'There are %d monkeys in the %s'; echo printf($format, $num, $location);


Sprintf - Formatted String

string sprintf ( string $format [, mixed $args [, mixed $... ]] ) $num = 5; $location = 'tree'; $format = 'There are %d monkeys in the %s'; echo sprintf($format, $num, $location);

A type specifier that says what type the argument data should be treated as. Possible types:

Type Specifiers
% 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 value.
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). The precision specifier stands for the number of digits after the decimal point since PHP 5.2.1. In earlier versions, it was taken as number of significant digits (one less).
E like %e 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). Available since PHP 4.3.10 and PHP 5.0.3.
g shorter of %e and %f.
G shorter of %E and %f.
o the argument is treated as an integer, and presented as an octal number.
s the argument is treated as 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).

Variables will be co-erced to a suitable type for the specifier:

Type Specifiers
string s
integer d, u, c, o, x, X, b
double g, G, e, E, f, F

Example #1 Argument Swapping

$num = 5; $location = 'tree'; $format = 'There are %d monkeys in the %s'; echo sprintf($format, $num, $location);

This will output "There are 5 monkeys in the tree". But imagine we are creating a format string in a separate file, commonly because we would like to internationalize it and we rewrite it as:


Example #2 Argument Swapping

$format = 'The %s contains %d monkeys'; echo sprintf($format, $num, $location);

We now have a problem. The order of the placeholders in the format string does not match the order of the arguments in the code. We would like to leave the code as is and simply indicate in the format string which arguments the placeholders refer to. We would write the format string like this instead:


Example #3 Argument Swapping

$format = 'The %2$s contains %1$d monkeys'; echo sprintf($format, $num, $location);

An added benefit here is that you can repeat the placeholders without adding more arguments in the code. For example:


Example #4 Argument Swapping

$format = 'The %2$s contains %1$d monkeys. That\'s a nice %2$s full of %1$d monkeys.'; echo sprintf($format, $num, $location);

When using argument swapping, the n$ position specifier must come immediately after the percent sign (%), before any other specifiers, as shown in the example below.


Example #5 Specifying Padding Character

echo sprintf("%'.9d\n", 123); echo sprintf("%'.09d\n", 123); The above example will output: ......123 000000123


Example #6 Position Specifier With Other Specifiers

$format = 'The %2$s contains %1$04d monkeys'; echo sprintf($format, $num, $location); The above example will output: The tree contains 0005 monkeys

Attempting to use a position specifier greater than PHP_INT_MAX will result in sprintf() generating warnings.


print_r

Prints human-readable information about a variable

Example #1 print_r() Example

<pre> <?php $a = array ('a'=>'apple','b'=>'banana','c'=>array('x','y','z')); print_r ($a); ?> </pre> The above example will output: <pre> Array ( [a] => apple [b] => banana [c] => Array ( [0] => x [1] => y [2] => z ) ) </pre>


Example #2 Return Parameter Example

$b = array ('m'=>'monkey','foo'=>'bar','x'=>array('x','y','z')); $results = print_r($b, true); // $results now contains output from print_r


var_dump

Dumps information about a variable
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() method (implemented in PHP 5.6.0).

$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" } }


Embedded PHP

<p>This is going to be ignored by PHP and displayed by the browser.</p> <?php echo 'While this is going to be parsed.'; ?> <p>This will also be ignored by PHP and displayed by the browser.</p>


Conditionally Embedded PHP

<?php if ($expression == true): ?> This will show if the expression is true. <?php else: ?> Otherwise this will show. <?php endif; ?>


Embedded PHP File

<?php include 'MusicTabs.php'; /* THIS EXAMPLE ASSUMES THAT www.example.com IS CONFIGURED TO PARSE .php * FILES AND NOT .txt FILES. ALSO, 'WORKS' HERE MEANS THAT THE VARIABLES * $foo AND $bar ARE AVAILABLE WITHIN THE INCLUDED FILE. */ // WILL NOT WORK; file.txt WAS NOT HANDLED BY www.example.com AS PHP include 'http://www.example.com/file.txt?foo=1&bar=2'; // WILL NOT WORK; LOOKS FOR A FILE NAMED 'file.php?foo=1&bar=2' // ON THE LOCAL FILESYSTEM. include 'file.php?foo=1&bar=2'; // WORKS. include 'http://www.example.com/file.php?foo=1&bar=2'; // WILL NOT WORK, EVALUATED AS include(('vars.php') == 'OK'), i.e. include('') if (include('vars.php') == 'OK') { echo 'OK'; } // WORKS if ((include 'vars.php') == 'OK') { echo 'OK'; } include_once 'MusicTabs.php'; require 'MusicTabs.php'; require_once 'MusicTabs.php'; ?>


Embedding & Inclusion

There are many options for constructing PHP applications.

Basic File Embedding

Basic file embedding is ofter used to add pieces that make for consistency between all the pages of the site. Things like headers and footers, side panels, etc...

// PSEUDO CODE Main.php Header.php HeaderNavigation.php Body.php Footer.php FooterNavigation.php

<?php // Main.php require_once 'Header.php' require_once 'Body.php' require_once 'Footer.php' ?>

// Header.php <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo $page_title; ?></title> <meta charset="UTF-8" /> ... META TAGS ... CSS INCLUDES ... JS INCLUDES </head> <?php require_once 'HeaderNavigation.php'; ?>

// HeaderNavigation.php <nav> <ul class="nav"> <li><a href="home.php">Home</a> <li><a href="shop.php">Shop</a> <li><a href="about.php">About</a> <li><a href="contact.php">Contact</a> </ul> </nav>

... HTML CONTENT

... BOTTOM OF PAGE HTML <div id="Footer"> ... SOME OTHER HTML, ETC... <?php require_once 'FooterNavigation.php'; ?> </div> ... INCLUDED SCRIPTS </body> </html>

// FooterNavigation.php <nav> <ul class="foot_nav"> <li><a href="home.php">Home</a> <li><a href="shop.php">Shop</a> <li><a href="about.php">About</a> <li><a href="contact.php">Contact</a> </ul> </nav>


Function Embedding

Functions used throughout the page can be grouped together into one file to be embedded at the beginning of the page. The functions will be available to any PHP sections within the page. In the structure below, within the body (Body.php), functions declared or included in any of the files above Body.php will be available in Body.php. These files include Main.php, Functions.php (The obvious location), Header.php or HeaderNavigation.php

Main.php Functions.php Header.php HeaderNavigation.php Body.php Footer.php FooterNavigation.php


Server Side Data Embedding Local

Data can be created in a separate file and included in the page. Possible data sources include all of the data types included in the PHP language, such as: integers, floating point numbers, strings, booleans, arrays, classes (Objects), JSON Data, XML Data, etc...


Example 1 - PHP Data Object

Main.php Functions.php $DataObj &t;- PHP Data Object (i.e. Array, Class)


Example 2 - JSON Data Object

Main.php Functions.php $DataObj &t;- JSON Data Object


Example 3 - XML Data Object

Main.php Functions.php $DataObj &t;- XML Data Object


Server Side Data Embedding Remote


Client Side Data Embedding Remote


Form - Post & Querystring (Get)

$_GET[""] - Get Query String

The below example will output something similar to: Hello Hannes!

URL Entered: http://example.com/?name=Hannes <?php echo 'Hello ' . htmlspecialchars($_GET["name"]) . '!'; ?>


$_POST - Get Post Variables

An associative array of variables passed to the current script via the HTTP POST method.

$HTTP_POST_VARS contains the same initial information, but is not a superglobal. (Note that $HTTP_POST_VARS and $_POST are different variables and that PHP handles them as such)


Start Page

<form action="welcome.php" method="post"> Name: <input type="text" name="name"><br> E-mail: <input type="text" name="email"><br> <input type="submit"> </form>


welcome.php

<html> <body> Welcome <?php echo $_POST["name"]; ?><br> Your email address is: <?php echo $_POST["email"]; ?> </body> </html>


PHP Predefined Functions

htmlspecialchars()

Convert special characters to HTML entities

/* Constant Name Description ENT_COMPAT Will convert double-quotes and leave single-quotes alone. ENT_QUOTES Will convert both double and single quotes. ENT_NOQUOTES Will leave both double and single quotes unconverted. ENT_IGNORE Silently discard invalid code unit sequences instead of returning an empty string. Using this flag is discouraged as it ยป may have security implications. ENT_SUBSTITUTE Replace invalid code unit sequences with a Unicode Replacement Character U+FFFD (UTF-8) or &#FFFD; (otherwise) instead of returning an empty string. ENT_DISALLOWED Replace invalid code points for the given document type with a Unicode Replacement Character U+FFFD (UTF-8) or &#FFFD; (otherwise) instead of leaving them as is. This may be useful, for instance, to ensure the well-formedness of XML documents with embedded external content. ENT_HTML401 Handle code as HTML 4.01. ENT_XML1 Handle code as XML 1. ENT_XHTML Handle code as XHTML. ENT_HTML5 Handle code as HTML 5. */ $new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); echo $new; // &lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt;


 

json_decode()

Decodes a JSON string

mixed json_decode ( string $json [, bool $assoc = false [, int $depth = 512 [, int $options = 0 ]]] ) assoc - When TRUE, returned objects will be converted into associative arrays. depth - User specified recursion depth. options - Bitmask of JSON decode options. Currently only JSON_BIGINT_AS_STRING is supported (default is to cast large integers as floats) 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 recursion limit. $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) }


 

json_encode()

Returns the JSON representation of a value

string json_encode ( mixed $value [, int $options = 0 [, int $depth = 512 ]] ) /* value - The value being encoded. Can be any type except a resource. All string data must be UTF-8 encoded. options - Bitmask consisting of JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT, JSON_UNESCAPED_UNICODE. The behaviour of these constants is described on the JSON constants page. depth - Set the maximum depth. Must be greater than zero. Return Values - Returns a JSON encoded string on success or FALSE on failure. */ $arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5); echo json_encode($arr); // The above example will output: {"a":1,"b":2,"c":3,"d":4,"e":5}


 

explode()

Split a string by string

array explode ( string $delimiter , string $string [, int $limit ] ) // Example 1 $pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; $pieces = explode(" ", $pizza); echo $pieces[0]; // piece1 echo $pieces[1]; // piece2 // Example 2 $data = "foo:*:1023:1000::/home/foo:/bin/sh"; list($user, $pass, $uid, $gid, $gecos, $home, $shell) = explode(":", $data); echo $user; // foo echo $pass; // * // Example 3 - Using limit $str = 'one|two|three|four'; // positive limit print_r(explode('|', $str, 2)); // negative limit (since PHP 5.1) print_r(explode('|', $str, -1)); // The above example will output: Array ( [0] => one [1] => two|three|four ) Array ( [0] => one [1] => two [2] => three )


 

implode()

Join array elements with a string

string implode ( string $glue , array $pieces ) string implode ( array $pieces ) /* Parameters: glue - Defaults to an empty string. pieces - 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 glue string between each element. */ $array = array('lastname', 'email', 'phone'); $comma_separated = implode(",", $array); echo $comma_separated; // lastname,email,phone // Empty string when using an empty array: var_dump(implode('hello', array())); // string(0) ""


 

str_split()

Convert a string to an array

array str_split ( string $string [, int $split_length = 1 ] ) /* Parameters: string - The input string. split_length - Maximum length of the chunk. Return Values If the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string, the entire string is returned as the first (and only) array element. */ Example #1 Example uses of str_split() $str = "Hello Friend"; $arr1 = str_split($str); $arr2 = str_split($str, 3); print_r($arr1); print_r($arr2); The above example will output: Array ( [0] => H [1] => e [2] => l [3] => l [4] => o [5] => [6] => F [7] => r [8] => i [9] => e [10] => n [11] => d ) Array ( [0] => Hel [1] => lo [2] => Fri [3] => end )


 

chunk_split()

Split a string into smaller chunks


 

preg_split()

Split string by a regular expression


 

count_chars()

Return information about characters used in a string


 

str_word_count()

Return information about words used in a string


 

file_get_contents

Reads entire file into a string

string 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(), 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.

If you're opening a URI with special characters, such as spaces, you need to encode the URI with urlencode().

Parameters
Parameter Description
filename Name of the file to read.
use_include_path Note: As of PHP 5 the FILE_USE_INCLUDE_PATH constant can be used to trigger include path search.
context A valid context resource created with 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. 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.

$argc

$argv

Language Reference

    Basic syntax
        PHP tags
        Escaping from HTML
        Instruction separation
        Comments
    Types
        Introduction
        Booleans
        Integers
        Floating point numbers
        Strings
        Arrays
        Objects
        Resources
        NULL
        Callbacks / Callables
        Pseudo-types and variables used in this documentation
        Type Juggling
    Variables
        Basics
        Predefined Variables
        Variable scope
        Variable variables
        Variables From External Sources
    Constants
        Syntax
        Magic constants
    Expressions
    Operators
        Operator Precedence
        Arithmetic Operators
        Assignment Operators
        Bitwise Operators
        Comparison Operators
        Error Control Operators
        Execution Operators
        Incrementing/Decrementing Operators
        Logical Operators
        String Operators
        Array Operators
        Type Operators
    Control Structures
        Introduction
        if
        else
        elseif/else if
        Alternative syntax for control structures
        while
        do-while
        for
        foreach
        break
        continue
        switch
        declare
        return
        require
        include
        require_once
        include_once
        goto
    Functions
        User-defined functions
        Function arguments
        Returning values
        Variable functions
        Internal (built-in) functions
        Anonymous functions
    Classes and Objects
        Introduction
        The Basics
        Properties
        Class Constants
        Autoloading Classes
        Constructors and Destructors
        Visibility
        Object Inheritance
        Scope Resolution Operator (::)
        Static Keyword
        Class Abstraction
        Object Interfaces
        Traits
        Overloading
        Object Iteration
        Magic Methods
        Final Keyword
        Object Cloning
        Comparing Objects
        Type Hinting
        Late Static Bindings
        Objects and references
        Object Serialization
        OOP Changelog
    Namespaces
        Namespaces overview
        Defining namespaces
        Declaring sub-namespaces
        Defining multiple namespaces in the same file
        Using namespaces: Basics
        Namespaces and dynamic language features
        namespace keyword and __NAMESPACE__ constant
        Using namespaces: Aliasing/Importing
        Global space
        Using namespaces: fallback to global function/constant
        Name resolution rules
        FAQ: things you need to know about namespaces
    Exceptions
        Extending Exceptions
    Generators
        Generators overview
        Generator syntax
        Comparing generators with Iterator objects
    References Explained
        What References Are
        What References Do
        What References Are Not
        Passing by Reference
        Returning References
        Unsetting References
        Spotting References
    Predefined Variables
        Superglobals - Superglobals are built-in variables that are always available in all scopes
        $GLOBALS - References all variables available in global scope
        $_SERVER - Server and execution environment information
        $_GET - HTTP GET variables
        $_POST - HTTP POST variables
        $_FILES - HTTP File Upload variables
        $_REQUEST - HTTP Request variables
        $_SESSION - Session variables
        $_ENV - Environment variables
        $_COOKIE - HTTP Cookies
        $php_errormsg - The previous error message
        $HTTP_RAW_POST_DATA - Raw POST data
        $http_response_header - HTTP response headers
        $argc - The number of arguments passed to script
        $argv - Array of arguments passed to script
    Predefined Exceptions
        Exception
        ErrorException
    Predefined Interfaces and Classes
        Traversable - The Traversable interface
        Iterator - The Iterator interface
        IteratorAggregate - The IteratorAggregate interface
        ArrayAccess - The ArrayAccess interface
        Serializable - The Serializable interface
        Closure - The Closure class
        Generator - The Generator class
    Context options and parameters
        Socket context options - Socket context option listing
        HTTP context options - HTTP context option listing
        FTP context options - FTP context option listing
        SSL context options - SSL context option listing
        CURL context options - CURL context option listing
        Phar context options - Phar context option listing
        MongoDB context options - MongoDB context option listing
        Context parameters - Context parameter listing
    Supported Protocols and Wrappers
        file:// - Accessing local filesystem
        http:// - Accessing HTTP(s) URLs
        ftp:// - Accessing FTP(s) URLs
        php:// - Accessing various I/O streams
        zlib:// - Compression Streams
        data:// - Data (RFC 2397)
        glob:// - Find pathnames matching pattern
        phar:// - PHP Archive
        ssh2:// - Secure Shell 2
        rar:// - RAR
        ogg:// - Audio streams
        expect:// - Process Interaction Streams