downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

SplFileObject::__toString> <SplFileObject::setFlags
[edit] Last updated: Fri, 18 Sep 2009

view this page in

SplFileObject::setMaxLineLen

(PHP 5 >= 5.1.0)

SplFileObject::setMaxLineLenSet maximum line length

Описание

public void SplFileObject::setMaxLineLen ( int $max_len )

Sets the maximum length of a line to be read.

Параметри

max_len

The maximum length of a line.

Връщани стойности

Няма връщана стойност.

Примери

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

Примерът по-горе ще изведе нещо подобно на:

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.

Вж. също

  • Classname::Method



add a note add a note User Contributed Notes SplFileObject::setMaxLineLen
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites