- var_dump: documentation ( source)
- round: documentation ( source)
- rand: documentation ( source)
<?php
$values = array(
'foo',
'bar',
'baz',
);
$index = round(rand(0, count($values) - 1));
var_dump($index, $values[$index]);