/ Published in: PHP

This is a simple PHP class that can be used to produce nicely formatted reports from unorganized data.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
class fileFormatter { public $width = 0; public function setMap($inArray) { $this->map=$inArray; } public function setWidth ($inWidth) { $this->width=$inWidth; } public function centerHeading($str) { $blank=' '; } public function formatLine($data) { $out=NULL; } return $out.PHP_EOL; } Used in script this way: $report=new fileformatter(); $heading='Report Heading'; $lineWidth=70; $colHeadings='Source,Id Code,Location,Agent,Status'; $report->setWidth($lineWidth); $report->setMap($columns); }
URL: http://coboldinosaur.com/pages/formatting-text-with-string-padding.html
Comments
