Ejemplo n.º 1
0
 public function isIdenticalTo(call $call)
 {
     $isIdentical = $this->isEqualTo($call);
     if ($isIdentical === true && $this->arguments !== null && $call->arguments !== null) {
         $callback = function ($a, $b) {
             return $a === $b ? 0 : -1;
         };
         $isIdentical = $this->arguments === array_uintersect_uassoc($call->arguments, $this->arguments, $callback, $callback);
     }
     return $isIdentical;
 }
Ejemplo n.º 2
0
 protected static function getArgumentsFilter($arguments, $identicalArguments)
 {
     $filter = null;
     if (is_array($arguments) === true) {
         if ($arguments === array()) {
             $filter = function ($callArguments) use($arguments) {
                 return $arguments === $callArguments;
             };
         } else {
             $callback = function ($a, $b) {
                 return $a == $b ? 0 : -1;
             };
             if ($identicalArguments === false) {
                 $filter = function ($callArguments) use($arguments, $callback) {
                     return $arguments == array_uintersect_uassoc($callArguments, $arguments, $callback, $callback);
                 };
             } else {
                 $filter = function ($callArguments) use($arguments, $callback) {
                     return $arguments === array_uintersect_uassoc($callArguments, $arguments, $callback, $callback);
                 };
             }
         }
     }
     return $filter;
 }
Ejemplo n.º 3
0
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;
})), $names, function ($a, $b) use($names) {
    return array_push($names, $a) === $b;
})))), function ($a, $b) {
Ejemplo n.º 4
0
 /**
  * (PHP 5)<br/>
  * Computes the intersection of arrays with additional index check, compares data and indexes by a callback functions
  * @link http://php.net/manual/en/function.array-uintersect-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>
  * Key comparison callback function.
  * </p>
  * @return array an array containing all the values of
  * <i>array1</i> that are present in all the arguments.
  */
 public function uintersect_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_uintersect_uassoc($this->array, $array2, $value_compare_func, $key_compare_func);
 }
