PHP sprintf Space Padding -
i have next line in code displays output in 6 characters leading zeros.
$formatted_value = sprintf("%06d", $phpparthrsmls);
i want replace leading zeros spaces. have tried examples found searching site , others , cannot figure out.
here have tried.
$formatted_value = sprintf("%6s", $phpparthrsmls); $formatted_value = printf("[%6s]\n", $phpparthrsmls); // right-justification spaces
thanks help!!
in browser, spaces collapsed.
try:
<pre><?php echo $formatted_value; ?></pre>
and 1 time you're satisfied that, take @ css white-space:pre-wrap
- useful property!
php padding space
No comments:
Post a Comment