Skip to content

Instantly share code, notes, and snippets.

@codeliger
Created November 29, 2014 00:42
Show Gist options
  • Save codeliger/e89d4a573b374a5b4a06 to your computer and use it in GitHub Desktop.
Save codeliger/e89d4a573b374a5b4a06 to your computer and use it in GitHub Desktop.
A zerofill function for numbers in php
<?php
function zerofill($num, $max, $pad = "0"){
return str_pad($num, strlen($max), $pad, STR_PAD_LEFT);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment