Inspired by some awesome-as-always code written by my co-worker Mike Adams, here’s a helper function to help create plaintext data tables in PHP. This is particularly useful for PHP-based CLI scripts (we use quite a few at Automattic) or for plaintext e-mails.
But first, here’s an example output with the optional dividers enabled:
ID | First Name | Last Name ------------------------------------- 1 | Alex | Mills 2 | John | Smith 3 | Barack | Obama 4 | Fred | Flinstone 12345 | ReallyLongName | IsReallyLong