note 67173 added to function.chunk-split

From: Date: Sun, 04 Jun 2006 18:06:00 +0000
Subject: note 67173 added to function.chunk-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-113214@lists.php.net to get a copy of this message
In reply to "adrian at zhp dot inet dot pl" digit grouping function: <?php $number = strrev(chunk_split (strrev($number), 3,' ')); //If $number is '1234567', result is '1 234 567'. ?> There is a much more simple way of doing this, by using the built-in number_format() function. <?php $number = number_format($number,2,"."," "); //This will round $number to 2 decimals, use the dot (".") //as decimal point, and the space (" ") as thousand sepparator. ?> ---- Server IP: 193.27.201.10 (proxied: 193.27.201.10 1.0 www1.shellkonto.se:3128 (squid/2.5.STABLE4)) Probable Submitter: 84.218.37.193 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.chunk-split.php Edit -- http://master.php.net/note/edit/67173 Del: integrated -- http://master.php.net/note/delete/67173/integrated Del: useless -- http://master.php.net/note/delete/67173/useless Del: bad code -- http://master.php.net/note/delete/67173/bad+code Del: spam -- http://master.php.net/note/delete/67173/spam Del: non-english -- http://master.php.net/note/delete/67173/non-english Del: in docs -- http://master.php.net/note/delete/67173/in+docs Del: other reasons-- http://master.php.net/note/delete/67173 Reject -- http://master.php.net/note/reject/67173 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#113214) next »