echo $num; // 1
$str = sprintf('%02d', $num, 2);
echo $str; //01