Sponsored Content
The Lounge What is on Your Mind? Please Welcome Nicki Paul to the Moderator Team! Post 303039446 by RavinderSingh13 on Saturday 5th of October 2019 05:15:35 AM
Old 10-05-2019
Thanks a lot Neo for inviting such a great experience and talent into forums Smilie

Welcome aboard Nicki Paul in MODs group Smilie Smilie

Thanks,
R. Singh
 

2 More Discussions You Might Find Interesting

1. What is on Your Mind?

Please Welcome Dave Munro to the Moderator Team!

Dear All, I am very pleased to announce that Dave Munro (gull04) is joining the Moderation Team, after being a very valuable member of UNIX.com for 15+ years. Dave is an IT Consultant with 30 years of experience this year, has worked in many of the industry vertical market segments and has... (6 Replies)
Discussion started by: Neo
6 Replies

2. What is on Your Mind?

Please Welcome Simon Sweetman (Chubler_XL) to the Moderator Team

Happy Thanksgiving Holidays, Today, I am happy to welcome Simon Sweetman (Chubler_XL) to the Moderation Team to help provide us some important coverage from (Down Under) Australia. Simon is a Senior Analyst Programmer/Developer at Cedar Creek Company in Brisbane, Australia and his LinkedIn... (7 Replies)
Discussion started by: Neo
7 Replies
ARRAY_RAND(3)								 1							     ARRAY_RAND(3)

array_rand - Pick one or more random entries out of an array

SYNOPSIS
mixed array_rand (array $array, [int $num = 1]) DESCRIPTION
Picks one or more random entries out of an array, and returns the key (or keys) of the random entries. PARAMETERS
o $array - The input array. o $num - Specifies how many entries should be picked. RETURN VALUES
When picking only one entry, array_rand(3) 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 than there are in the array will result in an E_WARNING level error, and NULL will be returned. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ |5.2.10 | | | | | | | The resulting array of keys is no longer shuf- | | | fled. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 array_rand(3) example <?php $input = array("Neo", "Morpheus", "Trinity", "Cypher", "Tank"); $rand_keys = array_rand($input, 2); echo $input[$rand_keys[0]] . " "; echo $input[$rand_keys[1]] . " "; ?> SEE ALSO
shuffle(3). PHP Documentation Group ARRAY_RAND(3)
All times are GMT -4. The time now is 09:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy