<?php

$s = new SplFileObject(__FILE__);
$s->setMaxLineLen(7);
echo $s->getMaxLineLen();
<?php

$s = new SplFileObject(__FILE__);
try {
    $s->setMaxLineLen(-1);
} catch (DomainException $e) {
    echo 'DomainException thrown';
}
示例#3
0
<?php

$splFileObject = new SplFileObject(__FILE__);
$splFileObject->setMaxLineLen(3);
$line = $splFileObject->getCurrentLine();
var_dump($line === '<?p');
var_dump(strlen($line) === 3);
<?php

$s = new SplFileObject(__FILE__);
$s->setMaxLineLen(3);
echo $s->getCurrentLine();
<?php

$s = new SplFileObject(__FILE__);
$s->setMaxLineLen('string');
<?php

$s = new SplFileObject(__FILE__);
$s->setMaxLineLen();