fork(3) download
  1. <?php
  2. $array = array(1, "hello", 1, "world", "hello",'2','2','2','3','3','3');
  3. $s = array_count_values($array);
  4.  
  5. $mostRepetead = max($s);
  6.  
  7.  
  8. $s = array_filter( $s, function($v) use ($mostRepetead) {
  9. return $v==$mostRepetead;
  10. });
  11.  
  12. print_r($s);
  13.  
  14. echo array_rand($s);
  15. ?>
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Array
(
    [2] => 3
    [3] => 3
)
3