Ver Mensaje Individual
  #12 (permalink)  
Antiguo 17/01/2011, 17:10
Avatar de portalmana
portalmana
 
Fecha de Ingreso: septiembre-2007
Ubicación: Montevideo-Uruguay
Mensajes: 633
Antigüedad: 16 años, 7 meses
Puntos: 80
Respuesta: Sirve en el servidor local pero no en el del hosting.

Mira sacando el casting a int de todos se comportan exactamente iguales en ambos lados...
Código PHP:
Ver original
  1. function ticket($pin)
  2. {  
  3.     $pin        = strtoupper($pin);
  4.     $pin        = str_split($pin);
  5.     $istore2    = 0;
  6.     $istore3    = 1313;
  7.     $bucle      = count($pin);
  8.  
  9.     for ($w = 0; $w < $bucle ; $w++) {
  10.         $istore5    = ord($pin[$w]);
  11.         echo $istore5 .'<br>';
  12.        
  13.         //$istore2 = ((int)$istore2 * (int)$istore3);
  14.         $istore2    = bcmul($istore2, $istore3);
  15.         echo 'i2:'. $istore2 .'<br>';
  16.  
  17.         //$istore21= (((((int)$istore5 * (int)$istore5) * (int)$istore5) * 667)* (int)$w);
  18.         $istore21   = bcmul(bcmul(bcmul( bcmul( $istore5, $istore5), $istore5), 667), $w);
  19.         echo $istore21 .'<br>';
  20.  
  21.         //$istore2    = (int)$istore2 + (int) $istore21;
  22.         $istore2    = bcadd( $istore2,  $istore21);
  23.         echo $istore2 .'<br>';
  24.     }
  25.  
  26.     //$istore2 = ((int)$istore2 & 2147483647) % 65536;
  27.     $istore2    = bcmod( ($istore2 & 2147483647), 65536);
  28.     echo ':'.$istore2 .'<br>';
  29.    
  30.     for ($istore5 = 4; $istore5 >= 0; $istore5-- ) {
  31.         //$astore4[$istore5] = ((int)$istore2 % 10) + 48;
  32.         $astore4[$istore5]  = bcadd( bcmod($istore2, 10), 48);
  33.         //$istore2 = (int)$istore2 / 10;
  34.         $istore2            = bcdiv($istore2, 10);
  35.     }
  36.  
  37.     $key=0;
  38.     for ($i=1; $i<count($astore4); $i++){
  39.         $key.=chr($astore4[$i]);
  40.     }
  41.     return $key;
  42. }
  43. print 'Tichet: ' . ticket("216B22DD") . '<br />';
  44.  
  45. echo PHP_INT_SIZE . '<br/>';
  46. echo PHP_INT_MAX;

P.D.: Después dime como al final lo pudiste solucionar, uno nunca sabe cuando va a caer en estos problemas...
Saludos
__________________
"La imaginación es más importante que el conocimiento. El conocimiento es limitado, mientras que la imaginación no" -- A.Einstein
objetivophp.com,twitter.com/objetivophp