Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. function second_solution($xs) {
  2. if (!is_array($xs)) return null;
  3.  
  4. foreach ($xs as $entry) {
  5. if (!isset($max)) $max = $entry;
  6. if (!is_array($entry) and $entry > $max) $max = $entry;
  7. if (is_array($entry)) $max = second_solution($entry);
  8. }
  9.  
  10. return $max;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement