Ver Mensaje Individual
  #4 (permalink)  
Antiguo 17/05/2010, 00:14
Luisus
 
Fecha de Ingreso: mayo-2010
Mensajes: 51
Antigüedad: 13 años, 11 meses
Puntos: 3
Respuesta: Mostrar dos digitos.

COPY PASTE desde el manual de php.net

Código PHP:
Here is a simple function to convert numbers into strings like this:

0 => 0000
1 => 0001
20 => 0020
432 => 0432

<?php

function number_pad($number,$n) {
return 
str_pad((int) $number,$n,"0",STR_PAD_LEFT);
}

?>

$n indicates how many characters you want.