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