SHARE
TWEET

Untitled

a guest Aug 20th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function my_max(array $values): int {
  2.     $max = $values[0];
  3.     if(is_array($max)) {
  4.         $max = my_max($max);
  5.     }
  6.     foreach ($values as $currentVal) {
  7.         if (is_array($currentVal)) {
  8.             $currentVal = my_max($currentVal);
  9.         }
  10.         if ($max < $currentVal) {
  11.             $max = $currentVal;
  12.         }
  13.     }
  14.     return $max;
  15. }
  16.  
  17. echo my_max( array( array( array(5), 6 ), 3, 4 ) );
  18. exit;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top