コード例 #1
0
ファイル: TestCase.php プロジェクト: ridhoq/mxpi-twitter
 public function verifyXMessage($expectedMsgs, $msgs)
 {
     Mage::log("verifyXMessage-expected messages: " . print_r($expectedMsgs, true), null, 'debug.log', true);
     Mage::log("verifyXMessage-actural messages: " . print_r($msgs, true), null, 'debug.log', true);
     $this->assertEquals(count($expectedMsgs), count($msgs), "Should have " . count($expectedMsgs) . " messages generated.");
     $result = array();
     foreach ($expectedMsgs as $expMsg) {
         $foundMsgs = $this->_findXMessageByTopic($msgs, $expMsg['topic']);
         if (empty($foundMsgs)) {
             $result[] = $expMsg;
         } else {
             $diff = array();
             $miniDiff = array();
             foreach ($foundMsgs as $foundMsg) {
                 $diff = array_udiff_uassoc($expMsg, $foundMsg, array($this, "_data_compare_func"), array($this, "_key_compare_func"));
                 if (empty($diff)) {
                     break;
                 } else {
                     if (empty($miniDiff) || !empty($miniDiff) && count($diff) < count($miniDiff)) {
                         $miniDiff = $diff;
                     }
                 }
             }
             if (!empty($miniDiff)) {
                 $miniDiff['topic'] = $expMsg['topic'];
                 $result[] = $miniDiff;
             }
         }
     }
     $this->assertEquals(0, count($result), "Missed the following messages:" . print_r($result, true));
 }
コード例 #2
0
ファイル: raffler.php プロジェクト: rpkamp/rafflers
<?php

