PHP code example of conkal / dat-reader
1. Go to this page and download the library: Download conkal/dat-reader library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
conkal / dat-reader example snippets
* A large text file
*/
$fileName = 'example.dat';
/**
* How fixed columns arranged
* example: 10 characters for id, 13 characters for name
*/
$template = ['id' => 10, 'name' => 13];
/**
* Create Reader
*/
$reader = new Conkal\DatReader\Reader($fileName, $template);
/**
* Read each line as fixed column records
*/
$reader->open();
while ($record = $reader->read()) {
var_dump($record);
}
$reader->close();