Last active
June 8, 2018 03:46
-
-
Save weird-coon/37052b2665449d6fb4f48734ec27746b to your computer and use it in GitHub Desktop.
[PHP] Add zero before number
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
<?php | |
/** | |
* Padding a time on the left format time 1 -> 01 | |
* | |
* @access private | |
* @param string $num 時間 | |
* @return string time after format | |
*/ | |
public function addZeroBeforeNumber($num) { | |
return sprintf('%02d', $num); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment