fork download
  1. <?php
  2.  
  3. $cb = 2;
  4. $rb = 3;
  5. $lb = 4;
  6. $rwb = 5;
  7. $lwb = 1;
  8. $cdm = 8;
  9. $cm = 3;
  10. $rm = 4;
  11. $lm = 5;
  12. $cam = 5;
  13. $cf = 6;
  14. $rf = 7;
  15. $lf = 8;
  16. $rw = 12;
  17. $lw = 10;
  18. $st = 0;
  19.  
  20. $arr = array("cb","rb","lb","rwb","lwb","cdm","cm","rm","lm","cam","cf","rf","lf","rw","lw","st");
  21. $result = compact($arr);
  22. print_r($result);
  23.  
  24. $maior =(max($result));
  25. echo $maior."\n";
  26.  
  27. $chave = array_search(max($result), $result);
  28.  
  29. echo $chave;
Success #stdin #stdout 0s 82560KB
stdin
Standard input is empty
stdout
Array
(
    [cb] => 2
    [rb] => 3
    [lb] => 4
    [rwb] => 5
    [lwb] => 1
    [cdm] => 8
    [cm] => 3
    [rm] => 4
    [lm] => 5
    [cam] => 5
    [cf] => 6
    [rf] => 7
    [lf] => 8
    [rw] => 12
    [lw] => 10
    [st] => 0
)
12
rw