Zitat:
Original geschrieben von käptn
Genau und PHP macht's für dich:
PHP-Code:
echo str_pad($num, 3, '0', STR_PAD_LEFT);
~
|
Währe nicht ein klassisches sprintf eleganter?
PHP-Code:
sprintf ( "%3.3d", $num)
http://www.php.net/manual/de/function.sprintf.php
Ja, mit str_pad gehts auch, aber (s)printf find ich pers. netter
