Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 2000051

Re: [PHP3] sprintf bug or something From: Alfred Perlstein (bright <email protected>)
Date: 05/11/00

* Lance Earl <lance <email protected>> [000510 21:52] wrote:
> While writing a script to send monthly statements to customers, I
> ran into strange problem. I use sprintf to format a value. This
> formated value is then inserted into a string to be emailed to the
> customer. If the value is a positive number, emailing works fine. If
> the value is a neg number, the email includes everything above and
> including the value but drops all the contents of the string following
> the string.
>
> If you have any ideas, here is my code
>
> $money = sprintf ("%01.2f", $bal_fwd);
> $statement .= "\nBalance Brought Forward: $$money\n";

I'm pretty sure you want:

  $statement .= "\nBalance Brought Forward: \$$money\n";

--
-Alfred Perlstein - [bright <email protected>|alfred <email protected>]
"I have the heart of a child; I keep it in a jar on my desk."

-- PHP 3 Mailing List <http://www.php.net/> To unsubscribe, send an empty message to php3-unsubscribe <email protected> To subscribe to the digest, e-mail: php3-digest-subscribe <email protected> To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 To contact the list administrators, e-mail: php-list-admin <email protected>