Overview

Namespaces

  • mechanicious
    • Columnizer
    • Extensions
      • Bs3Table
    • Support
    • Tableman
    • TablemanExtension
    • Test
      • Tableman
  • PHP

Traits

  • ArrayableTrait
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php namespace mechanicious\Support;
 2: 
 3: trait ArrayableTrait
 4: {
 5:   /**
 6:    * Returns what $has has, and $leaks leaks.
 7:    * @param  array $has
 8:    * @param  array $leaks
 9:    * @see http://stackoverflow.com/questions/3876435/recursive-array-diff
10:    * @return array
11:    */
12:   public function array_diff_recursive($has, $leaks) {
13:     $aReturn = array();
14: 
15:     foreach ($has as $mKey => $mValue) {
16:       if (array_key_exists($mKey, $leaks)) {
17:         if (is_array($mValue)) {
18:           $aRecursiveDiff = $this->array_diff_recursive($mValue, $leaks[$mKey]);
19:           if (count($aRecursiveDiff)) { $aReturn[$mKey] = $aRecursiveDiff; }
20:         } else {
21:           if ($mValue != $leaks[$mKey]) {
22:             $aReturn[$mKey] = $mValue;
23:           }
24:         }
25:       } else {
26:         $aReturn[$mKey] = $mValue;
27:       }
28:     }
29:     return $aReturn;
30:   }
31: }
API documentation generated by ApiGen 2.8.0