How to get a random key from a PHP array

How to get a random key from a PHP array

In this post, i will tell you how to get random key from PHP array.

array_rand method in PHP will return the keys of the random entries.

This method takes two argument : first will be the input array and second argument specifies how many entries you want to picked.

Each time when you refresh the page you will get different number.

Syntax :

array_rand(array,number)
Example :
  1. <?php
  2. $arr = array('a','b','c','d','e','f');
  3. $random_key = array_rand($arr, 3);
  4. print_r($random_key);
  5. ?>    

Phone: (+91) 8800417876
Noida, 201301
sakarya escort akyazı escort arifiye escort erenler escort eve gelen escort ferizli escort geyve escort hendek escort otele gelen escort sapanca escort söğütlü escort taraklı escort
sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort serdivan escort sapanca escort karasu escort hendek escort ankara escort
sakarya escort kızlar sakarya escort kaliteli sakarya escort vip sakarya escort elit sakarya escort bayan sakarya escort adresleri.