Toggle navigation
New
Learn
Snippets
Meta
News
About
API Docs
Source Code
Account
Register
Login
Legible numbers as Twitter uses
main.php
dio.php
✖
tria.php
✖
tessera.php
✖
pente.php
✖
eksi.php
✖
Run Settings
Language
PHP
Language Version
latest
Run Command
Snippet Metadata
Owner
Mert S. Kaplan
Created
8 years ago
Modified
4 years ago
Visibility
Public
1
2
3
4
5
6
7
8
9
10
11
<?php
function
legibleNumb
(
$numb
,
$lang
=
'en'
)
{
if
(
$lang
==
'tr'
)
{
// Usage with commas in Turkish
if
(
$numb
>=
1000000
)
{
// million
if
(
strstr
(
round
(
number_format
(
$numb
,
0
,
','
,
'.'
)
,
1
)
,
'.'
))
{
$legibleNumb
=
number_format
(
round
(
number_format
(
$numb
,
0
,
','
,
'.'
)
,
1
)
,
1
,
','
,
'.'
)
.
' Mn'
;
}
else
{
$legibleNumb
=
round
(
number_format
(
$numb
,
0
,
','
,
'.'
)
,
1
)
.
' Mn'
;
}
}
elseif
(
$numb
>=
100000
&&
$numb
<
1000000
)
{
// One hundred thousand
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Editor Settings
Theme
Chrome
Clouds
Crimson Editor
Dawn
Dreamweaver
Eclipse
GitHub
Solarized Light
TextMate
Tomorrow
XCode
Kuroir
KatzenMilch
Ambiance
Chaos
Clouds Midnight
Cobalt
idle Fingers
krTheme
Merbivore
Merbivore Soft
Mono Industrial
Monokai
Pastel on dark
Solarized Dark
Terminal
Tomorrow Night
Tomorrow Night Blue
Tomorrow Night Bright
Tomorrow Night 80s
Twilight
Vibrant Ink
Key bindings
Default
Vim
Emacs
Full width
True
False
Lines
-
Auto
+
10
Direct link
Raw
Embed