note 14120 deleted from function.chunk-split by jimw

From: Date: Mon, 08 Oct 2001 23:40:36 +0000
Subject: note 14120 deleted from function.chunk-split by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-18705@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 :)

« previous php.notes (#18705) next »