/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ext/random/tests/01_functions/array_rand_mt_rand_php.phpt
35 строк
737 B
DanielEScherzer
Replace `@deprecated` with `#[\Deprecated]` for internal constants (#18780)
26 июн 2025, 21:27
Не верифицирован
26 июн 2025, 21:27
171501b
Код
Авторство
О чём код?
--TEST-- array_rand() is not affected by MT_RAND_PHP as with PHP < 8.2 --FILE-- <?php $array = [ 'foo', 'bar', 'baz', ]; mt_srand(1, MT_RAND_PHP); function custom_array_rand() { global $array; $key = array_rand($array); var_dump('found key ' . $key); return $array[$key]; } var_dump( custom_array_rand(), custom_array_rand(), custom_array_rand(), ); ?> --EXPECTF-- Deprecated: Constant MT_RAND_PHP is deprecated since 8.3, as it uses a biased non-standard variant of Mt19937 in %s on line %d Deprecated: The MT_RAND_PHP variant of Mt19937 is deprecated in %s on line %d string(11) "found key 0" string(11) "found key 1" string(11) "found key 0" string(3) "foo" string(3) "bar" string(3) "foo"