cvs: pear /PHP_Compat/Compat/Function array_uintersect_uassoc.php
| From: | Aidan Lister | Date: | Tue, 31 Aug 2004 11:07:15 +0000 |
| Subject: | cvs: pear /PHP_Compat/Compat/Function array_uintersect_uassoc.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-23526@lists.php.net to get a copy of this message | ||
aidan Tue Aug 31 07:07:15 2004 EDT
Modified files:
/pear/PHP_Compat/Compat/Function array_uintersect_uassoc.php
Log:
Fixed
http://cvs.php.net/diff.php/pear/PHP_Compat/Compat/Function/array_uintersect_uassoc.php?r1=1.5&r2=1.6&ty=u
Index: pear/PHP_Compat/Compat/Function/array_uintersect_uassoc.php
diff -u pear/PHP_Compat/Compat/Function/array_uintersect_uassoc.php:1.5
pear/PHP_Compat/Compat/Function/array_uintersect_uassoc.php:1.6
--- pear/PHP_Compat/Compat/Function/array_uintersect_uassoc.php:1.5 Tue Aug 31 06:46:05 2004
+++ pear/PHP_Compat/Compat/Function/array_uintersect_uassoc.php Tue Aug 31 07:07:15 2004
@@ -15,7 +15,7 @@
// | Authors: Aidan Lister <aidan@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: array_uintersect_uassoc.php,v 1.5 2004/08/31 10:46:05 aidan Exp $
+// $Id: array_uintersect_uassoc.php,v 1.6 2004/08/31 11:07:15 aidan Exp $
/**
@@ -25,40 +25,47 @@
* @package PHP_Compat
* @link http://php.net/function.array_uintersect_uassoc
* @author Aidan Lister <aidan@php.net>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @since PHP 5
* @require PHP 4.0.1 (trigger_error)
*/
-if (!function_exists('array_uintersect_uassoc'))
+if (!function_exists('array_uintersect_uassoc2'))
{
- function array_uintersect_uassoc()
+ function array_uintersect_uassoc2()
{
$args = func_get_args();
- if (count($args) < 3) {
- trigger_error('wrong parameter count for array_uintersect_uassoc()',
E_USER_WARNING);
+ if (count($args) < 4) {
+ trigger_error('Wrong parameter count for array_uintersect_uassoc()',
E_USER_WARNING);
return;
}
- // Get compare function
- $compare_func = array_pop($args);
- if (!is_callable($compare_func)) {
- if (is_array($compare_func)) {
- $compare_func = $compare_func[0] . '::' . $compare_func[1];
+ // Get key_compare_func
+ $key_compare_func = array_pop($args);
+ if (!is_callable($key_compare_func)) {
+ if (is_array($key_compare_func)) {
+ $key_compare_func = $key_compare_func[0] . '::' . $key_compare_func[1];
}
- trigger_error('array_uintersect_uassoc() Not a valid callback ' .
$compare_func, E_USER_WARNING);
+ trigger_error('array_uintersect_uassoc() Not a valid callback ' .
$key_compare_func, E_USER_WARNING);
+ return;
+ }
+
+ // Get data_compare_func
+ $data_compare_func = array_pop($args);
+ if (!is_callable($data_compare_func)) {
+ if (is_array($data_compare_func)) {
+ $data_compare_func = $data_compare_func[0] . '::' .
$data_compare_func[1];
+ }
+ trigger_error('array_uintersect_uassoc() Not a valid callback ' .
$data_compare_func, E_USER_WARNING);
return;
}
// Check arrays
$array_count = count($args);
-
for ($i = 0; $i !== $array_count; $i++) {
-
if (!is_array($args[$i])) {
trigger_error('array_uintersect_uassoc() Argument #' . ($i + 1) . '
is not an array', E_USER_WARNING);
return;
}
-
}
// Compare entries
@@ -66,7 +73,7 @@
foreach ($args[0] as $key => $item) {
for ($i = 1; $i !== $array_count; $i++) {
if (array_key_exists($key, $args[$i])) {
- $compare = call_user_func($compare_func, $item, $args[$i][$key]);
+ $compare = call_user_func($key_compare_func, $item, $args[$i][$key]);
if ($compare === 0) {
$output[$key] = $item;
}