Advertisement
Guest User

Untitled

a guest
Apr 14th, 2017
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1. <?php
  2.  
  3. function empty_recursive($o)
  4. {
  5.     // This block is optional and could/should be removed. I'd deal with arrays
  6.     // only
  7.     if (is_object($o)) {
  8.         return empty_recursive((array) $o);
  9.     }
  10.  
  11.     if (is_array($o)) {
  12.         foreach ($o as $element) {
  13.             if (!empty_recursive($element)) {
  14.                 return false;
  15.             }
  16.         }
  17.         return true;
  18.     }
  19.  
  20.     return empty($o);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement