note 29934 added to function.sprintf
| From: | retestro_REMOVE at SPAM_esperanto dot org dot il | Date: | Sat, 01 Mar 2003 12:59:30 +0000 |
| Subject: | note 29934 added to function.sprintf | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44692@lists.php.net to get a copy of this message | ||
Pay attention, that PHP's printf() and sprintf() do NOT support special flags, as the
'+' one (makes a sign appear before the number, regardless of whether it's negative
or positive).
It took me a while to figure that out: you have to write it yourself...
use something similar to the following
($value >= 0) ? printf('+%d', $value) : printf('%d', $value);
--
http://www.php.net/manual/en/function.sprintf.php
http://master.php.net/manage/user-notes.php?action=edit+29934
http://master.php.net/manage/user-notes.php?action=delete+29934
http://master.php.net/manage/user-notes.php?action=reject+29934