Better Formatting Options?

Better Formatting Options?

am 31.07.2009 02:52:23 von sono-io

Is there a more efficient way to write the following?

itemid='ABC1'",$db);
printf("List: %s
\n", money_format('$%i',
mysql_result($result,0,"priceList"))); ?>

I have many products per page and this code pulls the list price and
formats it. It works fine, but I'd like to know if I can shorten it.

I've looked at number_format over money_format and it's a little
shorter, but not by much. Are there better options than printf and
mysql_result for my use?

Thanks,
Frank

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

Re: Better Formatting Options?

am 31.07.2009 11:31:35 von Richard Heyes

Hi,

> =A0 =A0 =A0 =A0I have many products per page and this code pulls the list=
price and
> formats it. =A0It works fine, but I'd like to know if I can shorten it.

Personally, I would advise against trying to cram as much as possible
into the least amount of space as possible, and instead going for
verbosity/readability. It will help when you come back to re-read it
in X months.

--=20
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 25th July)
Lots of PHP and Javascript code - http://www.phpguru.org

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