Function __global->array_rand

Definitions

sources_custom/phpstub.php

  • Pick one or more random entries out of an array.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$input array No No required parameter N/A N/A Array to choose from
$num_req integer No No 1 N/A N/A Number of entries required

Returns

  • Random entry, or array of random entries if $num_req!=1
  • Type: mixed
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Pick one or more random entries out of an array.
 *
 * @param  array $input Array to choose from
 * @param  integer $num_req Number of entries required
 * @return mixed Random entry, or array of random entries if $num_req!=1
 */

function array_rand(array $input, int $num_req = 1)