From 282140eb7d32d433017909966fd4a2c766b07be5 Mon Sep 17 00:00:00 2001 From: Christoph Michael Becker Date: Mon, 19 Oct 2020 07:35:23 +0000 Subject: [PATCH] Note that the order of returned keys is deterministic Patch contributed by Larry Garfield . git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@350939 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/array/functions/array-rand.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reference/array/functions/array-rand.xml b/reference/array/functions/array-rand.xml index 0d2fb7adf5..912acb9a5e 100644 --- a/reference/array/functions/array-rand.xml +++ b/reference/array/functions/array-rand.xml @@ -48,7 +48,9 @@ When picking only one entry, array_rand returns the key for a random entry. Otherwise, an array of keys for the random entries is returned. This is done so that random keys can be picked - from the array as well as random values. Trying to pick more elements + from the array as well as random values. If multiple keys are returned, + they will be returned in the order they were present in the original array. + Trying to pick more elements than there are in the array will result in an E_WARNING level error, and NULL will be returned.