PHP 7.4.0beta4 released!

SplFileObject::setMaxLineLen

(PHP 5 >= 5.1.0, PHP 7)

SplFileObject::setMaxLineLenSet maximum line length

Açıklama

public SplFileObject::setMaxLineLen ( int $max_len ) : void

Sets the maximum length of a line to be read.

Değiştirgeler

max_len

The maximum length of a line.

Dönen Değerler

Hiçbir değer dönmez.

Hatalar/İstisnalar

Throws DomainException when max_len is less than zero.

Örnekler

Örnek 1 SplFileObject::setMaxLineLen() example

<?php
$file 
= new SplFileObject("lipsum.txt");
$file->setMaxLineLen(20);
foreach (
$file as $line) {
    echo 
$line "\n";
}
?>

Contents of lipsum.txt

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Duis nec sapien felis, ac sodales nisl.
Nulla vitae magna vitae purus aliquet consequat.

Yukarıdaki örnek şuna benzer bir çıktı üretir:

Lorem ipsum dolor s
it amet, consectetu
r adipiscing elit.

Duis nec sapien fel
is, ac sodales nisl
.

Nulla vitae magna v
itae purus aliquet 
consequat.

Ayrıca Bakınız

  • Classname::Method()

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top