fork download
  1. <?php
  2. $array = array(6,5,4,5,6,2,1);
  3. $array = array_count_values ($array);
  4. $newArray = [];
  5. foreach ($newArray as $key => $element) {
  6. if ($element == 1) {
  7. $newArray[] = $element;
  8. }
  9. }
  10. $max = max($newArray);
  11.  
  12. var_dump($max);
  13. // your code goes here
Success #stdin #stdout #stderr 0.02s 23776KB
stdin
Standard input is empty
stdout
bool(false)
stderr
PHP Warning:  max(): Array must contain at least one element in /home/Kux7f3/prog.php on line 10