[PHP] Parse Bca Mutation Report - fourslickz/notes GitHub Wiki
<?php
//$filePath = "R-5401_14123_20220503_rpt.txt";
$filePath = "R-5401_14123_20220502_rpt.txt";
$lines = file($filePath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$totalLines = count($lines);
$footerLines = 5;
$start = 9;
$end = $totalLines - $footerLines;
echo "-----------------------------------------\n";
echo "Total Lines = {$totalLines} \n";
echo "-----------------------------------------\n";
$i=0;
foreach($lines as $line){
$i++;
if($i > $start && $i < $end){
$code = substr($line, 8, 7);
$idr = substr($line, 46, 3);
$amount = substr($line, 58, 13);
$transferDate = substr($line, 73, 8);
echo "{$code} {$idr} {$amount} {$transferDate} \n";
}
}
echo "-----------------------------------------\n";
?>