SplFileObject::setMaxLineLen

Set maximum line length

&reftitle.description; public `void` `SplFileObject::setMaxLineLen` `int` `maxLength`

Sets the maximum length of a line to be read.

&reftitle.parameters;

`maxLength`

- The maximum length of a line.

&reftitle.returnvalues;

&return.void;

&reftitle.errors;

Throws `DomainException` when `maxLength` is less than zero.

&reftitle.examples;

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

&example.outputs.similar;

    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.

&reftitle.seealso;

- `SplFileObject::getMaxLineLen`