2017 © Pedro Peláez
 

library array-to-text

Convert PHP arrays to plain text table.

image

rationalboss/array-to-text

Convert PHP arrays to plain text table.

  • Saturday, February 11, 2017
  • by rationalboss
  • Repository
  • 1 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

ArrayToText

ArrayToText will transform a PHP array to a textual table. Original script: http://tonylandis.com/php/php-text-tables-class/., (*1)

'AIG', 'id'=>1, 'balance'=> '-$99,999,999,999.00'),
    array('company'=>'Wachovia', 'id'=>2, 'balance'=> '-$10,000,000.00'),
    array('company'=>'HP', 'id'=>3, 'balance'=> '$555,000.000.00'),
    array('company'=>'IBM', 'id'=>4, 'balance'=> '$12,000.00')
);

$renderer = new ArrayToText($data);
$renderer->showHeaders(true);
$renderer->render();


// Using Composer:

/*

"require": {
    "rationalboss/array-to-text": "dev-master"
}

*/

$data = array(
    array('company'=>'AIG', 'id'=>1, 'balance'=> '-$99,999,999,999.00'),
    array('company'=>'Wachovia', 'id'=>2, 'balance'=> '-$10,000,000.00'),
    array('company'=>'HP', 'id'=>3, 'balance'=> '$555,000.000.00'),
    array('company'=>'IBM', 'id'=>4, 'balance'=> '$12,000.00')
);
$renderer = new \rationalboss\util\ArrayToText($data);
$renderer->showHeaders(true);
$renderer->render();

?>

Sample Output:, (*2)

+----------+----+---------------------+
| COMPANY  | ID |       BALANCE       |
+----------+----+---------------------+
| AIG      | 1  | -$99,999,999,999.00 |
| Wachovia | 2  | -$10,000,000.00     |
| HP       | 3  | $555,000.000.00     |
| IBM      | 4  | $12,000.00          |
+----------+----+---------------------+

The Versions

11/02 2017

dev-master

9999999-dev

Convert PHP arrays to plain text table.

  Sources   Download

by Avatar rationalboss