$names = file(realpath($argv[1]), FILE_IGNORE_NEW_LINES);
echo "And the WINNER is... " . array_rand(array_flip(array_filter(array_reverse(array_column(array_chunk(array_intersect($names, array_replace($names, array_change_key_case(array_fill_keys($names, 'Rick Astley')))), (int) @array_pop(array_fill(array_reduce(array_keys($names), function ($c, $a) {
    return $a;
}), array_unshift($names, 'Rick Astley'), '1 true love'))), array_sum(array_diff_ukey(array_intersect_key(array_diff_assoc(array_uintersect($names, array_intersect_assoc(array_uintersect_assoc($names, array_values($names), function ($a, $b) {
    return $b > $a;
}), $names), function ($a, $b) use($names) {
    return array_shift($names) > $b;
}), array()), array_uintersect_uassoc($names, array_udiff($names, array_diff($names, array_slice(array_merge(array_diff_uassoc(array_udiff_uassoc($names, $names, function ($a, $b) {
    return $b > $a;
}, function ($a, $b) {
    return $b > $a;
}), $names, function ($a, $b) {
    return $a > $b;
}), array_combine($names, $names)), array_product($names), array_search(array_unique(array_count_values(array_merge_recursive($names, array_pad(array_replace_recursive($names, array_intersect_uassoc($names, $names, function ($a, $b) {
    return $a > $b;
})), array_key_exists((int) array_walk($names, function ($v, $k) {
    return $k;
}), $names), array_walk_recursive($names, function ($v, $k) {
    return $k;
}))))), $names))), function ($a, $b) {
    return $a > $b;
}), function ($a, $b) {
    return $b > $a;
}, function ($a, $b) {
    return $b > $a;
})), array_splice($names, array_multisort(array_map(function ($v) {
    return $v;
}, array_intersect_ukey(array_diff_key($names, array_udiff_assoc($names, $names, function ($a, $b) {
    return $a > $b;
コード例 #3
0
<?php

// array_udiff_uassoc.php
$week = ["Monday" => "Rāhina", "Tuesday" => "Rātū", "Wednesday" => "Rāapa", "Thursday" => "Rāpare", "Friday" => "Rāmere", "Saturday" => "Rāhoroi", "Sunday" => "Rātapu"];
$weekend = ["Saturday" => "Rāhoroi", "Sunday" => "Rātapu"];
$weekdays = array_udiff_uassoc($week, $weekend, function ($v1, $v2) {
    echo "{$v1}:{$v2}<br>";
    if ($v1 == $v2) {
        return 0;
    }
    return $v1 > $v2 ? 1 : -1;
}, function ($v1, $v2) {
    echo "{$v1}:{$v2}<br>";
    if ($v1 == $v2) {
        return 0;
    }
    return $v1 > $v2 ? 1 : -1;
});
echo "<pre>";
var_dump($weekdays);
echo "</pre>";
コード例 #4
0
ファイル: logging.inc.php プロジェクト: aliyildiz84/openDCIM
 static function LogThis($object, $originalobject = null)
 {
     global $person;
     $log = new LogActions();
     $log->UserID = $person->UserID;
     $trace = debug_backtrace();
     // we're only concerned with the 2nd record $trace can be read for a full debug if something calls for it
     $caller = isset($trace[1]) ? $trace[1] : array('function' => 'direct');
     $action = $caller['function'];
     if (preg_match("/create/i", $caller['function'])) {
         $action = '1';
     }
     if (preg_match("/delete/i", $caller['function'])) {
         $action = '2';
     }
     if (preg_match("/update/i", $caller['function'])) {
         $action = '3';
     }
     // Move the action onto the object
     $log->Action = $action;
     $log->Class = get_class($object);
     // Will return true/false for key and value comparison
     if (!function_exists("key_comp")) {
         function key_comp($v1, $v2)
         {
             return $v1 == $v2 ? 0 : 1;
         }
         function val_comp($v1, $v2)
         {
             return $v1 == $v2 ? 0 : 1;
         }
     }
     // The diff function is acting retarded with some values so scrub em
     foreach ($object as $key => $value) {
         if ($value == 'NULL' || $value == '0') {
             $object->{$key} = '';
         }
     }
     if (!is_null($originalobject)) {
         foreach ($originalobject as $key => $value) {
             if ($value == 'NULL' || $value == '0') {
                 $originalobject->{$key} = '';
             }
         }
     }
     $diff = array();
     // Find the difference between the original object and the altered object, if present
     if (!is_null($originalobject)) {
         $diff = array_udiff_uassoc((array) $object, (array) $originalobject, "key_comp", "val_comp");
         // Note the changed values
         foreach ($diff as $key => $value) {
             // Suppressing errors here because if a new value exists on the object there won't be one in the
             // original and it will throw an error on the web server
             @($diff[$key] = $key . ": " . $originalobject->{$key} . " => " . $object->{$key});
         }
     }
     switch ($log->Class) {
         case "Device":
             $log->ObjectID = $object->DeviceID;
             break;
         case "Cabinet":
             $log->ObjectID = $object->CabinetID;
             break;
         case "CabinetAudit":
             $log->ObjectID = $object->CabinetID;
             break;
         case "DevicePorts":
             $log->ObjectID = $object->DeviceID;
             $log->ChildID = $object->PortNumber;
             // The two following functions are not logged
             // DevicePorts::removeConnections()
             // DevicePorts::removePorts()
             break;
         case "PowerPorts":
             $log->ObjectID = $object->DeviceID;
             $log->ChildID = $object->PortNumber;
             break;
         case "TemplatePorts":
             $log->ObjectID = $object->TemplateID;
             $log->ChildID = $object->PortNumber;
             break;
         case "RackRequest":
             $log->ObjectID = $object->RequestID;
             break;
         case "Slot":
             $log->ObjectID = $object->TemplateID;
             $log->ChildID = $object->Position;
             break;
         case "SensorTemplate":
             $log->ObjectID = $object->TemplateID;
             break;
         case "PowerConnection":
             $log->ObjectID = $object->DeviceID;
             $log->ChildID = $object->DeviceConnNumber;
             break;
             // similar questions as to the switch connections. are we going to track this?
         // similar questions as to the switch connections. are we going to track this?
         case "SupplyBin":
         case "Supplies":
         case "Config":
             // do we want to track when the default system config has been updated?
         // do we want to track when the default system config has been updated?
         case "PowerDistribution":
         case "CDUTemplate":
         case "PowerPanel":
             // only has create and update. should changes here be logged or figure out what changed and log that?
         // only has create and update. should changes here be logged or figure out what changed and log that?
         case "DeviceTemplate":
             // The following function isn't logged
             // UpdateDevice()
         // The following function isn't logged
         // UpdateDevice()
         case "Department":
             // Not sure how to go about tracking the changes in membership
         // Not sure how to go about tracking the changes in membership
         default:
             // Attempt to autofind the id of the object we've been handed
             foreach ($object as $prop => $value) {
                 if (preg_match("/ID/", $prop)) {
                     $log->ObjectID = $value;
                     break;
                 }
             }
     }
     $return = true;
     // If there are any differences then we are upating an object otherwise
     // this is a new object so just log the action as a create
     if (!is_null($originalobject)) {
         if (count($diff)) {
             foreach ($diff as $key => $value) {
                 $log->Property = $key;
                 // Suppressing errors here because if a new value exists on the object there won't be one in the
                 // original and it will throw an error on the web server
                 @($log->OldVal = $originalobject->{$key});
                 $log->NewVal = $object->{$key};
                 $return = $log->WriteToDB() ? $return : false;
             }
         }
         // in the event that two objects were passed but no changes found,
         // we just wrote the same info back to the db, nothing to log
     } else {
         // if we're creating a new object make a note of all the values
         if ($log->Action == 1) {
             foreach ($object as $prop => $value) {
                 $log->Property = $prop;
                 $log->NewVal = $value;
                 // Log only new object properties that have values
                 // this should cut down on the amount of useless junk we are putting into the log
                 $return = $log->NewVal ? $log->WriteToDB() : true;
             }
         } else {
             $return = $log->WriteToDB();
         }
     }
     return $return;
 }
コード例 #5
0
ファイル: Arr.php プロジェクト: steefdw/consistent-php
 /**
  * (PHP 5)<br/>
  * Computes the difference of arrays with additional index check, compares data and indexes by a callback function
  * @link http://php.net/manual/en/function.array-udiff-uassoc.php
  * @param array $array2 <p>
  * The second array.
  * </p>
  * @param array $_ [optional]
  * @param callable $value_compare_func <p>
  * The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
  * </p>
  * int<b>callback</b><b>mixed<i>a</i></b><b>mixed<i>b</i></b>
  * @param callable $key_compare_func <p>
  * The comparison of keys (indices) is done also by the callback function
  * <i>key_compare_func</i>. This behaviour is unlike what
  * <b>array_udiff_assoc</b> does, since the latter compares
  * the indices by using an internal function.
  * </p>
  * @return array an array containing all the values from
  * <i>array1</i> that are not present in any of the other
  * arguments.
  */
 public function udiff_uassoc(array $array2, array $_ = null, callable $value_compare_func, callable $key_compare_func)
 {
     // TODO: use func_get_args() for multiple arguments, like Arr($array)->function($v1, $v2, $v3)
     return array_udiff_uassoc($this->array, $array2, $value_compare_func, $key_compare_func);
 }
コード例 #6
0
 /**
  * 比较两个数据之间的差异,适用于修改数据时,记录变化
  *
  * @param array  $old_data 老数据
  * @param array  $new_data 新数据。默认array()
  * @param string $key      比较字段。默认''
  *
  * @return string 差异
  */
 protected function _dataDiff($old_data, $new_data = array(), $key = '')
 {
     $diff = empty($new_data) ? $old_data : array_udiff_uassoc($old_data, $new_data, create_function('$a, $b', 'return $a == $b ? 0 : 1;'), create_function('$a, $b', 'return $a === $b ? 0 : 1;'));
     $key = $key ? explode(',', $key) : array_keys($diff);
     foreach ($old_data as $k => $v) {
         if (in_array($k, $key) && isset($diff[$k])) {
             if (in_array($k, array('lock_start_time', 'lock_end_time'))) {
                 //时间戳转化为时间格式 by mrmsl on 2012-09-11 08:30:02
                 $diff[$k] = empty($diff[$k]) ? '' : new_date(null, $diff[$k]);
                 $diff[$k] .= '[to]' . (empty($new_data[$k]) ? 'NULL' : new_date(null, $new_data[$k]));
             } else {
                 $diff[$k] .= '[to]' . (isset($new_data[$k]) ? $k == 'password' ? '******' : $new_data[$k] : 'NULL');
             }
         } else {
             unset($diff[$k]);
         }
     }
     return $diff ? preg_replace('/ +/', ' ', stripslashes(str_replace(PHP_EOL, '', var_export($diff, true)))) : '';
 }
コード例 #7
0
ファイル: MarkCallable.05.php プロジェクト: exakat/exakat
<?php

// #0
assert(array('a', 'b'));
// #1
uasort($array, array($c, 'd'));
// #2
preg_replace_callback($s, $ss, array($e, 'f'));
// #3
sqlite_create_aggregate($a1, $a2, $a3, array($g, '$h'));
// #4
session_set_save_handler($sssh0, $sssh1, $sssh2, $sssh3, array($sssh4, 'sssh4'));
// #5
session_set_save_handler($sssh0, $sssh1, $sssh2, $sssh3, $sssh4, array($sssh5, 'sssh5'));
// #6
session_set_save_handler($sssh0, $sssh1, $sssh2, $sssh3, $sssh4, $sssh5, array($sssh6, 'sssh6'));
// #7
session_set_save_handler($sssh0, $sssh1, $sssh2, $sssh3, $sssh4, $sssh5, $sssh6, array($sssh7, 'sssh7'));
// 2nd to last arg
array_udiff_uassoc($a1, $a2, $a3, array($i, 'j'), $last);
// last arg
array_udiff($a1, $a2, $a3, array($k, 'l'));
コード例 #8
0
ファイル: Array.php プロジェクト: stuartherbert/mf
 public function udiff_uassoc($aArray, $__dataCallback, $keyCallback)
 {
     if ($aArray instanceof MF_PHP_Array) {
         $aArray =& $aArray->to_array();
     }
     $oReturn = new MF_PHP_Array(array_udiff_uassoc($this->__data, $aArray, $__dataCallback, $keyCallback));
     return $oReturn;
 }
コード例 #9
0
<?php

/* Prototype  : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
 * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions. 
 * Source code: ext/standard/array.c
 * Alias to functions: 
 */
echo "*** Testing array_udiff_uassoc() : error conditions ***\n";
$arr1 = array(1, 2);
$arr2 = array(1, 2);
include 'compare_function.inc';
$data_comp_func = 'compare_function';
$key_comp_func = 'compare_function';
$extra_arg = 10;
//Test array_udiff_uassoc with one more than the expected number of arguments
echo "\n-- Testing array_udiff_uassoc() function with more than expected no. of arguments --\n";
var_dump(array_udiff_uassoc($arr1, $arr2, $data_comp_func, $key_comp_func, $extra_arg));
// Testing array_udiff_uassoc with one less than the expected number of arguments
echo "\n-- Testing array_udiff_uassoc() function with less than expected no. of arguments --\n";
var_dump(array_udiff_uassoc($arr1, $arr2, $data_comp_func));
?>
===DONE===
コード例 #10
0
ファイル: DnsClient.php プロジェクト: lexty/yandexdns
 protected function match(array $record, array $cond)
 {
     return 0 === count(array_udiff_uassoc($cond, array_uintersect_uassoc($record, $cond, 'strcasecmp', 'strcasecmp'), 'strcasecmp', 'strcasecmp'));
 }
コード例 #11
0
ファイル: ArrayUtil.php プロジェクト: bdusell/jitsu-array
 /**
  * Get key-value pairs which exist in one array but not in another,
  * where both keys and values determine uniqueness.
  *
  * Returns an associative array containing all key-value pairs which
  * exist in the first array but not in the second. Optionally provide
  * comparison functions for the keys and values. String comparison is
  * used by default.
  *
  * @param array $array1
  * @param array $array2
  * @param callable|null $key_cmp
  * @param callable|null $value_cmp
  * @return array
  */
 public static function pairDifference($array1, $array2, $key_cmp = null, $value_cmp = null)
 {
     // Seriously, PHP? seriously?
     if ($key_cmp === null) {
         if ($value_cmp === null) {
             return array_diff_assoc($array1, $array2);
         } else {
             return array_udiff_assoc($array1, $array2, $value_cmp);
         }
     } else {
         if ($value_cmp === null) {
             return array_diff_uassoc($array1, $array2, $key_cmp);
         } else {
             return array_udiff_uassoc($array1, $array2, $value_cmp, $key_cmp);
         }
     }
 }
コード例 #12
0
ファイル: MarkCallable.04.php プロジェクト: exakat/exakat
<?php

// #0
assert(['a', 'b']);
// #1
uasort($array, [$c, 'd']);
// #2
preg_replace_callback($s, $ss, [$e, 'f']);
// #3
sqlite_create_aggregate($a1, $a2, $a3, [$g, '$h']);
// #4
session_set_save_handler($sssh0, $sssh1, $sssh2, $sssh3, [$sssh4, 'sssh4']);
// #5
session_set_save_handler($sssh0, $sssh1, $sssh2, $sssh3, $sssh4, [$sssh5, 'sssh5']);
// #6
session_set_save_handler($sssh0, $sssh1, $sssh2, $sssh3, $sssh4, $sssh5, [$sssh6, 'sssh6']);
// #7
session_set_save_handler($sssh0, $sssh1, $sssh2, $sssh3, $sssh4, $sssh5, $sssh6, [$sssh7, 'sssh7']);
// 2nd to last arg
array_udiff_uassoc($a1, $a2, $a3, [$i, 'j'], $last);
// last arg
array_udiff($a1, $a2, $a3, [$k, 'l']);
コード例 #13
0
 /**
  * @param HTArray $array2
  * @param $data_compare_func
  * @param $key_compare_func
  * @return $this
  * @desc 带索引检查计算数组的差集,用回调函数比较数据和索引。
  */
 public function array_udiff_uassoc(HTArray $array2, $data_compare_func, $key_compare_func)
 {
     $this->current = array_udiff_uassoc($this->current, (array) $array2, $data_compare_func, $key_compare_func);
     return $this;
 }
コード例 #14
0
<?php

/* Prototype  : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
 * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions. 
 * Source code: ext/standard/array.c
 * Alias to functions: 
 */
echo "*** Testing array_udiff_uassoc() : usage variation - differing comparison functions***\n";
$arr1 = array(1);
$arr2 = array(1);
echo "\n-- comparison function with an incorrect return value --\n";
function incorrect_return_value($val1, $val2)
{
    return array(1);
}
var_dump(array_udiff_uassoc($arr1, $arr2, 'incorrect_return_value', 'incorrect_return_value'));
echo "\n-- comparison function taking too many parameters --\n";
function too_many_parameters($val1, $val2, $val3)
{
    return 1;
}
var_dump(array_udiff_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters'));
echo "\n-- comparison function taking too few parameters --\n";
function too_few_parameters($val1)
{
    return 1;
}
var_dump(array_udiff_uassoc($arr1, $arr2, 'too_few_parameters', 'too_few_parameters'));
?>
===DONE===
コード例 #15
0
//get an unset variable
$unset_var = 10;
unset($unset_var);
// define some classes
class classWithToString
{
    public function __toString()
    {
        return "Class A object";
    }
}
class classWithoutToString
{
}
// heredoc string
$heredoc = <<<EOT
hello world
EOT;
// add arrays
$index_array = array(1, 2, 3);
$assoc_array = array('one' => 1, 'two' => 2);
//array of values to iterate over
$inputs = array('int 0' => 0, 'int 1' => 1, 'int 12345' => 12345, 'int -12345' => -2345, 'float 10.5' => 10.5, 'float -10.5' => -10.5, 'float 12.3456789000e10' => 123456789000.0, 'float -12.3456789000e10' => -123456789000.0, 'float .5' => 0.5, 'uppercase NULL' => NULL, 'lowercase null' => null, 'lowercase true' => true, 'lowercase false' => false, 'uppercase TRUE' => TRUE, 'uppercase FALSE' => FALSE, 'empty string DQ' => "", 'empty string SQ' => '', 'string DQ' => "string", 'string SQ' => 'string', 'mixed case string' => "sTrInG", 'heredoc' => $heredoc, 'instance of classWithToString' => new classWithToString(), 'instance of classWithoutToString' => new classWithoutToString(), 'undefined var' => @$undefined_var, 'unset var' => @$unset_var);
// loop through each element of the array for ...
foreach ($inputs as $key => $value) {
    echo "\n--{$key}--\n";
    var_dump(array_udiff_uassoc($arr1, $arr2, $value, $data_comp_func, $key_comp_func));
}
?>
===DONE===
/*
* proto array array_udiff_assoc ( array $array1, array $array2 [, array $ ..., callback $data_compare_func] )
* Function is implemented in ext/standard/array.c
*/
class cr
{
    private $priv_member;
    function __construct($val)
    {
        $this->priv_member = $val;
    }
    static function comp_func_cr($a, $b)
    {
        if ($a->priv_member === $b->priv_member) {
            return 0;
        }
        return $a->priv_member > $b->priv_member ? 1 : -1;
    }
    static function comp_func_key($a, $b)
    {
        if ($a === $b) {
            return 0;
        }
        return $a > $b ? 1 : -1;
    }
}
$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15));
$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15));
$result = array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), array("cr", "comp_func_key"));
var_dump($result);
コード例 #17
0
echo '$a='.var_export($a,TRUE).";\n";
echo '$b='.var_export($b,TRUE).";\n";
echo '$c='.var_export($c,TRUE).";\n";
var_dump(array_diff($a,$b,$c));
var_dump(array_diff_assoc($a,$b,$c));
var_dump(array_udiff($a, $b, $c, "comp_func"));
var_dump(array_diff_uassoc($a,$b,$c, "comp_func"));
*/
/*
 $a = array(new cr(9),new cr(12),new cr(23),new cr(4),new cr(-15),);
 $b = array(new cr(9),new cr(22),new cr( 3),new cr(4),new cr(-15),);
 var_dump(array_udiff($a, $b, "comp_func_cr"));
*/
$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15));
$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15));
echo '$a=' . var_export($a, TRUE) . ";\n";
echo '$b=' . var_export($b, TRUE) . ";\n";
echo 'var_dump(array_udiff_uassoc($a, $b, "comp_func_cr", "comp_func"));' . "\n";
var_dump(array_udiff_uassoc($a, $b, "comp_func_cr", "comp_func"));
echo '$a=' . var_export($a, TRUE) . ";\n";
echo '$b=' . var_export($b, TRUE) . ";\n";
echo 'var_dump(array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), "comp_func"));' . "\n";
var_dump(array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), "comp_func"));
echo '$a=' . var_export($a, TRUE) . ";\n";
echo '$b=' . var_export($b, TRUE) . ";\n";
echo 'var_dump(array_udiff($a, $b, "comp_func_cr"));' . "\n";
var_dump(array_udiff($a, $b, "comp_func_cr"));
echo '$a=' . var_export($a, TRUE) . ";\n";
echo '$b=' . var_export($b, TRUE) . ";\n";
echo 'var_dump(array_udiff_assoc($a, $b, "comp_func_cr"));' . "\n";
var_dump(array_udiff_assoc($a, $b, "comp_func_cr"));
コード例 #18
0
    {
        $this->priv_member = $val;
    }
    function comp_func_cr($a, $b)
    {
        if ($a->priv_member === $b->priv_member) {
            return 0;
        }
        return $a->priv_member > $b->priv_member ? 1 : -1;
    }
    function comp_func_key($a, $b)
    {
        if ($a === $b) {
            return 0;
        }
        return $a > $b ? 1 : -1;
    }
}
$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15));
$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15));
$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array2 = array("a" => "green", "yellow", "red");
print_r(array_udiff($a, $b, array("cr", "comp_func_cr")));
print_r(array_udiff_assoc($a, $b, array("cr", "comp_func_cr")));
print_r(array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), array("cr", "comp_func_key")));
print_r(array_diff_uassoc($array1, $array2, "key_compare_func"));
print "------------------------------------\n";
print_r(array_uintersect($a, $b, array("cr", "comp_func_cr")));
print_r(array_uintersect_assoc($a, $b, array("cr", "comp_func_cr")));
print_r(array_uintersect_uassoc($a, $b, array("cr", "comp_func_cr"), array("cr", "comp_func_key")));
print_r(array_intersect_uassoc($array1, $array2, "key_compare_func"));