array_rand : array_rand « Data Structure « PHP
- PHP
- Data Structure
- array_rand
array_rand
<?php
$states = array("Ohio" => "Columbus", "Iowa" => "Des Moines","Arizona" => "Phoenix");
$randomStates = array_rand($states, 2);
print_r($randomStates);
?>
Related examples in the same category