From th PHP docs:
"The size of an integer is platform-dependent, although a maximum value of about two billion is the usual value (that's 32 bits signed). "
For the sake of exactitude, the maximum value for a signed 32 bit number is 2147483647. If you try to store 2147483648, it fails miserably.
So, modify your code so that the first digit is either 0, 1 or 2. The second can be 0 or 1 if the first is 2, and can range from 0 to 9 if not. The third can range from 0 to 4 if the first and second are 2 and 1, and can range from 0 to 9 if not. I think you can guess the rest.
It is a really awful solution. If you could do with 9-digit numbers, it would be really easy.
If you cannot do this or need to make some calculations, try GMP; a library that works with huge integers contained in strings. With GMP, you can compute ('12345678901234567890' / '123456789012345') with no problem.
Last, there are much better ways to generate random numbers. There are a lot of code snippets out there to randomly generate a number between a minimum and a maximum value.
Hope it helps!