Your problem is that you always get the float value in the variable $hex. And the function mt_srand(), as you can see in manual :
void mt_srand ([ int $ seed])
Expects an integer. So what he does is he is just trying to convert your float value to an integer. But since this fails, it will always return 0.
, 0, "" .
, :
var_dump($hex);
:
float(1.0908183557664E+77)
, , , :
var_dump((int)$hex);
, 0.
, , float, - , manual:
PHP , float . , , , float.
:
echo PHP_INT_MAX;
int, :
28192147483647
9223372036854775807
EDIT:
, - ?
, , , , PHP_INT_MAX, , - . , , .
- :
$arr = str_split($hex);
shuffle($arr);
$hex = implode("", array_slice($arr, 0, 7));
str_split(), shuffle() implode() 7 , array_slice().
hexdec(), mt_srand().
7 ? , , PHP_INT_MAX.
share