0
$x = '37965190010';

$y = (int) $x;

var_dump($x);

var_dump($y);

The above will output

string '37965190010'
int 2147483647

Why does the casting not work?

1 Answers1

0

Thats because the highest number in an int (for 32bits) cannot exceed 2147483647, you can check it by outputting the constant PHP_INT_MAX.

Check this in order to find out more.

taxicala
  • 21,408
  • 7
  • 37
  • 66