Re: [PHP-DB] printf() in a variable, or alternative to printf()

2005-05-27 Thread Philip Hallstrom

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.


sprintf() is your friend!

http://us3.php.net/sprintf

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] printf() in a variable, or alternative to printf()

2005-05-27 Thread graeme

Are you looking for the sprintf() function?

graeme

mayo wrote:



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


 



--
Experience is a good teacher, but she sends in terrific bills.

Minna Antrim

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] printf() in a variable, or alternative to printf()

2005-05-27 Thread Simon Rees
On Friday 27 May 2005 04:49, mayo wrote:
 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.

Use sprintf
see:
http://uk2.php.net/manual/en/function.sprintf.php

Si

-- 
~~
Simon Rees | [EMAIL PROTECTED] |
ORA-03113: end-of-file on communication channel
~~

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] printf() in a variable, or alternative to printf()

2005-05-26 Thread mayo
 
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