PHP Doku:: Set maximum line length - splfileobject.setmaxlinelen.html

Verlauf / Chronik / History: (3) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzSonstige GrunderweiterungenStandard PHP Library (SPL)DateibehandlungThe SplFileObject classSplFileObject::setMaxLineLen

Ein Service von Reinhard Neidl - Webprogrammierung.

The SplFileObject class

<<SplFileObject::setFlags

SplFileObject::__toString>>

SplFileObject::setMaxLineLen

(PHP 5 >= 5.1.0)

SplFileObject::setMaxLineLenSet maximum line length

Beschreibung

public void SplFileObject::setMaxLineLen ( int $max_len )

Sets the maximum length of a line to be read.

Parameter-Liste

max_len

The maximum length of a line.

Rückgabewerte

Es wird kein Wert zurückgegeben.

Beispiele

Beispiel #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.

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

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.

Siehe auch

  • Classname::Method()


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)