Skip to content

Instantly share code, notes, and snippets.

@weird-coon
Last active June 8, 2018 03:46
Show Gist options
  • Save weird-coon/37052b2665449d6fb4f48734ec27746b to your computer and use it in GitHub Desktop.
Save weird-coon/37052b2665449d6fb4f48734ec27746b to your computer and use it in GitHub Desktop.
[PHP] Add zero before number
<?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