- time: documentation ( source)
- array_search: documentation ( source)
- array_fill: documentation ( source)
- max: documentation ( source)
- rand: documentation ( source)
- srand: documentation ( source)
#!/usr/bin/env php
<?php
$where = [ 'Péché mignon', 'McDo', 'Flunch' ];
srand(time());
$results = array_fill(0, count($where), 0);
for ($i = 0; $i < 10000; $i++) {
$results[rand(0, count($where) - 1)]++;
}
echo $where[array_search(max($results), $results)], "\n";