ChrisB: json_decode wandelt INT Werte um?

Beitrag lesen

Hi,

string(1951) "{"items":[{"id":1070107173001,"name":" ...

nach json_decode erhalte ich:

["id"]=>
      float(1.070107173E+12)

$x = '{"items":[{"id":1070107173001}]}';  
var_dump(json_decode($x));  
echo PHP_INT_MAX;

Ausgabe:

  • auf einem 64-Bit-System:
object(stdClass)#1 (1) {  
  ["items"]=>  
  array(1) {  
    [0]=>  
    object(stdClass)#2 (1) {  
      ["id"]=>  
      int(1070107173001)  
    }  
  }  
}  
9223372036854775807
  • auf einem 32-Bit-System:
object(stdClass)#1 (1) {  
  ["items"]=>  
  array(1) {  
    [0]=>  
    object(stdClass)#2 (1) {  
      ["id"]=>  
      float(1070107173001)  
    }  
  }  
}  
2147483647

Noch Fragen?

MfG ChrisB

--
RGB is totally confusing - I mean, at least #C0FFEE should be brown, right?