note 14120 added to function.chunk-split.php

From: Date: Wed, 18 Jul 2001 09:00:22 +0000
Subject: note 14120 added to function.chunk-split.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-15527@lists.php.net to get a copy of this message
I have tried to seek a function that would separate numbers into three number chunks 'backwards'. After some seeking, in vain, I concluded that I have to make my own. So, here it is: function doSpaces($num) { $num .= ""; // make sure it's a string for ($i=0; $i < strlen($num)+1; $i++) { $loop++; $result = $num[(strlen($num)-$i)].$result; if ($loop > 3) { $result = " ".$result; $loop = 0; } } return $result; } Hopefully there isn't such a function built-in :) http://www.php.net/manual/en/function.chunk-split.php

« previous php.notes (#15527) next »