3v4l.org

run code in 300+ PHP versions simultaneously
<?php function random_value() { // If there were no values returned, return false. if (func_num_args() == 0) { return false; } // Get all the values supplied $values = func_get_args(); $random = array_rand($values); return $values[$random]; } echo "First random try: ".random_value(1, 5, 4, 5); echo "\n\n"; echo "Second random try: ".random_value(9, 8); echo "\n\n"; echo "Third random try: ".random_value(3, 10, 6, 2, 4, 7);

preferences:
16.25 ms | 402 KiB | 5 Q