array_push <<< |
array_rand | array_reduce >>> |
6.2 Tableaux 6 Référence des fonctions Manuel PHP . Introduction . Pré-requis . Installation . Configuration à l'exécution . Types de ressources . Constantes pré-définies . Voir aussi . array_change_key_case . array_chunk . array_combine . array_count_values . array_diff_assoc . array_diff_key . array_diff_uassoc . array_diff_ukey . array_diff . array_fill . array_filter . array_flip . array_intersect_assoc . array_intersect_key . array_intersect_uassoc . array_intersect_ukey . array_intersect . array_key_exists . array_keys . array_map . array_merge_recursive . array_merge . array_multisort . array_pad . array_pop . array_product . array_push ->array_rand . array_reduce . array_reverse . array_search . array_shift . array_slice . array_splice . array_sum . array_udiff_assoc . array_udiff_uassoc . array_udiff . array_uintersect_assoc . array_uintersect_uassoc . array_uintersect . array_unique . array_unshift . array_values . array_walk_recursive . array_walk . array . arsort . asort . compact . count . current . each . end . extract . in_array . key . krsort . ksort . list . natcasesort . natsort . next . pos . prev . range . reset . rsort . shuffle . sizeof . sort . uasort . uksort . usort |
6.2.35 array_rand() Prend une ou plusieurs valeurs, au hasard dans un tableau[ Exemples avec array_rand ] PHP 4, PHP 5 mixed array_rand ( array input , int num_req )array_rand est pratique lorsque vous voulez sélectionner une ou plusieurs valeurs au hasard dans un tableau. Le paramètre input est un tableau, et num_req spécifie le nombre de valeurs que vous voulez obtenir (par défaut, c'est 1). Si vous ne demandez qu'une entrée, array_rand retourne l'index de la valeur. Sinon, elle retourne un tableau d'index. Cela vous permet de faire une sélection au hasard de clés, ou bien de valeurs.
Voir aussi shuffle . |
<< | array_rand | >> |
array_push | Tableaux | array_reduce |