Padding with 0 in Left

Sometimes there are situations where we want to pad 0 to our numbers, suppose one organizations registration number consists of 10 digits. So to print a number in 10 digits we use sprintf() as :

<?php

$number = 123456;
echo $number."<br>";
$padded_string = sprintf('%010d', $number);

echo $padded_string; 
?>

Output as under :

123456
0000123456