note 71279 added to function.substr
| From: | lisandrom_at_cantv_net at osu1 dot php dot net | Date: | Mon, 20 Nov 2006 22:45:11 +0000 |
| Subject: | note 71279 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119912@lists.php.net to get a copy of this message | ||
This small function return a integer in dotted (decimal) notation:
function dotted_int($int) {
$last3 = substr($int, strlen($int) - 3, 3);
if (strlen($int) <= 3) {
return $last3;
} else {
return dotted_int(substr($int, 0, strlen($int) - 3)) . "." . $last3;
}
}
echo dotted_int(123456789);
// prints 123.456.789
----
Server IP: 64.71.164.2
Probable Submitter: 64.116.132.46 (proxied: 10.1.111.10)
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- https://master.php.net/note/edit/71279
Del: integrated -- https://master.php.net/note/delete/71279/integrated
Del: useless -- https://master.php.net/note/delete/71279/useless
Del: bad code -- https://master.php.net/note/delete/71279/bad+code
Del: spam -- https://master.php.net/note/delete/71279/spam
Del: non-english -- https://master.php.net/note/delete/71279/non-english
Del: in docs -- https://master.php.net/note/delete/71279/in+docs
Del: other reasons-- https://master.php.net/note/delete/71279
Reject -- https://master.php.net/note/reject/71279
Search -- https://master.php.net/manage/user-notes.php