RE: [PHP4BETA] Formatting numbers
| From: | Mitja Šlenc | Date: | Wed, 31 May 2000 13:53:51 +0000 |
| Subject: | RE: [PHP4BETA] Formatting numbers | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-15978@lists.php.net to get a copy of this message | ||
Well, almost.
I probably shouldn't mention numbers, but strings in general.
How can I do the following:
"abcde" ==> "a:b:c:d:e" as in func("abcde",
":", 1)
"abcdef" ==> "ab:cd:ef" as in func("abcdef",
":", 2)
"abcdefgh" ==> "abcd:ef:gh" as in func("abcdefgh",
":", -2, 2)
without serious substring()ing in awkward loops?
not to mention how much faster this is to do in C compared to PHP...
Mitja
-----Original Message-----
From: Adam Trachtenberg [mailto:adam@student.net]
Sent: 31. maj 2000 15:34
To: Mitja Šlenc
Cc: php4beta@lists.php.net
Subject: Re: [PHP4BETA] Formatting numbers
number_format()
-adam
On Wed, 31 May 2000, [windows-1250] Mitja Šlenc wrote:
> Hi!
>
> Is there a function for formatting numbers by inserting characters like ,
> and .?
> If there isn't, does someone feel like writing it? :)
> I have something like the following in mind:
>
> str_format_number($number, $character, $every [, $maxnumber])
--
/ adam maccabee trachtenberg | visit college life online \
\ adam@student.net | http://www.student.com /