3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(array_rand(["1", "2"], 3));
Output for 8.0.0
Fatal error: Uncaught ValueError: array_rand(): Argument #2 ($num) must be between 1 and the number of elements in argument #1 ($array) in /in/LYSTs:3 Stack trace: #0 /in/LYSTs(3): array_rand(Array, 3) #1 {main} thrown in /in/LYSTs on line 3
Process exited with code 255.
Output for 7.3.0 - 7.3.26, 7.4.0 - 7.4.14
Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in /in/LYSTs on line 3 NULL

preferences:
48.19 ms | 407 KiB | 5 Q