array_rand Pick one or more random entries out of an array : Array Function : Data Structure PHP Source Code


PHP Source Code » Data Structure » Array Function »

 

array_rand Pick one or more random entries out of an array




<?php
   $states = array("Ohio" => "Columbus""Iowa" => "Des Moines","Arizona" => "Phoenix");
   $randomStates = array_rand($states, 2);
   print_r($randomStates);
?>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Data Structure
» Array Function