If I do $array = array("test1", "test2", "test3"); array_rand($array, 2); How would I get the result of this so I could store it as data?
Check it by yourself on phptester.net PHP: $array = ["hi", "ho", "xd", "bro"];$randomKeys = array_rand($array, 2);$randomArray = [$array[$randomKeys[0]], $array[$randomKeys[1]]];print_r($randomArray);
PHP: $array = ["a", "b", "c", "d", "e"];$randomValue = $array[array_rand($array, 1)];var_dump($randomValue); // random output string(1) "c"$randomizedArray = $array;shuffle($randomizedArray);var_dump($randomizedArray); // random output array(5) { [0]=> string(1) "b" [1]=> string(1) "c" [2]=> string(1) "e" [3]=> string(1) "a" [4]=> string(1) "d" }$twoRandomValues = array_slice($randomizedArray, 0, 2);var_dump($twoRandomValues); // random output array(2) { [0]=> string(1) "e" [1]=> string(1) "a" }