Skip to content

Instantly share code, notes, and snippets.

@klmr
Created February 1, 2018 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klmr/e1319f6d921a382e86296cce06eb7dbd to your computer and use it in GitHub Desktop.
Save klmr/e1319f6d921a382e86296cce06eb7dbd to your computer and use it in GitHub Desktop.

Input:

<?php
$digit = 1234;
var_dump($digit);
printf("%08d\n", $digit);

Output:

int(1234)
00001234
@hirenbhut93
Copy link

Following code is not working given error Invalid numeric literal

<?php
$digit = 09;
var_dump($digit);
printf("%02d", $digit);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment