Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/01/2003, 16:27
Avatar de Cain
Cain
 
Fecha de Ingreso: enero-2002
Ubicación: Catalunya
Mensajes: 6.459
Antigüedad: 22 años, 4 meses
Puntos: 17
Puedes usar str_pad()

Sintaxis:
string str_pad ( string input, int pad_length [, string pad_string [, int pad_type]])

Uso:

$numerito = 3;

print str_pad($numerito, 3, "0", STR_PAD_LEFT); // pinta: 003

$numerito = 13;

print str_pad($numerito, 3, "0", STR_PAD_LEFT); // pinta: 013

$numerito = 304;

print str_pad($numerito, 3, "0", STR_PAD_LEFT); // pinta: 304

__________________
M a l d i t o F r i k i