1--TEST-- 2array_udiff_uassoc(): Test return type and value for expected input 3--FILE-- 4<?php 5/* 6* Function is implemented in ext/standard/array.c 7*/ 8class cr { 9 private $priv_member; 10 function __construct($val) { 11 $this->priv_member = $val; 12 } 13 static function comp_func_cr($a, $b) { 14 if ($a->priv_member === $b->priv_member) return 0; 15 return ($a->priv_member > $b->priv_member) ? 1 : -1; 16 } 17 static function comp_func_key($a, $b) { 18 if ($a === $b) return 0; 19 return ($a > $b) ? 1 : -1; 20 } 21} 22$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),); 23$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),); 24$result = array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), array("cr", "comp_func_key")); 25var_dump($result); 26?> 27--EXPECTF-- 28array(3) { 29 ["0.1"]=> 30 object(cr)#%d (1) { 31 ["priv_member":"cr":private]=> 32 int(9) 33 } 34 ["0.5"]=> 35 object(cr)#%d (1) { 36 ["priv_member":"cr":private]=> 37 int(12) 38 } 39 [0]=> 40 object(cr)#%d (1) { 41 ["priv_member":"cr":private]=> 42 int(23) 43 } 44} 45