Created
June 16, 2016 09:42
-
-
Save platoosom/e05f74466933ee60f72ba7e3591a1cac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$number = '1'; | |
$max = 4; | |
$prefix = '0'; | |
$result = ''; | |
$length = strlen($number); | |
$loop = $max-$length; | |
for($i=$loop; $i>0; $i--){ | |
$result .= $prefix; | |
} | |
$result .= $number; | |
echo $result; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment