Re: [PHP4BETA] Formatting numbers

From: Date: Wed, 31 May 2000 13:59:36 +0000
Subject: Re: [PHP4BETA] Formatting numbers
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-19886@lists.php.net to get a copy of this message
AFAIK there´s currently no function doing this. You´ll have to write your own in php... wrote:
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    /
-- PHP 4.0 Beta Mailing List <http://www.php.net/version4/> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net For additional commands, e-mail: php4beta-help@lists.php.net To contact the list administrators, e-mail: php4beta-admin@lists.php.net
--
o----------0-¬---------O-·---¬----o---®-----o o    O   °       .
| http://www.kiffen.de | pRoteçt y0ur bRaín |0  O °     ¤  °        ·
0°·^(3)°^(2)'^(2)^(3)-^(1)'^(3)´^(3)°^°^(3)~^(3)^(2)^(3)°'^(3)^(2)^(2)¨^(3)^(2)^^(3)^(1)^(3)^(2)°^(2)^(3)`^(3)^(o)^(3)°? ° o © ° . ·
| psychedelic experience |  gott@kiffen.de  | O   ° o           °
o-¬--o--0-----©-·--O-----o-----0-¤----------o 0 ° · ° . ¤ ·

« previous php.dev (#19886) next »