1--TEST-- 2Test ArrayObject::uksort() function : basic functionality 3--FILE-- 4<?php 5/* Sort the entries by key using user defined function. 6 * Source code: ext/spl/spl_array.c 7 * Alias to functions: 8 */ 9 10echo "*** Testing ArrayObject::uksort() : basic functionality ***\n"; 11// Reverse sorter 12function cmp($value1, $value2) { 13 if($value1 == $value2) { 14 return 0; 15 } 16 else if($value1 < $value2) { 17 return 1; 18 } 19 else 20 return -1; 21} 22$ao = new ArrayObject(array(3=>0, 2=>1, 5=>2, 6=>3, 1=>4)); 23 24$ao->uksort('cmp'); 25var_dump($ao); 26?> 27--EXPECT-- 28*** Testing ArrayObject::uksort() : basic functionality *** 29object(ArrayObject)#1 (1) { 30 ["storage":"ArrayObject":private]=> 31 array(5) { 32 [6]=> 33 int(3) 34 [5]=> 35 int(2) 36 [3]=> 37 int(0) 38 [2]=> 39 int(1) 40 [1]=> 41 int(4) 42 } 43} 44