Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/06/2010, 10:13
rpv
 
Fecha de Ingreso: febrero-2010
Mensajes: 275
Antigüedad: 15 años
Puntos: 10
Respuesta: Problema con un cero en php

hay varias formas de hacerlo:

Código PHP:
Ver original
  1. //1
  2. $str=substr('0000'.$str,-3);
  3.  
  4. //2
  5. $str=($str<100&&$str{0}!='0')?'0'.$str:$str;