title: PHP sprintf space padding
body: <p>I have the following line in my code which displays my output in 6 characters with leading zeros.</p>
  
  <pre><code>$formatted_value = sprintf("%06d", $phpPartHrsMls);
  </code></pre>
  
  <p>I want to replace the leading zeros with spaces.  Have tried all the examples found by searching this site and others and cannot figure it out.</p>
  
  <p>Here are some I have tried:</p>
  
  <pre><code>$formatted_value = sprintf("%6s", $phpPartHrsMls);
  
  $formatted_value = printf("[%6s]\n",    $phpPartHrsMls); // right-justification with spaces
  </code></pre>