1--TEST-- 2array_udiff():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} 18$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr(4), 2 => new cr(-15),); 19$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),); 20$result = array_udiff($a, $b, array("cr", "comp_func_cr")); 21var_dump($result); 22?> 23--EXPECTF-- 24array(2) { 25 ["0.5"]=> 26 object(cr)#%d (1) { 27 ["priv_member":"cr":private]=> 28 int(12) 29 } 30 [0]=> 31 object(cr)#%d (1) { 32 ["priv_member":"cr":private]=> 33 int(23) 34 } 35} 36