RE: [PHP-DB] printf() in a variable, or alternative to
| From: | N dot A dot Morgan at bton dot ac dot uk | Date: | Fri, 27 May 2005 14:14:55 +0000 |
| Subject: | RE: [PHP-DB] printf() in a variable, or alternative to | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-39548@lists.php.net to get a copy of this message | ||
Try sprintf().
-----Original Message-----
From: mayo [mailto:mayo@nycinteractive.com]
Sent: 27 May 2005 14:02
To: php-db@lists.php.net
Subject: [PHP-DB] printf() in a variable, or alternative to
I need to be able to format data.
Printf() is perfect because I need a certain amount of characters (30 for
address).
However I need this formatted data to be inside a file that's fwrite() and
then FTPed to a distributor who will parse it and input into their database.
printf("% 4d",$orderID[0]); does not work in
$thisContent="
"data" .
"moredate" .
"evenmoredata" .
";
In effect I need the output of printf() to be placed inside a variable and I
don't see how to do that. Str_pad(), of course, does not work.
Thx for any hints.
mayo