Re: Does anyone know if this is possible?
| From: | Joel Boonstra | Date: | Mon, 04 Nov 2002 22:09:22 +0000 |
| Subject: | Re: Does anyone know if this is possible? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122708@lists.php.net to get a copy of this message | ||
Hi Raymond,
> I have made a website with a webshop and the orders are written down in
> txtfiles and a faxserver is scanning a directory for txtfiles and sends them
> as faxes.
>
> So I am trying to write the txtfile like I should have written the order in
> a table. Or you can say I am trying to make some columns in the txtfile.
>
> Something like this:
>
> 1 pizza cheese, beef, tomato, 5,-
> ham, bacon etc........
> 2 burgers cheese, bacon 2,-
I *think* if you're committed to doing this in PHP, you'll need to look
at the sprintf() or printf() functions:
http://www.php.net/manual/en/function.sprintf.php
You're given some level of control over the output of your program. I
don't know if you can get what you describe above, though.
If you're not adverse to looking to another language, Perl was built to
do exactly this. Perl Formats do what you need -- they provide a method
for generating "simple, formatted reports and charts", according to the
camel book. I know of no analagous capability of PHP (although I may
very well be wrong).
If you can't use perl for the whole thing, perhaps you could have PHP do
all your logic, and then pass the data to a perl script to format and
save it to a file. Or maybe sprintf() does everything you need...
Joel
(more on perl formats:
http://www.perl.com/doc/manual/html/pod/perlform.html)
--
[ joel boonstra | jboonstra@gospelcom.net ]