×
Home About Us Products Services News Free Scripts Contact
news php scripts and software

PHP example - How can I pick one or several random values contained in a PHP array?


PHP - How can I pick one or several random values contained in a PHP array?

You may use the array_rand function which is available  from PHP version 4.0.0.

<?php

$arr=array("netart","france","paris","media");

$arr_random=array_rand($arr,2);

echo $arr[$arr_random[0]]."<br>".$arr[$arr_random[1]];

?>

Category: PHP

 
<< Go back