HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

finfo_buffer

Description

The finfo_buffer of Fileinfo for PHP returns information about a string buffer.

Syntax

finfo_buffer(
    finfo $finfo,
    string $string,
    int $flags = FILEINFO_NONE,
    ?resource $context = null
): string|false

Parameters

finfo

An finfo instance, returned by finfo_open().

string

Content of a file to be checked.

flags

One or disjunction of more Fileinfo constants.

context

For a description of contexts, refer to Stream Functions.

Return

Returns a textual description of the string argument, or false if an error occurred.

Examples

1 · finfo string

<?

$finfo = finfo_open();

    if($finfo === false)
    {
        die("finfo_open");
    }

    $string = "string";

    $return = finfo_buffer($finfo, $string);

    echo $return;

finfo_close($finfo);
ASCII text, with no line terminators

2 · flags

<?

$finfo = finfo_open();

    if($finfo === false)
    {
        die("finfo_open");
    }

    $string = "string";
    $flags = FILEINFO_MIME_TYPE;

    $return = finfo_buffer($finfo, $string, $flags);

    echo $return;

finfo_close($finfo);
text/plain

3 · context

<?

$finfo = finfo_open();

    if($finfo === false)
    {
        die("finfo_open");
    }

    $string = "string";
    $flags = FILEINFO_MIME_TYPE;
    $context = stream_context_create();

    $return = finfo_buffer($finfo, $string, $flags, $context);

    echo $return;

finfo_close($finfo);
text/plain