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

stream_get_line

Description

The stream_get_line of Stream for PHP gets line from stream resource up to a given delimiter.

Syntax

stream_get_line ( resource $handle , int $length [, string $ending ] ) : string

Parameters

handle

A valid file handle.

length

The number of bytes to read from the handle.

ending

An optional string delimiter.

Return

Returns a string of up to length bytes read from the file pointed to by handle.

If an error occurs, returns FALSE.

Examples

1 · handle length

<?

$filename = "https://osbo.com";
$mode = "r";

$handle = fopen($filename, $mode);

    $length = 16;

    $return = stream_get_line($handle, $length);

    echo $return;

fclose($handle);
<!doctype html><

2 · ending

<?

$filename = "https://osbo.com";
$mode = "r";

$handle = fopen($filename, $mode);

    $length = 1024;
    $ending = "\n";

    $return = stream_get_line($handle, $length, $ending);

    echo $return;

fclose($handle);
<!doctype html><html lang=en><head><meta charset=utf-8><meta content=width=device-width name=viewport><meta content=osbo.com name=description><title>osbo.com</title><link href=/assets/css/ rel=stylesheet><link href=/assets/svg/ rel=icon><script defer src=/assets/js/></script></head><body><div id=foreground><header><a href=/><img alt=Home id=home src=/assets/svg/Home.svg title=Home></a><img alt=Menu id=menu src=/assets/svg/Menu.svg title=Menu><form action=/search/><input id=search name=search-site title=Search type=search></form></header><footer><a href=#><img alt=Top id=top src=/assets/svg/Top.svg title=Top></a></footer></div><div id=zeroground><div id=content><a href=https://samaritanspurse.org/occ/ target=_blank><img alt="Samaritan's Purse Operation Christmas Child" id=banner src=/assets/svg/SamaritansPurseOperationChristmasChild.svg title="Samaritan's Purse Operation Christmas Child"></a><header><div id=topnav><a href=/Jesus/>Jesus</a> · <a href=/Bible/>Bible</a> · <a href=/html/>HTML</a> · <a href=/css