Skip to content
All gists
Back to GitHub
Sign in
Sign up
Sign in
Sign up
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Instantly share code, notes, and snippets.
scodx
/
add-zeroes.md
Last active
October 11, 2019 20:32
Show Gist options
Download ZIP
Star
(
1
)
1
You must be signed in to star a gist
Fork
(
0
)
0
You must be signed in to fork a gist
Embed
Embed
Embed this gist in your website.
Share
Copy sharable link for this gist.
Clone via HTTPS
Clone using the web URL.
Learn more about clone URLs
Clone this repository at <script src="https://gist.github.com/scodx/f32528d929ce2d9632d2ebf5ed0963eb.js"></script>
Save scodx/f32528d929ce2d9632d2ebf5ed0963eb to your computer and use it in GitHub Desktop.
Code
Revisions
4
Stars
1
Embed
Embed
Embed this gist in your website.
Share
Copy sharable link for this gist.
Clone via HTTPS
Clone using the web URL.
Learn more about clone URLs
Clone this repository at <script src="https://gist.github.com/scodx/f32528d929ce2d9632d2ebf5ed0963eb.js"></script>
Save scodx/f32528d929ce2d9632d2ebf5ed0963eb to your computer and use it in GitHub Desktop.
Download ZIP
Adding 0's to a string when is lower than 10 in PHP and JS
Raw
add-zeroes.md
PHP
$
n
= sprintf("
%04d
",
$
n
)
JS
var
n
=
(
'00'
+
'09'
)
.
slice
(
-
2
)
;
Sign up for free
to join this conversation on GitHub
. Already have an account?
Sign in to comment
You can’t perform that action at this time.