The SplFileObject::setMaxLineLen() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to set the maximum length of line length.
Syntax:
void SplFileObject::setMaxLineLen( $len )
Parameters: This function accepts single parameter $len which is used to specify the maximum length of line.
Return values: This function returns the maximum length of line. The default value is 0.
Below Programs illustrate the SplFileObject::setMaxLineLen() function in PHP:
Program 1:
| <?php  Â// Create an SplFile Object $gfg= newSplFileObject("gfg.txt");  Â// Print Length var_dump($gfg->getMaxLineLen());  Â// Set length  $gfg->setMaxLineLen(20); var_dump($gfg->getMaxLineLen());  Â?>  | 
Output:
int(0) int(20)
Program 2:
| <?php  Â// Create an Array $GFG= array(     "dummy.txt",     "gfg.txt",     "frame.txt"    );  Â// Creating Spl Object foreach($GFGas&$arr)  {     // Create an SplFile Object     $gfg= newSplFileObject($arr);  Â    // Print Length before     var_dump($gfg->getMaxLineLen());  Â    // Set length      $gfg->setMaxLineLen(50);     echo"After = ";     // Print length after     var_dump($gfg->getMaxLineLen());  Â    echo"</br>";     } ?>  | 
int(0) After = int(50) int(0) After = int(50) int(0) After = int(50)
Reference: http://php.net/manual/en/splfileobject.setmaxlinelen.php

 
                                    







