It's failing because it's prefixed with a 0, making PHP attempt to interpret it as an octal number, where 8 is not a valid octal digit as it parses the string, so you get 0. The solution is to use a (string) cast or strval(), but you need to remove the leading zero from your definition of $code. $code = 87326487326; var_dump( $code, (string) $code, strval( $code));This will output (on an x64 machine): int(87326487326) string(11) "87326487326" string(11) "87326487326" (责任编辑:) |