> $something = 26;
> $something = sprintf('%7d', $something);
> $something = str_replace(' ', '0', $something);
> echo $something;

This is a bit more direct:

$something = 26;
echo str_pad($something, 7, '0', STR_PAD_LEFT);

Chris

=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to