Re: Formatting plain text file

From: Date: Fri, 31 Jul 2009 01:20:30 +0000
Subject: Re: Formatting plain text file
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-296088@lists.php.net to get a copy of this message
On 07/30/2009 06:29 PM, Skip Evans wrote:
Jim Lucas wrote:
Skip Evans wrote:
Hey all, Am I brain fading or what? I'm so used to formatting text in tables for HTML display I can't think of how to do it for a plain text file. I just need to create a columned table of names and addresses type stuff... sprintf?
or a little str_pad on each variable...
Sure, that will do it. But isn't there some way to construct formatted tables similar to HTML?
Are you thinking of a CSV file that you can open in a spreadsheet prog? Or, do you literally mean a plaintext file with columns? For the latter, you'd need to measure the max char length of each "column" for every line in the file, then go back and print each line using str_pad().

« previous php.general (#296088) next »