/*
* proto array array_uintersect_assoc ( array $array1, array $array2 [, array $ ..., callback $data_compare_func] )
* Function is implemented in ext/standard/array.c
*/
class cr
{
    private $priv_member;
    function cr($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_uintersect_uassoc($a, $b, array("cr", "comp_func_cr"), array("cr", "comp_func_key"));
var_dump($result);
//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, 'empty array' => array(), 'int indexed array' => $index_array, 'associative array' => $assoc_array, 'nested arrays' => array('foo', $index_array, $assoc_array), '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 data_compare_func
foreach ($inputs as $key => $value) {
    echo "\n--{$key}--\n";
    var_dump(array_uintersect_uassoc($arr1, $arr2, $value, $key_compare_func));
}
?>
===DONE===
Ejemplo n.º 7
0
 /**
  * Get key-value pairs which exist in both of two arrays.
  *
  * Returns an associative array whose key-value pairs exist in both
  * arrays. Uses string comparison for values by default. Optionally
  * provide comparison functions for keys and values.
  *
  * @param array $array1
  * @param array $array2
  * @param callable|null $key_cmp
  * @param callable|null $value_cmp
  * @return array
  */
 public static function pairIntersection($array1, $array2, $key_cmp = null, $value_cmp = null)
 {
     if ($key_cmp === null) {
         if ($value_cmp === null) {
             return array_intersect_assoc($array1, $array2);
         } else {
             return array_uintersect_assoc($array1, $array2, $value_cmp);
         }
     } else {
         if ($value_cmp === null) {
             return array_intersect_uassoc($array1, $array2, $key_cmp);
         } else {
             return array_uintersect_uassoc($array1, $array2, $value_cmp, $key_cmp);
         }
     }
 }
<?php

// array_uintersect_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"];
$weekendDays = array_uintersect_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($weekendDays);
echo "</pre>";
Ejemplo n.º 9
0
 protected function match(array $record, array $cond)
 {
     return 0 === count(array_udiff_uassoc($cond, array_uintersect_uassoc($record, $cond, 'strcasecmp', 'strcasecmp'), 'strcasecmp', 'strcasecmp'));
 }
Ejemplo n.º 10
0
 /**
  * Called when new data received.
  * @param string $buf New received data.
  * @return void
  */
 public function stdin($buf)
 {
     $this->buf .= $buf;
     if ($this->cstate === AsteriskDriver::CONN_STATE_START) {
         $this->cstate = AsteriskDriver::CONN_STATE_GOT_INITIAL_PACKET;
         $this->appInstance->amiVersions[$this->addr] = trim($this->buf);
         $this->auth();
     } elseif (strlen($this->buf) < 4) {
         return;
         // Not enough data buffered yet
     } elseif (strpos($this->buf, "\r\n\r\n") !== false) {
         while (($line = $this->gets()) !== false) {
             if ($line == "\r\n") {
                 $this->instate = AsteriskDriver::INPUT_STATE_END_OF_PACKET;
                 $packet =& $this->packets[$this->cnt];
                 $this->cnt++;
             } else {
                 $this->instate = AsteriskDriver::INPUT_STATE_PROCESSING;
                 list($header, $value) = $this->extract($line);
                 $this->packets[$this->cnt][$header] = $value;
             }
             if ((int) $this->cstate === AsteriskDriver::CONN_STATE_AUTH) {
                 if ($this->instate == AsteriskDriver::INPUT_STATE_END_OF_PACKET) {
                     if ($packet['response'] == 'success') {
                         if ($this->cstate === AsteriskDriver::CONN_STATE_CHALLENGE_PACKET_SENT) {
                             if (is_callable($this->onChallenge)) {
                                 call_user_func($this->onChallenge, $this, $packet['challenge']);
                             }
                         } else {
                             if ($packet['message'] == 'authentication accepted') {
                                 $this->cstate = AsteriskDriver::CONN_STATE_HANDSHAKED_OK;
                                 Daemon::$process->log(__METHOD__ . ': Authentication ok. Connected to ' . parse_url($this->addr, PHP_URL_HOST));
                                 if (is_callable($this->onConnected)) {
                                     call_user_func($this->onConnected, $this, true);
                                 }
                             }
                         }
                     } else {
                         $this->cstate = AsteriskDriver::CONN_STATE_HANDSHAKED_ERROR;
                         Daemon::$process->log(__METHOD__ . ': Authentication failed. Connection to ' . parse_url($this->addr, PHP_URL_HOST) . ' failed.');
                         if (is_callable($this->onConnected)) {
                             call_user_func($this->onConnected, $this, false);
                         }
                         $this->finish();
                     }
                     $this->packets = array();
                 }
             } elseif ($this->cstate === AsteriskDriver::CONN_STATE_HANDSHAKED_OK) {
                 if ($this->instate == AsteriskDriver::INPUT_STATE_END_OF_PACKET) {
                     // Event
                     if (isset($packet['event']) && !isset($packet['actionid'])) {
                         if (is_callable($this->onEvent)) {
                             call_user_func($this->onEvent, $this, $packet);
                         }
                     } elseif (isset($packet['actionid'])) {
                         $action_id =& $packet['actionid'];
                         if (isset($this->callbacks[$action_id])) {
                             if (isset($this->assertions[$action_id])) {
                                 $this->packets[$action_id][] = $packet;
                                 if (count(array_uintersect_uassoc($this->assertions[$action_id], $packet, 'strcasecmp', 'strcasecmp')) == count($this->assertions[$action_id])) {
                                     if (is_callable($this->callbacks[$action_id])) {
                                         call_user_func($this->callbacks[$action_id], $this, $this->packets[$action_id]);
                                         unset($this->callbacks[$action_id]);
                                     }
                                     unset($this->assertions[$action_id]);
                                     unset($this->packets[$action_id]);
                                 }
                             } else {
                                 if (is_callable($this->callbacks[$action_id])) {
                                     call_user_func($this->callbacks[$action_id], $this, $packet);
                                     unset($this->callbacks[$action_id]);
                                 }
                             }
                         }
                     }
                     unset($packet);
                     unset($this->packets[$this->cnt - 1]);
                 }
             }
         }
     }
 }
Ejemplo n.º 11
0
 /**
  * @param HTArray $array2
  * @param $data_compare_func
  * @param $key_compare_func
  * @return $this
  * @desc 带索引检查计算数组的交集,用回调函数比较数据和索引。
  */
 public function array_uintersect_uassoc(HTArray $array2, $data_compare_func, $key_compare_func)
 {
     $this->current = array_uintersect_uassoc($this->current, (array) $array2, $data_compare_func, $key_compare_func);
     return $this;
 }
Ejemplo n.º 12
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"));
Ejemplo n.º 13
0
<?php

$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array2 = array("a" => "GREEN", "B" => "brown", "yellow", "red");
var_dump(array_uintersect_uassoc($array1, $array2, 'strcasecmp', 'strcasecmp'));
Ejemplo n.º 14
0
<?php

/* Prototype  : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
 * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks. 
 * Source code: ext/standard/array.c
 * Alias to functions: 
 */
echo "*** Testing array_uintersect_uassoc() : error conditions ***\n";
$arr1 = array(1, 2);
$arr2 = array(1, 2);
include 'compare_function.inc';
$data_compare_func = 'compare_function';
$key_compare_func = 'compare_function';
$extra_arg = 10;
//Test array_uintersect_uassoc with one more than the expected number of arguments
echo "\n-- Testing array_uintersect_uassoc() function with more than expected no. of arguments --\n";
var_dump(array_uintersect_uassoc($arr1, $arr2, $data_compare_func, $key_compare_func, $extra_arg));
// Testing array_uintersect_uassoc with one less than the expected number of arguments
echo "\n-- Testing array_uintersect_uassoc() function with less than expected no. of arguments --\n";
var_dump(array_uintersect_uassoc($arr1, $arr2, $data_compare_func));
?>
===DONE===
Ejemplo n.º 15
0
 public function uintersect_uassoc($aArray, $__dataCallback, $keyCallback)
 {
     if ($aArray instanceof MF_PHP_Array) {
         $aArray =& $aArray->to_array();
     }
     $oReturn = new MF_PHP_Array(array_uintersect_uassoc($this->__data, $aArray, $__dataCallback, $keyCallback));
     return $oReturn;
 }
Ejemplo n.º 16
0
    // set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
    echo "Base de donnée non connecté: " . $e->getMessage();
}
$time = array("1" => 8, "2" => 10, "3" => 13, "4" => 15);
$dsemestre = "2015-09-14";
$dsemestre = new DateTime($dsemestre);
$dsemestre = $dsemestre->format("Y-m-d h:i:s");
if (isset($_POST)) {
    $sql = 'SELECT sdebut,sfin FROM `disponibilite` WHERE ((id_s = ' . $_POST["salle"] . ' AND `hour` = ' . $_POST["hour"] . ' AND `day` = ' . $_POST["day"] . ') OR (id_ens = ' . $_POST["ens"] . ' AND `hour` = ' . $_POST["hour"] . ' AND `day` = ' . $_POST["day"] . ')) AND id <> ' . $_POST["id"];
    $request = $conn->query($sql);
    $result = $request->fetch();
    if ($result != false) {
        for ($i = $result['sdebut']; $i <= $result['sfin']; $i++) {
            $table1[$i] = $i;
        }
        for ($i = $_POST['sdebut']; $i <= $_POST['sfin']; $i++) {
            $table2[$i] = $i;
        }
        $table = array_uintersect_uassoc($table1, $table2, "strcasecmp", "strcasecmp");
        if (count($table) > 0) {
            $test = 1;
        } else {
            $test = 0;
        }
    } else {
        $test = 0;
    }
    echo $test;
}
Ejemplo n.º 17
0
 /**
  * Called when new data received
  * @return void
  */
 public function onRead()
 {
     if ($this->state === self::CONN_STATE_START) {
         if (($ver = $this->readline()) === null) {
             return;
         }
         $this->pool->setAmiVersion($this->addr, $ver);
         $this->state = self::CONN_STATE_GOT_INITIAL_PACKET;
         $this->auth();
     }
     while (($line = $this->readline()) !== null) {
         //Daemon::log('>>> '.$line);
         if ($line === '') {
             $this->instate = self::INPUT_STATE_END_OF_PACKET;
             $packet =& $this->packets[$this->cnt];
             ++$this->cnt;
         } else {
             $this->instate = self::INPUT_STATE_PROCESSING;
             list($header, $value) = Pool::extract($line);
             $this->packets[$this->cnt][$header] = $value;
         }
         if ((int) $this->state === self::CONN_STATE_AUTH) {
             if ($this->instate === self::INPUT_STATE_END_OF_PACKET) {
                 if ($packet['response'] === 'success') {
                     if ($this->state === self::CONN_STATE_CHALLENGE_PACKET_SENT) {
                         if (is_callable($this->onChallenge)) {
                             call_user_func($this->onChallenge, $this, $packet['challenge']);
                         }
                     } else {
                         if ($packet['message'] === 'authentication accepted') {
                             $this->state = self::CONN_STATE_HANDSHAKED_OK;
                             Daemon::$process->log(__METHOD__ . ': Authentication ok. Connected to ' . parse_url($this->addr, PHP_URL_HOST));
                             if ($this->onConnected) {
                                 $this->connected = true;
                                 $this->onConnected->executeAll($this);
                                 $this->onConnected = null;
                             }
                             $this->event('connected');
                         }
                     }
                 } else {
                     $this->state = self::CONN_STATE_HANDSHAKED_ERROR;
                     Daemon::$process->log(__METHOD__ . ': Authentication failed. Connection to ' . parse_url($this->addr, PHP_URL_HOST) . ' failed.');
                     if ($this->onConnected) {
                         $this->connected = false;
                         $this->onConnected->executeAll($this);
                         $this->onConnected = null;
                     }
                     $this->finish();
                 }
                 $this->packets = [];
             }
         } elseif ($this->state === self::CONN_STATE_HANDSHAKED_OK) {
             if ($this->instate === self::INPUT_STATE_END_OF_PACKET) {
                 // Event
                 if (isset($packet['event']) && !isset($packet['actionid'])) {
                     $this->event('event_' . $packet['event'], $packet);
                     $this->event('event', $packet);
                 } elseif (isset($packet['actionid'])) {
                     $action_id =& $packet['actionid'];
                     if (isset($this->callbacks[$action_id])) {
                         if (isset($this->assertions[$action_id])) {
                             $this->packets[$action_id][] = $packet;
                             if (count(array_uintersect_uassoc($this->assertions[$action_id], $packet, 'strcasecmp', 'strcasecmp')) === count($this->assertions[$action_id])) {
                                 if (is_callable($this->callbacks[$action_id])) {
                                     call_user_func($this->callbacks[$action_id], $this, $this->packets[$action_id]);
                                     unset($this->callbacks[$action_id]);
                                 }
                                 unset($this->assertions[$action_id]);
                                 unset($this->packets[$action_id]);
                             }
                         } else {
                             if (is_callable($this->callbacks[$action_id])) {
                                 call_user_func($this->callbacks[$action_id], $this, $packet);
                                 unset($this->callbacks[$action_id]);
                             }
                         }
                     }
                 }
                 unset($packet);
                 unset($this->packets[$this->cnt - 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));
/* array_uintersect() */
echo "begin ------------ array_uintersect() ---------------------------\n";
echo '$a=' . var_export($a, TRUE) . ";\n";
echo '$b=' . var_export($b, TRUE) . ";\n";
echo 'var_dump(array_uintersect($a, $b, "comp_func_cr"));' . "\n";
var_dump(array_uintersect($a, $b, "comp_func_cr"));
echo "end   ------------ array_uintersect() ---------------------------\n";
/* array_uintersect_assoc() */
echo "begin ------------ array_uintersect_assoc() ---------------------\n";
echo '$a=' . var_export($a, TRUE) . ";\n";
echo '$b=' . var_export($b, TRUE) . ";\n";
echo 'var_dump(array_uintersect_assoc($a, $b, "comp_func_cr"));' . "\n";
var_dump(array_uintersect_assoc($a, $b, "comp_func_cr"));
echo "end   ------------ array_uintersect_assoc() ---------------------\n";
/* array_uintersect_uassoc() - with ordinary function */
echo "begin ------------ array_uintersect_uassoc() with ordinary func -\n";
echo '$a=' . var_export($a, TRUE) . ";\n";
echo '$b=' . var_export($b, TRUE) . ";\n";
echo 'var_dump(array_uintersect_uassoc($a, $b, "comp_func_cr", "comp_func"));' . "\n";
var_dump(array_uintersect_uassoc($a, $b, "comp_func_cr", "comp_func"));
echo "end   ------------ array_uintersect_uassoc() with ordinary func -\n";
/* array_uintersect_uassoc() - by method call */
echo "begin ------------ array_uintersect_uassoc() with method --------\n";
echo '$a=' . var_export($a, TRUE) . ";\n";
echo '$b=' . var_export($b, TRUE) . ";\n";
echo 'var_dump(array_uintersect_uassoc($a, $b, array("cr", "comp_func_cr"), "comp_func"));' . "\n";
var_dump(array_uintersect_uassoc($a, $b, array("cr", "comp_func_cr"), "comp_func"));
echo "end   ------------ array_uintersect_uassoc() with method --------\n";
<?php

/* Prototype  : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
 * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks. 
 * Source code: ext/standard/array.c
 * Alias to functions: 
 */
echo "*** Testing array_uintersect_uassoc() : usage variation - incorrect callbacks ***\n";
$arr1 = array(1);
$arr2 = array(1, 2);
echo "\n-- comparison function with an incorrect return value --\n";
function incorrect_return_value($val1, $val2)
{
    return array(1);
}
var_dump(array_uintersect_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_uintersect_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_uintersect_uassoc($arr1, $arr2, 'too_few_parameters', 'too_few_parameters'));
?>
===DONE===