SplFileObject
PHP Manual

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.

참고


SplFileObject
PHP Manual