echo '<br/>'; } echo '<br/>'; echo '<br/>'; echo 'Navigate:<br/>'; echo $fileObject->firstLine(); echo '<br/>'; echo $fileObject->nextLine(); echo '<br/>'; echo $fileObject->nextLine(); echo '<br/>'; echo $fileObject->firstLine(); echo '<br/>'; echo $fileObject->readLine(3); echo '<br/>'; echo $fileObject->readLine(7); echo '<br/>'; echo '<br/>'; echo '<br/>'; // read all echo 'File Content:<br/>'; echo nl2br($fileObject->read()); echo '<br/>'; echo '<br/>'; echo '<br/>'; echo 'Array of lines:<br/>'; $lines = $fileObject->readLines(); // return array foreach ($lines as $line) { echo $line . '<br/>'; }
/** * @depends testInit * @return void */ public function testReadLines() { $filePath = __DIR__ . '/example_read.txt'; $fileObject = new FileReader($filePath, 'r', true); $expectedArray = array('Line01', 'Line02', 'Line03', 'Line04', 'Line05', 'Line06', 'Line07', 'Line08', 'Line09'); $this->assertEquals($expectedArray, $fileObject->readLines()); }