Monday, July 15, 2013

Single digit to Double digit conversion of a number using PHP

<?php
   $number = 8;
   echo sprintf("%02u", $number);  //Outputs 08
?>


For details refer: http://www.w3schools.com/php/func_string_sprintf.asp

1 comment: